massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-tsserver / node_modules / typescript / lib / tsc.js
1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
6
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
11
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
15
16
17 "use strict";
18 var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19     if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20         if (ar || !(i in from)) {
21             if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22             ar[i] = from[i];
23         }
24     }
25     return to.concat(ar || Array.prototype.slice.call(from));
26 };
27 var __assign = (this && this.__assign) || function () {
28     __assign = Object.assign || function(t) {
29         for (var s, i = 1, n = arguments.length; i < n; i++) {
30             s = arguments[i];
31             for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
32                 t[p] = s[p];
33         }
34         return t;
35     };
36     return __assign.apply(this, arguments);
37 };
38 var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
39     if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
40     return cooked;
41 };
42 var __generator = (this && this.__generator) || function (thisArg, body) {
43     var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
44     return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
45     function verb(n) { return function (v) { return step([n, v]); }; }
46     function step(op) {
47         if (f) throw new TypeError("Generator is already executing.");
48         while (_) try {
49             if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
50             if (y = 0, t) op = [op[0] & 2, t.value];
51             switch (op[0]) {
52                 case 0: case 1: t = op; break;
53                 case 4: _.label++; return { value: op[1], done: false };
54                 case 5: _.label++; y = op[1]; op = [0]; continue;
55                 case 7: op = _.ops.pop(); _.trys.pop(); continue;
56                 default:
57                     if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
58                     if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59                     if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
60                     if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
61                     if (t[2]) _.ops.pop();
62                     _.trys.pop(); continue;
63             }
64             op = body.call(thisArg, _);
65         } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
66         if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67     }
68 };
69 var ts;
70 (function (ts) {
71     ts.versionMajorMinor = "4.5";
72     ts.version = "4.5.2";
73     var NativeCollections;
74     (function (NativeCollections) {
75         function tryGetNativeMap() {
76             return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
77         }
78         NativeCollections.tryGetNativeMap = tryGetNativeMap;
79         function tryGetNativeSet() {
80             return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
81         }
82         NativeCollections.tryGetNativeSet = tryGetNativeSet;
83     })(NativeCollections || (NativeCollections = {}));
84     ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
85     ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
86     function getCollectionImplementation(name, nativeFactory, shimFactory) {
87         var _a;
88         var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
89         if (constructor)
90             return constructor;
91         throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation."));
92     }
93 })(ts || (ts = {}));
94 var ts;
95 (function (ts) {
96     function getIterator(iterable) {
97         if (iterable) {
98             if (isArray(iterable))
99                 return arrayIterator(iterable);
100             if (iterable instanceof ts.Map)
101                 return iterable.entries();
102             if (iterable instanceof ts.Set)
103                 return iterable.values();
104             throw new Error("Iteration not supported.");
105         }
106     }
107     ts.getIterator = getIterator;
108     ts.emptyArray = [];
109     ts.emptyMap = new ts.Map();
110     ts.emptySet = new ts.Set();
111     function createMap() {
112         return new ts.Map();
113     }
114     ts.createMap = createMap;
115     function createMapFromTemplate(template) {
116         var map = new ts.Map();
117         for (var key in template) {
118             if (hasOwnProperty.call(template, key)) {
119                 map.set(key, template[key]);
120             }
121         }
122         return map;
123     }
124     ts.createMapFromTemplate = createMapFromTemplate;
125     function length(array) {
126         return array ? array.length : 0;
127     }
128     ts.length = length;
129     function forEach(array, callback) {
130         if (array) {
131             for (var i = 0; i < array.length; i++) {
132                 var result = callback(array[i], i);
133                 if (result) {
134                     return result;
135                 }
136             }
137         }
138         return undefined;
139     }
140     ts.forEach = forEach;
141     function forEachRight(array, callback) {
142         if (array) {
143             for (var i = array.length - 1; i >= 0; i--) {
144                 var result = callback(array[i], i);
145                 if (result) {
146                     return result;
147                 }
148             }
149         }
150         return undefined;
151     }
152     ts.forEachRight = forEachRight;
153     function firstDefined(array, callback) {
154         if (array === undefined) {
155             return undefined;
156         }
157         for (var i = 0; i < array.length; i++) {
158             var result = callback(array[i], i);
159             if (result !== undefined) {
160                 return result;
161             }
162         }
163         return undefined;
164     }
165     ts.firstDefined = firstDefined;
166     function firstDefinedIterator(iter, callback) {
167         while (true) {
168             var iterResult = iter.next();
169             if (iterResult.done) {
170                 return undefined;
171             }
172             var result = callback(iterResult.value);
173             if (result !== undefined) {
174                 return result;
175             }
176         }
177     }
178     ts.firstDefinedIterator = firstDefinedIterator;
179     function reduceLeftIterator(iterator, f, initial) {
180         var result = initial;
181         if (iterator) {
182             for (var step = iterator.next(), pos = 0; !step.done; step = iterator.next(), pos++) {
183                 result = f(result, step.value, pos);
184             }
185         }
186         return result;
187     }
188     ts.reduceLeftIterator = reduceLeftIterator;
189     function zipWith(arrayA, arrayB, callback) {
190         var result = [];
191         ts.Debug.assertEqual(arrayA.length, arrayB.length);
192         for (var i = 0; i < arrayA.length; i++) {
193             result.push(callback(arrayA[i], arrayB[i], i));
194         }
195         return result;
196     }
197     ts.zipWith = zipWith;
198     function zipToIterator(arrayA, arrayB) {
199         ts.Debug.assertEqual(arrayA.length, arrayB.length);
200         var i = 0;
201         return {
202             next: function () {
203                 if (i === arrayA.length) {
204                     return { value: undefined, done: true };
205                 }
206                 i++;
207                 return { value: [arrayA[i - 1], arrayB[i - 1]], done: false };
208             }
209         };
210     }
211     ts.zipToIterator = zipToIterator;
212     function zipToMap(keys, values) {
213         ts.Debug.assert(keys.length === values.length);
214         var map = new ts.Map();
215         for (var i = 0; i < keys.length; ++i) {
216             map.set(keys[i], values[i]);
217         }
218         return map;
219     }
220     ts.zipToMap = zipToMap;
221     function intersperse(input, element) {
222         if (input.length <= 1) {
223             return input;
224         }
225         var result = [];
226         for (var i = 0, n = input.length; i < n; i++) {
227             if (i)
228                 result.push(element);
229             result.push(input[i]);
230         }
231         return result;
232     }
233     ts.intersperse = intersperse;
234     function every(array, callback) {
235         if (array) {
236             for (var i = 0; i < array.length; i++) {
237                 if (!callback(array[i], i)) {
238                     return false;
239                 }
240             }
241         }
242         return true;
243     }
244     ts.every = every;
245     function find(array, predicate) {
246         for (var i = 0; i < array.length; i++) {
247             var value = array[i];
248             if (predicate(value, i)) {
249                 return value;
250             }
251         }
252         return undefined;
253     }
254     ts.find = find;
255     function findLast(array, predicate) {
256         for (var i = array.length - 1; i >= 0; i--) {
257             var value = array[i];
258             if (predicate(value, i)) {
259                 return value;
260             }
261         }
262         return undefined;
263     }
264     ts.findLast = findLast;
265     function findIndex(array, predicate, startIndex) {
266         for (var i = startIndex || 0; i < array.length; i++) {
267             if (predicate(array[i], i)) {
268                 return i;
269             }
270         }
271         return -1;
272     }
273     ts.findIndex = findIndex;
274     function findLastIndex(array, predicate, startIndex) {
275         for (var i = startIndex === undefined ? array.length - 1 : startIndex; i >= 0; i--) {
276             if (predicate(array[i], i)) {
277                 return i;
278             }
279         }
280         return -1;
281     }
282     ts.findLastIndex = findLastIndex;
283     function findMap(array, callback) {
284         for (var i = 0; i < array.length; i++) {
285             var result = callback(array[i], i);
286             if (result) {
287                 return result;
288             }
289         }
290         return ts.Debug.fail();
291     }
292     ts.findMap = findMap;
293     function contains(array, value, equalityComparer) {
294         if (equalityComparer === void 0) { equalityComparer = equateValues; }
295         if (array) {
296             for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
297                 var v = array_1[_i];
298                 if (equalityComparer(v, value)) {
299                     return true;
300                 }
301             }
302         }
303         return false;
304     }
305     ts.contains = contains;
306     function arraysEqual(a, b, equalityComparer) {
307         if (equalityComparer === void 0) { equalityComparer = equateValues; }
308         return a.length === b.length && a.every(function (x, i) { return equalityComparer(x, b[i]); });
309     }
310     ts.arraysEqual = arraysEqual;
311     function indexOfAnyCharCode(text, charCodes, start) {
312         for (var i = start || 0; i < text.length; i++) {
313             if (contains(charCodes, text.charCodeAt(i))) {
314                 return i;
315             }
316         }
317         return -1;
318     }
319     ts.indexOfAnyCharCode = indexOfAnyCharCode;
320     function countWhere(array, predicate) {
321         var count = 0;
322         if (array) {
323             for (var i = 0; i < array.length; i++) {
324                 var v = array[i];
325                 if (predicate(v, i)) {
326                     count++;
327                 }
328             }
329         }
330         return count;
331     }
332     ts.countWhere = countWhere;
333     function filter(array, f) {
334         if (array) {
335             var len = array.length;
336             var i = 0;
337             while (i < len && f(array[i]))
338                 i++;
339             if (i < len) {
340                 var result = array.slice(0, i);
341                 i++;
342                 while (i < len) {
343                     var item = array[i];
344                     if (f(item)) {
345                         result.push(item);
346                     }
347                     i++;
348                 }
349                 return result;
350             }
351         }
352         return array;
353     }
354     ts.filter = filter;
355     function filterMutate(array, f) {
356         var outIndex = 0;
357         for (var i = 0; i < array.length; i++) {
358             if (f(array[i], i, array)) {
359                 array[outIndex] = array[i];
360                 outIndex++;
361             }
362         }
363         array.length = outIndex;
364     }
365     ts.filterMutate = filterMutate;
366     function clear(array) {
367         array.length = 0;
368     }
369     ts.clear = clear;
370     function map(array, f) {
371         var result;
372         if (array) {
373             result = [];
374             for (var i = 0; i < array.length; i++) {
375                 result.push(f(array[i], i));
376             }
377         }
378         return result;
379     }
380     ts.map = map;
381     function mapIterator(iter, mapFn) {
382         return {
383             next: function () {
384                 var iterRes = iter.next();
385                 return iterRes.done ? iterRes : { value: mapFn(iterRes.value), done: false };
386             }
387         };
388     }
389     ts.mapIterator = mapIterator;
390     function sameMap(array, f) {
391         if (array) {
392             for (var i = 0; i < array.length; i++) {
393                 var item = array[i];
394                 var mapped = f(item, i);
395                 if (item !== mapped) {
396                     var result = array.slice(0, i);
397                     result.push(mapped);
398                     for (i++; i < array.length; i++) {
399                         result.push(f(array[i], i));
400                     }
401                     return result;
402                 }
403             }
404         }
405         return array;
406     }
407     ts.sameMap = sameMap;
408     function flatten(array) {
409         var result = [];
410         for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {
411             var v = array_2[_i];
412             if (v) {
413                 if (isArray(v)) {
414                     addRange(result, v);
415                 }
416                 else {
417                     result.push(v);
418                 }
419             }
420         }
421         return result;
422     }
423     ts.flatten = flatten;
424     function flatMap(array, mapfn) {
425         var result;
426         if (array) {
427             for (var i = 0; i < array.length; i++) {
428                 var v = mapfn(array[i], i);
429                 if (v) {
430                     if (isArray(v)) {
431                         result = addRange(result, v);
432                     }
433                     else {
434                         result = append(result, v);
435                     }
436                 }
437             }
438         }
439         return result || ts.emptyArray;
440     }
441     ts.flatMap = flatMap;
442     function flatMapToMutable(array, mapfn) {
443         var result = [];
444         if (array) {
445             for (var i = 0; i < array.length; i++) {
446                 var v = mapfn(array[i], i);
447                 if (v) {
448                     if (isArray(v)) {
449                         addRange(result, v);
450                     }
451                     else {
452                         result.push(v);
453                     }
454                 }
455             }
456         }
457         return result;
458     }
459     ts.flatMapToMutable = flatMapToMutable;
460     function flatMapIterator(iter, mapfn) {
461         var first = iter.next();
462         if (first.done) {
463             return ts.emptyIterator;
464         }
465         var currentIter = getIterator(first.value);
466         return {
467             next: function () {
468                 while (true) {
469                     var currentRes = currentIter.next();
470                     if (!currentRes.done) {
471                         return currentRes;
472                     }
473                     var iterRes = iter.next();
474                     if (iterRes.done) {
475                         return iterRes;
476                     }
477                     currentIter = getIterator(iterRes.value);
478                 }
479             },
480         };
481         function getIterator(x) {
482             var res = mapfn(x);
483             return res === undefined ? ts.emptyIterator : isArray(res) ? arrayIterator(res) : res;
484         }
485     }
486     ts.flatMapIterator = flatMapIterator;
487     function sameFlatMap(array, mapfn) {
488         var result;
489         if (array) {
490             for (var i = 0; i < array.length; i++) {
491                 var item = array[i];
492                 var mapped = mapfn(item, i);
493                 if (result || item !== mapped || isArray(mapped)) {
494                     if (!result) {
495                         result = array.slice(0, i);
496                     }
497                     if (isArray(mapped)) {
498                         addRange(result, mapped);
499                     }
500                     else {
501                         result.push(mapped);
502                     }
503                 }
504             }
505         }
506         return result || array;
507     }
508     ts.sameFlatMap = sameFlatMap;
509     function mapAllOrFail(array, mapFn) {
510         var result = [];
511         for (var i = 0; i < array.length; i++) {
512             var mapped = mapFn(array[i], i);
513             if (mapped === undefined) {
514                 return undefined;
515             }
516             result.push(mapped);
517         }
518         return result;
519     }
520     ts.mapAllOrFail = mapAllOrFail;
521     function mapDefined(array, mapFn) {
522         var result = [];
523         if (array) {
524             for (var i = 0; i < array.length; i++) {
525                 var mapped = mapFn(array[i], i);
526                 if (mapped !== undefined) {
527                     result.push(mapped);
528                 }
529             }
530         }
531         return result;
532     }
533     ts.mapDefined = mapDefined;
534     function mapDefinedIterator(iter, mapFn) {
535         return {
536             next: function () {
537                 while (true) {
538                     var res = iter.next();
539                     if (res.done) {
540                         return res;
541                     }
542                     var value = mapFn(res.value);
543                     if (value !== undefined) {
544                         return { value: value, done: false };
545                     }
546                 }
547             }
548         };
549     }
550     ts.mapDefinedIterator = mapDefinedIterator;
551     function mapDefinedEntries(map, f) {
552         if (!map) {
553             return undefined;
554         }
555         var result = new ts.Map();
556         map.forEach(function (value, key) {
557             var entry = f(key, value);
558             if (entry !== undefined) {
559                 var newKey = entry[0], newValue = entry[1];
560                 if (newKey !== undefined && newValue !== undefined) {
561                     result.set(newKey, newValue);
562                 }
563             }
564         });
565         return result;
566     }
567     ts.mapDefinedEntries = mapDefinedEntries;
568     function mapDefinedValues(set, f) {
569         if (set) {
570             var result_1 = new ts.Set();
571             set.forEach(function (value) {
572                 var newValue = f(value);
573                 if (newValue !== undefined) {
574                     result_1.add(newValue);
575                 }
576             });
577             return result_1;
578         }
579     }
580     ts.mapDefinedValues = mapDefinedValues;
581     function getOrUpdate(map, key, callback) {
582         if (map.has(key)) {
583             return map.get(key);
584         }
585         var value = callback();
586         map.set(key, value);
587         return value;
588     }
589     ts.getOrUpdate = getOrUpdate;
590     function tryAddToSet(set, value) {
591         if (!set.has(value)) {
592             set.add(value);
593             return true;
594         }
595         return false;
596     }
597     ts.tryAddToSet = tryAddToSet;
598     ts.emptyIterator = { next: function () { return ({ value: undefined, done: true }); } };
599     function singleIterator(value) {
600         var done = false;
601         return {
602             next: function () {
603                 var wasDone = done;
604                 done = true;
605                 return wasDone ? { value: undefined, done: true } : { value: value, done: false };
606             }
607         };
608     }
609     ts.singleIterator = singleIterator;
610     function spanMap(array, keyfn, mapfn) {
611         var result;
612         if (array) {
613             result = [];
614             var len = array.length;
615             var previousKey = void 0;
616             var key = void 0;
617             var start = 0;
618             var pos = 0;
619             while (start < len) {
620                 while (pos < len) {
621                     var value = array[pos];
622                     key = keyfn(value, pos);
623                     if (pos === 0) {
624                         previousKey = key;
625                     }
626                     else if (key !== previousKey) {
627                         break;
628                     }
629                     pos++;
630                 }
631                 if (start < pos) {
632                     var v = mapfn(array.slice(start, pos), previousKey, start, pos);
633                     if (v) {
634                         result.push(v);
635                     }
636                     start = pos;
637                 }
638                 previousKey = key;
639                 pos++;
640             }
641         }
642         return result;
643     }
644     ts.spanMap = spanMap;
645     function mapEntries(map, f) {
646         if (!map) {
647             return undefined;
648         }
649         var result = new ts.Map();
650         map.forEach(function (value, key) {
651             var _a = f(key, value), newKey = _a[0], newValue = _a[1];
652             result.set(newKey, newValue);
653         });
654         return result;
655     }
656     ts.mapEntries = mapEntries;
657     function some(array, predicate) {
658         if (array) {
659             if (predicate) {
660                 for (var _i = 0, array_3 = array; _i < array_3.length; _i++) {
661                     var v = array_3[_i];
662                     if (predicate(v)) {
663                         return true;
664                     }
665                 }
666             }
667             else {
668                 return array.length > 0;
669             }
670         }
671         return false;
672     }
673     ts.some = some;
674     function getRangesWhere(arr, pred, cb) {
675         var start;
676         for (var i = 0; i < arr.length; i++) {
677             if (pred(arr[i])) {
678                 start = start === undefined ? i : start;
679             }
680             else {
681                 if (start !== undefined) {
682                     cb(start, i);
683                     start = undefined;
684                 }
685             }
686         }
687         if (start !== undefined)
688             cb(start, arr.length);
689     }
690     ts.getRangesWhere = getRangesWhere;
691     function concatenate(array1, array2) {
692         if (!some(array2))
693             return array1;
694         if (!some(array1))
695             return array2;
696         return __spreadArray(__spreadArray([], array1, true), array2, true);
697     }
698     ts.concatenate = concatenate;
699     function selectIndex(_, i) {
700         return i;
701     }
702     function indicesOf(array) {
703         return array.map(selectIndex);
704     }
705     ts.indicesOf = indicesOf;
706     function deduplicateRelational(array, equalityComparer, comparer) {
707         var indices = indicesOf(array);
708         stableSortIndices(array, indices, comparer);
709         var last = array[indices[0]];
710         var deduplicated = [indices[0]];
711         for (var i = 1; i < indices.length; i++) {
712             var index = indices[i];
713             var item = array[index];
714             if (!equalityComparer(last, item)) {
715                 deduplicated.push(index);
716                 last = item;
717             }
718         }
719         deduplicated.sort();
720         return deduplicated.map(function (i) { return array[i]; });
721     }
722     function deduplicateEquality(array, equalityComparer) {
723         var result = [];
724         for (var _i = 0, array_4 = array; _i < array_4.length; _i++) {
725             var item = array_4[_i];
726             pushIfUnique(result, item, equalityComparer);
727         }
728         return result;
729     }
730     function deduplicate(array, equalityComparer, comparer) {
731         return array.length === 0 ? [] :
732             array.length === 1 ? array.slice() :
733                 comparer ? deduplicateRelational(array, equalityComparer, comparer) :
734                     deduplicateEquality(array, equalityComparer);
735     }
736     ts.deduplicate = deduplicate;
737     function deduplicateSorted(array, comparer) {
738         if (array.length === 0)
739             return ts.emptyArray;
740         var last = array[0];
741         var deduplicated = [last];
742         for (var i = 1; i < array.length; i++) {
743             var next = array[i];
744             switch (comparer(next, last)) {
745                 case true:
746                 case 0:
747                     continue;
748                 case -1:
749                     return ts.Debug.fail("Array is unsorted.");
750             }
751             deduplicated.push(last = next);
752         }
753         return deduplicated;
754     }
755     function insertSorted(array, insert, compare) {
756         if (array.length === 0) {
757             array.push(insert);
758             return;
759         }
760         var insertIndex = binarySearch(array, insert, identity, compare);
761         if (insertIndex < 0) {
762             array.splice(~insertIndex, 0, insert);
763         }
764     }
765     ts.insertSorted = insertSorted;
766     function sortAndDeduplicate(array, comparer, equalityComparer) {
767         return deduplicateSorted(sort(array, comparer), equalityComparer || comparer || compareStringsCaseSensitive);
768     }
769     ts.sortAndDeduplicate = sortAndDeduplicate;
770     function arrayIsSorted(array, comparer) {
771         if (array.length < 2)
772             return true;
773         var prevElement = array[0];
774         for (var _i = 0, _a = array.slice(1); _i < _a.length; _i++) {
775             var element = _a[_i];
776             if (comparer(prevElement, element) === 1) {
777                 return false;
778             }
779             prevElement = element;
780         }
781         return true;
782     }
783     ts.arrayIsSorted = arrayIsSorted;
784     function arrayIsEqualTo(array1, array2, equalityComparer) {
785         if (equalityComparer === void 0) { equalityComparer = equateValues; }
786         if (!array1 || !array2) {
787             return array1 === array2;
788         }
789         if (array1.length !== array2.length) {
790             return false;
791         }
792         for (var i = 0; i < array1.length; i++) {
793             if (!equalityComparer(array1[i], array2[i], i)) {
794                 return false;
795             }
796         }
797         return true;
798     }
799     ts.arrayIsEqualTo = arrayIsEqualTo;
800     function compact(array) {
801         var result;
802         if (array) {
803             for (var i = 0; i < array.length; i++) {
804                 var v = array[i];
805                 if (result || !v) {
806                     if (!result) {
807                         result = array.slice(0, i);
808                     }
809                     if (v) {
810                         result.push(v);
811                     }
812                 }
813             }
814         }
815         return result || array;
816     }
817     ts.compact = compact;
818     function relativeComplement(arrayA, arrayB, comparer) {
819         if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0)
820             return arrayB;
821         var result = [];
822         loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
823             if (offsetB > 0) {
824                 ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0);
825             }
826             loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
827                 if (offsetA > startA) {
828                     ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0);
829                 }
830                 switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
831                     case -1:
832                         result.push(arrayB[offsetB]);
833                         continue loopB;
834                     case 0:
835                         continue loopB;
836                     case 1:
837                         continue loopA;
838                 }
839             }
840         }
841         return result;
842     }
843     ts.relativeComplement = relativeComplement;
844     function sum(array, prop) {
845         var result = 0;
846         for (var _i = 0, array_5 = array; _i < array_5.length; _i++) {
847             var v = array_5[_i];
848             result += v[prop];
849         }
850         return result;
851     }
852     ts.sum = sum;
853     function append(to, value) {
854         if (value === undefined)
855             return to;
856         if (to === undefined)
857             return [value];
858         to.push(value);
859         return to;
860     }
861     ts.append = append;
862     function combine(xs, ys) {
863         if (xs === undefined)
864             return ys;
865         if (ys === undefined)
866             return xs;
867         if (isArray(xs))
868             return isArray(ys) ? concatenate(xs, ys) : append(xs, ys);
869         if (isArray(ys))
870             return append(ys, xs);
871         return [xs, ys];
872     }
873     ts.combine = combine;
874     function toOffset(array, offset) {
875         return offset < 0 ? array.length + offset : offset;
876     }
877     function addRange(to, from, start, end) {
878         if (from === undefined || from.length === 0)
879             return to;
880         if (to === undefined)
881             return from.slice(start, end);
882         start = start === undefined ? 0 : toOffset(from, start);
883         end = end === undefined ? from.length : toOffset(from, end);
884         for (var i = start; i < end && i < from.length; i++) {
885             if (from[i] !== undefined) {
886                 to.push(from[i]);
887             }
888         }
889         return to;
890     }
891     ts.addRange = addRange;
892     function pushIfUnique(array, toAdd, equalityComparer) {
893         if (contains(array, toAdd, equalityComparer)) {
894             return false;
895         }
896         else {
897             array.push(toAdd);
898             return true;
899         }
900     }
901     ts.pushIfUnique = pushIfUnique;
902     function appendIfUnique(array, toAdd, equalityComparer) {
903         if (array) {
904             pushIfUnique(array, toAdd, equalityComparer);
905             return array;
906         }
907         else {
908             return [toAdd];
909         }
910     }
911     ts.appendIfUnique = appendIfUnique;
912     function stableSortIndices(array, indices, comparer) {
913         indices.sort(function (x, y) { return comparer(array[x], array[y]) || compareValues(x, y); });
914     }
915     function sort(array, comparer) {
916         return (array.length === 0 ? array : array.slice().sort(comparer));
917     }
918     ts.sort = sort;
919     function arrayIterator(array) {
920         var i = 0;
921         return { next: function () {
922                 if (i === array.length) {
923                     return { value: undefined, done: true };
924                 }
925                 else {
926                     i++;
927                     return { value: array[i - 1], done: false };
928                 }
929             } };
930     }
931     ts.arrayIterator = arrayIterator;
932     function arrayReverseIterator(array) {
933         var i = array.length;
934         return {
935             next: function () {
936                 if (i === 0) {
937                     return { value: undefined, done: true };
938                 }
939                 else {
940                     i--;
941                     return { value: array[i], done: false };
942                 }
943             }
944         };
945     }
946     ts.arrayReverseIterator = arrayReverseIterator;
947     function stableSort(array, comparer) {
948         var indices = indicesOf(array);
949         stableSortIndices(array, indices, comparer);
950         return indices.map(function (i) { return array[i]; });
951     }
952     ts.stableSort = stableSort;
953     function rangeEquals(array1, array2, pos, end) {
954         while (pos < end) {
955             if (array1[pos] !== array2[pos]) {
956                 return false;
957             }
958             pos++;
959         }
960         return true;
961     }
962     ts.rangeEquals = rangeEquals;
963     function elementAt(array, offset) {
964         if (array) {
965             offset = toOffset(array, offset);
966             if (offset < array.length) {
967                 return array[offset];
968             }
969         }
970         return undefined;
971     }
972     ts.elementAt = elementAt;
973     function firstOrUndefined(array) {
974         return array.length === 0 ? undefined : array[0];
975     }
976     ts.firstOrUndefined = firstOrUndefined;
977     function first(array) {
978         ts.Debug.assert(array.length !== 0);
979         return array[0];
980     }
981     ts.first = first;
982     function lastOrUndefined(array) {
983         return array.length === 0 ? undefined : array[array.length - 1];
984     }
985     ts.lastOrUndefined = lastOrUndefined;
986     function last(array) {
987         ts.Debug.assert(array.length !== 0);
988         return array[array.length - 1];
989     }
990     ts.last = last;
991     function singleOrUndefined(array) {
992         return array && array.length === 1
993             ? array[0]
994             : undefined;
995     }
996     ts.singleOrUndefined = singleOrUndefined;
997     function singleOrMany(array) {
998         return array && array.length === 1
999             ? array[0]
1000             : array;
1001     }
1002     ts.singleOrMany = singleOrMany;
1003     function replaceElement(array, index, value) {
1004         var result = array.slice(0);
1005         result[index] = value;
1006         return result;
1007     }
1008     ts.replaceElement = replaceElement;
1009     function binarySearch(array, value, keySelector, keyComparer, offset) {
1010         return binarySearchKey(array, keySelector(value), keySelector, keyComparer, offset);
1011     }
1012     ts.binarySearch = binarySearch;
1013     function binarySearchKey(array, key, keySelector, keyComparer, offset) {
1014         if (!some(array)) {
1015             return -1;
1016         }
1017         var low = offset || 0;
1018         var high = array.length - 1;
1019         while (low <= high) {
1020             var middle = low + ((high - low) >> 1);
1021             var midKey = keySelector(array[middle], middle);
1022             switch (keyComparer(midKey, key)) {
1023                 case -1:
1024                     low = middle + 1;
1025                     break;
1026                 case 0:
1027                     return middle;
1028                 case 1:
1029                     high = middle - 1;
1030                     break;
1031             }
1032         }
1033         return ~low;
1034     }
1035     ts.binarySearchKey = binarySearchKey;
1036     function reduceLeft(array, f, initial, start, count) {
1037         if (array && array.length > 0) {
1038             var size = array.length;
1039             if (size > 0) {
1040                 var pos = start === undefined || start < 0 ? 0 : start;
1041                 var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count;
1042                 var result = void 0;
1043                 if (arguments.length <= 2) {
1044                     result = array[pos];
1045                     pos++;
1046                 }
1047                 else {
1048                     result = initial;
1049                 }
1050                 while (pos <= end) {
1051                     result = f(result, array[pos], pos);
1052                     pos++;
1053                 }
1054                 return result;
1055             }
1056         }
1057         return initial;
1058     }
1059     ts.reduceLeft = reduceLeft;
1060     var hasOwnProperty = Object.prototype.hasOwnProperty;
1061     function hasProperty(map, key) {
1062         return hasOwnProperty.call(map, key);
1063     }
1064     ts.hasProperty = hasProperty;
1065     function getProperty(map, key) {
1066         return hasOwnProperty.call(map, key) ? map[key] : undefined;
1067     }
1068     ts.getProperty = getProperty;
1069     function getOwnKeys(map) {
1070         var keys = [];
1071         for (var key in map) {
1072             if (hasOwnProperty.call(map, key)) {
1073                 keys.push(key);
1074             }
1075         }
1076         return keys;
1077     }
1078     ts.getOwnKeys = getOwnKeys;
1079     function getAllKeys(obj) {
1080         var result = [];
1081         do {
1082             var names = Object.getOwnPropertyNames(obj);
1083             for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
1084                 var name = names_1[_i];
1085                 pushIfUnique(result, name);
1086             }
1087         } while (obj = Object.getPrototypeOf(obj));
1088         return result;
1089     }
1090     ts.getAllKeys = getAllKeys;
1091     function getOwnValues(sparseArray) {
1092         var values = [];
1093         for (var key in sparseArray) {
1094             if (hasOwnProperty.call(sparseArray, key)) {
1095                 values.push(sparseArray[key]);
1096             }
1097         }
1098         return values;
1099     }
1100     ts.getOwnValues = getOwnValues;
1101     var _entries = Object.entries || (function (obj) {
1102         var keys = getOwnKeys(obj);
1103         var result = Array(keys.length);
1104         for (var i = 0; i < keys.length; i++) {
1105             result[i] = [keys[i], obj[keys[i]]];
1106         }
1107         return result;
1108     });
1109     function getEntries(obj) {
1110         return obj ? _entries(obj) : [];
1111     }
1112     ts.getEntries = getEntries;
1113     function arrayOf(count, f) {
1114         var result = new Array(count);
1115         for (var i = 0; i < count; i++) {
1116             result[i] = f(i);
1117         }
1118         return result;
1119     }
1120     ts.arrayOf = arrayOf;
1121     function arrayFrom(iterator, map) {
1122         var result = [];
1123         for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
1124             result.push(map ? map(iterResult.value) : iterResult.value);
1125         }
1126         return result;
1127     }
1128     ts.arrayFrom = arrayFrom;
1129     function assign(t) {
1130         var args = [];
1131         for (var _i = 1; _i < arguments.length; _i++) {
1132             args[_i - 1] = arguments[_i];
1133         }
1134         for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
1135             var arg = args_1[_a];
1136             if (arg === undefined)
1137                 continue;
1138             for (var p in arg) {
1139                 if (hasProperty(arg, p)) {
1140                     t[p] = arg[p];
1141                 }
1142             }
1143         }
1144         return t;
1145     }
1146     ts.assign = assign;
1147     function equalOwnProperties(left, right, equalityComparer) {
1148         if (equalityComparer === void 0) { equalityComparer = equateValues; }
1149         if (left === right)
1150             return true;
1151         if (!left || !right)
1152             return false;
1153         for (var key in left) {
1154             if (hasOwnProperty.call(left, key)) {
1155                 if (!hasOwnProperty.call(right, key))
1156                     return false;
1157                 if (!equalityComparer(left[key], right[key]))
1158                     return false;
1159             }
1160         }
1161         for (var key in right) {
1162             if (hasOwnProperty.call(right, key)) {
1163                 if (!hasOwnProperty.call(left, key))
1164                     return false;
1165             }
1166         }
1167         return true;
1168     }
1169     ts.equalOwnProperties = equalOwnProperties;
1170     function arrayToMap(array, makeKey, makeValue) {
1171         if (makeValue === void 0) { makeValue = identity; }
1172         var result = new ts.Map();
1173         for (var _i = 0, array_6 = array; _i < array_6.length; _i++) {
1174             var value = array_6[_i];
1175             var key = makeKey(value);
1176             if (key !== undefined)
1177                 result.set(key, makeValue(value));
1178         }
1179         return result;
1180     }
1181     ts.arrayToMap = arrayToMap;
1182     function arrayToNumericMap(array, makeKey, makeValue) {
1183         if (makeValue === void 0) { makeValue = identity; }
1184         var result = [];
1185         for (var _i = 0, array_7 = array; _i < array_7.length; _i++) {
1186             var value = array_7[_i];
1187             result[makeKey(value)] = makeValue(value);
1188         }
1189         return result;
1190     }
1191     ts.arrayToNumericMap = arrayToNumericMap;
1192     function arrayToMultiMap(values, makeKey, makeValue) {
1193         if (makeValue === void 0) { makeValue = identity; }
1194         var result = createMultiMap();
1195         for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
1196             var value = values_1[_i];
1197             result.add(makeKey(value), makeValue(value));
1198         }
1199         return result;
1200     }
1201     ts.arrayToMultiMap = arrayToMultiMap;
1202     function group(values, getGroupId, resultSelector) {
1203         if (resultSelector === void 0) { resultSelector = identity; }
1204         return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector);
1205     }
1206     ts.group = group;
1207     function clone(object) {
1208         var result = {};
1209         for (var id in object) {
1210             if (hasOwnProperty.call(object, id)) {
1211                 result[id] = object[id];
1212             }
1213         }
1214         return result;
1215     }
1216     ts.clone = clone;
1217     function extend(first, second) {
1218         var result = {};
1219         for (var id in second) {
1220             if (hasOwnProperty.call(second, id)) {
1221                 result[id] = second[id];
1222             }
1223         }
1224         for (var id in first) {
1225             if (hasOwnProperty.call(first, id)) {
1226                 result[id] = first[id];
1227             }
1228         }
1229         return result;
1230     }
1231     ts.extend = extend;
1232     function copyProperties(first, second) {
1233         for (var id in second) {
1234             if (hasOwnProperty.call(second, id)) {
1235                 first[id] = second[id];
1236             }
1237         }
1238     }
1239     ts.copyProperties = copyProperties;
1240     function maybeBind(obj, fn) {
1241         return fn ? fn.bind(obj) : undefined;
1242     }
1243     ts.maybeBind = maybeBind;
1244     function createMultiMap() {
1245         var map = new ts.Map();
1246         map.add = multiMapAdd;
1247         map.remove = multiMapRemove;
1248         return map;
1249     }
1250     ts.createMultiMap = createMultiMap;
1251     function multiMapAdd(key, value) {
1252         var values = this.get(key);
1253         if (values) {
1254             values.push(value);
1255         }
1256         else {
1257             this.set(key, values = [value]);
1258         }
1259         return values;
1260     }
1261     function multiMapRemove(key, value) {
1262         var values = this.get(key);
1263         if (values) {
1264             unorderedRemoveItem(values, value);
1265             if (!values.length) {
1266                 this.delete(key);
1267             }
1268         }
1269     }
1270     function createUnderscoreEscapedMultiMap() {
1271         return createMultiMap();
1272     }
1273     ts.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap;
1274     function isArray(value) {
1275         return Array.isArray ? Array.isArray(value) : value instanceof Array;
1276     }
1277     ts.isArray = isArray;
1278     function toArray(value) {
1279         return isArray(value) ? value : [value];
1280     }
1281     ts.toArray = toArray;
1282     function isString(text) {
1283         return typeof text === "string";
1284     }
1285     ts.isString = isString;
1286     function isNumber(x) {
1287         return typeof x === "number";
1288     }
1289     ts.isNumber = isNumber;
1290     function tryCast(value, test) {
1291         return value !== undefined && test(value) ? value : undefined;
1292     }
1293     ts.tryCast = tryCast;
1294     function cast(value, test) {
1295         if (value !== undefined && test(value))
1296             return value;
1297         return ts.Debug.fail("Invalid cast. The supplied value ".concat(value, " did not pass the test '").concat(ts.Debug.getFunctionName(test), "'."));
1298     }
1299     ts.cast = cast;
1300     function noop(_) { }
1301     ts.noop = noop;
1302     function returnFalse() {
1303         return false;
1304     }
1305     ts.returnFalse = returnFalse;
1306     function returnTrue() {
1307         return true;
1308     }
1309     ts.returnTrue = returnTrue;
1310     function returnUndefined() {
1311         return undefined;
1312     }
1313     ts.returnUndefined = returnUndefined;
1314     function identity(x) {
1315         return x;
1316     }
1317     ts.identity = identity;
1318     function toLowerCase(x) {
1319         return x.toLowerCase();
1320     }
1321     ts.toLowerCase = toLowerCase;
1322     var fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
1323     function toFileNameLowerCase(x) {
1324         return fileNameLowerCaseRegExp.test(x) ?
1325             x.replace(fileNameLowerCaseRegExp, toLowerCase) :
1326             x;
1327     }
1328     ts.toFileNameLowerCase = toFileNameLowerCase;
1329     function notImplemented() {
1330         throw new Error("Not implemented");
1331     }
1332     ts.notImplemented = notImplemented;
1333     function memoize(callback) {
1334         var value;
1335         return function () {
1336             if (callback) {
1337                 value = callback();
1338                 callback = undefined;
1339             }
1340             return value;
1341         };
1342     }
1343     ts.memoize = memoize;
1344     function memoizeOne(callback) {
1345         var map = new ts.Map();
1346         return function (arg) {
1347             var key = "".concat(typeof arg, ":").concat(arg);
1348             var value = map.get(key);
1349             if (value === undefined && !map.has(key)) {
1350                 value = callback(arg);
1351                 map.set(key, value);
1352             }
1353             return value;
1354         };
1355     }
1356     ts.memoizeOne = memoizeOne;
1357     function compose(a, b, c, d, e) {
1358         if (!!e) {
1359             var args_2 = [];
1360             for (var i = 0; i < arguments.length; i++) {
1361                 args_2[i] = arguments[i];
1362             }
1363             return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
1364         }
1365         else if (d) {
1366             return function (t) { return d(c(b(a(t)))); };
1367         }
1368         else if (c) {
1369             return function (t) { return c(b(a(t))); };
1370         }
1371         else if (b) {
1372             return function (t) { return b(a(t)); };
1373         }
1374         else if (a) {
1375             return function (t) { return a(t); };
1376         }
1377         else {
1378             return function (t) { return t; };
1379         }
1380     }
1381     ts.compose = compose;
1382     function equateValues(a, b) {
1383         return a === b;
1384     }
1385     ts.equateValues = equateValues;
1386     function equateStringsCaseInsensitive(a, b) {
1387         return a === b
1388             || a !== undefined
1389                 && b !== undefined
1390                 && a.toUpperCase() === b.toUpperCase();
1391     }
1392     ts.equateStringsCaseInsensitive = equateStringsCaseInsensitive;
1393     function equateStringsCaseSensitive(a, b) {
1394         return equateValues(a, b);
1395     }
1396     ts.equateStringsCaseSensitive = equateStringsCaseSensitive;
1397     function compareComparableValues(a, b) {
1398         return a === b ? 0 :
1399             a === undefined ? -1 :
1400                 b === undefined ? 1 :
1401                     a < b ? -1 :
1402                         1;
1403     }
1404     function compareValues(a, b) {
1405         return compareComparableValues(a, b);
1406     }
1407     ts.compareValues = compareValues;
1408     function compareTextSpans(a, b) {
1409         return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
1410     }
1411     ts.compareTextSpans = compareTextSpans;
1412     function min(a, b, compare) {
1413         return compare(a, b) === -1 ? a : b;
1414     }
1415     ts.min = min;
1416     function compareStringsCaseInsensitive(a, b) {
1417         if (a === b)
1418             return 0;
1419         if (a === undefined)
1420             return -1;
1421         if (b === undefined)
1422             return 1;
1423         a = a.toUpperCase();
1424         b = b.toUpperCase();
1425         return a < b ? -1 : a > b ? 1 : 0;
1426     }
1427     ts.compareStringsCaseInsensitive = compareStringsCaseInsensitive;
1428     function compareStringsCaseSensitive(a, b) {
1429         return compareComparableValues(a, b);
1430     }
1431     ts.compareStringsCaseSensitive = compareStringsCaseSensitive;
1432     function getStringComparer(ignoreCase) {
1433         return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
1434     }
1435     ts.getStringComparer = getStringComparer;
1436     var createUIStringComparer = (function () {
1437         var defaultComparer;
1438         var enUSComparer;
1439         var stringComparerFactory = getStringComparerFactory();
1440         return createStringComparer;
1441         function compareWithCallback(a, b, comparer) {
1442             if (a === b)
1443                 return 0;
1444             if (a === undefined)
1445                 return -1;
1446             if (b === undefined)
1447                 return 1;
1448             var value = comparer(a, b);
1449             return value < 0 ? -1 : value > 0 ? 1 : 0;
1450         }
1451         function createIntlCollatorStringComparer(locale) {
1452             var comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
1453             return function (a, b) { return compareWithCallback(a, b, comparer); };
1454         }
1455         function createLocaleCompareStringComparer(locale) {
1456             if (locale !== undefined)
1457                 return createFallbackStringComparer();
1458             return function (a, b) { return compareWithCallback(a, b, compareStrings); };
1459             function compareStrings(a, b) {
1460                 return a.localeCompare(b);
1461             }
1462         }
1463         function createFallbackStringComparer() {
1464             return function (a, b) { return compareWithCallback(a, b, compareDictionaryOrder); };
1465             function compareDictionaryOrder(a, b) {
1466                 return compareStrings(a.toUpperCase(), b.toUpperCase()) || compareStrings(a, b);
1467             }
1468             function compareStrings(a, b) {
1469                 return a < b ? -1 : a > b ? 1 : 0;
1470             }
1471         }
1472         function getStringComparerFactory() {
1473             if (typeof Intl === "object" && typeof Intl.Collator === "function") {
1474                 return createIntlCollatorStringComparer;
1475             }
1476             if (typeof String.prototype.localeCompare === "function" &&
1477                 typeof String.prototype.toLocaleUpperCase === "function" &&
1478                 "a".localeCompare("B") < 0) {
1479                 return createLocaleCompareStringComparer;
1480             }
1481             return createFallbackStringComparer;
1482         }
1483         function createStringComparer(locale) {
1484             if (locale === undefined) {
1485                 return defaultComparer || (defaultComparer = stringComparerFactory(locale));
1486             }
1487             else if (locale === "en-US") {
1488                 return enUSComparer || (enUSComparer = stringComparerFactory(locale));
1489             }
1490             else {
1491                 return stringComparerFactory(locale);
1492             }
1493         }
1494     })();
1495     var uiComparerCaseSensitive;
1496     var uiLocale;
1497     function getUILocale() {
1498         return uiLocale;
1499     }
1500     ts.getUILocale = getUILocale;
1501     function setUILocale(value) {
1502         if (uiLocale !== value) {
1503             uiLocale = value;
1504             uiComparerCaseSensitive = undefined;
1505         }
1506     }
1507     ts.setUILocale = setUILocale;
1508     function compareStringsCaseSensitiveUI(a, b) {
1509         var comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
1510         return comparer(a, b);
1511     }
1512     ts.compareStringsCaseSensitiveUI = compareStringsCaseSensitiveUI;
1513     function compareProperties(a, b, key, comparer) {
1514         return a === b ? 0 :
1515             a === undefined ? -1 :
1516                 b === undefined ? 1 :
1517                     comparer(a[key], b[key]);
1518     }
1519     ts.compareProperties = compareProperties;
1520     function compareBooleans(a, b) {
1521         return compareValues(a ? 1 : 0, b ? 1 : 0);
1522     }
1523     ts.compareBooleans = compareBooleans;
1524     function getSpellingSuggestion(name, candidates, getName) {
1525         var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
1526         var bestDistance = Math.floor(name.length * 0.4) + 1;
1527         var bestCandidate;
1528         for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
1529             var candidate = candidates_1[_i];
1530             var candidateName = getName(candidate);
1531             if (candidateName !== undefined && Math.abs(candidateName.length - name.length) <= maximumLengthDifference) {
1532                 if (candidateName === name) {
1533                     continue;
1534                 }
1535                 if (candidateName.length < 3 && candidateName.toLowerCase() !== name.toLowerCase()) {
1536                     continue;
1537                 }
1538                 var distance = levenshteinWithMax(name, candidateName, bestDistance - 0.1);
1539                 if (distance === undefined) {
1540                     continue;
1541                 }
1542                 ts.Debug.assert(distance < bestDistance);
1543                 bestDistance = distance;
1544                 bestCandidate = candidate;
1545             }
1546         }
1547         return bestCandidate;
1548     }
1549     ts.getSpellingSuggestion = getSpellingSuggestion;
1550     function levenshteinWithMax(s1, s2, max) {
1551         var previous = new Array(s2.length + 1);
1552         var current = new Array(s2.length + 1);
1553         var big = max + 0.01;
1554         for (var i = 0; i <= s2.length; i++) {
1555             previous[i] = i;
1556         }
1557         for (var i = 1; i <= s1.length; i++) {
1558             var c1 = s1.charCodeAt(i - 1);
1559             var minJ = Math.ceil(i > max ? i - max : 1);
1560             var maxJ = Math.floor(s2.length > max + i ? max + i : s2.length);
1561             current[0] = i;
1562             var colMin = i;
1563             for (var j = 1; j < minJ; j++) {
1564                 current[j] = big;
1565             }
1566             for (var j = minJ; j <= maxJ; j++) {
1567                 var substitutionDistance = s1[i - 1].toLowerCase() === s2[j - 1].toLowerCase()
1568                     ? (previous[j - 1] + 0.1)
1569                     : (previous[j - 1] + 2);
1570                 var dist = c1 === s2.charCodeAt(j - 1)
1571                     ? previous[j - 1]
1572                     : Math.min(previous[j] + 1, current[j - 1] + 1, substitutionDistance);
1573                 current[j] = dist;
1574                 colMin = Math.min(colMin, dist);
1575             }
1576             for (var j = maxJ + 1; j <= s2.length; j++) {
1577                 current[j] = big;
1578             }
1579             if (colMin > max) {
1580                 return undefined;
1581             }
1582             var temp = previous;
1583             previous = current;
1584             current = temp;
1585         }
1586         var res = previous[s2.length];
1587         return res > max ? undefined : res;
1588     }
1589     function endsWith(str, suffix) {
1590         var expectedPos = str.length - suffix.length;
1591         return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
1592     }
1593     ts.endsWith = endsWith;
1594     function removeSuffix(str, suffix) {
1595         return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
1596     }
1597     ts.removeSuffix = removeSuffix;
1598     function tryRemoveSuffix(str, suffix) {
1599         return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : undefined;
1600     }
1601     ts.tryRemoveSuffix = tryRemoveSuffix;
1602     function stringContains(str, substring) {
1603         return str.indexOf(substring) !== -1;
1604     }
1605     ts.stringContains = stringContains;
1606     function removeMinAndVersionNumbers(fileName) {
1607         var end = fileName.length;
1608         for (var pos = end - 1; pos > 0; pos--) {
1609             var ch = fileName.charCodeAt(pos);
1610             if (ch >= 48 && ch <= 57) {
1611                 do {
1612                     --pos;
1613                     ch = fileName.charCodeAt(pos);
1614                 } while (pos > 0 && ch >= 48 && ch <= 57);
1615             }
1616             else if (pos > 4 && (ch === 110 || ch === 78)) {
1617                 --pos;
1618                 ch = fileName.charCodeAt(pos);
1619                 if (ch !== 105 && ch !== 73) {
1620                     break;
1621                 }
1622                 --pos;
1623                 ch = fileName.charCodeAt(pos);
1624                 if (ch !== 109 && ch !== 77) {
1625                     break;
1626                 }
1627                 --pos;
1628                 ch = fileName.charCodeAt(pos);
1629             }
1630             else {
1631                 break;
1632             }
1633             if (ch !== 45 && ch !== 46) {
1634                 break;
1635             }
1636             end = pos;
1637         }
1638         return end === fileName.length ? fileName : fileName.slice(0, end);
1639     }
1640     ts.removeMinAndVersionNumbers = removeMinAndVersionNumbers;
1641     function orderedRemoveItem(array, item) {
1642         for (var i = 0; i < array.length; i++) {
1643             if (array[i] === item) {
1644                 orderedRemoveItemAt(array, i);
1645                 return true;
1646             }
1647         }
1648         return false;
1649     }
1650     ts.orderedRemoveItem = orderedRemoveItem;
1651     function orderedRemoveItemAt(array, index) {
1652         for (var i = index; i < array.length - 1; i++) {
1653             array[i] = array[i + 1];
1654         }
1655         array.pop();
1656     }
1657     ts.orderedRemoveItemAt = orderedRemoveItemAt;
1658     function unorderedRemoveItemAt(array, index) {
1659         array[index] = array[array.length - 1];
1660         array.pop();
1661     }
1662     ts.unorderedRemoveItemAt = unorderedRemoveItemAt;
1663     function unorderedRemoveItem(array, item) {
1664         return unorderedRemoveFirstItemWhere(array, function (element) { return element === item; });
1665     }
1666     ts.unorderedRemoveItem = unorderedRemoveItem;
1667     function unorderedRemoveFirstItemWhere(array, predicate) {
1668         for (var i = 0; i < array.length; i++) {
1669             if (predicate(array[i])) {
1670                 unorderedRemoveItemAt(array, i);
1671                 return true;
1672             }
1673         }
1674         return false;
1675     }
1676     function createGetCanonicalFileName(useCaseSensitiveFileNames) {
1677         return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
1678     }
1679     ts.createGetCanonicalFileName = createGetCanonicalFileName;
1680     function patternText(_a) {
1681         var prefix = _a.prefix, suffix = _a.suffix;
1682         return "".concat(prefix, "*").concat(suffix);
1683     }
1684     ts.patternText = patternText;
1685     function matchedText(pattern, candidate) {
1686         ts.Debug.assert(isPatternMatch(pattern, candidate));
1687         return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
1688     }
1689     ts.matchedText = matchedText;
1690     function findBestPatternMatch(values, getPattern, candidate) {
1691         var matchedValue;
1692         var longestMatchPrefixLength = -1;
1693         for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
1694             var v = values_2[_i];
1695             var pattern = getPattern(v);
1696             if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
1697                 longestMatchPrefixLength = pattern.prefix.length;
1698                 matchedValue = v;
1699             }
1700         }
1701         return matchedValue;
1702     }
1703     ts.findBestPatternMatch = findBestPatternMatch;
1704     function startsWith(str, prefix) {
1705         return str.lastIndexOf(prefix, 0) === 0;
1706     }
1707     ts.startsWith = startsWith;
1708     function removePrefix(str, prefix) {
1709         return startsWith(str, prefix) ? str.substr(prefix.length) : str;
1710     }
1711     ts.removePrefix = removePrefix;
1712     function tryRemovePrefix(str, prefix, getCanonicalFileName) {
1713         if (getCanonicalFileName === void 0) { getCanonicalFileName = identity; }
1714         return startsWith(getCanonicalFileName(str), getCanonicalFileName(prefix)) ? str.substring(prefix.length) : undefined;
1715     }
1716     ts.tryRemovePrefix = tryRemovePrefix;
1717     function isPatternMatch(_a, candidate) {
1718         var prefix = _a.prefix, suffix = _a.suffix;
1719         return candidate.length >= prefix.length + suffix.length &&
1720             startsWith(candidate, prefix) &&
1721             endsWith(candidate, suffix);
1722     }
1723     function and(f, g) {
1724         return function (arg) { return f(arg) && g(arg); };
1725     }
1726     ts.and = and;
1727     function or() {
1728         var fs = [];
1729         for (var _i = 0; _i < arguments.length; _i++) {
1730             fs[_i] = arguments[_i];
1731         }
1732         return function () {
1733             var args = [];
1734             for (var _i = 0; _i < arguments.length; _i++) {
1735                 args[_i] = arguments[_i];
1736             }
1737             for (var _a = 0, fs_1 = fs; _a < fs_1.length; _a++) {
1738                 var f = fs_1[_a];
1739                 if (f.apply(void 0, args)) {
1740                     return true;
1741                 }
1742             }
1743             return false;
1744         };
1745     }
1746     ts.or = or;
1747     function not(fn) {
1748         return function () {
1749             var args = [];
1750             for (var _i = 0; _i < arguments.length; _i++) {
1751                 args[_i] = arguments[_i];
1752             }
1753             return !fn.apply(void 0, args);
1754         };
1755     }
1756     ts.not = not;
1757     function assertType(_) { }
1758     ts.assertType = assertType;
1759     function singleElementArray(t) {
1760         return t === undefined ? undefined : [t];
1761     }
1762     ts.singleElementArray = singleElementArray;
1763     function enumerateInsertsAndDeletes(newItems, oldItems, comparer, inserted, deleted, unchanged) {
1764         unchanged = unchanged || noop;
1765         var newIndex = 0;
1766         var oldIndex = 0;
1767         var newLen = newItems.length;
1768         var oldLen = oldItems.length;
1769         var hasChanges = false;
1770         while (newIndex < newLen && oldIndex < oldLen) {
1771             var newItem = newItems[newIndex];
1772             var oldItem = oldItems[oldIndex];
1773             var compareResult = comparer(newItem, oldItem);
1774             if (compareResult === -1) {
1775                 inserted(newItem);
1776                 newIndex++;
1777                 hasChanges = true;
1778             }
1779             else if (compareResult === 1) {
1780                 deleted(oldItem);
1781                 oldIndex++;
1782                 hasChanges = true;
1783             }
1784             else {
1785                 unchanged(oldItem, newItem);
1786                 newIndex++;
1787                 oldIndex++;
1788             }
1789         }
1790         while (newIndex < newLen) {
1791             inserted(newItems[newIndex++]);
1792             hasChanges = true;
1793         }
1794         while (oldIndex < oldLen) {
1795             deleted(oldItems[oldIndex++]);
1796             hasChanges = true;
1797         }
1798         return hasChanges;
1799     }
1800     ts.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes;
1801     function fill(length, cb) {
1802         var result = Array(length);
1803         for (var i = 0; i < length; i++) {
1804             result[i] = cb(i);
1805         }
1806         return result;
1807     }
1808     ts.fill = fill;
1809     function cartesianProduct(arrays) {
1810         var result = [];
1811         cartesianProductWorker(arrays, result, undefined, 0);
1812         return result;
1813     }
1814     ts.cartesianProduct = cartesianProduct;
1815     function cartesianProductWorker(arrays, result, outer, index) {
1816         for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
1817             var element = _a[_i];
1818             var inner = void 0;
1819             if (outer) {
1820                 inner = outer.slice();
1821                 inner.push(element);
1822             }
1823             else {
1824                 inner = [element];
1825             }
1826             if (index === arrays.length - 1) {
1827                 result.push(inner);
1828             }
1829             else {
1830                 cartesianProductWorker(arrays, result, inner, index + 1);
1831             }
1832         }
1833     }
1834     function padLeft(s, length, padString) {
1835         if (padString === void 0) { padString = " "; }
1836         return length <= s.length ? s : padString.repeat(length - s.length) + s;
1837     }
1838     ts.padLeft = padLeft;
1839     function padRight(s, length, padString) {
1840         if (padString === void 0) { padString = " "; }
1841         return length <= s.length ? s : s + padString.repeat(length - s.length);
1842     }
1843     ts.padRight = padRight;
1844     function takeWhile(array, predicate) {
1845         var len = array.length;
1846         var index = 0;
1847         while (index < len && predicate(array[index])) {
1848             index++;
1849         }
1850         return array.slice(0, index);
1851     }
1852     ts.takeWhile = takeWhile;
1853     ts.trimString = !!String.prototype.trim ? (function (s) { return s.trim(); }) : function (s) { return ts.trimStringEnd(ts.trimStringStart(s)); };
1854     ts.trimStringEnd = !!String.prototype.trimEnd ? (function (s) { return s.trimEnd(); }) : trimEndImpl;
1855     ts.trimStringStart = !!String.prototype.trimStart ? (function (s) { return s.trimStart(); }) : function (s) { return s.replace(/^\s+/g, ""); };
1856     function trimEndImpl(s) {
1857         var end = s.length - 1;
1858         while (end >= 0) {
1859             if (!ts.isWhiteSpaceLike(s.charCodeAt(end)))
1860                 break;
1861             end--;
1862         }
1863         return s.slice(0, end + 1);
1864     }
1865 })(ts || (ts = {}));
1866 var ts;
1867 (function (ts) {
1868     var LogLevel;
1869     (function (LogLevel) {
1870         LogLevel[LogLevel["Off"] = 0] = "Off";
1871         LogLevel[LogLevel["Error"] = 1] = "Error";
1872         LogLevel[LogLevel["Warning"] = 2] = "Warning";
1873         LogLevel[LogLevel["Info"] = 3] = "Info";
1874         LogLevel[LogLevel["Verbose"] = 4] = "Verbose";
1875     })(LogLevel = ts.LogLevel || (ts.LogLevel = {}));
1876     var Debug;
1877     (function (Debug) {
1878         var typeScriptVersion;
1879         var currentAssertionLevel = 0;
1880         Debug.currentLogLevel = LogLevel.Warning;
1881         Debug.isDebugging = false;
1882         function getTypeScriptVersion() {
1883             return typeScriptVersion !== null && typeScriptVersion !== void 0 ? typeScriptVersion : (typeScriptVersion = new ts.Version(ts.version));
1884         }
1885         Debug.getTypeScriptVersion = getTypeScriptVersion;
1886         function shouldLog(level) {
1887             return Debug.currentLogLevel <= level;
1888         }
1889         Debug.shouldLog = shouldLog;
1890         function logMessage(level, s) {
1891             if (Debug.loggingHost && shouldLog(level)) {
1892                 Debug.loggingHost.log(level, s);
1893             }
1894         }
1895         function log(s) {
1896             logMessage(LogLevel.Info, s);
1897         }
1898         Debug.log = log;
1899         (function (log_1) {
1900             function error(s) {
1901                 logMessage(LogLevel.Error, s);
1902             }
1903             log_1.error = error;
1904             function warn(s) {
1905                 logMessage(LogLevel.Warning, s);
1906             }
1907             log_1.warn = warn;
1908             function log(s) {
1909                 logMessage(LogLevel.Info, s);
1910             }
1911             log_1.log = log;
1912             function trace(s) {
1913                 logMessage(LogLevel.Verbose, s);
1914             }
1915             log_1.trace = trace;
1916         })(log = Debug.log || (Debug.log = {}));
1917         var assertionCache = {};
1918         function getAssertionLevel() {
1919             return currentAssertionLevel;
1920         }
1921         Debug.getAssertionLevel = getAssertionLevel;
1922         function setAssertionLevel(level) {
1923             var prevAssertionLevel = currentAssertionLevel;
1924             currentAssertionLevel = level;
1925             if (level > prevAssertionLevel) {
1926                 for (var _i = 0, _a = ts.getOwnKeys(assertionCache); _i < _a.length; _i++) {
1927                     var key = _a[_i];
1928                     var cachedFunc = assertionCache[key];
1929                     if (cachedFunc !== undefined && Debug[key] !== cachedFunc.assertion && level >= cachedFunc.level) {
1930                         Debug[key] = cachedFunc;
1931                         assertionCache[key] = undefined;
1932                     }
1933                 }
1934             }
1935         }
1936         Debug.setAssertionLevel = setAssertionLevel;
1937         function shouldAssert(level) {
1938             return currentAssertionLevel >= level;
1939         }
1940         Debug.shouldAssert = shouldAssert;
1941         function shouldAssertFunction(level, name) {
1942             if (!shouldAssert(level)) {
1943                 assertionCache[name] = { level: level, assertion: Debug[name] };
1944                 Debug[name] = ts.noop;
1945                 return false;
1946             }
1947             return true;
1948         }
1949         function fail(message, stackCrawlMark) {
1950             debugger;
1951             var e = new Error(message ? "Debug Failure. ".concat(message) : "Debug Failure.");
1952             if (Error.captureStackTrace) {
1953                 Error.captureStackTrace(e, stackCrawlMark || fail);
1954             }
1955             throw e;
1956         }
1957         Debug.fail = fail;
1958         function failBadSyntaxKind(node, message, stackCrawlMark) {
1959             return fail("".concat(message || "Unexpected node.", "\r\nNode ").concat(formatSyntaxKind(node.kind), " was unexpected."), stackCrawlMark || failBadSyntaxKind);
1960         }
1961         Debug.failBadSyntaxKind = failBadSyntaxKind;
1962         function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
1963             if (!expression) {
1964                 message = message ? "False expression: ".concat(message) : "False expression.";
1965                 if (verboseDebugInfo) {
1966                     message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
1967                 }
1968                 fail(message, stackCrawlMark || assert);
1969             }
1970         }
1971         Debug.assert = assert;
1972         function assertEqual(a, b, msg, msg2, stackCrawlMark) {
1973             if (a !== b) {
1974                 var message = msg ? msg2 ? "".concat(msg, " ").concat(msg2) : msg : "";
1975                 fail("Expected ".concat(a, " === ").concat(b, ". ").concat(message), stackCrawlMark || assertEqual);
1976             }
1977         }
1978         Debug.assertEqual = assertEqual;
1979         function assertLessThan(a, b, msg, stackCrawlMark) {
1980             if (a >= b) {
1981                 fail("Expected ".concat(a, " < ").concat(b, ". ").concat(msg || ""), stackCrawlMark || assertLessThan);
1982             }
1983         }
1984         Debug.assertLessThan = assertLessThan;
1985         function assertLessThanOrEqual(a, b, stackCrawlMark) {
1986             if (a > b) {
1987                 fail("Expected ".concat(a, " <= ").concat(b), stackCrawlMark || assertLessThanOrEqual);
1988             }
1989         }
1990         Debug.assertLessThanOrEqual = assertLessThanOrEqual;
1991         function assertGreaterThanOrEqual(a, b, stackCrawlMark) {
1992             if (a < b) {
1993                 fail("Expected ".concat(a, " >= ").concat(b), stackCrawlMark || assertGreaterThanOrEqual);
1994             }
1995         }
1996         Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
1997         function assertIsDefined(value, message, stackCrawlMark) {
1998             if (value === undefined || value === null) {
1999                 fail(message, stackCrawlMark || assertIsDefined);
2000             }
2001         }
2002         Debug.assertIsDefined = assertIsDefined;
2003         function checkDefined(value, message, stackCrawlMark) {
2004             assertIsDefined(value, message, stackCrawlMark || checkDefined);
2005             return value;
2006         }
2007         Debug.checkDefined = checkDefined;
2008         Debug.assertDefined = checkDefined;
2009         function assertEachIsDefined(value, message, stackCrawlMark) {
2010             for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2011                 var v = value_1[_i];
2012                 assertIsDefined(v, message, stackCrawlMark || assertEachIsDefined);
2013             }
2014         }
2015         Debug.assertEachIsDefined = assertEachIsDefined;
2016         function checkEachDefined(value, message, stackCrawlMark) {
2017             assertEachIsDefined(value, message, stackCrawlMark || checkEachDefined);
2018             return value;
2019         }
2020         Debug.checkEachDefined = checkEachDefined;
2021         Debug.assertEachDefined = checkEachDefined;
2022         function assertNever(member, message, stackCrawlMark) {
2023             if (message === void 0) { message = "Illegal value:"; }
2024             var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
2025             return fail("".concat(message, " ").concat(detail), stackCrawlMark || assertNever);
2026         }
2027         Debug.assertNever = assertNever;
2028         function assertEachNode(nodes, test, message, stackCrawlMark) {
2029             if (shouldAssertFunction(1, "assertEachNode")) {
2030                 assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '".concat(getFunctionName(test), "'."); }, stackCrawlMark || assertEachNode);
2031             }
2032         }
2033         Debug.assertEachNode = assertEachNode;
2034         function assertNode(node, test, message, stackCrawlMark) {
2035             if (shouldAssertFunction(1, "assertNode")) {
2036                 assert(node !== undefined && (test === undefined || test(node)), message || "Unexpected node.", function () { return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " did not pass test '").concat(getFunctionName(test), "'."); }, stackCrawlMark || assertNode);
2037             }
2038         }
2039         Debug.assertNode = assertNode;
2040         function assertNotNode(node, test, message, stackCrawlMark) {
2041             if (shouldAssertFunction(1, "assertNotNode")) {
2042                 assert(node === undefined || test === undefined || !test(node), message || "Unexpected node.", function () { return "Node ".concat(formatSyntaxKind(node.kind), " should not have passed test '").concat(getFunctionName(test), "'."); }, stackCrawlMark || assertNotNode);
2043             }
2044         }
2045         Debug.assertNotNode = assertNotNode;
2046         function assertOptionalNode(node, test, message, stackCrawlMark) {
2047             if (shouldAssertFunction(1, "assertOptionalNode")) {
2048                 assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " did not pass test '").concat(getFunctionName(test), "'."); }, stackCrawlMark || assertOptionalNode);
2049             }
2050         }
2051         Debug.assertOptionalNode = assertOptionalNode;
2052         function assertOptionalToken(node, kind, message, stackCrawlMark) {
2053             if (shouldAssertFunction(1, "assertOptionalToken")) {
2054                 assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node ".concat(formatSyntaxKind(node === null || node === void 0 ? void 0 : node.kind), " was not a '").concat(formatSyntaxKind(kind), "' token."); }, stackCrawlMark || assertOptionalToken);
2055             }
2056         }
2057         Debug.assertOptionalToken = assertOptionalToken;
2058         function assertMissingNode(node, message, stackCrawlMark) {
2059             if (shouldAssertFunction(1, "assertMissingNode")) {
2060                 assert(node === undefined, message || "Unexpected node.", function () { return "Node ".concat(formatSyntaxKind(node.kind), " was unexpected'."); }, stackCrawlMark || assertMissingNode);
2061             }
2062         }
2063         Debug.assertMissingNode = assertMissingNode;
2064         function type(_value) { }
2065         Debug.type = type;
2066         function getFunctionName(func) {
2067             if (typeof func !== "function") {
2068                 return "";
2069             }
2070             else if (func.hasOwnProperty("name")) {
2071                 return func.name;
2072             }
2073             else {
2074                 var text = Function.prototype.toString.call(func);
2075                 var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
2076                 return match ? match[1] : "";
2077             }
2078         }
2079         Debug.getFunctionName = getFunctionName;
2080         function formatSymbol(symbol) {
2081             return "{ name: ".concat(ts.unescapeLeadingUnderscores(symbol.escapedName), "; flags: ").concat(formatSymbolFlags(symbol.flags), "; declarations: ").concat(ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }), " }");
2082         }
2083         Debug.formatSymbol = formatSymbol;
2084         function formatEnum(value, enumObject, isFlags) {
2085             if (value === void 0) { value = 0; }
2086             var members = getEnumMembers(enumObject);
2087             if (value === 0) {
2088                 return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2089             }
2090             if (isFlags) {
2091                 var result = "";
2092                 var remainingFlags = value;
2093                 for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2094                     var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
2095                     if (enumValue > value) {
2096                         break;
2097                     }
2098                     if (enumValue !== 0 && enumValue & value) {
2099                         result = "".concat(result).concat(result ? "|" : "").concat(enumName);
2100                         remainingFlags &= ~enumValue;
2101                     }
2102                 }
2103                 if (remainingFlags === 0) {
2104                     return result;
2105                 }
2106             }
2107             else {
2108                 for (var _b = 0, members_2 = members; _b < members_2.length; _b++) {
2109                     var _c = members_2[_b], enumValue = _c[0], enumName = _c[1];
2110                     if (enumValue === value) {
2111                         return enumName;
2112                     }
2113                 }
2114             }
2115             return value.toString();
2116         }
2117         Debug.formatEnum = formatEnum;
2118         function getEnumMembers(enumObject) {
2119             var result = [];
2120             for (var name in enumObject) {
2121                 var value = enumObject[name];
2122                 if (typeof value === "number") {
2123                     result.push([value, name]);
2124                 }
2125             }
2126             return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2127         }
2128         function formatSyntaxKind(kind) {
2129             return formatEnum(kind, ts.SyntaxKind, false);
2130         }
2131         Debug.formatSyntaxKind = formatSyntaxKind;
2132         function formatSnippetKind(kind) {
2133             return formatEnum(kind, ts.SnippetKind, false);
2134         }
2135         Debug.formatSnippetKind = formatSnippetKind;
2136         function formatNodeFlags(flags) {
2137             return formatEnum(flags, ts.NodeFlags, true);
2138         }
2139         Debug.formatNodeFlags = formatNodeFlags;
2140         function formatModifierFlags(flags) {
2141             return formatEnum(flags, ts.ModifierFlags, true);
2142         }
2143         Debug.formatModifierFlags = formatModifierFlags;
2144         function formatTransformFlags(flags) {
2145             return formatEnum(flags, ts.TransformFlags, true);
2146         }
2147         Debug.formatTransformFlags = formatTransformFlags;
2148         function formatEmitFlags(flags) {
2149             return formatEnum(flags, ts.EmitFlags, true);
2150         }
2151         Debug.formatEmitFlags = formatEmitFlags;
2152         function formatSymbolFlags(flags) {
2153             return formatEnum(flags, ts.SymbolFlags, true);
2154         }
2155         Debug.formatSymbolFlags = formatSymbolFlags;
2156         function formatTypeFlags(flags) {
2157             return formatEnum(flags, ts.TypeFlags, true);
2158         }
2159         Debug.formatTypeFlags = formatTypeFlags;
2160         function formatSignatureFlags(flags) {
2161             return formatEnum(flags, ts.SignatureFlags, true);
2162         }
2163         Debug.formatSignatureFlags = formatSignatureFlags;
2164         function formatObjectFlags(flags) {
2165             return formatEnum(flags, ts.ObjectFlags, true);
2166         }
2167         Debug.formatObjectFlags = formatObjectFlags;
2168         function formatFlowFlags(flags) {
2169             return formatEnum(flags, ts.FlowFlags, true);
2170         }
2171         Debug.formatFlowFlags = formatFlowFlags;
2172         var isDebugInfoEnabled = false;
2173         var extendedDebugModule;
2174         function extendedDebug() {
2175             enableDebugInfo();
2176             if (!extendedDebugModule) {
2177                 throw new Error("Debugging helpers could not be loaded.");
2178             }
2179             return extendedDebugModule;
2180         }
2181         function printControlFlowGraph(flowNode) {
2182             return console.log(formatControlFlowGraph(flowNode));
2183         }
2184         Debug.printControlFlowGraph = printControlFlowGraph;
2185         function formatControlFlowGraph(flowNode) {
2186             return extendedDebug().formatControlFlowGraph(flowNode);
2187         }
2188         Debug.formatControlFlowGraph = formatControlFlowGraph;
2189         var flowNodeProto;
2190         function attachFlowNodeDebugInfoWorker(flowNode) {
2191             if (!("__debugFlowFlags" in flowNode)) {
2192                 Object.defineProperties(flowNode, {
2193                     __tsDebuggerDisplay: {
2194                         value: function () {
2195                             var flowHeader = this.flags & 2 ? "FlowStart" :
2196                                 this.flags & 4 ? "FlowBranchLabel" :
2197                                     this.flags & 8 ? "FlowLoopLabel" :
2198                                         this.flags & 16 ? "FlowAssignment" :
2199                                             this.flags & 32 ? "FlowTrueCondition" :
2200                                                 this.flags & 64 ? "FlowFalseCondition" :
2201                                                     this.flags & 128 ? "FlowSwitchClause" :
2202                                                         this.flags & 256 ? "FlowArrayMutation" :
2203                                                             this.flags & 512 ? "FlowCall" :
2204                                                                 this.flags & 1024 ? "FlowReduceLabel" :
2205                                                                     this.flags & 1 ? "FlowUnreachable" :
2206                                                                         "UnknownFlow";
2207                             var remainingFlags = this.flags & ~(2048 - 1);
2208                             return "".concat(flowHeader).concat(remainingFlags ? " (".concat(formatFlowFlags(remainingFlags), ")") : "");
2209                         }
2210                     },
2211                     __debugFlowFlags: { get: function () { return formatEnum(this.flags, ts.FlowFlags, true); } },
2212                     __debugToString: { value: function () { return formatControlFlowGraph(this); } }
2213                 });
2214             }
2215         }
2216         function attachFlowNodeDebugInfo(flowNode) {
2217             if (isDebugInfoEnabled) {
2218                 if (typeof Object.setPrototypeOf === "function") {
2219                     if (!flowNodeProto) {
2220                         flowNodeProto = Object.create(Object.prototype);
2221                         attachFlowNodeDebugInfoWorker(flowNodeProto);
2222                     }
2223                     Object.setPrototypeOf(flowNode, flowNodeProto);
2224                 }
2225                 else {
2226                     attachFlowNodeDebugInfoWorker(flowNode);
2227                 }
2228             }
2229         }
2230         Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo;
2231         var nodeArrayProto;
2232         function attachNodeArrayDebugInfoWorker(array) {
2233             if (!("__tsDebuggerDisplay" in array)) {
2234                 Object.defineProperties(array, {
2235                     __tsDebuggerDisplay: {
2236                         value: function (defaultValue) {
2237                             defaultValue = String(defaultValue).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/, "]");
2238                             return "NodeArray ".concat(defaultValue);
2239                         }
2240                     }
2241                 });
2242             }
2243         }
2244         function attachNodeArrayDebugInfo(array) {
2245             if (isDebugInfoEnabled) {
2246                 if (typeof Object.setPrototypeOf === "function") {
2247                     if (!nodeArrayProto) {
2248                         nodeArrayProto = Object.create(Array.prototype);
2249                         attachNodeArrayDebugInfoWorker(nodeArrayProto);
2250                     }
2251                     Object.setPrototypeOf(array, nodeArrayProto);
2252                 }
2253                 else {
2254                     attachNodeArrayDebugInfoWorker(array);
2255                 }
2256             }
2257         }
2258         Debug.attachNodeArrayDebugInfo = attachNodeArrayDebugInfo;
2259         function enableDebugInfo() {
2260             if (isDebugInfoEnabled)
2261                 return;
2262             var weakTypeTextMap;
2263             var weakNodeTextMap;
2264             function getWeakTypeTextMap() {
2265                 if (weakTypeTextMap === undefined) {
2266                     if (typeof WeakMap === "function")
2267                         weakTypeTextMap = new WeakMap();
2268                 }
2269                 return weakTypeTextMap;
2270             }
2271             function getWeakNodeTextMap() {
2272                 if (weakNodeTextMap === undefined) {
2273                     if (typeof WeakMap === "function")
2274                         weakNodeTextMap = new WeakMap();
2275                 }
2276                 return weakNodeTextMap;
2277             }
2278             Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
2279                 __tsDebuggerDisplay: {
2280                     value: function () {
2281                         var symbolHeader = this.flags & 33554432 ? "TransientSymbol" :
2282                             "Symbol";
2283                         var remainingSymbolFlags = this.flags & ~33554432;
2284                         return "".concat(symbolHeader, " '").concat(ts.symbolName(this), "'").concat(remainingSymbolFlags ? " (".concat(formatSymbolFlags(remainingSymbolFlags), ")") : "");
2285                     }
2286                 },
2287                 __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
2288             });
2289             Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
2290                 __tsDebuggerDisplay: {
2291                     value: function () {
2292                         var typeHeader = this.flags & 98304 ? "NullableType" :
2293                             this.flags & 384 ? "LiteralType ".concat(JSON.stringify(this.value)) :
2294                                 this.flags & 2048 ? "LiteralType ".concat(this.value.negative ? "-" : "").concat(this.value.base10Value, "n") :
2295                                     this.flags & 8192 ? "UniqueESSymbolType" :
2296                                         this.flags & 32 ? "EnumType" :
2297                                             this.flags & 67359327 ? "IntrinsicType ".concat(this.intrinsicName) :
2298                                                 this.flags & 1048576 ? "UnionType" :
2299                                                     this.flags & 2097152 ? "IntersectionType" :
2300                                                         this.flags & 4194304 ? "IndexType" :
2301                                                             this.flags & 8388608 ? "IndexedAccessType" :
2302                                                                 this.flags & 16777216 ? "ConditionalType" :
2303                                                                     this.flags & 33554432 ? "SubstitutionType" :
2304                                                                         this.flags & 262144 ? "TypeParameter" :
2305                                                                             this.flags & 524288 ?
2306                                                                                 this.objectFlags & 3 ? "InterfaceType" :
2307                                                                                     this.objectFlags & 4 ? "TypeReference" :
2308                                                                                         this.objectFlags & 8 ? "TupleType" :
2309                                                                                             this.objectFlags & 16 ? "AnonymousType" :
2310                                                                                                 this.objectFlags & 32 ? "MappedType" :
2311                                                                                                     this.objectFlags & 1024 ? "ReverseMappedType" :
2312                                                                                                         this.objectFlags & 256 ? "EvolvingArrayType" :
2313                                                                                                             "ObjectType" :
2314                                                                                 "Type";
2315                         var remainingObjectFlags = this.flags & 524288 ? this.objectFlags & ~1343 : 0;
2316                         return "".concat(typeHeader).concat(this.symbol ? " '".concat(ts.symbolName(this.symbol), "'") : "").concat(remainingObjectFlags ? " (".concat(formatObjectFlags(remainingObjectFlags), ")") : "");
2317                     }
2318                 },
2319                 __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
2320                 __debugObjectFlags: { get: function () { return this.flags & 524288 ? formatObjectFlags(this.objectFlags) : ""; } },
2321                 __debugTypeToString: {
2322                     value: function () {
2323                         var map = getWeakTypeTextMap();
2324                         var text = map === null || map === void 0 ? void 0 : map.get(this);
2325                         if (text === undefined) {
2326                             text = this.checker.typeToString(this);
2327                             map === null || map === void 0 ? void 0 : map.set(this, text);
2328                         }
2329                         return text;
2330                     }
2331                 },
2332             });
2333             Object.defineProperties(ts.objectAllocator.getSignatureConstructor().prototype, {
2334                 __debugFlags: { get: function () { return formatSignatureFlags(this.flags); } },
2335                 __debugSignatureToString: { value: function () { var _a; return (_a = this.checker) === null || _a === void 0 ? void 0 : _a.signatureToString(this); } }
2336             });
2337             var nodeConstructors = [
2338                 ts.objectAllocator.getNodeConstructor(),
2339                 ts.objectAllocator.getIdentifierConstructor(),
2340                 ts.objectAllocator.getTokenConstructor(),
2341                 ts.objectAllocator.getSourceFileConstructor()
2342             ];
2343             for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
2344                 var ctor = nodeConstructors_1[_i];
2345                 if (!ctor.prototype.hasOwnProperty("__debugKind")) {
2346                     Object.defineProperties(ctor.prototype, {
2347                         __tsDebuggerDisplay: {
2348                             value: function () {
2349                                 var nodeHeader = ts.isGeneratedIdentifier(this) ? "GeneratedIdentifier" :
2350                                     ts.isIdentifier(this) ? "Identifier '".concat(ts.idText(this), "'") :
2351                                         ts.isPrivateIdentifier(this) ? "PrivateIdentifier '".concat(ts.idText(this), "'") :
2352                                             ts.isStringLiteral(this) ? "StringLiteral ".concat(JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")) :
2353                                                 ts.isNumericLiteral(this) ? "NumericLiteral ".concat(this.text) :
2354                                                     ts.isBigIntLiteral(this) ? "BigIntLiteral ".concat(this.text, "n") :
2355                                                         ts.isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" :
2356                                                             ts.isParameter(this) ? "ParameterDeclaration" :
2357                                                                 ts.isConstructorDeclaration(this) ? "ConstructorDeclaration" :
2358                                                                     ts.isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" :
2359                                                                         ts.isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" :
2360                                                                             ts.isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" :
2361                                                                                 ts.isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" :
2362                                                                                     ts.isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" :
2363                                                                                         ts.isTypePredicateNode(this) ? "TypePredicateNode" :
2364                                                                                             ts.isTypeReferenceNode(this) ? "TypeReferenceNode" :
2365                                                                                                 ts.isFunctionTypeNode(this) ? "FunctionTypeNode" :
2366                                                                                                     ts.isConstructorTypeNode(this) ? "ConstructorTypeNode" :
2367                                                                                                         ts.isTypeQueryNode(this) ? "TypeQueryNode" :
2368                                                                                                             ts.isTypeLiteralNode(this) ? "TypeLiteralNode" :
2369                                                                                                                 ts.isArrayTypeNode(this) ? "ArrayTypeNode" :
2370                                                                                                                     ts.isTupleTypeNode(this) ? "TupleTypeNode" :
2371                                                                                                                         ts.isOptionalTypeNode(this) ? "OptionalTypeNode" :
2372                                                                                                                             ts.isRestTypeNode(this) ? "RestTypeNode" :
2373                                                                                                                                 ts.isUnionTypeNode(this) ? "UnionTypeNode" :
2374                                                                                                                                     ts.isIntersectionTypeNode(this) ? "IntersectionTypeNode" :
2375                                                                                                                                         ts.isConditionalTypeNode(this) ? "ConditionalTypeNode" :
2376                                                                                                                                             ts.isInferTypeNode(this) ? "InferTypeNode" :
2377                                                                                                                                                 ts.isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" :
2378                                                                                                                                                     ts.isThisTypeNode(this) ? "ThisTypeNode" :
2379                                                                                                                                                         ts.isTypeOperatorNode(this) ? "TypeOperatorNode" :
2380                                                                                                                                                             ts.isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" :
2381                                                                                                                                                                 ts.isMappedTypeNode(this) ? "MappedTypeNode" :
2382                                                                                                                                                                     ts.isLiteralTypeNode(this) ? "LiteralTypeNode" :
2383                                                                                                                                                                         ts.isNamedTupleMember(this) ? "NamedTupleMember" :
2384                                                                                                                                                                             ts.isImportTypeNode(this) ? "ImportTypeNode" :
2385                                                                                                                                                                                 formatSyntaxKind(this.kind);
2386                                 return "".concat(nodeHeader).concat(this.flags ? " (".concat(formatNodeFlags(this.flags), ")") : "");
2387                             }
2388                         },
2389                         __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
2390                         __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
2391                         __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getEffectiveModifierFlagsNoCache(this)); } },
2392                         __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
2393                         __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
2394                         __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
2395                         __debugGetText: {
2396                             value: function (includeTrivia) {
2397                                 if (ts.nodeIsSynthesized(this))
2398                                     return "";
2399                                 var map = getWeakNodeTextMap();
2400                                 var text = map === null || map === void 0 ? void 0 : map.get(this);
2401                                 if (text === undefined) {
2402                                     var parseNode = ts.getParseTreeNode(this);
2403                                     var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
2404                                     text = sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
2405                                     map === null || map === void 0 ? void 0 : map.set(this, text);
2406                                 }
2407                                 return text;
2408                             }
2409                         }
2410                     });
2411                 }
2412             }
2413             try {
2414                 if (ts.sys && ts.sys.require) {
2415                     var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
2416                     var result = ts.sys.require(basePath, "./compiler-debug");
2417                     if (!result.error) {
2418                         result.module.init(ts);
2419                         extendedDebugModule = result.module;
2420                     }
2421                 }
2422             }
2423             catch (_a) {
2424             }
2425             isDebugInfoEnabled = true;
2426         }
2427         Debug.enableDebugInfo = enableDebugInfo;
2428         function formatDeprecationMessage(name, error, errorAfter, since, message) {
2429             var deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: ";
2430             deprecationMessage += "'".concat(name, "' ");
2431             deprecationMessage += since ? "has been deprecated since v".concat(since) : "is deprecated";
2432             deprecationMessage += error ? " and can no longer be used." : errorAfter ? " and will no longer be usable after v".concat(errorAfter, ".") : ".";
2433             deprecationMessage += message ? " ".concat(ts.formatStringFromArgs(message, [name], 0)) : "";
2434             return deprecationMessage;
2435         }
2436         function createErrorDeprecation(name, errorAfter, since, message) {
2437             var deprecationMessage = formatDeprecationMessage(name, true, errorAfter, since, message);
2438             return function () {
2439                 throw new TypeError(deprecationMessage);
2440             };
2441         }
2442         function createWarningDeprecation(name, errorAfter, since, message) {
2443             var hasWrittenDeprecation = false;
2444             return function () {
2445                 if (!hasWrittenDeprecation) {
2446                     log.warn(formatDeprecationMessage(name, false, errorAfter, since, message));
2447                     hasWrittenDeprecation = true;
2448                 }
2449             };
2450         }
2451         function createDeprecation(name, options) {
2452             var _a, _b;
2453             if (options === void 0) { options = {}; }
2454             var version = typeof options.typeScriptVersion === "string" ? new ts.Version(options.typeScriptVersion) : (_a = options.typeScriptVersion) !== null && _a !== void 0 ? _a : getTypeScriptVersion();
2455             var errorAfter = typeof options.errorAfter === "string" ? new ts.Version(options.errorAfter) : options.errorAfter;
2456             var warnAfter = typeof options.warnAfter === "string" ? new ts.Version(options.warnAfter) : options.warnAfter;
2457             var since = typeof options.since === "string" ? new ts.Version(options.since) : (_b = options.since) !== null && _b !== void 0 ? _b : warnAfter;
2458             var error = options.error || errorAfter && version.compareTo(errorAfter) <= 0;
2459             var warn = !warnAfter || version.compareTo(warnAfter) >= 0;
2460             return error ? createErrorDeprecation(name, errorAfter, since, options.message) :
2461                 warn ? createWarningDeprecation(name, errorAfter, since, options.message) :
2462                     ts.noop;
2463         }
2464         function wrapFunction(deprecation, func) {
2465             return function () {
2466                 deprecation();
2467                 return func.apply(this, arguments);
2468             };
2469         }
2470         function deprecate(func, options) {
2471             var deprecation = createDeprecation(getFunctionName(func), options);
2472             return wrapFunction(deprecation, func);
2473         }
2474         Debug.deprecate = deprecate;
2475     })(Debug = ts.Debug || (ts.Debug = {}));
2476 })(ts || (ts = {}));
2477 var ts;
2478 (function (ts) {
2479     var versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
2480     var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
2481     var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
2482     var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
2483     var Version = (function () {
2484         function Version(major, minor, patch, prerelease, build) {
2485             if (minor === void 0) { minor = 0; }
2486             if (patch === void 0) { patch = 0; }
2487             if (prerelease === void 0) { prerelease = ""; }
2488             if (build === void 0) { build = ""; }
2489             if (typeof major === "string") {
2490                 var result = ts.Debug.checkDefined(tryParseComponents(major), "Invalid version");
2491                 (major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build);
2492             }
2493             ts.Debug.assert(major >= 0, "Invalid argument: major");
2494             ts.Debug.assert(minor >= 0, "Invalid argument: minor");
2495             ts.Debug.assert(patch >= 0, "Invalid argument: patch");
2496             ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease");
2497             ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build");
2498             this.major = major;
2499             this.minor = minor;
2500             this.patch = patch;
2501             this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray;
2502             this.build = build ? build.split(".") : ts.emptyArray;
2503         }
2504         Version.tryParse = function (text) {
2505             var result = tryParseComponents(text);
2506             if (!result)
2507                 return undefined;
2508             var major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build;
2509             return new Version(major, minor, patch, prerelease, build);
2510         };
2511         Version.prototype.compareTo = function (other) {
2512             if (this === other)
2513                 return 0;
2514             if (other === undefined)
2515                 return 1;
2516             return ts.compareValues(this.major, other.major)
2517                 || ts.compareValues(this.minor, other.minor)
2518                 || ts.compareValues(this.patch, other.patch)
2519                 || comparePrereleaseIdentifiers(this.prerelease, other.prerelease);
2520         };
2521         Version.prototype.increment = function (field) {
2522             switch (field) {
2523                 case "major": return new Version(this.major + 1, 0, 0);
2524                 case "minor": return new Version(this.major, this.minor + 1, 0);
2525                 case "patch": return new Version(this.major, this.minor, this.patch + 1);
2526                 default: return ts.Debug.assertNever(field);
2527             }
2528         };
2529         Version.prototype.toString = function () {
2530             var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
2531             if (ts.some(this.prerelease))
2532                 result += "-".concat(this.prerelease.join("."));
2533             if (ts.some(this.build))
2534                 result += "+".concat(this.build.join("."));
2535             return result;
2536         };
2537         Version.zero = new Version(0, 0, 0);
2538         return Version;
2539     }());
2540     ts.Version = Version;
2541     function tryParseComponents(text) {
2542         var match = versionRegExp.exec(text);
2543         if (!match)
2544             return undefined;
2545         var major = match[1], _a = match[2], minor = _a === void 0 ? "0" : _a, _b = match[3], patch = _b === void 0 ? "0" : _b, _c = match[4], prerelease = _c === void 0 ? "" : _c, _d = match[5], build = _d === void 0 ? "" : _d;
2546         if (prerelease && !prereleaseRegExp.test(prerelease))
2547             return undefined;
2548         if (build && !buildRegExp.test(build))
2549             return undefined;
2550         return {
2551             major: parseInt(major, 10),
2552             minor: parseInt(minor, 10),
2553             patch: parseInt(patch, 10),
2554             prerelease: prerelease,
2555             build: build
2556         };
2557     }
2558     function comparePrereleaseIdentifiers(left, right) {
2559         if (left === right)
2560             return 0;
2561         if (left.length === 0)
2562             return right.length === 0 ? 0 : 1;
2563         if (right.length === 0)
2564             return -1;
2565         var length = Math.min(left.length, right.length);
2566         for (var i = 0; i < length; i++) {
2567             var leftIdentifier = left[i];
2568             var rightIdentifier = right[i];
2569             if (leftIdentifier === rightIdentifier)
2570                 continue;
2571             var leftIsNumeric = numericIdentifierRegExp.test(leftIdentifier);
2572             var rightIsNumeric = numericIdentifierRegExp.test(rightIdentifier);
2573             if (leftIsNumeric || rightIsNumeric) {
2574                 if (leftIsNumeric !== rightIsNumeric)
2575                     return leftIsNumeric ? -1 : 1;
2576                 var result = ts.compareValues(+leftIdentifier, +rightIdentifier);
2577                 if (result)
2578                     return result;
2579             }
2580             else {
2581                 var result = ts.compareStringsCaseSensitive(leftIdentifier, rightIdentifier);
2582                 if (result)
2583                     return result;
2584             }
2585         }
2586         return ts.compareValues(left.length, right.length);
2587     }
2588     var VersionRange = (function () {
2589         function VersionRange(spec) {
2590             this._alternatives = spec ? ts.Debug.checkDefined(parseRange(spec), "Invalid range spec.") : ts.emptyArray;
2591         }
2592         VersionRange.tryParse = function (text) {
2593             var sets = parseRange(text);
2594             if (sets) {
2595                 var range = new VersionRange("");
2596                 range._alternatives = sets;
2597                 return range;
2598             }
2599             return undefined;
2600         };
2601         VersionRange.prototype.test = function (version) {
2602             if (typeof version === "string")
2603                 version = new Version(version);
2604             return testDisjunction(version, this._alternatives);
2605         };
2606         VersionRange.prototype.toString = function () {
2607             return formatDisjunction(this._alternatives);
2608         };
2609         return VersionRange;
2610     }());
2611     ts.VersionRange = VersionRange;
2612     var logicalOrRegExp = /\|\|/g;
2613     var whitespaceRegExp = /\s+/g;
2614     var partialRegExp = /^([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
2615     var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
2616     var rangeRegExp = /^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i;
2617     function parseRange(text) {
2618         var alternatives = [];
2619         for (var _i = 0, _a = ts.trimString(text).split(logicalOrRegExp); _i < _a.length; _i++) {
2620             var range = _a[_i];
2621             if (!range)
2622                 continue;
2623             var comparators = [];
2624             range = ts.trimString(range);
2625             var match = hyphenRegExp.exec(range);
2626             if (match) {
2627                 if (!parseHyphen(match[1], match[2], comparators))
2628                     return undefined;
2629             }
2630             else {
2631                 for (var _b = 0, _c = range.split(whitespaceRegExp); _b < _c.length; _b++) {
2632                     var simple = _c[_b];
2633                     var match_1 = rangeRegExp.exec(ts.trimString(simple));
2634                     if (!match_1 || !parseComparator(match_1[1], match_1[2], comparators))
2635                         return undefined;
2636                 }
2637             }
2638             alternatives.push(comparators);
2639         }
2640         return alternatives;
2641     }
2642     function parsePartial(text) {
2643         var match = partialRegExp.exec(text);
2644         if (!match)
2645             return undefined;
2646         var major = match[1], _a = match[2], minor = _a === void 0 ? "*" : _a, _b = match[3], patch = _b === void 0 ? "*" : _b, prerelease = match[4], build = match[5];
2647         var version = new Version(isWildcard(major) ? 0 : parseInt(major, 10), isWildcard(major) || isWildcard(minor) ? 0 : parseInt(minor, 10), isWildcard(major) || isWildcard(minor) || isWildcard(patch) ? 0 : parseInt(patch, 10), prerelease, build);
2648         return { version: version, major: major, minor: minor, patch: patch };
2649     }
2650     function parseHyphen(left, right, comparators) {
2651         var leftResult = parsePartial(left);
2652         if (!leftResult)
2653             return false;
2654         var rightResult = parsePartial(right);
2655         if (!rightResult)
2656             return false;
2657         if (!isWildcard(leftResult.major)) {
2658             comparators.push(createComparator(">=", leftResult.version));
2659         }
2660         if (!isWildcard(rightResult.major)) {
2661             comparators.push(isWildcard(rightResult.minor) ? createComparator("<", rightResult.version.increment("major")) :
2662                 isWildcard(rightResult.patch) ? createComparator("<", rightResult.version.increment("minor")) :
2663                     createComparator("<=", rightResult.version));
2664         }
2665         return true;
2666     }
2667     function parseComparator(operator, text, comparators) {
2668         var result = parsePartial(text);
2669         if (!result)
2670             return false;
2671         var version = result.version, major = result.major, minor = result.minor, patch = result.patch;
2672         if (!isWildcard(major)) {
2673             switch (operator) {
2674                 case "~":
2675                     comparators.push(createComparator(">=", version));
2676                     comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" :
2677                         "minor")));
2678                     break;
2679                 case "^":
2680                     comparators.push(createComparator(">=", version));
2681                     comparators.push(createComparator("<", version.increment(version.major > 0 || isWildcard(minor) ? "major" :
2682                         version.minor > 0 || isWildcard(patch) ? "minor" :
2683                             "patch")));
2684                     break;
2685                 case "<":
2686                 case ">=":
2687                     comparators.push(createComparator(operator, version));
2688                     break;
2689                 case "<=":
2690                 case ">":
2691                     comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) :
2692                         isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) :
2693                             createComparator(operator, version));
2694                     break;
2695                 case "=":
2696                 case undefined:
2697                     if (isWildcard(minor) || isWildcard(patch)) {
2698                         comparators.push(createComparator(">=", version));
2699                         comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor")));
2700                     }
2701                     else {
2702                         comparators.push(createComparator("=", version));
2703                     }
2704                     break;
2705                 default:
2706                     return false;
2707             }
2708         }
2709         else if (operator === "<" || operator === ">") {
2710             comparators.push(createComparator("<", Version.zero));
2711         }
2712         return true;
2713     }
2714     function isWildcard(part) {
2715         return part === "*" || part === "x" || part === "X";
2716     }
2717     function createComparator(operator, operand) {
2718         return { operator: operator, operand: operand };
2719     }
2720     function testDisjunction(version, alternatives) {
2721         if (alternatives.length === 0)
2722             return true;
2723         for (var _i = 0, alternatives_1 = alternatives; _i < alternatives_1.length; _i++) {
2724             var alternative = alternatives_1[_i];
2725             if (testAlternative(version, alternative))
2726                 return true;
2727         }
2728         return false;
2729     }
2730     function testAlternative(version, comparators) {
2731         for (var _i = 0, comparators_1 = comparators; _i < comparators_1.length; _i++) {
2732             var comparator = comparators_1[_i];
2733             if (!testComparator(version, comparator.operator, comparator.operand))
2734                 return false;
2735         }
2736         return true;
2737     }
2738     function testComparator(version, operator, operand) {
2739         var cmp = version.compareTo(operand);
2740         switch (operator) {
2741             case "<": return cmp < 0;
2742             case "<=": return cmp <= 0;
2743             case ">": return cmp > 0;
2744             case ">=": return cmp >= 0;
2745             case "=": return cmp === 0;
2746             default: return ts.Debug.assertNever(operator);
2747         }
2748     }
2749     function formatDisjunction(alternatives) {
2750         return ts.map(alternatives, formatAlternative).join(" || ") || "*";
2751     }
2752     function formatAlternative(comparators) {
2753         return ts.map(comparators, formatComparator).join(" ");
2754     }
2755     function formatComparator(comparator) {
2756         return "".concat(comparator.operator).concat(comparator.operand);
2757     }
2758 })(ts || (ts = {}));
2759 var ts;
2760 (function (ts) {
2761     function hasRequiredAPI(performance, PerformanceObserver) {
2762         return typeof performance === "object" &&
2763             typeof performance.timeOrigin === "number" &&
2764             typeof performance.mark === "function" &&
2765             typeof performance.measure === "function" &&
2766             typeof performance.now === "function" &&
2767             typeof PerformanceObserver === "function";
2768     }
2769     function tryGetWebPerformanceHooks() {
2770         if (typeof performance === "object" &&
2771             typeof PerformanceObserver === "function" &&
2772             hasRequiredAPI(performance, PerformanceObserver)) {
2773             return {
2774                 shouldWriteNativeEvents: true,
2775                 performance: performance,
2776                 PerformanceObserver: PerformanceObserver
2777             };
2778         }
2779     }
2780     function tryGetNodePerformanceHooks() {
2781         if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof require === "function") {
2782             try {
2783                 var performance_1;
2784                 var _a = require("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;
2785                 if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) {
2786                     performance_1 = nodePerformance_1;
2787                     var version_1 = new ts.Version(process.versions.node);
2788                     var range = new ts.VersionRange("<12.16.3 || 13 <13.13");
2789                     if (range.test(version_1)) {
2790                         performance_1 = {
2791                             get timeOrigin() { return nodePerformance_1.timeOrigin; },
2792                             now: function () { return nodePerformance_1.now(); },
2793                             mark: function (name) { return nodePerformance_1.mark(name); },
2794                             measure: function (name, start, end) {
2795                                 if (start === void 0) { start = "nodeStart"; }
2796                                 if (end === undefined) {
2797                                     end = "__performance.measure-fix__";
2798                                     nodePerformance_1.mark(end);
2799                                 }
2800                                 nodePerformance_1.measure(name, start, end);
2801                                 if (end === "__performance.measure-fix__") {
2802                                     nodePerformance_1.clearMarks("__performance.measure-fix__");
2803                                 }
2804                             }
2805                         };
2806                     }
2807                     return {
2808                         shouldWriteNativeEvents: false,
2809                         performance: performance_1,
2810                         PerformanceObserver: PerformanceObserver_1
2811                     };
2812                 }
2813             }
2814             catch (_b) {
2815             }
2816         }
2817     }
2818     var nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks();
2819     var nativePerformance = nativePerformanceHooks === null || nativePerformanceHooks === void 0 ? void 0 : nativePerformanceHooks.performance;
2820     function tryGetNativePerformanceHooks() {
2821         return nativePerformanceHooks;
2822     }
2823     ts.tryGetNativePerformanceHooks = tryGetNativePerformanceHooks;
2824     ts.timestamp = nativePerformance ? function () { return nativePerformance.now(); } :
2825         Date.now ? Date.now :
2826             function () { return +(new Date()); };
2827 })(ts || (ts = {}));
2828 var ts;
2829 (function (ts) {
2830     var performance;
2831     (function (performance) {
2832         var perfHooks;
2833         var performanceImpl;
2834         function createTimerIf(condition, measureName, startMarkName, endMarkName) {
2835             return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
2836         }
2837         performance.createTimerIf = createTimerIf;
2838         function createTimer(measureName, startMarkName, endMarkName) {
2839             var enterCount = 0;
2840             return {
2841                 enter: enter,
2842                 exit: exit
2843             };
2844             function enter() {
2845                 if (++enterCount === 1) {
2846                     mark(startMarkName);
2847                 }
2848             }
2849             function exit() {
2850                 if (--enterCount === 0) {
2851                     mark(endMarkName);
2852                     measure(measureName, startMarkName, endMarkName);
2853                 }
2854                 else if (enterCount < 0) {
2855                     ts.Debug.fail("enter/exit count does not match.");
2856                 }
2857             }
2858         }
2859         performance.createTimer = createTimer;
2860         performance.nullTimer = { enter: ts.noop, exit: ts.noop };
2861         var enabled = false;
2862         var timeorigin = ts.timestamp();
2863         var marks = new ts.Map();
2864         var counts = new ts.Map();
2865         var durations = new ts.Map();
2866         function mark(markName) {
2867             var _a;
2868             if (enabled) {
2869                 var count = (_a = counts.get(markName)) !== null && _a !== void 0 ? _a : 0;
2870                 counts.set(markName, count + 1);
2871                 marks.set(markName, ts.timestamp());
2872                 performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
2873             }
2874         }
2875         performance.mark = mark;
2876         function measure(measureName, startMarkName, endMarkName) {
2877             var _a, _b;
2878             if (enabled) {
2879                 var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
2880                 var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
2881                 var previousDuration = durations.get(measureName) || 0;
2882                 durations.set(measureName, previousDuration + (end - start));
2883                 performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
2884             }
2885         }
2886         performance.measure = measure;
2887         function getCount(markName) {
2888             return counts.get(markName) || 0;
2889         }
2890         performance.getCount = getCount;
2891         function getDuration(measureName) {
2892             return durations.get(measureName) || 0;
2893         }
2894         performance.getDuration = getDuration;
2895         function forEachMeasure(cb) {
2896             durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
2897         }
2898         performance.forEachMeasure = forEachMeasure;
2899         function isEnabled() {
2900             return enabled;
2901         }
2902         performance.isEnabled = isEnabled;
2903         function enable(system) {
2904             var _a;
2905             if (system === void 0) { system = ts.sys; }
2906             if (!enabled) {
2907                 enabled = true;
2908                 perfHooks || (perfHooks = ts.tryGetNativePerformanceHooks());
2909                 if (perfHooks) {
2910                     timeorigin = perfHooks.performance.timeOrigin;
2911                     if (perfHooks.shouldWriteNativeEvents || ((_a = system === null || system === void 0 ? void 0 : system.cpuProfilingEnabled) === null || _a === void 0 ? void 0 : _a.call(system)) || (system === null || system === void 0 ? void 0 : system.debugMode)) {
2912                         performanceImpl = perfHooks.performance;
2913                     }
2914                 }
2915             }
2916             return true;
2917         }
2918         performance.enable = enable;
2919         function disable() {
2920             if (enabled) {
2921                 marks.clear();
2922                 counts.clear();
2923                 durations.clear();
2924                 performanceImpl = undefined;
2925                 enabled = false;
2926             }
2927         }
2928         performance.disable = disable;
2929     })(performance = ts.performance || (ts.performance = {}));
2930 })(ts || (ts = {}));
2931 var ts;
2932 (function (ts) {
2933     var _a;
2934     var nullLogger = {
2935         logEvent: ts.noop,
2936         logErrEvent: ts.noop,
2937         logPerfEvent: ts.noop,
2938         logInfoEvent: ts.noop,
2939         logStartCommand: ts.noop,
2940         logStopCommand: ts.noop,
2941         logStartUpdateProgram: ts.noop,
2942         logStopUpdateProgram: ts.noop,
2943         logStartUpdateGraph: ts.noop,
2944         logStopUpdateGraph: ts.noop,
2945         logStartResolveModule: ts.noop,
2946         logStopResolveModule: ts.noop,
2947         logStartParseSourceFile: ts.noop,
2948         logStopParseSourceFile: ts.noop,
2949         logStartReadFile: ts.noop,
2950         logStopReadFile: ts.noop,
2951         logStartBindFile: ts.noop,
2952         logStopBindFile: ts.noop,
2953         logStartScheduledOperation: ts.noop,
2954         logStopScheduledOperation: ts.noop,
2955     };
2956     var etwModule;
2957     try {
2958         var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw";
2959         etwModule = require(etwModulePath);
2960     }
2961     catch (e) {
2962         etwModule = undefined;
2963     }
2964     ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
2965 })(ts || (ts = {}));
2966 var ts;
2967 (function (ts) {
2968     var tracingEnabled;
2969     (function (tracingEnabled) {
2970         var fs;
2971         var traceCount = 0;
2972         var traceFd = 0;
2973         var mode;
2974         var typeCatalog = [];
2975         var legendPath;
2976         var legend = [];
2977         ;
2978         function startTracing(tracingMode, traceDir, configFilePath) {
2979             ts.Debug.assert(!ts.tracing, "Tracing already started");
2980             if (fs === undefined) {
2981                 try {
2982                     fs = require("fs");
2983                 }
2984                 catch (e) {
2985                     throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")"));
2986                 }
2987             }
2988             mode = tracingMode;
2989             typeCatalog.length = 0;
2990             if (legendPath === undefined) {
2991                 legendPath = ts.combinePaths(traceDir, "legend.json");
2992             }
2993             if (!fs.existsSync(traceDir)) {
2994                 fs.mkdirSync(traceDir, { recursive: true });
2995             }
2996             var countPart = mode === "build" ? ".".concat(process.pid, "-").concat(++traceCount)
2997                 : mode === "server" ? ".".concat(process.pid)
2998                     : "";
2999             var tracePath = ts.combinePaths(traceDir, "trace".concat(countPart, ".json"));
3000             var typesPath = ts.combinePaths(traceDir, "types".concat(countPart, ".json"));
3001             legend.push({
3002                 configFilePath: configFilePath,
3003                 tracePath: tracePath,
3004                 typesPath: typesPath,
3005             });
3006             traceFd = fs.openSync(tracePath, "w");
3007             ts.tracing = tracingEnabled;
3008             var meta = { cat: "__metadata", ph: "M", ts: 1000 * ts.timestamp(), pid: 1, tid: 1 };
3009             fs.writeSync(traceFd, "[\n"
3010                 + [__assign({ name: "process_name", args: { name: "tsc" } }, meta), __assign({ name: "thread_name", args: { name: "Main" } }, meta), __assign(__assign({ name: "TracingStartedInBrowser" }, meta), { cat: "disabled-by-default-devtools.timeline" })]
3011                     .map(function (v) { return JSON.stringify(v); }).join(",\n"));
3012         }
3013         tracingEnabled.startTracing = startTracing;
3014         function stopTracing() {
3015             ts.Debug.assert(ts.tracing, "Tracing is not in progress");
3016             ts.Debug.assert(!!typeCatalog.length === (mode !== "server"));
3017             fs.writeSync(traceFd, "\n]\n");
3018             fs.closeSync(traceFd);
3019             ts.tracing = undefined;
3020             if (typeCatalog.length) {
3021                 dumpTypes(typeCatalog);
3022             }
3023             else {
3024                 legend[legend.length - 1].typesPath = undefined;
3025             }
3026         }
3027         tracingEnabled.stopTracing = stopTracing;
3028         function recordType(type) {
3029             if (mode !== "server") {
3030                 typeCatalog.push(type);
3031             }
3032         }
3033         tracingEnabled.recordType = recordType;
3034         function instant(phase, name, args) {
3035             writeEvent("I", phase, name, args, "\"s\":\"g\"");
3036         }
3037         tracingEnabled.instant = instant;
3038         var eventStack = [];
3039         function push(phase, name, args, separateBeginAndEnd) {
3040             if (separateBeginAndEnd === void 0) { separateBeginAndEnd = false; }
3041             if (separateBeginAndEnd) {
3042                 writeEvent("B", phase, name, args);
3043             }
3044             eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
3045         }
3046         tracingEnabled.push = push;
3047         function pop() {
3048             ts.Debug.assert(eventStack.length > 0);
3049             writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
3050             eventStack.length--;
3051         }
3052         tracingEnabled.pop = pop;
3053         function popAll() {
3054             var endTime = 1000 * ts.timestamp();
3055             for (var i = eventStack.length - 1; i >= 0; i--) {
3056                 writeStackEvent(i, endTime);
3057             }
3058             eventStack.length = 0;
3059         }
3060         tracingEnabled.popAll = popAll;
3061         var sampleInterval = 1000 * 10;
3062         function writeStackEvent(index, endTime) {
3063             var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
3064             if (separateBeginAndEnd) {
3065                 writeEvent("E", phase, name, args, undefined, endTime);
3066             }
3067             else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
3068                 writeEvent("X", phase, name, args, "\"dur\":".concat(endTime - time), time);
3069             }
3070         }
3071         function writeEvent(eventType, phase, name, args, extras, time) {
3072             if (time === void 0) { time = 1000 * ts.timestamp(); }
3073             if (mode === "server" && phase === "checkTypes")
3074                 return;
3075             ts.performance.mark("beginTracing");
3076             fs.writeSync(traceFd, ",\n{\"pid\":1,\"tid\":1,\"ph\":\"".concat(eventType, "\",\"cat\":\"").concat(phase, "\",\"ts\":").concat(time, ",\"name\":\"").concat(name, "\""));
3077             if (extras)
3078                 fs.writeSync(traceFd, ",".concat(extras));
3079             if (args)
3080                 fs.writeSync(traceFd, ",\"args\":".concat(JSON.stringify(args)));
3081             fs.writeSync(traceFd, "}");
3082             ts.performance.mark("endTracing");
3083             ts.performance.measure("Tracing", "beginTracing", "endTracing");
3084         }
3085         function getLocation(node) {
3086             var file = ts.getSourceFileOfNode(node);
3087             return !file
3088                 ? undefined
3089                 : {
3090                     path: file.path,
3091                     start: indexFromOne(ts.getLineAndCharacterOfPosition(file, node.pos)),
3092                     end: indexFromOne(ts.getLineAndCharacterOfPosition(file, node.end)),
3093                 };
3094             function indexFromOne(lc) {
3095                 return {
3096                     line: lc.line + 1,
3097                     character: lc.character + 1,
3098                 };
3099             }
3100         }
3101         function dumpTypes(types) {
3102             var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
3103             ts.performance.mark("beginDumpTypes");
3104             var typesPath = legend[legend.length - 1].typesPath;
3105             var typesFd = fs.openSync(typesPath, "w");
3106             var recursionIdentityMap = new ts.Map();
3107             fs.writeSync(typesFd, "[");
3108             var numTypes = types.length;
3109             for (var i = 0; i < numTypes; i++) {
3110                 var type = types[i];
3111                 var objectFlags = type.objectFlags;
3112                 var symbol = (_a = type.aliasSymbol) !== null && _a !== void 0 ? _a : type.symbol;
3113                 var display = void 0;
3114                 if ((objectFlags & 16) | (type.flags & 2944)) {
3115                     try {
3116                         display = (_b = type.checker) === null || _b === void 0 ? void 0 : _b.typeToString(type);
3117                     }
3118                     catch (_y) {
3119                         display = undefined;
3120                     }
3121                 }
3122                 var indexedAccessProperties = {};
3123                 if (type.flags & 8388608) {
3124                     var indexedAccessType = type;
3125                     indexedAccessProperties = {
3126                         indexedAccessObjectType: (_c = indexedAccessType.objectType) === null || _c === void 0 ? void 0 : _c.id,
3127                         indexedAccessIndexType: (_d = indexedAccessType.indexType) === null || _d === void 0 ? void 0 : _d.id,
3128                     };
3129                 }
3130                 var referenceProperties = {};
3131                 if (objectFlags & 4) {
3132                     var referenceType = type;
3133                     referenceProperties = {
3134                         instantiatedType: (_e = referenceType.target) === null || _e === void 0 ? void 0 : _e.id,
3135                         typeArguments: (_f = referenceType.resolvedTypeArguments) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.id; }),
3136                         referenceLocation: getLocation(referenceType.node),
3137                     };
3138                 }
3139                 var conditionalProperties = {};
3140                 if (type.flags & 16777216) {
3141                     var conditionalType = type;
3142                     conditionalProperties = {
3143                         conditionalCheckType: (_g = conditionalType.checkType) === null || _g === void 0 ? void 0 : _g.id,
3144                         conditionalExtendsType: (_h = conditionalType.extendsType) === null || _h === void 0 ? void 0 : _h.id,
3145                         conditionalTrueType: (_k = (_j = conditionalType.resolvedTrueType) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : -1,
3146                         conditionalFalseType: (_m = (_l = conditionalType.resolvedFalseType) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : -1,
3147                     };
3148                 }
3149                 var substitutionProperties = {};
3150                 if (type.flags & 33554432) {
3151                     var substitutionType = type;
3152                     substitutionProperties = {
3153                         substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id,
3154                         substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id,
3155                     };
3156                 }
3157                 var reverseMappedProperties = {};
3158                 if (objectFlags & 1024) {
3159                     var reverseMappedType = type;
3160                     reverseMappedProperties = {
3161                         reverseMappedSourceType: (_q = reverseMappedType.source) === null || _q === void 0 ? void 0 : _q.id,
3162                         reverseMappedMappedType: (_r = reverseMappedType.mappedType) === null || _r === void 0 ? void 0 : _r.id,
3163                         reverseMappedConstraintType: (_s = reverseMappedType.constraintType) === null || _s === void 0 ? void 0 : _s.id,
3164                     };
3165                 }
3166                 var evolvingArrayProperties = {};
3167                 if (objectFlags & 256) {
3168                     var evolvingArrayType = type;
3169                     evolvingArrayProperties = {
3170                         evolvingArrayElementType: evolvingArrayType.elementType.id,
3171                         evolvingArrayFinalType: (_t = evolvingArrayType.finalArrayType) === null || _t === void 0 ? void 0 : _t.id,
3172                     };
3173                 }
3174                 var recursionToken = void 0;
3175                 var recursionIdentity = type.checker.getRecursionIdentity(type);
3176                 if (recursionIdentity) {
3177                     recursionToken = recursionIdentityMap.get(recursionIdentity);
3178                     if (!recursionToken) {
3179                         recursionToken = recursionIdentityMap.size;
3180                         recursionIdentityMap.set(recursionIdentity, recursionToken);
3181                     }
3182                 }
3183                 var descriptor = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: type.id, intrinsicName: type.intrinsicName, symbolName: (symbol === null || symbol === void 0 ? void 0 : symbol.escapedName) && ts.unescapeLeadingUnderscores(symbol.escapedName), recursionId: recursionToken, isTuple: objectFlags & 8 ? true : undefined, unionTypes: (type.flags & 1048576) ? (_u = type.types) === null || _u === void 0 ? void 0 : _u.map(function (t) { return t.id; }) : undefined, intersectionTypes: (type.flags & 2097152) ? type.types.map(function (t) { return t.id; }) : undefined, aliasTypeArguments: (_v = type.aliasTypeArguments) === null || _v === void 0 ? void 0 : _v.map(function (t) { return t.id; }), keyofType: (type.flags & 4194304) ? (_w = type.type) === null || _w === void 0 ? void 0 : _w.id : undefined }, indexedAccessProperties), referenceProperties), conditionalProperties), substitutionProperties), reverseMappedProperties), evolvingArrayProperties), { destructuringPattern: getLocation(type.pattern), firstDeclaration: getLocation((_x = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _x === void 0 ? void 0 : _x[0]), flags: ts.Debug.formatTypeFlags(type.flags).split("|"), display: display });
3184                 fs.writeSync(typesFd, JSON.stringify(descriptor));
3185                 if (i < numTypes - 1) {
3186                     fs.writeSync(typesFd, ",\n");
3187                 }
3188             }
3189             fs.writeSync(typesFd, "]\n");
3190             fs.closeSync(typesFd);
3191             ts.performance.mark("endDumpTypes");
3192             ts.performance.measure("Dump types", "beginDumpTypes", "endDumpTypes");
3193         }
3194         function dumpLegend() {
3195             if (!legendPath) {
3196                 return;
3197             }
3198             fs.writeFileSync(legendPath, JSON.stringify(legend));
3199         }
3200         tracingEnabled.dumpLegend = dumpLegend;
3201     })(tracingEnabled || (tracingEnabled = {}));
3202     ts.startTracing = tracingEnabled.startTracing;
3203     ts.dumpTracingLegend = tracingEnabled.dumpLegend;
3204 })(ts || (ts = {}));
3205 var ts;
3206 (function (ts) {
3207     var OperationCanceledException = (function () {
3208         function OperationCanceledException() {
3209         }
3210         return OperationCanceledException;
3211     }());
3212     ts.OperationCanceledException = OperationCanceledException;
3213     var FileIncludeKind;
3214     (function (FileIncludeKind) {
3215         FileIncludeKind[FileIncludeKind["RootFile"] = 0] = "RootFile";
3216         FileIncludeKind[FileIncludeKind["SourceFromProjectReference"] = 1] = "SourceFromProjectReference";
3217         FileIncludeKind[FileIncludeKind["OutputFromProjectReference"] = 2] = "OutputFromProjectReference";
3218         FileIncludeKind[FileIncludeKind["Import"] = 3] = "Import";
3219         FileIncludeKind[FileIncludeKind["ReferenceFile"] = 4] = "ReferenceFile";
3220         FileIncludeKind[FileIncludeKind["TypeReferenceDirective"] = 5] = "TypeReferenceDirective";
3221         FileIncludeKind[FileIncludeKind["LibFile"] = 6] = "LibFile";
3222         FileIncludeKind[FileIncludeKind["LibReferenceDirective"] = 7] = "LibReferenceDirective";
3223         FileIncludeKind[FileIncludeKind["AutomaticTypeDirectiveFile"] = 8] = "AutomaticTypeDirectiveFile";
3224     })(FileIncludeKind = ts.FileIncludeKind || (ts.FileIncludeKind = {}));
3225     var ExitStatus;
3226     (function (ExitStatus) {
3227         ExitStatus[ExitStatus["Success"] = 0] = "Success";
3228         ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped";
3229         ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
3230         ExitStatus[ExitStatus["InvalidProject_OutputsSkipped"] = 3] = "InvalidProject_OutputsSkipped";
3231         ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkipped"] = 4] = "ProjectReferenceCycle_OutputsSkipped";
3232         ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
3233     })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
3234     var TypeReferenceSerializationKind;
3235     (function (TypeReferenceSerializationKind) {
3236         TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
3237         TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
3238         TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidNullableOrNeverType"] = 2] = "VoidNullableOrNeverType";
3239         TypeReferenceSerializationKind[TypeReferenceSerializationKind["NumberLikeType"] = 3] = "NumberLikeType";
3240         TypeReferenceSerializationKind[TypeReferenceSerializationKind["BigIntLikeType"] = 4] = "BigIntLikeType";
3241         TypeReferenceSerializationKind[TypeReferenceSerializationKind["StringLikeType"] = 5] = "StringLikeType";
3242         TypeReferenceSerializationKind[TypeReferenceSerializationKind["BooleanType"] = 6] = "BooleanType";
3243         TypeReferenceSerializationKind[TypeReferenceSerializationKind["ArrayLikeType"] = 7] = "ArrayLikeType";
3244         TypeReferenceSerializationKind[TypeReferenceSerializationKind["ESSymbolType"] = 8] = "ESSymbolType";
3245         TypeReferenceSerializationKind[TypeReferenceSerializationKind["Promise"] = 9] = "Promise";
3246         TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 10] = "TypeWithCallSignature";
3247         TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 11] = "ObjectType";
3248     })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
3249     var DiagnosticCategory;
3250     (function (DiagnosticCategory) {
3251         DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
3252         DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
3253         DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
3254         DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
3255     })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
3256     function diagnosticCategoryName(d, lowerCase) {
3257         if (lowerCase === void 0) { lowerCase = true; }
3258         var name = DiagnosticCategory[d.category];
3259         return lowerCase ? name.toLowerCase() : name;
3260     }
3261     ts.diagnosticCategoryName = diagnosticCategoryName;
3262     var ModuleResolutionKind;
3263     (function (ModuleResolutionKind) {
3264         ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
3265         ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
3266         ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
3267         ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
3268     })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
3269     var WatchFileKind;
3270     (function (WatchFileKind) {
3271         WatchFileKind[WatchFileKind["FixedPollingInterval"] = 0] = "FixedPollingInterval";
3272         WatchFileKind[WatchFileKind["PriorityPollingInterval"] = 1] = "PriorityPollingInterval";
3273         WatchFileKind[WatchFileKind["DynamicPriorityPolling"] = 2] = "DynamicPriorityPolling";
3274         WatchFileKind[WatchFileKind["FixedChunkSizePolling"] = 3] = "FixedChunkSizePolling";
3275         WatchFileKind[WatchFileKind["UseFsEvents"] = 4] = "UseFsEvents";
3276         WatchFileKind[WatchFileKind["UseFsEventsOnParentDirectory"] = 5] = "UseFsEventsOnParentDirectory";
3277     })(WatchFileKind = ts.WatchFileKind || (ts.WatchFileKind = {}));
3278     var WatchDirectoryKind;
3279     (function (WatchDirectoryKind) {
3280         WatchDirectoryKind[WatchDirectoryKind["UseFsEvents"] = 0] = "UseFsEvents";
3281         WatchDirectoryKind[WatchDirectoryKind["FixedPollingInterval"] = 1] = "FixedPollingInterval";
3282         WatchDirectoryKind[WatchDirectoryKind["DynamicPriorityPolling"] = 2] = "DynamicPriorityPolling";
3283         WatchDirectoryKind[WatchDirectoryKind["FixedChunkSizePolling"] = 3] = "FixedChunkSizePolling";
3284     })(WatchDirectoryKind = ts.WatchDirectoryKind || (ts.WatchDirectoryKind = {}));
3285     var PollingWatchKind;
3286     (function (PollingWatchKind) {
3287         PollingWatchKind[PollingWatchKind["FixedInterval"] = 0] = "FixedInterval";
3288         PollingWatchKind[PollingWatchKind["PriorityInterval"] = 1] = "PriorityInterval";
3289         PollingWatchKind[PollingWatchKind["DynamicPriority"] = 2] = "DynamicPriority";
3290         PollingWatchKind[PollingWatchKind["FixedChunkSize"] = 3] = "FixedChunkSize";
3291     })(PollingWatchKind = ts.PollingWatchKind || (ts.PollingWatchKind = {}));
3292     var ModuleKind;
3293     (function (ModuleKind) {
3294         ModuleKind[ModuleKind["None"] = 0] = "None";
3295         ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS";
3296         ModuleKind[ModuleKind["AMD"] = 2] = "AMD";
3297         ModuleKind[ModuleKind["UMD"] = 3] = "UMD";
3298         ModuleKind[ModuleKind["System"] = 4] = "System";
3299         ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
3300         ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
3301         ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
3302         ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
3303         ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
3304         ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
3305     })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
3306     ts.commentPragmas = {
3307         "reference": {
3308             args: [
3309                 { name: "types", optional: true, captureSpan: true },
3310                 { name: "lib", optional: true, captureSpan: true },
3311                 { name: "path", optional: true, captureSpan: true },
3312                 { name: "no-default-lib", optional: true }
3313             ],
3314             kind: 1
3315         },
3316         "amd-dependency": {
3317             args: [{ name: "path" }, { name: "name", optional: true }],
3318             kind: 1
3319         },
3320         "amd-module": {
3321             args: [{ name: "name" }],
3322             kind: 1
3323         },
3324         "ts-check": {
3325             kind: 2
3326         },
3327         "ts-nocheck": {
3328             kind: 2
3329         },
3330         "jsx": {
3331             args: [{ name: "factory" }],
3332             kind: 4
3333         },
3334         "jsxfrag": {
3335             args: [{ name: "factory" }],
3336             kind: 4
3337         },
3338         "jsximportsource": {
3339             args: [{ name: "factory" }],
3340             kind: 4
3341         },
3342         "jsxruntime": {
3343             args: [{ name: "factory" }],
3344             kind: 4
3345         },
3346     };
3347 })(ts || (ts = {}));
3348 var ts;
3349 (function (ts) {
3350     ts.directorySeparator = "/";
3351     ts.altDirectorySeparator = "\\";
3352     var urlSchemeSeparator = "://";
3353     var backslashRegExp = /\\/g;
3354     function isAnyDirectorySeparator(charCode) {
3355         return charCode === 47 || charCode === 92;
3356     }
3357     ts.isAnyDirectorySeparator = isAnyDirectorySeparator;
3358     function isUrl(path) {
3359         return getEncodedRootLength(path) < 0;
3360     }
3361     ts.isUrl = isUrl;
3362     function isRootedDiskPath(path) {
3363         return getEncodedRootLength(path) > 0;
3364     }
3365     ts.isRootedDiskPath = isRootedDiskPath;
3366     function isDiskPathRoot(path) {
3367         var rootLength = getEncodedRootLength(path);
3368         return rootLength > 0 && rootLength === path.length;
3369     }
3370     ts.isDiskPathRoot = isDiskPathRoot;
3371     function pathIsAbsolute(path) {
3372         return getEncodedRootLength(path) !== 0;
3373     }
3374     ts.pathIsAbsolute = pathIsAbsolute;
3375     function pathIsRelative(path) {
3376         return /^\.\.?($|[\\/])/.test(path);
3377     }
3378     ts.pathIsRelative = pathIsRelative;
3379     function pathIsBareSpecifier(path) {
3380         return !pathIsAbsolute(path) && !pathIsRelative(path);
3381     }
3382     ts.pathIsBareSpecifier = pathIsBareSpecifier;
3383     function hasExtension(fileName) {
3384         return ts.stringContains(getBaseFileName(fileName), ".");
3385     }
3386     ts.hasExtension = hasExtension;
3387     function fileExtensionIs(path, extension) {
3388         return path.length > extension.length && ts.endsWith(path, extension);
3389     }
3390     ts.fileExtensionIs = fileExtensionIs;
3391     function fileExtensionIsOneOf(path, extensions) {
3392         for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {
3393             var extension = extensions_1[_i];
3394             if (fileExtensionIs(path, extension)) {
3395                 return true;
3396             }
3397         }
3398         return false;
3399     }
3400     ts.fileExtensionIsOneOf = fileExtensionIsOneOf;
3401     function hasTrailingDirectorySeparator(path) {
3402         return path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1));
3403     }
3404     ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator;
3405     function isVolumeCharacter(charCode) {
3406         return (charCode >= 97 && charCode <= 122) ||
3407             (charCode >= 65 && charCode <= 90);
3408     }
3409     function getFileUrlVolumeSeparatorEnd(url, start) {
3410         var ch0 = url.charCodeAt(start);
3411         if (ch0 === 58)
3412             return start + 1;
3413         if (ch0 === 37 && url.charCodeAt(start + 1) === 51) {
3414             var ch2 = url.charCodeAt(start + 2);
3415             if (ch2 === 97 || ch2 === 65)
3416                 return start + 3;
3417         }
3418         return -1;
3419     }
3420     function getEncodedRootLength(path) {
3421         if (!path)
3422             return 0;
3423         var ch0 = path.charCodeAt(0);
3424         if (ch0 === 47 || ch0 === 92) {
3425             if (path.charCodeAt(1) !== ch0)
3426                 return 1;
3427             var p1 = path.indexOf(ch0 === 47 ? ts.directorySeparator : ts.altDirectorySeparator, 2);
3428             if (p1 < 0)
3429                 return path.length;
3430             return p1 + 1;
3431         }
3432         if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58) {
3433             var ch2 = path.charCodeAt(2);
3434             if (ch2 === 47 || ch2 === 92)
3435                 return 3;
3436             if (path.length === 2)
3437                 return 2;
3438         }
3439         var schemeEnd = path.indexOf(urlSchemeSeparator);
3440         if (schemeEnd !== -1) {
3441             var authorityStart = schemeEnd + urlSchemeSeparator.length;
3442             var authorityEnd = path.indexOf(ts.directorySeparator, authorityStart);
3443             if (authorityEnd !== -1) {
3444                 var scheme = path.slice(0, schemeEnd);
3445                 var authority = path.slice(authorityStart, authorityEnd);
3446                 if (scheme === "file" && (authority === "" || authority === "localhost") &&
3447                     isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
3448                     var volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
3449                     if (volumeSeparatorEnd !== -1) {
3450                         if (path.charCodeAt(volumeSeparatorEnd) === 47) {
3451                             return ~(volumeSeparatorEnd + 1);
3452                         }
3453                         if (volumeSeparatorEnd === path.length) {
3454                             return ~volumeSeparatorEnd;
3455                         }
3456                     }
3457                 }
3458                 return ~(authorityEnd + 1);
3459             }
3460             return ~path.length;
3461         }
3462         return 0;
3463     }
3464     function getRootLength(path) {
3465         var rootLength = getEncodedRootLength(path);
3466         return rootLength < 0 ? ~rootLength : rootLength;
3467     }
3468     ts.getRootLength = getRootLength;
3469     function getDirectoryPath(path) {
3470         path = normalizeSlashes(path);
3471         var rootLength = getRootLength(path);
3472         if (rootLength === path.length)
3473             return path;
3474         path = removeTrailingDirectorySeparator(path);
3475         return path.slice(0, Math.max(rootLength, path.lastIndexOf(ts.directorySeparator)));
3476     }
3477     ts.getDirectoryPath = getDirectoryPath;
3478     function getBaseFileName(path, extensions, ignoreCase) {
3479         path = normalizeSlashes(path);
3480         var rootLength = getRootLength(path);
3481         if (rootLength === path.length)
3482             return "";
3483         path = removeTrailingDirectorySeparator(path);
3484         var name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator) + 1));
3485         var extension = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(name, extensions, ignoreCase) : undefined;
3486         return extension ? name.slice(0, name.length - extension.length) : name;
3487     }
3488     ts.getBaseFileName = getBaseFileName;
3489     function tryGetExtensionFromPath(path, extension, stringEqualityComparer) {
3490         if (!ts.startsWith(extension, "."))
3491             extension = "." + extension;
3492         if (path.length >= extension.length && path.charCodeAt(path.length - extension.length) === 46) {
3493             var pathExtension = path.slice(path.length - extension.length);
3494             if (stringEqualityComparer(pathExtension, extension)) {
3495                 return pathExtension;
3496             }
3497         }
3498     }
3499     function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) {
3500         if (typeof extensions === "string") {
3501             return tryGetExtensionFromPath(path, extensions, stringEqualityComparer) || "";
3502         }
3503         for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) {
3504             var extension = extensions_2[_i];
3505             var result = tryGetExtensionFromPath(path, extension, stringEqualityComparer);
3506             if (result)
3507                 return result;
3508         }
3509         return "";
3510     }
3511     function getAnyExtensionFromPath(path, extensions, ignoreCase) {
3512         if (extensions) {
3513             return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(path), extensions, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive);
3514         }
3515         var baseFileName = getBaseFileName(path);
3516         var extensionIndex = baseFileName.lastIndexOf(".");
3517         if (extensionIndex >= 0) {
3518             return baseFileName.substring(extensionIndex);
3519         }
3520         return "";
3521     }
3522     ts.getAnyExtensionFromPath = getAnyExtensionFromPath;
3523     function pathComponents(path, rootLength) {
3524         var root = path.substring(0, rootLength);
3525         var rest = path.substring(rootLength).split(ts.directorySeparator);
3526         if (rest.length && !ts.lastOrUndefined(rest))
3527             rest.pop();
3528         return __spreadArray([root], rest, true);
3529     }
3530     function getPathComponents(path, currentDirectory) {
3531         if (currentDirectory === void 0) { currentDirectory = ""; }
3532         path = combinePaths(currentDirectory, path);
3533         return pathComponents(path, getRootLength(path));
3534     }
3535     ts.getPathComponents = getPathComponents;
3536     function getPathFromPathComponents(pathComponents) {
3537         if (pathComponents.length === 0)
3538             return "";
3539         var root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]);
3540         return root + pathComponents.slice(1).join(ts.directorySeparator);
3541     }
3542     ts.getPathFromPathComponents = getPathFromPathComponents;
3543     function normalizeSlashes(path) {
3544         var index = path.indexOf("\\");
3545         if (index === -1) {
3546             return path;
3547         }
3548         backslashRegExp.lastIndex = index;
3549         return path.replace(backslashRegExp, ts.directorySeparator);
3550     }
3551     ts.normalizeSlashes = normalizeSlashes;
3552     function reducePathComponents(components) {
3553         if (!ts.some(components))
3554             return [];
3555         var reduced = [components[0]];
3556         for (var i = 1; i < components.length; i++) {
3557             var component = components[i];
3558             if (!component)
3559                 continue;
3560             if (component === ".")
3561                 continue;
3562             if (component === "..") {
3563                 if (reduced.length > 1) {
3564                     if (reduced[reduced.length - 1] !== "..") {
3565                         reduced.pop();
3566                         continue;
3567                     }
3568                 }
3569                 else if (reduced[0])
3570                     continue;
3571             }
3572             reduced.push(component);
3573         }
3574         return reduced;
3575     }
3576     ts.reducePathComponents = reducePathComponents;
3577     function combinePaths(path) {
3578         var paths = [];
3579         for (var _i = 1; _i < arguments.length; _i++) {
3580             paths[_i - 1] = arguments[_i];
3581         }
3582         if (path)
3583             path = normalizeSlashes(path);
3584         for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) {
3585             var relativePath = paths_1[_a];
3586             if (!relativePath)
3587                 continue;
3588             relativePath = normalizeSlashes(relativePath);
3589             if (!path || getRootLength(relativePath) !== 0) {
3590                 path = relativePath;
3591             }
3592             else {
3593                 path = ensureTrailingDirectorySeparator(path) + relativePath;
3594             }
3595         }
3596         return path;
3597     }
3598     ts.combinePaths = combinePaths;
3599     function resolvePath(path) {
3600         var paths = [];
3601         for (var _i = 1; _i < arguments.length; _i++) {
3602             paths[_i - 1] = arguments[_i];
3603         }
3604         return normalizePath(ts.some(paths) ? combinePaths.apply(void 0, __spreadArray([path], paths, false)) : normalizeSlashes(path));
3605     }
3606     ts.resolvePath = resolvePath;
3607     function getNormalizedPathComponents(path, currentDirectory) {
3608         return reducePathComponents(getPathComponents(path, currentDirectory));
3609     }
3610     ts.getNormalizedPathComponents = getNormalizedPathComponents;
3611     function getNormalizedAbsolutePath(fileName, currentDirectory) {
3612         return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
3613     }
3614     ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;
3615     function normalizePath(path) {
3616         path = normalizeSlashes(path);
3617         if (!relativePathSegmentRegExp.test(path)) {
3618             return path;
3619         }
3620         var simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, "");
3621         if (simplified !== path) {
3622             path = simplified;
3623             if (!relativePathSegmentRegExp.test(path)) {
3624                 return path;
3625             }
3626         }
3627         var normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));
3628         return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
3629     }
3630     ts.normalizePath = normalizePath;
3631     function getPathWithoutRoot(pathComponents) {
3632         if (pathComponents.length === 0)
3633             return "";
3634         return pathComponents.slice(1).join(ts.directorySeparator);
3635     }
3636     function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
3637         return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
3638     }
3639     ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
3640     function toPath(fileName, basePath, getCanonicalFileName) {
3641         var nonCanonicalizedPath = isRootedDiskPath(fileName)
3642             ? normalizePath(fileName)
3643             : getNormalizedAbsolutePath(fileName, basePath);
3644         return getCanonicalFileName(nonCanonicalizedPath);
3645     }
3646     ts.toPath = toPath;
3647     function normalizePathAndParts(path) {
3648         path = normalizeSlashes(path);
3649         var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
3650         if (parts.length) {
3651             var joinedParts = root + parts.join(ts.directorySeparator);
3652             return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
3653         }
3654         else {
3655             return { path: root, parts: parts };
3656         }
3657     }
3658     ts.normalizePathAndParts = normalizePathAndParts;
3659     function removeTrailingDirectorySeparator(path) {
3660         if (hasTrailingDirectorySeparator(path)) {
3661             return path.substr(0, path.length - 1);
3662         }
3663         return path;
3664     }
3665     ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
3666     function ensureTrailingDirectorySeparator(path) {
3667         if (!hasTrailingDirectorySeparator(path)) {
3668             return path + ts.directorySeparator;
3669         }
3670         return path;
3671     }
3672     ts.ensureTrailingDirectorySeparator = ensureTrailingDirectorySeparator;
3673     function ensurePathIsNonModuleName(path) {
3674         return !pathIsAbsolute(path) && !pathIsRelative(path) ? "./" + path : path;
3675     }
3676     ts.ensurePathIsNonModuleName = ensurePathIsNonModuleName;
3677     function changeAnyExtension(path, ext, extensions, ignoreCase) {
3678         var pathext = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path);
3679         return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
3680     }
3681     ts.changeAnyExtension = changeAnyExtension;
3682     var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
3683     function comparePathsWorker(a, b, componentComparer) {
3684         if (a === b)
3685             return 0;
3686         if (a === undefined)
3687             return -1;
3688         if (b === undefined)
3689             return 1;
3690         var aRoot = a.substring(0, getRootLength(a));
3691         var bRoot = b.substring(0, getRootLength(b));
3692         var result = ts.compareStringsCaseInsensitive(aRoot, bRoot);
3693         if (result !== 0) {
3694             return result;
3695         }
3696         var aRest = a.substring(aRoot.length);
3697         var bRest = b.substring(bRoot.length);
3698         if (!relativePathSegmentRegExp.test(aRest) && !relativePathSegmentRegExp.test(bRest)) {
3699             return componentComparer(aRest, bRest);
3700         }
3701         var aComponents = reducePathComponents(getPathComponents(a));
3702         var bComponents = reducePathComponents(getPathComponents(b));
3703         var sharedLength = Math.min(aComponents.length, bComponents.length);
3704         for (var i = 1; i < sharedLength; i++) {
3705             var result_2 = componentComparer(aComponents[i], bComponents[i]);
3706             if (result_2 !== 0) {
3707                 return result_2;
3708             }
3709         }
3710         return ts.compareValues(aComponents.length, bComponents.length);
3711     }
3712     function comparePathsCaseSensitive(a, b) {
3713         return comparePathsWorker(a, b, ts.compareStringsCaseSensitive);
3714     }
3715     ts.comparePathsCaseSensitive = comparePathsCaseSensitive;
3716     function comparePathsCaseInsensitive(a, b) {
3717         return comparePathsWorker(a, b, ts.compareStringsCaseInsensitive);
3718     }
3719     ts.comparePathsCaseInsensitive = comparePathsCaseInsensitive;
3720     function comparePaths(a, b, currentDirectory, ignoreCase) {
3721         if (typeof currentDirectory === "string") {
3722             a = combinePaths(currentDirectory, a);
3723             b = combinePaths(currentDirectory, b);
3724         }
3725         else if (typeof currentDirectory === "boolean") {
3726             ignoreCase = currentDirectory;
3727         }
3728         return comparePathsWorker(a, b, ts.getStringComparer(ignoreCase));
3729     }
3730     ts.comparePaths = comparePaths;
3731     function containsPath(parent, child, currentDirectory, ignoreCase) {
3732         if (typeof currentDirectory === "string") {
3733             parent = combinePaths(currentDirectory, parent);
3734             child = combinePaths(currentDirectory, child);
3735         }
3736         else if (typeof currentDirectory === "boolean") {
3737             ignoreCase = currentDirectory;
3738         }
3739         if (parent === undefined || child === undefined)
3740             return false;
3741         if (parent === child)
3742             return true;
3743         var parentComponents = reducePathComponents(getPathComponents(parent));
3744         var childComponents = reducePathComponents(getPathComponents(child));
3745         if (childComponents.length < parentComponents.length) {
3746             return false;
3747         }
3748         var componentEqualityComparer = ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive;
3749         for (var i = 0; i < parentComponents.length; i++) {
3750             var equalityComparer = i === 0 ? ts.equateStringsCaseInsensitive : componentEqualityComparer;
3751             if (!equalityComparer(parentComponents[i], childComponents[i])) {
3752                 return false;
3753             }
3754         }
3755         return true;
3756     }
3757     ts.containsPath = containsPath;
3758     function startsWithDirectory(fileName, directoryName, getCanonicalFileName) {
3759         var canonicalFileName = getCanonicalFileName(fileName);
3760         var canonicalDirectoryName = getCanonicalFileName(directoryName);
3761         return ts.startsWith(canonicalFileName, canonicalDirectoryName + "/") || ts.startsWith(canonicalFileName, canonicalDirectoryName + "\\");
3762     }
3763     ts.startsWithDirectory = startsWithDirectory;
3764     function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) {
3765         var fromComponents = reducePathComponents(getPathComponents(from));
3766         var toComponents = reducePathComponents(getPathComponents(to));
3767         var start;
3768         for (start = 0; start < fromComponents.length && start < toComponents.length; start++) {
3769             var fromComponent = getCanonicalFileName(fromComponents[start]);
3770             var toComponent = getCanonicalFileName(toComponents[start]);
3771             var comparer = start === 0 ? ts.equateStringsCaseInsensitive : stringEqualityComparer;
3772             if (!comparer(fromComponent, toComponent))
3773                 break;
3774         }
3775         if (start === 0) {
3776             return toComponents;
3777         }
3778         var components = toComponents.slice(start);
3779         var relative = [];
3780         for (; start < fromComponents.length; start++) {
3781             relative.push("..");
3782         }
3783         return __spreadArray(__spreadArray([""], relative, true), components, true);
3784     }
3785     ts.getPathComponentsRelativeTo = getPathComponentsRelativeTo;
3786     function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
3787         ts.Debug.assert((getRootLength(fromDirectory) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
3788         var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
3789         var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
3790         var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
3791         return getPathFromPathComponents(pathComponents);
3792     }
3793     ts.getRelativePathFromDirectory = getRelativePathFromDirectory;
3794     function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) {
3795         return !isRootedDiskPath(absoluteOrRelativePath)
3796             ? absoluteOrRelativePath
3797             : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, false);
3798     }
3799     ts.convertToRelativePath = convertToRelativePath;
3800     function getRelativePathFromFile(from, to, getCanonicalFileName) {
3801         return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from), to, getCanonicalFileName));
3802     }
3803     ts.getRelativePathFromFile = getRelativePathFromFile;
3804     function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
3805         var pathComponents = getPathComponentsRelativeTo(resolvePath(currentDirectory, directoryPathOrUrl), resolvePath(currentDirectory, relativeOrAbsolutePath), ts.equateStringsCaseSensitive, getCanonicalFileName);
3806         var firstComponent = pathComponents[0];
3807         if (isAbsolutePathAnUrl && isRootedDiskPath(firstComponent)) {
3808             var prefix = firstComponent.charAt(0) === ts.directorySeparator ? "file://" : "file:///";
3809             pathComponents[0] = prefix + firstComponent;
3810         }
3811         return getPathFromPathComponents(pathComponents);
3812     }
3813     ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;
3814     function forEachAncestorDirectory(directory, callback) {
3815         while (true) {
3816             var result = callback(directory);
3817             if (result !== undefined) {
3818                 return result;
3819             }
3820             var parentPath = getDirectoryPath(directory);
3821             if (parentPath === directory) {
3822                 return undefined;
3823             }
3824             directory = parentPath;
3825         }
3826     }
3827     ts.forEachAncestorDirectory = forEachAncestorDirectory;
3828     function isNodeModulesDirectory(dirPath) {
3829         return ts.endsWith(dirPath, "/node_modules");
3830     }
3831     ts.isNodeModulesDirectory = isNodeModulesDirectory;
3832 })(ts || (ts = {}));
3833 var ts;
3834 (function (ts) {
3835     function generateDjb2Hash(data) {
3836         var acc = 5381;
3837         for (var i = 0; i < data.length; i++) {
3838             acc = ((acc << 5) + acc) + data.charCodeAt(i);
3839         }
3840         return acc.toString();
3841     }
3842     ts.generateDjb2Hash = generateDjb2Hash;
3843     function setStackTraceLimit() {
3844         if (Error.stackTraceLimit < 100) {
3845             Error.stackTraceLimit = 100;
3846         }
3847     }
3848     ts.setStackTraceLimit = setStackTraceLimit;
3849     var FileWatcherEventKind;
3850     (function (FileWatcherEventKind) {
3851         FileWatcherEventKind[FileWatcherEventKind["Created"] = 0] = "Created";
3852         FileWatcherEventKind[FileWatcherEventKind["Changed"] = 1] = "Changed";
3853         FileWatcherEventKind[FileWatcherEventKind["Deleted"] = 2] = "Deleted";
3854     })(FileWatcherEventKind = ts.FileWatcherEventKind || (ts.FileWatcherEventKind = {}));
3855     var PollingInterval;
3856     (function (PollingInterval) {
3857         PollingInterval[PollingInterval["High"] = 2000] = "High";
3858         PollingInterval[PollingInterval["Medium"] = 500] = "Medium";
3859         PollingInterval[PollingInterval["Low"] = 250] = "Low";
3860     })(PollingInterval = ts.PollingInterval || (ts.PollingInterval = {}));
3861     ts.missingFileModifiedTime = new Date(0);
3862     function getModifiedTime(host, fileName) {
3863         return host.getModifiedTime(fileName) || ts.missingFileModifiedTime;
3864     }
3865     ts.getModifiedTime = getModifiedTime;
3866     function createPollingIntervalBasedLevels(levels) {
3867         var _a;
3868         return _a = {},
3869             _a[PollingInterval.Low] = levels.Low,
3870             _a[PollingInterval.Medium] = levels.Medium,
3871             _a[PollingInterval.High] = levels.High,
3872             _a;
3873     }
3874     var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
3875     var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
3876     ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
3877     function setCustomPollingValues(system) {
3878         if (!system.getEnvironmentVariable) {
3879             return;
3880         }
3881         var pollingIntervalChanged = setCustomLevels("TSC_WATCH_POLLINGINTERVAL", PollingInterval);
3882         pollingChunkSize = getCustomPollingBasedLevels("TSC_WATCH_POLLINGCHUNKSIZE", defaultChunkLevels) || pollingChunkSize;
3883         ts.unchangedPollThresholds = getCustomPollingBasedLevels("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS", defaultChunkLevels) || ts.unchangedPollThresholds;
3884         function getLevel(envVar, level) {
3885             return system.getEnvironmentVariable("".concat(envVar, "_").concat(level.toUpperCase()));
3886         }
3887         function getCustomLevels(baseVariable) {
3888             var customLevels;
3889             setCustomLevel("Low");
3890             setCustomLevel("Medium");
3891             setCustomLevel("High");
3892             return customLevels;
3893             function setCustomLevel(level) {
3894                 var customLevel = getLevel(baseVariable, level);
3895                 if (customLevel) {
3896                     (customLevels || (customLevels = {}))[level] = Number(customLevel);
3897                 }
3898             }
3899         }
3900         function setCustomLevels(baseVariable, levels) {
3901             var customLevels = getCustomLevels(baseVariable);
3902             if (customLevels) {
3903                 setLevel("Low");
3904                 setLevel("Medium");
3905                 setLevel("High");
3906                 return true;
3907             }
3908             return false;
3909             function setLevel(level) {
3910                 levels[level] = customLevels[level] || levels[level];
3911             }
3912         }
3913         function getCustomPollingBasedLevels(baseVariable, defaultLevels) {
3914             var customLevels = getCustomLevels(baseVariable);
3915             return (pollingIntervalChanged || customLevels) &&
3916                 createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
3917         }
3918     }
3919     ts.setCustomPollingValues = setCustomPollingValues;
3920     function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
3921         var definedValueCopyToIndex = pollIndex;
3922         for (var canVisit = queue.length; chunkSize && canVisit; nextPollIndex(), canVisit--) {
3923             var watchedFile = queue[pollIndex];
3924             if (!watchedFile) {
3925                 continue;
3926             }
3927             else if (watchedFile.isClosed) {
3928                 queue[pollIndex] = undefined;
3929                 continue;
3930             }
3931             chunkSize--;
3932             var fileChanged = onWatchedFileStat(watchedFile, getModifiedTime(host, watchedFile.fileName));
3933             if (watchedFile.isClosed) {
3934                 queue[pollIndex] = undefined;
3935                 continue;
3936             }
3937             callbackOnWatchFileStat === null || callbackOnWatchFileStat === void 0 ? void 0 : callbackOnWatchFileStat(watchedFile, pollIndex, fileChanged);
3938             if (queue[pollIndex]) {
3939                 if (definedValueCopyToIndex < pollIndex) {
3940                     queue[definedValueCopyToIndex] = watchedFile;
3941                     queue[pollIndex] = undefined;
3942                 }
3943                 definedValueCopyToIndex++;
3944             }
3945         }
3946         return pollIndex;
3947         function nextPollIndex() {
3948             pollIndex++;
3949             if (pollIndex === queue.length) {
3950                 if (definedValueCopyToIndex < pollIndex) {
3951                     queue.length = definedValueCopyToIndex;
3952                 }
3953                 pollIndex = 0;
3954                 definedValueCopyToIndex = 0;
3955             }
3956         }
3957     }
3958     function createDynamicPriorityPollingWatchFile(host) {
3959         var watchedFiles = [];
3960         var changedFilesInLastPoll = [];
3961         var lowPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Low);
3962         var mediumPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Medium);
3963         var highPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.High);
3964         return watchFile;
3965         function watchFile(fileName, callback, defaultPollingInterval) {
3966             var file = {
3967                 fileName: fileName,
3968                 callback: callback,
3969                 unchangedPolls: 0,
3970                 mtime: getModifiedTime(host, fileName)
3971             };
3972             watchedFiles.push(file);
3973             addToPollingIntervalQueue(file, defaultPollingInterval);
3974             return {
3975                 close: function () {
3976                     file.isClosed = true;
3977                     ts.unorderedRemoveItem(watchedFiles, file);
3978                 }
3979             };
3980         }
3981         function createPollingIntervalQueue(pollingInterval) {
3982             var queue = [];
3983             queue.pollingInterval = pollingInterval;
3984             queue.pollIndex = 0;
3985             queue.pollScheduled = false;
3986             return queue;
3987         }
3988         function pollPollingIntervalQueue(queue) {
3989             queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
3990             if (queue.length) {
3991                 scheduleNextPoll(queue.pollingInterval);
3992             }
3993             else {
3994                 ts.Debug.assert(queue.pollIndex === 0);
3995                 queue.pollScheduled = false;
3996             }
3997         }
3998         function pollLowPollingIntervalQueue(queue) {
3999             pollQueue(changedFilesInLastPoll, PollingInterval.Low, 0, changedFilesInLastPoll.length);
4000             pollPollingIntervalQueue(queue);
4001             if (!queue.pollScheduled && changedFilesInLastPoll.length) {
4002                 scheduleNextPoll(PollingInterval.Low);
4003             }
4004         }
4005         function pollQueue(queue, pollingInterval, pollIndex, chunkSize) {
4006             return pollWatchedFileQueue(host, queue, pollIndex, chunkSize, onWatchFileStat);
4007             function onWatchFileStat(watchedFile, pollIndex, fileChanged) {
4008                 if (fileChanged) {
4009                     watchedFile.unchangedPolls = 0;
4010                     if (queue !== changedFilesInLastPoll) {
4011                         queue[pollIndex] = undefined;
4012                         addChangedFileToLowPollingIntervalQueue(watchedFile);
4013                     }
4014                 }
4015                 else if (watchedFile.unchangedPolls !== ts.unchangedPollThresholds[pollingInterval]) {
4016                     watchedFile.unchangedPolls++;
4017                 }
4018                 else if (queue === changedFilesInLastPoll) {
4019                     watchedFile.unchangedPolls = 1;
4020                     queue[pollIndex] = undefined;
4021                     addToPollingIntervalQueue(watchedFile, PollingInterval.Low);
4022                 }
4023                 else if (pollingInterval !== PollingInterval.High) {
4024                     watchedFile.unchangedPolls++;
4025                     queue[pollIndex] = undefined;
4026                     addToPollingIntervalQueue(watchedFile, pollingInterval === PollingInterval.Low ? PollingInterval.Medium : PollingInterval.High);
4027                 }
4028             }
4029         }
4030         function pollingIntervalQueue(pollingInterval) {
4031             switch (pollingInterval) {
4032                 case PollingInterval.Low:
4033                     return lowPollingIntervalQueue;
4034                 case PollingInterval.Medium:
4035                     return mediumPollingIntervalQueue;
4036                 case PollingInterval.High:
4037                     return highPollingIntervalQueue;
4038             }
4039         }
4040         function addToPollingIntervalQueue(file, pollingInterval) {
4041             pollingIntervalQueue(pollingInterval).push(file);
4042             scheduleNextPollIfNotAlreadyScheduled(pollingInterval);
4043         }
4044         function addChangedFileToLowPollingIntervalQueue(file) {
4045             changedFilesInLastPoll.push(file);
4046             scheduleNextPollIfNotAlreadyScheduled(PollingInterval.Low);
4047         }
4048         function scheduleNextPollIfNotAlreadyScheduled(pollingInterval) {
4049             if (!pollingIntervalQueue(pollingInterval).pollScheduled) {
4050                 scheduleNextPoll(pollingInterval);
4051             }
4052         }
4053         function scheduleNextPoll(pollingInterval) {
4054             pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
4055         }
4056     }
4057     ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
4058     function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
4059         var fileWatcherCallbacks = ts.createMultiMap();
4060         var dirWatchers = new ts.Map();
4061         var toCanonicalName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
4062         return nonPollingWatchFile;
4063         function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
4064             var filePath = toCanonicalName(fileName);
4065             fileWatcherCallbacks.add(filePath, callback);
4066             var dirPath = ts.getDirectoryPath(filePath) || ".";
4067             var watcher = dirWatchers.get(dirPath) ||
4068                 createDirectoryWatcher(ts.getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
4069             watcher.referenceCount++;
4070             return {
4071                 close: function () {
4072                     if (watcher.referenceCount === 1) {
4073                         watcher.close();
4074                         dirWatchers.delete(dirPath);
4075                     }
4076                     else {
4077                         watcher.referenceCount--;
4078                     }
4079                     fileWatcherCallbacks.remove(filePath, callback);
4080                 }
4081             };
4082         }
4083         function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
4084             var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName) {
4085                 if (!ts.isString(relativeFileName))
4086                     return;
4087                 var fileName = ts.getNormalizedAbsolutePath(relativeFileName, dirName);
4088                 var callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
4089                 if (callbacks) {
4090                     for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
4091                         var fileCallback = callbacks_1[_i];
4092                         fileCallback(fileName, FileWatcherEventKind.Changed);
4093                     }
4094                 }
4095             }, false, PollingInterval.Medium, fallbackOptions);
4096             watcher.referenceCount = 0;
4097             dirWatchers.set(dirPath, watcher);
4098             return watcher;
4099         }
4100     }
4101     function createFixedChunkSizePollingWatchFile(host) {
4102         var watchedFiles = [];
4103         var pollIndex = 0;
4104         var pollScheduled;
4105         return watchFile;
4106         function watchFile(fileName, callback) {
4107             var file = {
4108                 fileName: fileName,
4109                 callback: callback,
4110                 mtime: getModifiedTime(host, fileName)
4111             };
4112             watchedFiles.push(file);
4113             scheduleNextPoll();
4114             return {
4115                 close: function () {
4116                     file.isClosed = true;
4117                     ts.unorderedRemoveItem(watchedFiles, file);
4118                 }
4119             };
4120         }
4121         function pollQueue() {
4122             pollScheduled = undefined;
4123             pollIndex = pollWatchedFileQueue(host, watchedFiles, pollIndex, pollingChunkSize[PollingInterval.Low]);
4124             scheduleNextPoll();
4125         }
4126         function scheduleNextPoll() {
4127             if (!watchedFiles.length || pollScheduled)
4128                 return;
4129             pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
4130         }
4131     }
4132     function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
4133         var cache = new ts.Map();
4134         var callbacksCache = ts.createMultiMap();
4135         var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
4136         return function (fileName, callback, pollingInterval, options) {
4137             var path = toCanonicalFileName(fileName);
4138             var existing = cache.get(path);
4139             if (existing) {
4140                 existing.refCount++;
4141             }
4142             else {
4143                 cache.set(path, {
4144                     watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
4145                     refCount: 1
4146                 });
4147             }
4148             callbacksCache.add(path, callback);
4149             return {
4150                 close: function () {
4151                     var watcher = ts.Debug.checkDefined(cache.get(path));
4152                     callbacksCache.remove(path, callback);
4153                     watcher.refCount--;
4154                     if (watcher.refCount)
4155                         return;
4156                     cache.delete(path);
4157                     ts.closeFileWatcherOf(watcher);
4158                 }
4159             };
4160         };
4161     }
4162     ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
4163     function onWatchedFileStat(watchedFile, modifiedTime) {
4164         var oldTime = watchedFile.mtime.getTime();
4165         var newTime = modifiedTime.getTime();
4166         if (oldTime !== newTime) {
4167             watchedFile.mtime = modifiedTime;
4168             watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
4169             return true;
4170         }
4171         return false;
4172     }
4173     ts.onWatchedFileStat = onWatchedFileStat;
4174     function getFileWatcherEventKind(oldTime, newTime) {
4175         return oldTime === 0
4176             ? FileWatcherEventKind.Created
4177             : newTime === 0
4178                 ? FileWatcherEventKind.Deleted
4179                 : FileWatcherEventKind.Changed;
4180     }
4181     ts.getFileWatcherEventKind = getFileWatcherEventKind;
4182     ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
4183     ts.sysLog = ts.noop;
4184     function setSysLog(logger) {
4185         ts.sysLog = logger;
4186     }
4187     ts.setSysLog = setSysLog;
4188     function createDirectoryWatcherSupportingRecursive(_a) {
4189         var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, directoryExists = _a.directoryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
4190         var cache = new ts.Map();
4191         var callbackCache = ts.createMultiMap();
4192         var cacheToUpdateChildWatches = new ts.Map();
4193         var timerToUpdateChildWatches;
4194         var filePathComparer = ts.getStringComparer(!useCaseSensitiveFileNames);
4195         var toCanonicalFilePath = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
4196         return function (dirName, callback, recursive, options) { return recursive ?
4197             createDirectoryWatcher(dirName, options, callback) :
4198             watchDirectory(dirName, callback, recursive, options); };
4199         function createDirectoryWatcher(dirName, options, callback) {
4200             var dirPath = toCanonicalFilePath(dirName);
4201             var directoryWatcher = cache.get(dirPath);
4202             if (directoryWatcher) {
4203                 directoryWatcher.refCount++;
4204             }
4205             else {
4206                 directoryWatcher = {
4207                     watcher: watchDirectory(dirName, function (fileName) {
4208                         if (isIgnoredPath(fileName, options))
4209                             return;
4210                         if (options === null || options === void 0 ? void 0 : options.synchronousWatchDirectory) {
4211                             invokeCallbacks(dirPath, fileName);
4212                             updateChildWatches(dirName, dirPath, options);
4213                         }
4214                         else {
4215                             nonSyncUpdateChildWatches(dirName, dirPath, fileName, options);
4216                         }
4217                     }, false, options),
4218                     refCount: 1,
4219                     childWatches: ts.emptyArray
4220                 };
4221                 cache.set(dirPath, directoryWatcher);
4222                 updateChildWatches(dirName, dirPath, options);
4223             }
4224             var callbackToAdd = callback && { dirName: dirName, callback: callback };
4225             if (callbackToAdd) {
4226                 callbackCache.add(dirPath, callbackToAdd);
4227             }
4228             return {
4229                 dirName: dirName,
4230                 close: function () {
4231                     var directoryWatcher = ts.Debug.checkDefined(cache.get(dirPath));
4232                     if (callbackToAdd)
4233                         callbackCache.remove(dirPath, callbackToAdd);
4234                     directoryWatcher.refCount--;
4235                     if (directoryWatcher.refCount)
4236                         return;
4237                     cache.delete(dirPath);
4238                     ts.closeFileWatcherOf(directoryWatcher);
4239                     directoryWatcher.childWatches.forEach(ts.closeFileWatcher);
4240                 }
4241             };
4242         }
4243         function invokeCallbacks(dirPath, fileNameOrInvokeMap, fileNames) {
4244             var fileName;
4245             var invokeMap;
4246             if (ts.isString(fileNameOrInvokeMap)) {
4247                 fileName = fileNameOrInvokeMap;
4248             }
4249             else {
4250                 invokeMap = fileNameOrInvokeMap;
4251             }
4252             callbackCache.forEach(function (callbacks, rootDirName) {
4253                 var _a;
4254                 if (invokeMap && invokeMap.get(rootDirName) === true)
4255                     return;
4256                 if (rootDirName === dirPath || (ts.startsWith(dirPath, rootDirName) && dirPath[rootDirName.length] === ts.directorySeparator)) {
4257                     if (invokeMap) {
4258                         if (fileNames) {
4259                             var existing = invokeMap.get(rootDirName);
4260                             if (existing) {
4261                                 (_a = existing).push.apply(_a, fileNames);
4262                             }
4263                             else {
4264                                 invokeMap.set(rootDirName, fileNames.slice());
4265                             }
4266                         }
4267                         else {
4268                             invokeMap.set(rootDirName, true);
4269                         }
4270                     }
4271                     else {
4272                         callbacks.forEach(function (_a) {
4273                             var callback = _a.callback;
4274                             return callback(fileName);
4275                         });
4276                     }
4277                 }
4278             });
4279         }
4280         function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
4281             var parentWatcher = cache.get(dirPath);
4282             if (parentWatcher && directoryExists(dirName)) {
4283                 scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
4284                 return;
4285             }
4286             invokeCallbacks(dirPath, fileName);
4287             removeChildWatches(parentWatcher);
4288         }
4289         function scheduleUpdateChildWatches(dirName, dirPath, fileName, options) {
4290             var existing = cacheToUpdateChildWatches.get(dirPath);
4291             if (existing) {
4292                 existing.fileNames.push(fileName);
4293             }
4294             else {
4295                 cacheToUpdateChildWatches.set(dirPath, { dirName: dirName, options: options, fileNames: [fileName] });
4296             }
4297             if (timerToUpdateChildWatches) {
4298                 clearTimeout(timerToUpdateChildWatches);
4299                 timerToUpdateChildWatches = undefined;
4300             }
4301             timerToUpdateChildWatches = setTimeout(onTimerToUpdateChildWatches, 1000);
4302         }
4303         function onTimerToUpdateChildWatches() {
4304             timerToUpdateChildWatches = undefined;
4305             ts.sysLog("sysLog:: onTimerToUpdateChildWatches:: ".concat(cacheToUpdateChildWatches.size));
4306             var start = ts.timestamp();
4307             var invokeMap = new ts.Map();
4308             while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
4309                 var result = cacheToUpdateChildWatches.entries().next();
4310                 ts.Debug.assert(!result.done);
4311                 var _a = result.value, dirPath = _a[0], _b = _a[1], dirName = _b.dirName, options = _b.options, fileNames = _b.fileNames;
4312                 cacheToUpdateChildWatches.delete(dirPath);
4313                 var hasChanges = updateChildWatches(dirName, dirPath, options);
4314                 invokeCallbacks(dirPath, invokeMap, hasChanges ? undefined : fileNames);
4315             }
4316             ts.sysLog("sysLog:: invokingWatchers:: Elapsed:: ".concat(ts.timestamp() - start, "ms:: ").concat(cacheToUpdateChildWatches.size));
4317             callbackCache.forEach(function (callbacks, rootDirName) {
4318                 var existing = invokeMap.get(rootDirName);
4319                 if (existing) {
4320                     callbacks.forEach(function (_a) {
4321                         var callback = _a.callback, dirName = _a.dirName;
4322                         if (ts.isArray(existing)) {
4323                             existing.forEach(callback);
4324                         }
4325                         else {
4326                             callback(dirName);
4327                         }
4328                     });
4329                 }
4330             });
4331             var elapsed = ts.timestamp() - start;
4332             ts.sysLog("sysLog:: Elapsed:: ".concat(elapsed, "ms:: onTimerToUpdateChildWatches:: ").concat(cacheToUpdateChildWatches.size, " ").concat(timerToUpdateChildWatches));
4333         }
4334         function removeChildWatches(parentWatcher) {
4335             if (!parentWatcher)
4336                 return;
4337             var existingChildWatches = parentWatcher.childWatches;
4338             parentWatcher.childWatches = ts.emptyArray;
4339             for (var _i = 0, existingChildWatches_1 = existingChildWatches; _i < existingChildWatches_1.length; _i++) {
4340                 var childWatcher = existingChildWatches_1[_i];
4341                 childWatcher.close();
4342                 removeChildWatches(cache.get(toCanonicalFilePath(childWatcher.dirName)));
4343             }
4344         }
4345         function updateChildWatches(parentDir, parentDirPath, options) {
4346             var parentWatcher = cache.get(parentDirPath);
4347             if (!parentWatcher)
4348                 return false;
4349             var newChildWatches;
4350             var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4351                 var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
4352                 return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts.normalizePath(realpath(childFullName))) === 0 ? childFullName : undefined;
4353             }) : ts.emptyArray, parentWatcher.childWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
4354             parentWatcher.childWatches = newChildWatches || ts.emptyArray;
4355             return hasChanges;
4356             function createAndAddChildDirectoryWatcher(childName) {
4357                 var result = createDirectoryWatcher(childName, options);
4358                 addChildDirectoryWatcher(result);
4359             }
4360             function addChildDirectoryWatcher(childWatcher) {
4361                 (newChildWatches || (newChildWatches = [])).push(childWatcher);
4362             }
4363         }
4364         function isIgnoredPath(path, options) {
4365             return ts.some(ts.ignoredPaths, function (searchPath) { return isInPath(path, searchPath); }) ||
4366                 isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames, getCurrentDirectory);
4367         }
4368         function isInPath(path, searchPath) {
4369             if (ts.stringContains(path, searchPath))
4370                 return true;
4371             if (useCaseSensitiveFileNames)
4372                 return false;
4373             return ts.stringContains(toCanonicalFilePath(path), searchPath);
4374         }
4375     }
4376     ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4377     function createFileWatcherCallback(callback) {
4378         return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
4379     }
4380     ts.createFileWatcherCallback = createFileWatcherCallback;
4381     function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
4382         return function (eventName) {
4383             if (eventName === "rename") {
4384                 callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
4385             }
4386             else {
4387                 callback(fileName, FileWatcherEventKind.Changed);
4388             }
4389         };
4390     }
4391     function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames, getCurrentDirectory) {
4392         return ((options === null || options === void 0 ? void 0 : options.excludeDirectories) || (options === null || options === void 0 ? void 0 : options.excludeFiles)) && (ts.matchesExclude(pathToCheck, options === null || options === void 0 ? void 0 : options.excludeFiles, useCaseSensitiveFileNames, getCurrentDirectory()) ||
4393             ts.matchesExclude(pathToCheck, options === null || options === void 0 ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames, getCurrentDirectory()));
4394     }
4395     function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory) {
4396         return function (eventName, relativeFileName) {
4397             if (eventName === "rename") {
4398                 var fileName = !relativeFileName ? directoryName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName));
4399                 if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames, getCurrentDirectory)) {
4400                     callback(fileName);
4401                 }
4402             }
4403         };
4404     }
4405     function createSystemWatchFunctions(_a) {
4406         var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
4407         var dynamicPollingWatchFile;
4408         var fixedChunkSizePollingWatchFile;
4409         var nonPollingWatchFile;
4410         var hostRecursiveDirectoryWatcher;
4411         return {
4412             watchFile: watchFile,
4413             watchDirectory: watchDirectory
4414         };
4415         function watchFile(fileName, callback, pollingInterval, options) {
4416             options = updateOptionsForWatchFile(options, useNonPollingWatchers);
4417             var watchFileKind = ts.Debug.checkDefined(options.watchFile);
4418             switch (watchFileKind) {
4419                 case ts.WatchFileKind.FixedPollingInterval:
4420                     return pollingWatchFile(fileName, callback, PollingInterval.Low, undefined);
4421                 case ts.WatchFileKind.PriorityPollingInterval:
4422                     return pollingWatchFile(fileName, callback, pollingInterval, undefined);
4423                 case ts.WatchFileKind.DynamicPriorityPolling:
4424                     return ensureDynamicPollingWatchFile()(fileName, callback, pollingInterval, undefined);
4425                 case ts.WatchFileKind.FixedChunkSizePolling:
4426                     return ensureFixedChunkSizePollingWatchFile()(fileName, callback, undefined, undefined);
4427                 case ts.WatchFileKind.UseFsEvents:
4428                     return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists), false, pollingInterval, ts.getFallbackOptions(options));
4429                 case ts.WatchFileKind.UseFsEventsOnParentDirectory:
4430                     if (!nonPollingWatchFile) {
4431                         nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
4432                     }
4433                     return nonPollingWatchFile(fileName, callback, pollingInterval, ts.getFallbackOptions(options));
4434                 default:
4435                     ts.Debug.assertNever(watchFileKind);
4436             }
4437         }
4438         function ensureDynamicPollingWatchFile() {
4439             return dynamicPollingWatchFile || (dynamicPollingWatchFile = createDynamicPriorityPollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout }));
4440         }
4441         function ensureFixedChunkSizePollingWatchFile() {
4442             return fixedChunkSizePollingWatchFile || (fixedChunkSizePollingWatchFile = createFixedChunkSizePollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout }));
4443         }
4444         function updateOptionsForWatchFile(options, useNonPollingWatchers) {
4445             if (options && options.watchFile !== undefined)
4446                 return options;
4447             switch (tscWatchFile) {
4448                 case "PriorityPollingInterval":
4449                     return { watchFile: ts.WatchFileKind.PriorityPollingInterval };
4450                 case "DynamicPriorityPolling":
4451                     return { watchFile: ts.WatchFileKind.DynamicPriorityPolling };
4452                 case "UseFsEvents":
4453                     return generateWatchFileOptions(ts.WatchFileKind.UseFsEvents, ts.PollingWatchKind.PriorityInterval, options);
4454                 case "UseFsEventsWithFallbackDynamicPolling":
4455                     return generateWatchFileOptions(ts.WatchFileKind.UseFsEvents, ts.PollingWatchKind.DynamicPriority, options);
4456                 case "UseFsEventsOnParentDirectory":
4457                     useNonPollingWatchers = true;
4458                 default:
4459                     return useNonPollingWatchers ?
4460                         generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
4461                         { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
4462             }
4463         }
4464         function generateWatchFileOptions(watchFile, fallbackPolling, options) {
4465             var defaultFallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling;
4466             return {
4467                 watchFile: watchFile,
4468                 fallbackPolling: defaultFallbackPolling === undefined ?
4469                     fallbackPolling :
4470                     defaultFallbackPolling
4471             };
4472         }
4473         function watchDirectory(directoryName, callback, recursive, options) {
4474             if (fsSupportsRecursiveFsWatch) {
4475                 return fsWatch(directoryName, 1, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), recursive, PollingInterval.Medium, ts.getFallbackOptions(options));
4476             }
4477             if (!hostRecursiveDirectoryWatcher) {
4478                 hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
4479                     useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4480                     getCurrentDirectory: getCurrentDirectory,
4481                     directoryExists: directoryExists,
4482                     getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
4483                     watchDirectory: nonRecursiveWatchDirectory,
4484                     realpath: realpath,
4485                     setTimeout: setTimeout,
4486                     clearTimeout: clearTimeout
4487                 });
4488             }
4489             return hostRecursiveDirectoryWatcher(directoryName, callback, recursive, options);
4490         }
4491         function nonRecursiveWatchDirectory(directoryName, callback, recursive, options) {
4492             ts.Debug.assert(!recursive);
4493             var watchDirectoryOptions = updateOptionsForWatchDirectory(options);
4494             var watchDirectoryKind = ts.Debug.checkDefined(watchDirectoryOptions.watchDirectory);
4495             switch (watchDirectoryKind) {
4496                 case ts.WatchDirectoryKind.FixedPollingInterval:
4497                     return pollingWatchFile(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium, undefined);
4498                 case ts.WatchDirectoryKind.DynamicPriorityPolling:
4499                     return ensureDynamicPollingWatchFile()(directoryName, function () { return callback(directoryName); }, PollingInterval.Medium, undefined);
4500                 case ts.WatchDirectoryKind.FixedChunkSizePolling:
4501                     return ensureFixedChunkSizePollingWatchFile()(directoryName, function () { return callback(directoryName); }, undefined, undefined);
4502                 case ts.WatchDirectoryKind.UseFsEvents:
4503                     return fsWatch(directoryName, 1, createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), recursive, PollingInterval.Medium, ts.getFallbackOptions(watchDirectoryOptions));
4504                 default:
4505                     ts.Debug.assertNever(watchDirectoryKind);
4506             }
4507         }
4508         function updateOptionsForWatchDirectory(options) {
4509             if (options && options.watchDirectory !== undefined)
4510                 return options;
4511             switch (tscWatchDirectory) {
4512                 case "RecursiveDirectoryUsingFsWatchFile":
4513                     return { watchDirectory: ts.WatchDirectoryKind.FixedPollingInterval };
4514                 case "RecursiveDirectoryUsingDynamicPriorityPolling":
4515                     return { watchDirectory: ts.WatchDirectoryKind.DynamicPriorityPolling };
4516                 default:
4517                     var defaultFallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling;
4518                     return {
4519                         watchDirectory: ts.WatchDirectoryKind.UseFsEvents,
4520                         fallbackPolling: defaultFallbackPolling !== undefined ?
4521                             defaultFallbackPolling :
4522                             undefined
4523                     };
4524             }
4525         }
4526     }
4527     ts.createSystemWatchFunctions = createSystemWatchFunctions;
4528     function patchWriteFileEnsuringDirectory(sys) {
4529         var originalWriteFile = sys.writeFile;
4530         sys.writeFile = function (path, data, writeBom) {
4531             return ts.writeFileEnsuringDirectories(path, data, !!writeBom, function (path, data, writeByteOrderMark) { return originalWriteFile.call(sys, path, data, writeByteOrderMark); }, function (path) { return sys.createDirectory(path); }, function (path) { return sys.directoryExists(path); });
4532         };
4533     }
4534     ts.patchWriteFileEnsuringDirectory = patchWriteFileEnsuringDirectory;
4535     function getNodeMajorVersion() {
4536         if (typeof process === "undefined") {
4537             return undefined;
4538         }
4539         var version = process.version;
4540         if (!version) {
4541             return undefined;
4542         }
4543         var dot = version.indexOf(".");
4544         if (dot === -1) {
4545             return undefined;
4546         }
4547         return parseInt(version.substring(1, dot));
4548     }
4549     ts.getNodeMajorVersion = getNodeMajorVersion;
4550     ts.sys = (function () {
4551         var byteOrderMarkIndicator = "\uFEFF";
4552         function getNodeSystem() {
4553             var _a;
4554             var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
4555             var _fs = require("fs");
4556             var _path = require("path");
4557             var _os = require("os");
4558             var _crypto;
4559             try {
4560                 _crypto = require("crypto");
4561             }
4562             catch (_b) {
4563                 _crypto = undefined;
4564             }
4565             var activeSession;
4566             var profilePath = "./profile.cpuprofile";
4567             var hitSystemWatcherLimit = false;
4568             var Buffer = require("buffer").Buffer;
4569             var nodeVersion = getNodeMajorVersion();
4570             var isNode4OrLater = nodeVersion >= 4;
4571             var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4572             var platform = _os.platform();
4573             var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
4574             var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
4575             var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
4576             var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
4577             var _c = createSystemWatchFunctions({
4578                 pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
4579                 getModifiedTime: getModifiedTime,
4580                 setTimeout: setTimeout,
4581                 clearTimeout: clearTimeout,
4582                 fsWatch: fsWatch,
4583                 useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4584                 getCurrentDirectory: getCurrentDirectory,
4585                 fileExists: fileExists,
4586                 fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
4587                 directoryExists: directoryExists,
4588                 getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
4589                 realpath: realpath,
4590                 tscWatchFile: process.env.TSC_WATCHFILE,
4591                 useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4592                 tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4593                 defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
4594             }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
4595             var nodeSystem = {
4596                 args: process.argv.slice(2),
4597                 newLine: _os.EOL,
4598                 useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4599                 write: function (s) {
4600                     process.stdout.write(s);
4601                 },
4602                 getWidthOfTerminal: function () {
4603                     return process.stdout.columns;
4604                 },
4605                 writeOutputIsTTY: function () {
4606                     return process.stdout.isTTY;
4607                 },
4608                 readFile: readFile,
4609                 writeFile: writeFile,
4610                 watchFile: watchFile,
4611                 watchDirectory: watchDirectory,
4612                 resolvePath: function (path) { return _path.resolve(path); },
4613                 fileExists: fileExists,
4614                 directoryExists: directoryExists,
4615                 createDirectory: function (directoryName) {
4616                     if (!nodeSystem.directoryExists(directoryName)) {
4617                         try {
4618                             _fs.mkdirSync(directoryName);
4619                         }
4620                         catch (e) {
4621                             if (e.code !== "EEXIST") {
4622                                 throw e;
4623                             }
4624                         }
4625                     }
4626                 },
4627                 getExecutingFilePath: function () {
4628                     return __filename;
4629                 },
4630                 getCurrentDirectory: getCurrentDirectory,
4631                 getDirectories: getDirectories,
4632                 getEnvironmentVariable: function (name) {
4633                     return process.env[name] || "";
4634                 },
4635                 readDirectory: readDirectory,
4636                 getModifiedTime: getModifiedTime,
4637                 setModifiedTime: setModifiedTime,
4638                 deleteFile: deleteFile,
4639                 createHash: _crypto ? createSHA256Hash : generateDjb2Hash,
4640                 createSHA256Hash: _crypto ? createSHA256Hash : undefined,
4641                 getMemoryUsage: function () {
4642                     if (global.gc) {
4643                         global.gc();
4644                     }
4645                     return process.memoryUsage().heapUsed;
4646                 },
4647                 getFileSize: function (path) {
4648                     try {
4649                         var stat = statSync(path);
4650                         if (stat === null || stat === void 0 ? void 0 : stat.isFile()) {
4651                             return stat.size;
4652                         }
4653                     }
4654                     catch (_a) { }
4655                     return 0;
4656                 },
4657                 exit: function (exitCode) {
4658                     disableCPUProfiler(function () { return process.exit(exitCode); });
4659                 },
4660                 enableCPUProfiler: enableCPUProfiler,
4661                 disableCPUProfiler: disableCPUProfiler,
4662                 cpuProfilingEnabled: function () { return !!activeSession || ts.contains(process.execArgv, "--cpu-prof") || ts.contains(process.execArgv, "--prof"); },
4663                 realpath: realpath,
4664                 debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }),
4665                 tryEnableSourceMapsForHost: function () {
4666                     try {
4667                         require("source-map-support").install();
4668                     }
4669                     catch (_a) {
4670                     }
4671                 },
4672                 setTimeout: setTimeout,
4673                 clearTimeout: clearTimeout,
4674                 clearScreen: function () {
4675                     process.stdout.write("\x1Bc");
4676                 },
4677                 setBlocking: function () {
4678                     if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
4679                         process.stdout._handle.setBlocking(true);
4680                     }
4681                 },
4682                 bufferFrom: bufferFrom,
4683                 base64decode: function (input) { return bufferFrom(input, "base64").toString("utf8"); },
4684                 base64encode: function (input) { return bufferFrom(input).toString("base64"); },
4685                 require: function (baseDir, moduleName) {
4686                     try {
4687                         var modulePath = ts.resolveJSModule(moduleName, baseDir, nodeSystem);
4688                         return { module: require(modulePath), modulePath: modulePath, error: undefined };
4689                     }
4690                     catch (error) {
4691                         return { module: undefined, modulePath: undefined, error: error };
4692                     }
4693                 }
4694             };
4695             return nodeSystem;
4696             function statSync(path) {
4697                 return _fs.statSync(path, { throwIfNoEntry: false });
4698             }
4699             function enableCPUProfiler(path, cb) {
4700                 if (activeSession) {
4701                     cb();
4702                     return false;
4703                 }
4704                 var inspector = require("inspector");
4705                 if (!inspector || !inspector.Session) {
4706                     cb();
4707                     return false;
4708                 }
4709                 var session = new inspector.Session();
4710                 session.connect();
4711                 session.post("Profiler.enable", function () {
4712                     session.post("Profiler.start", function () {
4713                         activeSession = session;
4714                         profilePath = path;
4715                         cb();
4716                     });
4717                 });
4718                 return true;
4719             }
4720             function cleanupPaths(profile) {
4721                 var externalFileCounter = 0;
4722                 var remappedPaths = new ts.Map();
4723                 var normalizedDir = ts.normalizeSlashes(__dirname);
4724                 var fileUrlRoot = "file://".concat(ts.getRootLength(normalizedDir) === 1 ? "" : "/").concat(normalizedDir);
4725                 for (var _i = 0, _a = profile.nodes; _i < _a.length; _i++) {
4726                     var node = _a[_i];
4727                     if (node.callFrame.url) {
4728                         var url = ts.normalizeSlashes(node.callFrame.url);
4729                         if (ts.containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) {
4730                             node.callFrame.url = ts.getRelativePathToDirectoryOrUrl(fileUrlRoot, url, fileUrlRoot, ts.createGetCanonicalFileName(useCaseSensitiveFileNames), true);
4731                         }
4732                         else if (!nativePattern.test(url)) {
4733                             node.callFrame.url = (remappedPaths.has(url) ? remappedPaths : remappedPaths.set(url, "external".concat(externalFileCounter, ".js"))).get(url);
4734                             externalFileCounter++;
4735                         }
4736                     }
4737                 }
4738                 return profile;
4739             }
4740             function disableCPUProfiler(cb) {
4741                 if (activeSession && activeSession !== "stopping") {
4742                     var s_1 = activeSession;
4743                     activeSession.post("Profiler.stop", function (err, _a) {
4744                         var _b;
4745                         var profile = _a.profile;
4746                         if (!err) {
4747                             try {
4748                                 if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) {
4749                                     profilePath = _path.join(profilePath, "".concat((new Date()).toISOString().replace(/:/g, "-"), "+P").concat(process.pid, ".cpuprofile"));
4750                                 }
4751                             }
4752                             catch (_c) {
4753                             }
4754                             try {
4755                                 _fs.mkdirSync(_path.dirname(profilePath), { recursive: true });
4756                             }
4757                             catch (_d) {
4758                             }
4759                             _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile)));
4760                         }
4761                         activeSession = undefined;
4762                         s_1.disconnect();
4763                         cb();
4764                     });
4765                     activeSession = "stopping";
4766                     return true;
4767                 }
4768                 else {
4769                     cb();
4770                     return false;
4771                 }
4772             }
4773             function bufferFrom(input, encoding) {
4774                 return Buffer.from && Buffer.from !== Int8Array.from
4775                     ? Buffer.from(input, encoding)
4776                     : new Buffer(input, encoding);
4777             }
4778             function isFileSystemCaseSensitive() {
4779                 if (platform === "win32" || platform === "win64") {
4780                     return false;
4781                 }
4782                 return !fileExists(swapCase(__filename));
4783             }
4784             function swapCase(s) {
4785                 return s.replace(/\w/g, function (ch) {
4786                     var up = ch.toUpperCase();
4787                     return ch === up ? ch.toLowerCase() : up;
4788                 });
4789             }
4790             function fsWatchFileWorker(fileName, callback, pollingInterval) {
4791                 _fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged);
4792                 var eventKind;
4793                 return {
4794                     close: function () { return _fs.unwatchFile(fileName, fileChanged); }
4795                 };
4796                 function fileChanged(curr, prev) {
4797                     var isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
4798                     if (+curr.mtime === 0) {
4799                         if (isPreviouslyDeleted) {
4800                             return;
4801                         }
4802                         eventKind = FileWatcherEventKind.Deleted;
4803                     }
4804                     else if (isPreviouslyDeleted) {
4805                         eventKind = FileWatcherEventKind.Created;
4806                     }
4807                     else if (+curr.mtime === +prev.mtime) {
4808                         return;
4809                     }
4810                     else {
4811                         eventKind = FileWatcherEventKind.Changed;
4812                     }
4813                     callback(fileName, eventKind);
4814                 }
4815             }
4816             function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4817                 var options;
4818                 var lastDirectoryPartWithDirectorySeparator;
4819                 var lastDirectoryPart;
4820                 if (isLinuxOrMacOs) {
4821                     lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4822                     lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4823                 }
4824                 var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4825                     watchMissingFileSystemEntry() :
4826                     watchPresentFileSystemEntry();
4827                 return {
4828                     close: function () {
4829                         watcher.close();
4830                         watcher = undefined;
4831                     }
4832                 };
4833                 function invokeCallbackAndUpdateWatcher(createWatcher) {
4834                     ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing watcher to ").concat(createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing", "FileSystemEntryWatcher"));
4835                     callback("rename", "");
4836                     if (watcher) {
4837                         watcher.close();
4838                         watcher = createWatcher();
4839                     }
4840                 }
4841                 function watchPresentFileSystemEntry() {
4842                     if (options === undefined) {
4843                         if (fsSupportsRecursiveFsWatch) {
4844                             options = { persistent: true, recursive: !!recursive };
4845                         }
4846                         else {
4847                             options = { persistent: true };
4848                         }
4849                     }
4850                     if (hitSystemWatcherLimit) {
4851                         ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Defaulting to fsWatchFile"));
4852                         return watchPresentFileSystemEntryWithFsWatchFile();
4853                     }
4854                     try {
4855                         var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
4856                             callbackChangingToMissingFileSystemEntry :
4857                             callback);
4858                         presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
4859                         return presentWatcher;
4860                     }
4861                     catch (e) {
4862                         hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4863                         ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing to fsWatchFile"));
4864                         return watchPresentFileSystemEntryWithFsWatchFile();
4865                     }
4866                 }
4867                 function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4868                     return event === "rename" &&
4869                         (!relativeName ||
4870                             relativeName === lastDirectoryPart ||
4871                             (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
4872                         !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4873                         invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
4874                         callback(event, relativeName);
4875                 }
4876                 function watchPresentFileSystemEntryWithFsWatchFile() {
4877                     return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4878                 }
4879                 function watchMissingFileSystemEntry() {
4880                     return watchFile(fileOrDirectory, function (_fileName, eventKind) {
4881                         if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
4882                             invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
4883                         }
4884                     }, fallbackPollingInterval, fallbackOptions);
4885                 }
4886             }
4887             function readFileWorker(fileName, _encoding) {
4888                 var buffer;
4889                 try {
4890                     buffer = _fs.readFileSync(fileName);
4891                 }
4892                 catch (e) {
4893                     return undefined;
4894                 }
4895                 var len = buffer.length;
4896                 if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
4897                     len &= ~1;
4898                     for (var i = 0; i < len; i += 2) {
4899                         var temp = buffer[i];
4900                         buffer[i] = buffer[i + 1];
4901                         buffer[i + 1] = temp;
4902                     }
4903                     return buffer.toString("utf16le", 2);
4904                 }
4905                 if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
4906                     return buffer.toString("utf16le", 2);
4907                 }
4908                 if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
4909                     return buffer.toString("utf8", 3);
4910                 }
4911                 return buffer.toString("utf8");
4912             }
4913             function readFile(fileName, _encoding) {
4914                 ts.perfLogger.logStartReadFile(fileName);
4915                 var file = readFileWorker(fileName, _encoding);
4916                 ts.perfLogger.logStopReadFile();
4917                 return file;
4918             }
4919             function writeFile(fileName, data, writeByteOrderMark) {
4920                 ts.perfLogger.logEvent("WriteFile: " + fileName);
4921                 if (writeByteOrderMark) {
4922                     data = byteOrderMarkIndicator + data;
4923                 }
4924                 var fd;
4925                 try {
4926                     fd = _fs.openSync(fileName, "w");
4927                     _fs.writeSync(fd, data, undefined, "utf8");
4928                 }
4929                 finally {
4930                     if (fd !== undefined) {
4931                         _fs.closeSync(fd);
4932                     }
4933                 }
4934             }
4935             function getAccessibleFileSystemEntries(path) {
4936                 ts.perfLogger.logEvent("ReadDir: " + (path || "."));
4937                 try {
4938                     var entries = _fs.readdirSync(path || ".", { withFileTypes: true });
4939                     var files = [];
4940                     var directories = [];
4941                     for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
4942                         var dirent = entries_1[_i];
4943                         var entry = typeof dirent === "string" ? dirent : dirent.name;
4944                         if (entry === "." || entry === "..") {
4945                             continue;
4946                         }
4947                         var stat = void 0;
4948                         if (typeof dirent === "string" || dirent.isSymbolicLink()) {
4949                             var name = ts.combinePaths(path, entry);
4950                             try {
4951                                 stat = statSync(name);
4952                                 if (!stat) {
4953                                     continue;
4954                                 }
4955                             }
4956                             catch (e) {
4957                                 continue;
4958                             }
4959                         }
4960                         else {
4961                             stat = dirent;
4962                         }
4963                         if (stat.isFile()) {
4964                             files.push(entry);
4965                         }
4966                         else if (stat.isDirectory()) {
4967                             directories.push(entry);
4968                         }
4969                     }
4970                     files.sort();
4971                     directories.sort();
4972                     return { files: files, directories: directories };
4973                 }
4974                 catch (e) {
4975                     return ts.emptyFileSystemEntries;
4976                 }
4977             }
4978             function readDirectory(path, extensions, excludes, includes, depth) {
4979                 return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
4980             }
4981             function fileSystemEntryExists(path, entryKind) {
4982                 var originalStackTraceLimit = Error.stackTraceLimit;
4983                 Error.stackTraceLimit = 0;
4984                 try {
4985                     var stat = statSync(path);
4986                     if (!stat) {
4987                         return false;
4988                     }
4989                     switch (entryKind) {
4990                         case 0: return stat.isFile();
4991                         case 1: return stat.isDirectory();
4992                         default: return false;
4993                     }
4994                 }
4995                 catch (e) {
4996                     return false;
4997                 }
4998                 finally {
4999                     Error.stackTraceLimit = originalStackTraceLimit;
5000                 }
5001             }
5002             function fileExists(path) {
5003                 return fileSystemEntryExists(path, 0);
5004             }
5005             function directoryExists(path) {
5006                 return fileSystemEntryExists(path, 1);
5007             }
5008             function getDirectories(path) {
5009                 return getAccessibleFileSystemEntries(path).directories.slice();
5010             }
5011             function realpath(path) {
5012                 try {
5013                     return realpathSync(path);
5014                 }
5015                 catch (_a) {
5016                     return path;
5017                 }
5018             }
5019             function getModifiedTime(path) {
5020                 var _a;
5021                 try {
5022                     return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
5023                 }
5024                 catch (e) {
5025                     return undefined;
5026                 }
5027             }
5028             function setModifiedTime(path, time) {
5029                 try {
5030                     _fs.utimesSync(path, time, time);
5031                 }
5032                 catch (e) {
5033                     return;
5034                 }
5035             }
5036             function deleteFile(path) {
5037                 try {
5038                     return _fs.unlinkSync(path);
5039                 }
5040                 catch (e) {
5041                     return;
5042                 }
5043             }
5044             function createSHA256Hash(data) {
5045                 var hash = _crypto.createHash("sha256");
5046                 hash.update(data);
5047                 return hash.digest("hex");
5048             }
5049         }
5050         var sys;
5051         if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
5052             sys = getNodeSystem();
5053         }
5054         if (sys) {
5055             patchWriteFileEnsuringDirectory(sys);
5056         }
5057         return sys;
5058     })();
5059     function setSys(s) {
5060         ts.sys = s;
5061     }
5062     ts.setSys = setSys;
5063     if (ts.sys && ts.sys.getEnvironmentVariable) {
5064         setCustomPollingValues(ts.sys);
5065         ts.Debug.setAssertionLevel(/^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))
5066             ? 1
5067             : 0);
5068     }
5069     if (ts.sys && ts.sys.debugMode) {
5070         ts.Debug.isDebugging = true;
5071     }
5072 })(ts || (ts = {}));
5073 var ts;
5074 (function (ts) {
5075     function diag(code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated) {
5076         return { code: code, category: category, key: key, message: message, reportsUnnecessary: reportsUnnecessary, elidedInCompatabilityPyramid: elidedInCompatabilityPyramid, reportsDeprecated: reportsDeprecated };
5077     }
5078     ts.Diagnostics = {
5079         Unterminated_string_literal: diag(1002, ts.DiagnosticCategory.Error, "Unterminated_string_literal_1002", "Unterminated string literal."),
5080         Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
5081         _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
5082         A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."),
5083         The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."),
5084         Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
5085         Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
5086         An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."),
5087         Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."),
5088         A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma: diag(1013, ts.DiagnosticCategory.Error, "A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma_1013", "A rest parameter or binding pattern may not have a trailing comma."),
5089         A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."),
5090         Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."),
5091         A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."),
5092         An_index_signature_cannot_have_a_rest_parameter: diag(1017, ts.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_rest_parameter_1017", "An index signature cannot have a rest parameter."),
5093         An_index_signature_parameter_cannot_have_an_accessibility_modifier: diag(1018, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", "An index signature parameter cannot have an accessibility modifier."),
5094         An_index_signature_parameter_cannot_have_a_question_mark: diag(1019, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_a_question_mark_1019", "An index signature parameter cannot have a question mark."),
5095         An_index_signature_parameter_cannot_have_an_initializer: diag(1020, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_initializer_1020", "An index signature parameter cannot have an initializer."),
5096         An_index_signature_must_have_a_type_annotation: diag(1021, ts.DiagnosticCategory.Error, "An_index_signature_must_have_a_type_annotation_1021", "An index signature must have a type annotation."),
5097         An_index_signature_parameter_must_have_a_type_annotation: diag(1022, ts.DiagnosticCategory.Error, "An_index_signature_parameter_must_have_a_type_annotation_1022", "An index signature parameter must have a type annotation."),
5098         readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: diag(1024, ts.DiagnosticCategory.Error, "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", "'readonly' modifier can only appear on a property declaration or index signature."),
5099         An_index_signature_cannot_have_a_trailing_comma: diag(1025, ts.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_trailing_comma_1025", "An index signature cannot have a trailing comma."),
5100         Accessibility_modifier_already_seen: diag(1028, ts.DiagnosticCategory.Error, "Accessibility_modifier_already_seen_1028", "Accessibility modifier already seen."),
5101         _0_modifier_must_precede_1_modifier: diag(1029, ts.DiagnosticCategory.Error, "_0_modifier_must_precede_1_modifier_1029", "'{0}' modifier must precede '{1}' modifier."),
5102         _0_modifier_already_seen: diag(1030, ts.DiagnosticCategory.Error, "_0_modifier_already_seen_1030", "'{0}' modifier already seen."),
5103         _0_modifier_cannot_appear_on_class_elements_of_this_kind: diag(1031, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_class_elements_of_this_kind_1031", "'{0}' modifier cannot appear on class elements of this kind."),
5104         super_must_be_followed_by_an_argument_list_or_member_access: diag(1034, ts.DiagnosticCategory.Error, "super_must_be_followed_by_an_argument_list_or_member_access_1034", "'super' must be followed by an argument list or member access."),
5105         Only_ambient_modules_can_use_quoted_names: diag(1035, ts.DiagnosticCategory.Error, "Only_ambient_modules_can_use_quoted_names_1035", "Only ambient modules can use quoted names."),
5106         Statements_are_not_allowed_in_ambient_contexts: diag(1036, ts.DiagnosticCategory.Error, "Statements_are_not_allowed_in_ambient_contexts_1036", "Statements are not allowed in ambient contexts."),
5107         A_declare_modifier_cannot_be_used_in_an_already_ambient_context: diag(1038, ts.DiagnosticCategory.Error, "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", "A 'declare' modifier cannot be used in an already ambient context."),
5108         Initializers_are_not_allowed_in_ambient_contexts: diag(1039, ts.DiagnosticCategory.Error, "Initializers_are_not_allowed_in_ambient_contexts_1039", "Initializers are not allowed in ambient contexts."),
5109         _0_modifier_cannot_be_used_in_an_ambient_context: diag(1040, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_in_an_ambient_context_1040", "'{0}' modifier cannot be used in an ambient context."),
5110         _0_modifier_cannot_be_used_here: diag(1042, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_here_1042", "'{0}' modifier cannot be used here."),
5111         _0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
5112         Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
5113         A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
5114         A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
5115         A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
5116         A_set_accessor_cannot_have_an_optional_parameter: diag(1051, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_an_optional_parameter_1051", "A 'set' accessor cannot have an optional parameter."),
5117         A_set_accessor_parameter_cannot_have_an_initializer: diag(1052, ts.DiagnosticCategory.Error, "A_set_accessor_parameter_cannot_have_an_initializer_1052", "A 'set' accessor parameter cannot have an initializer."),
5118         A_set_accessor_cannot_have_rest_parameter: diag(1053, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_rest_parameter_1053", "A 'set' accessor cannot have rest parameter."),
5119         A_get_accessor_cannot_have_parameters: diag(1054, ts.DiagnosticCategory.Error, "A_get_accessor_cannot_have_parameters_1054", "A 'get' accessor cannot have parameters."),
5120         Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: diag(1055, ts.DiagnosticCategory.Error, "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."),
5121         Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: diag(1056, ts.DiagnosticCategory.Error, "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", "Accessors are only available when targeting ECMAScript 5 and higher."),
5122         The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1058, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", "The return type of an async function must either be a valid promise or must not contain a callable 'then' member."),
5123         A_promise_must_have_a_then_method: diag(1059, ts.DiagnosticCategory.Error, "A_promise_must_have_a_then_method_1059", "A promise must have a 'then' method."),
5124         The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: diag(1060, ts.DiagnosticCategory.Error, "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", "The first parameter of the 'then' method of a promise must be a callback."),
5125         Enum_member_must_have_initializer: diag(1061, ts.DiagnosticCategory.Error, "Enum_member_must_have_initializer_1061", "Enum member must have initializer."),
5126         Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, ts.DiagnosticCategory.Error, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."),
5127         An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."),
5128         The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<{0}>'?"),
5129         In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, ts.DiagnosticCategory.Error, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."),
5130         Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, ts.DiagnosticCategory.Error, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."),
5131         Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, ts.DiagnosticCategory.Error, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."),
5132         _0_modifier_cannot_appear_on_a_type_member: diag(1070, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_member_1070", "'{0}' modifier cannot appear on a type member."),
5133         _0_modifier_cannot_appear_on_an_index_signature: diag(1071, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."),
5134         A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."),
5135         Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."),
5136         Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."),
5137         _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."),
5138         _0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."),
5139         Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."),
5140         Type_parameters_cannot_appear_on_a_constructor_declaration: diag(1092, ts.DiagnosticCategory.Error, "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", "Type parameters cannot appear on a constructor declaration."),
5141         Type_annotation_cannot_appear_on_a_constructor_declaration: diag(1093, ts.DiagnosticCategory.Error, "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", "Type annotation cannot appear on a constructor declaration."),
5142         An_accessor_cannot_have_type_parameters: diag(1094, ts.DiagnosticCategory.Error, "An_accessor_cannot_have_type_parameters_1094", "An accessor cannot have type parameters."),
5143         A_set_accessor_cannot_have_a_return_type_annotation: diag(1095, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_a_return_type_annotation_1095", "A 'set' accessor cannot have a return type annotation."),
5144         An_index_signature_must_have_exactly_one_parameter: diag(1096, ts.DiagnosticCategory.Error, "An_index_signature_must_have_exactly_one_parameter_1096", "An index signature must have exactly one parameter."),
5145         _0_list_cannot_be_empty: diag(1097, ts.DiagnosticCategory.Error, "_0_list_cannot_be_empty_1097", "'{0}' list cannot be empty."),
5146         Type_parameter_list_cannot_be_empty: diag(1098, ts.DiagnosticCategory.Error, "Type_parameter_list_cannot_be_empty_1098", "Type parameter list cannot be empty."),
5147         Type_argument_list_cannot_be_empty: diag(1099, ts.DiagnosticCategory.Error, "Type_argument_list_cannot_be_empty_1099", "Type argument list cannot be empty."),
5148         Invalid_use_of_0_in_strict_mode: diag(1100, ts.DiagnosticCategory.Error, "Invalid_use_of_0_in_strict_mode_1100", "Invalid use of '{0}' in strict mode."),
5149         with_statements_are_not_allowed_in_strict_mode: diag(1101, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_strict_mode_1101", "'with' statements are not allowed in strict mode."),
5150         delete_cannot_be_called_on_an_identifier_in_strict_mode: diag(1102, ts.DiagnosticCategory.Error, "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", "'delete' cannot be called on an identifier in strict mode."),
5151         for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1103, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1103", "'for await' loops are only allowed within async functions and at the top levels of modules."),
5152         A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: diag(1104, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", "A 'continue' statement can only be used within an enclosing iteration statement."),
5153         A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: diag(1105, ts.DiagnosticCategory.Error, "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", "A 'break' statement can only be used within an enclosing iteration or switch statement."),
5154         The_left_hand_side_of_a_for_of_statement_may_not_be_async: diag(1106, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106", "The left-hand side of a 'for...of' statement may not be 'async'."),
5155         Jump_target_cannot_cross_function_boundary: diag(1107, ts.DiagnosticCategory.Error, "Jump_target_cannot_cross_function_boundary_1107", "Jump target cannot cross function boundary."),
5156         A_return_statement_can_only_be_used_within_a_function_body: diag(1108, ts.DiagnosticCategory.Error, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
5157         Expression_expected: diag(1109, ts.DiagnosticCategory.Error, "Expression_expected_1109", "Expression expected."),
5158         Type_expected: diag(1110, ts.DiagnosticCategory.Error, "Type_expected_1110", "Type expected."),
5159         A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, ts.DiagnosticCategory.Error, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
5160         Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
5161         A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
5162         A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."),
5163         An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", "An object literal cannot have multiple properties with the same name in strict mode."),
5164         An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."),
5165         An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."),
5166         An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."),
5167         Octal_literals_are_not_allowed_in_strict_mode: diag(1121, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."),
5168         Variable_declaration_list_cannot_be_empty: diag(1123, ts.DiagnosticCategory.Error, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."),
5169         Digit_expected: diag(1124, ts.DiagnosticCategory.Error, "Digit_expected_1124", "Digit expected."),
5170         Hexadecimal_digit_expected: diag(1125, ts.DiagnosticCategory.Error, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."),
5171         Unexpected_end_of_text: diag(1126, ts.DiagnosticCategory.Error, "Unexpected_end_of_text_1126", "Unexpected end of text."),
5172         Invalid_character: diag(1127, ts.DiagnosticCategory.Error, "Invalid_character_1127", "Invalid character."),
5173         Declaration_or_statement_expected: diag(1128, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_1128", "Declaration or statement expected."),
5174         Statement_expected: diag(1129, ts.DiagnosticCategory.Error, "Statement_expected_1129", "Statement expected."),
5175         case_or_default_expected: diag(1130, ts.DiagnosticCategory.Error, "case_or_default_expected_1130", "'case' or 'default' expected."),
5176         Property_or_signature_expected: diag(1131, ts.DiagnosticCategory.Error, "Property_or_signature_expected_1131", "Property or signature expected."),
5177         Enum_member_expected: diag(1132, ts.DiagnosticCategory.Error, "Enum_member_expected_1132", "Enum member expected."),
5178         Variable_declaration_expected: diag(1134, ts.DiagnosticCategory.Error, "Variable_declaration_expected_1134", "Variable declaration expected."),
5179         Argument_expression_expected: diag(1135, ts.DiagnosticCategory.Error, "Argument_expression_expected_1135", "Argument expression expected."),
5180         Property_assignment_expected: diag(1136, ts.DiagnosticCategory.Error, "Property_assignment_expected_1136", "Property assignment expected."),
5181         Expression_or_comma_expected: diag(1137, ts.DiagnosticCategory.Error, "Expression_or_comma_expected_1137", "Expression or comma expected."),
5182         Parameter_declaration_expected: diag(1138, ts.DiagnosticCategory.Error, "Parameter_declaration_expected_1138", "Parameter declaration expected."),
5183         Type_parameter_declaration_expected: diag(1139, ts.DiagnosticCategory.Error, "Type_parameter_declaration_expected_1139", "Type parameter declaration expected."),
5184         Type_argument_expected: diag(1140, ts.DiagnosticCategory.Error, "Type_argument_expected_1140", "Type argument expected."),
5185         String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."),
5186         Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."),
5187         or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."),
5188         Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."),
5189         Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."),
5190         Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."),
5191         File_name_0_differs_from_already_included_file_name_1_only_in_casing: diag(1149, ts.DiagnosticCategory.Error, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."),
5192         const_declarations_must_be_initialized: diag(1155, ts.DiagnosticCategory.Error, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."),
5193         const_declarations_can_only_be_declared_inside_a_block: diag(1156, ts.DiagnosticCategory.Error, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."),
5194         let_declarations_can_only_be_declared_inside_a_block: diag(1157, ts.DiagnosticCategory.Error, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."),
5195         Unterminated_template_literal: diag(1160, ts.DiagnosticCategory.Error, "Unterminated_template_literal_1160", "Unterminated template literal."),
5196         Unterminated_regular_expression_literal: diag(1161, ts.DiagnosticCategory.Error, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."),
5197         An_object_member_cannot_be_declared_optional: diag(1162, ts.DiagnosticCategory.Error, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."),
5198         A_yield_expression_is_only_allowed_in_a_generator_body: diag(1163, ts.DiagnosticCategory.Error, "A_yield_expression_is_only_allowed_in_a_generator_body_1163", "A 'yield' expression is only allowed in a generator body."),
5199         Computed_property_names_are_not_allowed_in_enums: diag(1164, ts.DiagnosticCategory.Error, "Computed_property_names_are_not_allowed_in_enums_1164", "Computed property names are not allowed in enums."),
5200         A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1165, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165", "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type."),
5201         A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type: diag(1166, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_1166", "A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type."),
5202         A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1168, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_ty_1168", "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type."),
5203         A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1169, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169", "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type."),
5204         A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type: diag(1170, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type__1170", "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."),
5205         A_comma_expression_is_not_allowed_in_a_computed_property_name: diag(1171, ts.DiagnosticCategory.Error, "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", "A comma expression is not allowed in a computed property name."),
5206         extends_clause_already_seen: diag(1172, ts.DiagnosticCategory.Error, "extends_clause_already_seen_1172", "'extends' clause already seen."),
5207         extends_clause_must_precede_implements_clause: diag(1173, ts.DiagnosticCategory.Error, "extends_clause_must_precede_implements_clause_1173", "'extends' clause must precede 'implements' clause."),
5208         Classes_can_only_extend_a_single_class: diag(1174, ts.DiagnosticCategory.Error, "Classes_can_only_extend_a_single_class_1174", "Classes can only extend a single class."),
5209         implements_clause_already_seen: diag(1175, ts.DiagnosticCategory.Error, "implements_clause_already_seen_1175", "'implements' clause already seen."),
5210         Interface_declaration_cannot_have_implements_clause: diag(1176, ts.DiagnosticCategory.Error, "Interface_declaration_cannot_have_implements_clause_1176", "Interface declaration cannot have 'implements' clause."),
5211         Binary_digit_expected: diag(1177, ts.DiagnosticCategory.Error, "Binary_digit_expected_1177", "Binary digit expected."),
5212         Octal_digit_expected: diag(1178, ts.DiagnosticCategory.Error, "Octal_digit_expected_1178", "Octal digit expected."),
5213         Unexpected_token_expected: diag(1179, ts.DiagnosticCategory.Error, "Unexpected_token_expected_1179", "Unexpected token. '{' expected."),
5214         Property_destructuring_pattern_expected: diag(1180, ts.DiagnosticCategory.Error, "Property_destructuring_pattern_expected_1180", "Property destructuring pattern expected."),
5215         Array_element_destructuring_pattern_expected: diag(1181, ts.DiagnosticCategory.Error, "Array_element_destructuring_pattern_expected_1181", "Array element destructuring pattern expected."),
5216         A_destructuring_declaration_must_have_an_initializer: diag(1182, ts.DiagnosticCategory.Error, "A_destructuring_declaration_must_have_an_initializer_1182", "A destructuring declaration must have an initializer."),
5217         An_implementation_cannot_be_declared_in_ambient_contexts: diag(1183, ts.DiagnosticCategory.Error, "An_implementation_cannot_be_declared_in_ambient_contexts_1183", "An implementation cannot be declared in ambient contexts."),
5218         Modifiers_cannot_appear_here: diag(1184, ts.DiagnosticCategory.Error, "Modifiers_cannot_appear_here_1184", "Modifiers cannot appear here."),
5219         Merge_conflict_marker_encountered: diag(1185, ts.DiagnosticCategory.Error, "Merge_conflict_marker_encountered_1185", "Merge conflict marker encountered."),
5220         A_rest_element_cannot_have_an_initializer: diag(1186, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_an_initializer_1186", "A rest element cannot have an initializer."),
5221         A_parameter_property_may_not_be_declared_using_a_binding_pattern: diag(1187, ts.DiagnosticCategory.Error, "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", "A parameter property may not be declared using a binding pattern."),
5222         Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: diag(1188, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", "Only a single variable declaration is allowed in a 'for...of' statement."),
5223         The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: diag(1189, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", "The variable declaration of a 'for...in' statement cannot have an initializer."),
5224         The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: diag(1190, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", "The variable declaration of a 'for...of' statement cannot have an initializer."),
5225         An_import_declaration_cannot_have_modifiers: diag(1191, ts.DiagnosticCategory.Error, "An_import_declaration_cannot_have_modifiers_1191", "An import declaration cannot have modifiers."),
5226         Module_0_has_no_default_export: diag(1192, ts.DiagnosticCategory.Error, "Module_0_has_no_default_export_1192", "Module '{0}' has no default export."),
5227         An_export_declaration_cannot_have_modifiers: diag(1193, ts.DiagnosticCategory.Error, "An_export_declaration_cannot_have_modifiers_1193", "An export declaration cannot have modifiers."),
5228         Export_declarations_are_not_permitted_in_a_namespace: diag(1194, ts.DiagnosticCategory.Error, "Export_declarations_are_not_permitted_in_a_namespace_1194", "Export declarations are not permitted in a namespace."),
5229         export_Asterisk_does_not_re_export_a_default: diag(1195, ts.DiagnosticCategory.Error, "export_Asterisk_does_not_re_export_a_default_1195", "'export *' does not re-export a default."),
5230         Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified: diag(1196, ts.DiagnosticCategory.Error, "Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196", "Catch clause variable type annotation must be 'any' or 'unknown' if specified."),
5231         Catch_clause_variable_cannot_have_an_initializer: diag(1197, ts.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_an_initializer_1197", "Catch clause variable cannot have an initializer."),
5232         An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: diag(1198, ts.DiagnosticCategory.Error, "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."),
5233         Unterminated_Unicode_escape_sequence: diag(1199, ts.DiagnosticCategory.Error, "Unterminated_Unicode_escape_sequence_1199", "Unterminated Unicode escape sequence."),
5234         Line_terminator_not_permitted_before_arrow: diag(1200, ts.DiagnosticCategory.Error, "Line_terminator_not_permitted_before_arrow_1200", "Line terminator not permitted before arrow."),
5235         Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(1202, ts.DiagnosticCategory.Error, "Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_1202", "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."),
5236         Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead: diag(1203, ts.DiagnosticCategory.Error, "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203", "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead."),
5237         Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type: diag(1205, ts.DiagnosticCategory.Error, "Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type_1205", "Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'."),
5238         Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
5239         Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
5240         _0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),
5241         Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),
5242         A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
5243         Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
5244         Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: diag(1213, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."),
5245         Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: diag(1214, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."),
5246         Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
5247         Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
5248         Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
5249         Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
5250         Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
5251         An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
5252         _0_tag_already_specified: diag(1223, ts.DiagnosticCategory.Error, "_0_tag_already_specified_1223", "'{0}' tag already specified."),
5253         Signature_0_must_be_a_type_predicate: diag(1224, ts.DiagnosticCategory.Error, "Signature_0_must_be_a_type_predicate_1224", "Signature '{0}' must be a type predicate."),
5254         Cannot_find_parameter_0: diag(1225, ts.DiagnosticCategory.Error, "Cannot_find_parameter_0_1225", "Cannot find parameter '{0}'."),
5255         Type_predicate_0_is_not_assignable_to_1: diag(1226, ts.DiagnosticCategory.Error, "Type_predicate_0_is_not_assignable_to_1_1226", "Type predicate '{0}' is not assignable to '{1}'."),
5256         Parameter_0_is_not_in_the_same_position_as_parameter_1: diag(1227, ts.DiagnosticCategory.Error, "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", "Parameter '{0}' is not in the same position as parameter '{1}'."),
5257         A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: diag(1228, ts.DiagnosticCategory.Error, "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", "A type predicate is only allowed in return type position for functions and methods."),
5258         A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."),
5259         A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."),
5260         An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."),
5261         An_import_declaration_can_only_be_used_in_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", "An import declaration can only be used in a namespace or module."),
5262         An_export_declaration_can_only_be_used_in_a_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_in_a_module_1233", "An export declaration can only be used in a module."),
5263         An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."),
5264         A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", "A namespace declaration is only allowed in a namespace or module."),
5265         The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."),
5266         The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."),
5267         Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."),
5268         Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: diag(1239, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", "Unable to resolve signature of parameter decorator when called as an expression."),
5269         Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: diag(1240, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", "Unable to resolve signature of property decorator when called as an expression."),
5270         Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: diag(1241, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", "Unable to resolve signature of method decorator when called as an expression."),
5271         abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: diag(1242, ts.DiagnosticCategory.Error, "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", "'abstract' modifier can only appear on a class, method, or property declaration."),
5272         _0_modifier_cannot_be_used_with_1_modifier: diag(1243, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_1_modifier_1243", "'{0}' modifier cannot be used with '{1}' modifier."),
5273         Abstract_methods_can_only_appear_within_an_abstract_class: diag(1244, ts.DiagnosticCategory.Error, "Abstract_methods_can_only_appear_within_an_abstract_class_1244", "Abstract methods can only appear within an abstract class."),
5274         Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: diag(1245, ts.DiagnosticCategory.Error, "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", "Method '{0}' cannot have an implementation because it is marked abstract."),
5275         An_interface_property_cannot_have_an_initializer: diag(1246, ts.DiagnosticCategory.Error, "An_interface_property_cannot_have_an_initializer_1246", "An interface property cannot have an initializer."),
5276         A_type_literal_property_cannot_have_an_initializer: diag(1247, ts.DiagnosticCategory.Error, "A_type_literal_property_cannot_have_an_initializer_1247", "A type literal property cannot have an initializer."),
5277         A_class_member_cannot_have_the_0_keyword: diag(1248, ts.DiagnosticCategory.Error, "A_class_member_cannot_have_the_0_keyword_1248", "A class member cannot have the '{0}' keyword."),
5278         A_decorator_can_only_decorate_a_method_implementation_not_an_overload: diag(1249, ts.DiagnosticCategory.Error, "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", "A decorator can only decorate a method implementation, not an overload."),
5279         Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."),
5280         Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."),
5281         Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."),
5282         A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference: diag(1254, ts.DiagnosticCategory.Error, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),
5283         A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
5284         A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
5285         A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1258, ts.DiagnosticCategory.Error, "A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration_1258", "A default export must be at the top level of a file or module declaration."),
5286         Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
5287         Keywords_cannot_contain_escape_characters: diag(1260, ts.DiagnosticCategory.Error, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
5288         Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, ts.DiagnosticCategory.Error, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
5289         Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
5290         Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, ts.DiagnosticCategory.Error, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
5291         Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, ts.DiagnosticCategory.Error, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
5292         A_rest_element_cannot_follow_another_rest_element: diag(1265, ts.DiagnosticCategory.Error, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
5293         An_optional_element_cannot_follow_a_rest_element: diag(1266, ts.DiagnosticCategory.Error, "An_optional_element_cannot_follow_a_rest_element_1266", "An optional element cannot follow a rest element."),
5294         Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."),
5295         An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),
5296         with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
5297         await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
5298         Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
5299         The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
5300         Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
5301         Global_module_exports_may_only_appear_in_declaration_files: diag(1315, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_declaration_files_1315", "Global module exports may only appear in declaration files."),
5302         Global_module_exports_may_only_appear_at_top_level: diag(1316, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_at_top_level_1316", "Global module exports may only appear at top level."),
5303         A_parameter_property_cannot_be_declared_using_a_rest_parameter: diag(1317, ts.DiagnosticCategory.Error, "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", "A parameter property cannot be declared using a rest parameter."),
5304         An_abstract_accessor_cannot_have_an_implementation: diag(1318, ts.DiagnosticCategory.Error, "An_abstract_accessor_cannot_have_an_implementation_1318", "An abstract accessor cannot have an implementation."),
5305         A_default_export_can_only_be_used_in_an_ECMAScript_style_module: diag(1319, ts.DiagnosticCategory.Error, "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", "A default export can only be used in an ECMAScript-style module."),
5306         Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
5307         Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
5308         Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
5309         Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
5310         Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext'."),
5311         Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
5312         Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
5313         String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
5314         Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),
5315         _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),
5316         A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly: diag(1330, ts.DiagnosticCategory.Error, "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330", "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'."),
5317         A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly: diag(1331, ts.DiagnosticCategory.Error, "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331", "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'."),
5318         A_variable_whose_type_is_a_unique_symbol_type_must_be_const: diag(1332, ts.DiagnosticCategory.Error, "A_variable_whose_type_is_a_unique_symbol_type_must_be_const_1332", "A variable whose type is a 'unique symbol' type must be 'const'."),
5319         unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name: diag(1333, ts.DiagnosticCategory.Error, "unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name_1333", "'unique symbol' types may not be used on a variable declaration with a binding name."),
5320         unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement: diag(1334, ts.DiagnosticCategory.Error, "unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement_1334", "'unique symbol' types are only allowed on variables in a variable statement."),
5321         unique_symbol_types_are_not_allowed_here: diag(1335, ts.DiagnosticCategory.Error, "unique_symbol_types_are_not_allowed_here_1335", "'unique symbol' types are not allowed here."),
5322         An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead: diag(1337, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337", "An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead."),
5323         infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."),
5324         Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
5325         Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
5326         Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
5327         The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'."),
5328         A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
5329         An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
5330         This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
5331         use_strict_directive_cannot_be_used_with_non_simple_parameter_list: diag(1347, ts.DiagnosticCategory.Error, "use_strict_directive_cannot_be_used_with_non_simple_parameter_list_1347", "'use strict' directive cannot be used with non-simple parameter list."),
5332         Non_simple_parameter_declared_here: diag(1348, ts.DiagnosticCategory.Error, "Non_simple_parameter_declared_here_1348", "Non-simple parameter declared here."),
5333         use_strict_directive_used_here: diag(1349, ts.DiagnosticCategory.Error, "use_strict_directive_used_here_1349", "'use strict' directive used here."),
5334         Print_the_final_configuration_instead_of_building: diag(1350, ts.DiagnosticCategory.Message, "Print_the_final_configuration_instead_of_building_1350", "Print the final configuration instead of building."),
5335         An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal: diag(1351, ts.DiagnosticCategory.Error, "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351", "An identifier or keyword cannot immediately follow a numeric literal."),
5336         A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
5337         A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
5338         readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
5339         A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
5340         Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
5341         An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."),
5342         Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."),
5343         Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."),
5344         _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."),
5345         _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."),
5346         A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."),
5347         Convert_to_type_only_export: diag(1364, ts.DiagnosticCategory.Message, "Convert_to_type_only_export_1364", "Convert to type-only export"),
5348         Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"),
5349         Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"),
5350         Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"),
5351         Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"),
5352         This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."),
5353         Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"),
5354         Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, ts.DiagnosticCategory.Message, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"),
5355         await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
5356         _0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
5357         _0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
5358         Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5359         An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
5360         An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
5361         Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `&rbrace;`?"),
5362         Unexpected_token_Did_you_mean_or_gt: diag(1382, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `&gt;`?"),
5363         Only_named_exports_may_use_export_type: diag(1383, ts.DiagnosticCategory.Error, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
5364         A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list: diag(1384, ts.DiagnosticCategory.Error, "A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list_1384", "A 'new' expression with type arguments must always be followed by a parenthesized argument list."),
5365         Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
5366         Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
5367         Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
5368         Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
5369         _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
5370         _0_is_not_allowed_as_a_parameter_name: diag(1390, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."),
5371         An_import_alias_cannot_use_import_type: diag(1392, ts.DiagnosticCategory.Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"),
5372         Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
5373         Imported_via_0_from_file_1_with_packageId_2: diag(1394, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"),
5374         Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions: diag(1395, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions_1395", "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions"),
5375         Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions: diag(1396, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions_1396", "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions"),
5376         Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions: diag(1397, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions_1397", "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions"),
5377         Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions: diag(1398, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions_1398", "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions"),
5378         File_is_included_via_import_here: diag(1399, ts.DiagnosticCategory.Message, "File_is_included_via_import_here_1399", "File is included via import here."),
5379         Referenced_via_0_from_file_1: diag(1400, ts.DiagnosticCategory.Message, "Referenced_via_0_from_file_1_1400", "Referenced via '{0}' from file '{1}'"),
5380         File_is_included_via_reference_here: diag(1401, ts.DiagnosticCategory.Message, "File_is_included_via_reference_here_1401", "File is included via reference here."),
5381         Type_library_referenced_via_0_from_file_1: diag(1402, ts.DiagnosticCategory.Message, "Type_library_referenced_via_0_from_file_1_1402", "Type library referenced via '{0}' from file '{1}'"),
5382         Type_library_referenced_via_0_from_file_1_with_packageId_2: diag(1403, ts.DiagnosticCategory.Message, "Type_library_referenced_via_0_from_file_1_with_packageId_2_1403", "Type library referenced via '{0}' from file '{1}' with packageId '{2}'"),
5383         File_is_included_via_type_library_reference_here: diag(1404, ts.DiagnosticCategory.Message, "File_is_included_via_type_library_reference_here_1404", "File is included via type library reference here."),
5384         Library_referenced_via_0_from_file_1: diag(1405, ts.DiagnosticCategory.Message, "Library_referenced_via_0_from_file_1_1405", "Library referenced via '{0}' from file '{1}'"),
5385         File_is_included_via_library_reference_here: diag(1406, ts.DiagnosticCategory.Message, "File_is_included_via_library_reference_here_1406", "File is included via library reference here."),
5386         Matched_by_include_pattern_0_in_1: diag(1407, ts.DiagnosticCategory.Message, "Matched_by_include_pattern_0_in_1_1407", "Matched by include pattern '{0}' in '{1}'"),
5387         File_is_matched_by_include_pattern_specified_here: diag(1408, ts.DiagnosticCategory.Message, "File_is_matched_by_include_pattern_specified_here_1408", "File is matched by include pattern specified here."),
5388         Part_of_files_list_in_tsconfig_json: diag(1409, ts.DiagnosticCategory.Message, "Part_of_files_list_in_tsconfig_json_1409", "Part of 'files' list in tsconfig.json"),
5389         File_is_matched_by_files_list_specified_here: diag(1410, ts.DiagnosticCategory.Message, "File_is_matched_by_files_list_specified_here_1410", "File is matched by 'files' list specified here."),
5390         Output_from_referenced_project_0_included_because_1_specified: diag(1411, ts.DiagnosticCategory.Message, "Output_from_referenced_project_0_included_because_1_specified_1411", "Output from referenced project '{0}' included because '{1}' specified"),
5391         Output_from_referenced_project_0_included_because_module_is_specified_as_none: diag(1412, ts.DiagnosticCategory.Message, "Output_from_referenced_project_0_included_because_module_is_specified_as_none_1412", "Output from referenced project '{0}' included because '--module' is specified as 'none'"),
5392         File_is_output_from_referenced_project_specified_here: diag(1413, ts.DiagnosticCategory.Message, "File_is_output_from_referenced_project_specified_here_1413", "File is output from referenced project specified here."),
5393         Source_from_referenced_project_0_included_because_1_specified: diag(1414, ts.DiagnosticCategory.Message, "Source_from_referenced_project_0_included_because_1_specified_1414", "Source from referenced project '{0}' included because '{1}' specified"),
5394         Source_from_referenced_project_0_included_because_module_is_specified_as_none: diag(1415, ts.DiagnosticCategory.Message, "Source_from_referenced_project_0_included_because_module_is_specified_as_none_1415", "Source from referenced project '{0}' included because '--module' is specified as 'none'"),
5395         File_is_source_from_referenced_project_specified_here: diag(1416, ts.DiagnosticCategory.Message, "File_is_source_from_referenced_project_specified_here_1416", "File is source from referenced project specified here."),
5396         Entry_point_of_type_library_0_specified_in_compilerOptions: diag(1417, ts.DiagnosticCategory.Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_1417", "Entry point of type library '{0}' specified in compilerOptions"),
5397         Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1: diag(1418, ts.DiagnosticCategory.Message, "Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1_1418", "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'"),
5398         File_is_entry_point_of_type_library_specified_here: diag(1419, ts.DiagnosticCategory.Message, "File_is_entry_point_of_type_library_specified_here_1419", "File is entry point of type library specified here."),
5399         Entry_point_for_implicit_type_library_0: diag(1420, ts.DiagnosticCategory.Message, "Entry_point_for_implicit_type_library_0_1420", "Entry point for implicit type library '{0}'"),
5400         Entry_point_for_implicit_type_library_0_with_packageId_1: diag(1421, ts.DiagnosticCategory.Message, "Entry_point_for_implicit_type_library_0_with_packageId_1_1421", "Entry point for implicit type library '{0}' with packageId '{1}'"),
5401         Library_0_specified_in_compilerOptions: diag(1422, ts.DiagnosticCategory.Message, "Library_0_specified_in_compilerOptions_1422", "Library '{0}' specified in compilerOptions"),
5402         File_is_library_specified_here: diag(1423, ts.DiagnosticCategory.Message, "File_is_library_specified_here_1423", "File is library specified here."),
5403         Default_library: diag(1424, ts.DiagnosticCategory.Message, "Default_library_1424", "Default library"),
5404         Default_library_for_target_0: diag(1425, ts.DiagnosticCategory.Message, "Default_library_for_target_0_1425", "Default library for target '{0}'"),
5405         File_is_default_library_for_target_specified_here: diag(1426, ts.DiagnosticCategory.Message, "File_is_default_library_for_target_specified_here_1426", "File is default library for target specified here."),
5406         Root_file_specified_for_compilation: diag(1427, ts.DiagnosticCategory.Message, "Root_file_specified_for_compilation_1427", "Root file specified for compilation"),
5407         File_is_output_of_project_reference_source_0: diag(1428, ts.DiagnosticCategory.Message, "File_is_output_of_project_reference_source_0_1428", "File is output of project reference source '{0}'"),
5408         File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
5409         The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
5410         for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
5411         Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5412         Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
5413         Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
5414         Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
5415         Decorators_must_precede_the_name_and_all_keywords_of_property_declarations: diag(1436, ts.DiagnosticCategory.Error, "Decorators_must_precede_the_name_and_all_keywords_of_property_declarations_1436", "Decorators must precede the name and all keywords of property declarations."),
5416         Namespace_must_be_given_a_name: diag(1437, ts.DiagnosticCategory.Error, "Namespace_must_be_given_a_name_1437", "Namespace must be given a name."),
5417         Interface_must_be_given_a_name: diag(1438, ts.DiagnosticCategory.Error, "Interface_must_be_given_a_name_1438", "Interface must be given a name."),
5418         Type_alias_must_be_given_a_name: diag(1439, ts.DiagnosticCategory.Error, "Type_alias_must_be_given_a_name_1439", "Type alias must be given a name."),
5419         Variable_declaration_not_allowed_at_this_location: diag(1440, ts.DiagnosticCategory.Error, "Variable_declaration_not_allowed_at_this_location_1440", "Variable declaration not allowed at this location."),
5420         Cannot_start_a_function_call_in_a_type_annotation: diag(1441, ts.DiagnosticCategory.Error, "Cannot_start_a_function_call_in_a_type_annotation_1441", "Cannot start a function call in a type annotation."),
5421         Expected_for_property_initializer: diag(1442, ts.DiagnosticCategory.Error, "Expected_for_property_initializer_1442", "Expected '=' for property initializer."),
5422         Module_declaration_names_may_only_use_or_quoted_strings: diag(1443, ts.DiagnosticCategory.Error, "Module_declaration_names_may_only_use_or_quoted_strings_1443", "Module declaration names may only use ' or \" quoted strings."),
5423         _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1444, ts.DiagnosticCategory.Error, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedMod_1444", "'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),
5424         _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1446, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),
5425         _0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled: diag(1448, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."),
5426         Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
5427         Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
5428         Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
5429         The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
5430         Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
5431         The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
5432         The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
5433         Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
5434         Construct_signature_return_types_0_and_1_are_incompatible: diag(2203, ts.DiagnosticCategory.Error, "Construct_signature_return_types_0_and_1_are_incompatible_2203", "Construct signature return types '{0}' and '{1}' are incompatible.", undefined, true),
5435         Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2204, ts.DiagnosticCategory.Error, "Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204", "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
5436         Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
5437         The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
5438         The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
5439         Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
5440         Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
5441         Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
5442         Circular_definition_of_import_alias_0: diag(2303, ts.DiagnosticCategory.Error, "Circular_definition_of_import_alias_0_2303", "Circular definition of import alias '{0}'."),
5443         Cannot_find_name_0: diag(2304, ts.DiagnosticCategory.Error, "Cannot_find_name_0_2304", "Cannot find name '{0}'."),
5444         Module_0_has_no_exported_member_1: diag(2305, ts.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_2305", "Module '{0}' has no exported member '{1}'."),
5445         File_0_is_not_a_module: diag(2306, ts.DiagnosticCategory.Error, "File_0_is_not_a_module_2306", "File '{0}' is not a module."),
5446         Cannot_find_module_0_or_its_corresponding_type_declarations: diag(2307, ts.DiagnosticCategory.Error, "Cannot_find_module_0_or_its_corresponding_type_declarations_2307", "Cannot find module '{0}' or its corresponding type declarations."),
5447         Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."),
5448         An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."),
5449         Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."),
5450         An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2312, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312", "An interface can only extend an object type or intersection of object types with statically known members."),
5451         Type_parameter_0_has_a_circular_constraint: diag(2313, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."),
5452         Generic_type_0_requires_1_type_argument_s: diag(2314, ts.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."),
5453         Type_0_is_not_generic: diag(2315, ts.DiagnosticCategory.Error, "Type_0_is_not_generic_2315", "Type '{0}' is not generic."),
5454         Global_type_0_must_be_a_class_or_interface_type: diag(2316, ts.DiagnosticCategory.Error, "Global_type_0_must_be_a_class_or_interface_type_2316", "Global type '{0}' must be a class or interface type."),
5455         Global_type_0_must_have_1_type_parameter_s: diag(2317, ts.DiagnosticCategory.Error, "Global_type_0_must_have_1_type_parameter_s_2317", "Global type '{0}' must have {1} type parameter(s)."),
5456         Cannot_find_global_type_0: diag(2318, ts.DiagnosticCategory.Error, "Cannot_find_global_type_0_2318", "Cannot find global type '{0}'."),
5457         Named_property_0_of_types_1_and_2_are_not_identical: diag(2319, ts.DiagnosticCategory.Error, "Named_property_0_of_types_1_and_2_are_not_identical_2319", "Named property '{0}' of types '{1}' and '{2}' are not identical."),
5458         Interface_0_cannot_simultaneously_extend_types_1_and_2: diag(2320, ts.DiagnosticCategory.Error, "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."),
5459         Excessive_stack_depth_comparing_types_0_and_1: diag(2321, ts.DiagnosticCategory.Error, "Excessive_stack_depth_comparing_types_0_and_1_2321", "Excessive stack depth comparing types '{0}' and '{1}'."),
5460         Type_0_is_not_assignable_to_type_1: diag(2322, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_2322", "Type '{0}' is not assignable to type '{1}'."),
5461         Cannot_redeclare_exported_variable_0: diag(2323, ts.DiagnosticCategory.Error, "Cannot_redeclare_exported_variable_0_2323", "Cannot redeclare exported variable '{0}'."),
5462         Property_0_is_missing_in_type_1: diag(2324, ts.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_2324", "Property '{0}' is missing in type '{1}'."),
5463         Property_0_is_private_in_type_1_but_not_in_type_2: diag(2325, ts.DiagnosticCategory.Error, "Property_0_is_private_in_type_1_but_not_in_type_2_2325", "Property '{0}' is private in type '{1}' but not in type '{2}'."),
5464         Types_of_property_0_are_incompatible: diag(2326, ts.DiagnosticCategory.Error, "Types_of_property_0_are_incompatible_2326", "Types of property '{0}' are incompatible."),
5465         Property_0_is_optional_in_type_1_but_required_in_type_2: diag(2327, ts.DiagnosticCategory.Error, "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", "Property '{0}' is optional in type '{1}' but required in type '{2}'."),
5466         Types_of_parameters_0_and_1_are_incompatible: diag(2328, ts.DiagnosticCategory.Error, "Types_of_parameters_0_and_1_are_incompatible_2328", "Types of parameters '{0}' and '{1}' are incompatible."),
5467         Index_signature_for_type_0_is_missing_in_type_1: diag(2329, ts.DiagnosticCategory.Error, "Index_signature_for_type_0_is_missing_in_type_1_2329", "Index signature for type '{0}' is missing in type '{1}'."),
5468         _0_and_1_index_signatures_are_incompatible: diag(2330, ts.DiagnosticCategory.Error, "_0_and_1_index_signatures_are_incompatible_2330", "'{0}' and '{1}' index signatures are incompatible."),
5469         this_cannot_be_referenced_in_a_module_or_namespace_body: diag(2331, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."),
5470         this_cannot_be_referenced_in_current_location: diag(2332, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."),
5471         this_cannot_be_referenced_in_constructor_arguments: diag(2333, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."),
5472         this_cannot_be_referenced_in_a_static_property_initializer: diag(2334, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."),
5473         super_can_only_be_referenced_in_a_derived_class: diag(2335, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."),
5474         super_cannot_be_referenced_in_constructor_arguments: diag(2336, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."),
5475         Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: diag(2337, ts.DiagnosticCategory.Error, "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", "Super calls are not permitted outside constructors or in nested functions inside constructors."),
5476         super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: diag(2338, ts.DiagnosticCategory.Error, "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."),
5477         Property_0_does_not_exist_on_type_1: diag(2339, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_2339", "Property '{0}' does not exist on type '{1}'."),
5478         Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: diag(2340, ts.DiagnosticCategory.Error, "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", "Only public and protected methods of the base class are accessible via the 'super' keyword."),
5479         Property_0_is_private_and_only_accessible_within_class_1: diag(2341, ts.DiagnosticCategory.Error, "Property_0_is_private_and_only_accessible_within_class_1_2341", "Property '{0}' is private and only accessible within class '{1}'."),
5480         This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),
5481         Type_0_does_not_satisfy_the_constraint_1: diag(2344, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."),
5482         Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."),
5483         Call_target_does_not_contain_any_signatures: diag(2346, ts.DiagnosticCategory.Error, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."),
5484         Untyped_function_calls_may_not_accept_type_arguments: diag(2347, ts.DiagnosticCategory.Error, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."),
5485         Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, ts.DiagnosticCategory.Error, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"),
5486         This_expression_is_not_callable: diag(2349, ts.DiagnosticCategory.Error, "This_expression_is_not_callable_2349", "This expression is not callable."),
5487         Only_a_void_function_can_be_called_with_the_new_keyword: diag(2350, ts.DiagnosticCategory.Error, "Only_a_void_function_can_be_called_with_the_new_keyword_2350", "Only a void function can be called with the 'new' keyword."),
5488         This_expression_is_not_constructable: diag(2351, ts.DiagnosticCategory.Error, "This_expression_is_not_constructable_2351", "This expression is not constructable."),
5489         Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first: diag(2352, ts.DiagnosticCategory.Error, "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352", "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."),
5490         Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: diag(2353, ts.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."),
5491         This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: diag(2354, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."),
5492         A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: diag(2355, ts.DiagnosticCategory.Error, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."),
5493         An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, ts.DiagnosticCategory.Error, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),
5494         The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
5495         The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
5496         The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
5497         The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
5498         The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
5499         The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
5500         The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
5501         The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
5502         Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."),
5503         Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."),
5504         This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."),
5505         Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."),
5506         A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."),
5507         A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."),
5508         A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: diag(2371, ts.DiagnosticCategory.Error, "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", "A parameter initializer is only allowed in a function or constructor implementation."),
5509         Parameter_0_cannot_reference_itself: diag(2372, ts.DiagnosticCategory.Error, "Parameter_0_cannot_reference_itself_2372", "Parameter '{0}' cannot reference itself."),
5510         Parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts.DiagnosticCategory.Error, "Parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Parameter '{0}' cannot reference identifier '{1}' declared after it."),
5511         Duplicate_index_signature_for_type_0: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."),
5512         Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2375, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
5513         A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2376, ts.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", "A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers."),
5514         Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
5515         A_get_accessor_must_return_a_value: diag(2378, ts.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
5516         Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
5517         The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, ts.DiagnosticCategory.Error, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
5518         Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
5519         Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
5520         Overload_signatures_must_all_be_public_private_or_protected: diag(2385, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
5521         Overload_signatures_must_all_be_optional_or_required: diag(2386, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_optional_or_required_2386", "Overload signatures must all be optional or required."),
5522         Function_overload_must_be_static: diag(2387, ts.DiagnosticCategory.Error, "Function_overload_must_be_static_2387", "Function overload must be static."),
5523         Function_overload_must_not_be_static: diag(2388, ts.DiagnosticCategory.Error, "Function_overload_must_not_be_static_2388", "Function overload must not be static."),
5524         Function_implementation_name_must_be_0: diag(2389, ts.DiagnosticCategory.Error, "Function_implementation_name_must_be_0_2389", "Function implementation name must be '{0}'."),
5525         Constructor_implementation_is_missing: diag(2390, ts.DiagnosticCategory.Error, "Constructor_implementation_is_missing_2390", "Constructor implementation is missing."),
5526         Function_implementation_is_missing_or_not_immediately_following_the_declaration: diag(2391, ts.DiagnosticCategory.Error, "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", "Function implementation is missing or not immediately following the declaration."),
5527         Multiple_constructor_implementations_are_not_allowed: diag(2392, ts.DiagnosticCategory.Error, "Multiple_constructor_implementations_are_not_allowed_2392", "Multiple constructor implementations are not allowed."),
5528         Duplicate_function_implementation: diag(2393, ts.DiagnosticCategory.Error, "Duplicate_function_implementation_2393", "Duplicate function implementation."),
5529         This_overload_signature_is_not_compatible_with_its_implementation_signature: diag(2394, ts.DiagnosticCategory.Error, "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394", "This overload signature is not compatible with its implementation signature."),
5530         Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: diag(2395, ts.DiagnosticCategory.Error, "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", "Individual declarations in merged declaration '{0}' must be all exported or all local."),
5531         Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: diag(2396, ts.DiagnosticCategory.Error, "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."),
5532         Declaration_name_conflicts_with_built_in_global_identifier_0: diag(2397, ts.DiagnosticCategory.Error, "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", "Declaration name conflicts with built-in global identifier '{0}'."),
5533         constructor_cannot_be_used_as_a_parameter_property_name: diag(2398, ts.DiagnosticCategory.Error, "constructor_cannot_be_used_as_a_parameter_property_name_2398", "'constructor' cannot be used as a parameter property name."),
5534         Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."),
5535         Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."),
5536         Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."),
5537         Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type.  Variable '{0}' must be of type '{1}', but here has type '{2}'."),
5538         The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."),
5539         The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."),
5540         The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."),
5541         The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'."),
5542         Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."),
5543         Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."),
5544         The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."),
5545         Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target: diag(2412, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target."),
5546         Property_0_of_type_1_is_not_assignable_to_2_index_type_3: diag(2411, ts.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_2_index_type_3_2411", "Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'."),
5547         _0_index_type_1_is_not_assignable_to_2_index_type_3: diag(2413, ts.DiagnosticCategory.Error, "_0_index_type_1_is_not_assignable_to_2_index_type_3_2413", "'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'."),
5548         Class_name_cannot_be_0: diag(2414, ts.DiagnosticCategory.Error, "Class_name_cannot_be_0_2414", "Class name cannot be '{0}'."),
5549         Class_0_incorrectly_extends_base_class_1: diag(2415, ts.DiagnosticCategory.Error, "Class_0_incorrectly_extends_base_class_1_2415", "Class '{0}' incorrectly extends base class '{1}'."),
5550         Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: diag(2416, ts.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2_2416", "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'."),
5551         Class_static_side_0_incorrectly_extends_base_class_static_side_1: diag(2417, ts.DiagnosticCategory.Error, "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", "Class static side '{0}' incorrectly extends base class static side '{1}'."),
5552         Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1: diag(2418, ts.DiagnosticCategory.Error, "Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418", "Type of computed property's value is '{0}', which is not assignable to type '{1}'."),
5553         Types_of_construct_signatures_are_incompatible: diag(2419, ts.DiagnosticCategory.Error, "Types_of_construct_signatures_are_incompatible_2419", "Types of construct signatures are incompatible."),
5554         Class_0_incorrectly_implements_interface_1: diag(2420, ts.DiagnosticCategory.Error, "Class_0_incorrectly_implements_interface_1_2420", "Class '{0}' incorrectly implements interface '{1}'."),
5555         A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2422, ts.DiagnosticCategory.Error, "A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_memb_2422", "A class can only implement an object type or intersection of object types with statically known members."),
5556         Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: diag(2423, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."),
5557         Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2425, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."),
5558         Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2426, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."),
5559         Interface_name_cannot_be_0: diag(2427, ts.DiagnosticCategory.Error, "Interface_name_cannot_be_0_2427", "Interface name cannot be '{0}'."),
5560         All_declarations_of_0_must_have_identical_type_parameters: diag(2428, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_type_parameters_2428", "All declarations of '{0}' must have identical type parameters."),
5561         Interface_0_incorrectly_extends_interface_1: diag(2430, ts.DiagnosticCategory.Error, "Interface_0_incorrectly_extends_interface_1_2430", "Interface '{0}' incorrectly extends interface '{1}'."),
5562         Enum_name_cannot_be_0: diag(2431, ts.DiagnosticCategory.Error, "Enum_name_cannot_be_0_2431", "Enum name cannot be '{0}'."),
5563         In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: diag(2432, ts.DiagnosticCategory.Error, "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."),
5564         A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: diag(2433, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", "A namespace declaration cannot be in a different file from a class or function with which it is merged."),
5565         A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: diag(2434, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", "A namespace declaration cannot be located prior to a class or function with which it is merged."),
5566         Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: diag(2435, ts.DiagnosticCategory.Error, "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", "Ambient modules cannot be nested in other modules or namespaces."),
5567         Ambient_module_declaration_cannot_specify_relative_module_name: diag(2436, ts.DiagnosticCategory.Error, "Ambient_module_declaration_cannot_specify_relative_module_name_2436", "Ambient module declaration cannot specify relative module name."),
5568         Module_0_is_hidden_by_a_local_declaration_with_the_same_name: diag(2437, ts.DiagnosticCategory.Error, "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", "Module '{0}' is hidden by a local declaration with the same name."),
5569         Import_name_cannot_be_0: diag(2438, ts.DiagnosticCategory.Error, "Import_name_cannot_be_0_2438", "Import name cannot be '{0}'."),
5570         Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: diag(2439, ts.DiagnosticCategory.Error, "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", "Import or export declaration in an ambient module declaration cannot reference module through relative module name."),
5571         Import_declaration_conflicts_with_local_declaration_of_0: diag(2440, ts.DiagnosticCategory.Error, "Import_declaration_conflicts_with_local_declaration_of_0_2440", "Import declaration conflicts with local declaration of '{0}'."),
5572         Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: diag(2441, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."),
5573         Types_have_separate_declarations_of_a_private_property_0: diag(2442, ts.DiagnosticCategory.Error, "Types_have_separate_declarations_of_a_private_property_0_2442", "Types have separate declarations of a private property '{0}'."),
5574         Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: diag(2443, ts.DiagnosticCategory.Error, "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."),
5575         Property_0_is_protected_in_type_1_but_public_in_type_2: diag(2444, ts.DiagnosticCategory.Error, "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", "Property '{0}' is protected in type '{1}' but public in type '{2}'."),
5576         Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: diag(2445, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."),
5577         Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2: diag(2446, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_cl_2446", "Property '{0}' is protected and only accessible through an instance of class '{1}'. This is an instance of class '{2}'."),
5578         The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: diag(2447, ts.DiagnosticCategory.Error, "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."),
5579         Block_scoped_variable_0_used_before_its_declaration: diag(2448, ts.DiagnosticCategory.Error, "Block_scoped_variable_0_used_before_its_declaration_2448", "Block-scoped variable '{0}' used before its declaration."),
5580         Class_0_used_before_its_declaration: diag(2449, ts.DiagnosticCategory.Error, "Class_0_used_before_its_declaration_2449", "Class '{0}' used before its declaration."),
5581         Enum_0_used_before_its_declaration: diag(2450, ts.DiagnosticCategory.Error, "Enum_0_used_before_its_declaration_2450", "Enum '{0}' used before its declaration."),
5582         Cannot_redeclare_block_scoped_variable_0: diag(2451, ts.DiagnosticCategory.Error, "Cannot_redeclare_block_scoped_variable_0_2451", "Cannot redeclare block-scoped variable '{0}'."),
5583         An_enum_member_cannot_have_a_numeric_name: diag(2452, ts.DiagnosticCategory.Error, "An_enum_member_cannot_have_a_numeric_name_2452", "An enum member cannot have a numeric name."),
5584         Variable_0_is_used_before_being_assigned: diag(2454, ts.DiagnosticCategory.Error, "Variable_0_is_used_before_being_assigned_2454", "Variable '{0}' is used before being assigned."),
5585         Type_alias_0_circularly_references_itself: diag(2456, ts.DiagnosticCategory.Error, "Type_alias_0_circularly_references_itself_2456", "Type alias '{0}' circularly references itself."),
5586         Type_alias_name_cannot_be_0: diag(2457, ts.DiagnosticCategory.Error, "Type_alias_name_cannot_be_0_2457", "Type alias name cannot be '{0}'."),
5587         An_AMD_module_cannot_have_multiple_name_assignments: diag(2458, ts.DiagnosticCategory.Error, "An_AMD_module_cannot_have_multiple_name_assignments_2458", "An AMD module cannot have multiple name assignments."),
5588         Module_0_declares_1_locally_but_it_is_not_exported: diag(2459, ts.DiagnosticCategory.Error, "Module_0_declares_1_locally_but_it_is_not_exported_2459", "Module '{0}' declares '{1}' locally, but it is not exported."),
5589         Module_0_declares_1_locally_but_it_is_exported_as_2: diag(2460, ts.DiagnosticCategory.Error, "Module_0_declares_1_locally_but_it_is_exported_as_2_2460", "Module '{0}' declares '{1}' locally, but it is exported as '{2}'."),
5590         Type_0_is_not_an_array_type: diag(2461, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_2461", "Type '{0}' is not an array type."),
5591         A_rest_element_must_be_last_in_a_destructuring_pattern: diag(2462, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", "A rest element must be last in a destructuring pattern."),
5592         A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: diag(2463, ts.DiagnosticCategory.Error, "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", "A binding pattern parameter cannot be optional in an implementation signature."),
5593         A_computed_property_name_must_be_of_type_string_number_symbol_or_any: diag(2464, ts.DiagnosticCategory.Error, "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", "A computed property name must be of type 'string', 'number', 'symbol', or 'any'."),
5594         this_cannot_be_referenced_in_a_computed_property_name: diag(2465, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_computed_property_name_2465", "'this' cannot be referenced in a computed property name."),
5595         super_cannot_be_referenced_in_a_computed_property_name: diag(2466, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_a_computed_property_name_2466", "'super' cannot be referenced in a computed property name."),
5596         A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: diag(2467, ts.DiagnosticCategory.Error, "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", "A computed property name cannot reference a type parameter from its containing type."),
5597         Cannot_find_global_value_0: diag(2468, ts.DiagnosticCategory.Error, "Cannot_find_global_value_0_2468", "Cannot find global value '{0}'."),
5598         The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, ts.DiagnosticCategory.Error, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."),
5599         Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, ts.DiagnosticCategory.Error, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."),
5600         Enum_declarations_must_all_be_const_or_non_const: diag(2473, ts.DiagnosticCategory.Error, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."),
5601         const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values: diag(2474, ts.DiagnosticCategory.Error, "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474", "const enum member initializers can only contain literal values and other computed enum values."),
5602         const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: diag(2475, ts.DiagnosticCategory.Error, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."),
5603         A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, ts.DiagnosticCategory.Error, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."),
5604         const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."),
5605         const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: diag(2478, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", "'const' enum member initializer was evaluated to disallowed value 'NaN'."),
5606         let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: diag(2480, ts.DiagnosticCategory.Error, "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", "'let' is not allowed to be used as a name in 'let' or 'const' declarations."),
5607         Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: diag(2481, ts.DiagnosticCategory.Error, "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."),
5608         The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."),
5609         Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."),
5610         The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."),
5611         Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator."),
5612         An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."),
5613         The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the '{0}()' method of an iterator must have a 'value' property."),
5614         The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."),
5615         Cannot_redeclare_identifier_0_in_catch_clause: diag(2492, ts.DiagnosticCategory.Error, "Cannot_redeclare_identifier_0_in_catch_clause_2492", "Cannot redeclare identifier '{0}' in catch clause."),
5616         Tuple_type_0_of_length_1_has_no_element_at_index_2: diag(2493, ts.DiagnosticCategory.Error, "Tuple_type_0_of_length_1_has_no_element_at_index_2_2493", "Tuple type '{0}' of length '{1}' has no element at index '{2}'."),
5617         Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: diag(2494, ts.DiagnosticCategory.Error, "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."),
5618         Type_0_is_not_an_array_type_or_a_string_type: diag(2495, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_2495", "Type '{0}' is not an array type or a string type."),
5619         The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: diag(2496, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."),
5620         This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export: diag(2497, ts.DiagnosticCategory.Error, "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497", "This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export."),
5621         Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: diag(2498, ts.DiagnosticCategory.Error, "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", "Module '{0}' uses 'export =' and cannot be used with 'export *'."),
5622         An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2499, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", "An interface can only extend an identifier/qualified-name with optional type arguments."),
5623         A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2500, ts.DiagnosticCategory.Error, "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", "A class can only implement an identifier/qualified-name with optional type arguments."),
5624         A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."),
5625         _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."),
5626         Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."),
5627         Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator."),
5628         A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."),
5629         _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."),
5630         Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."),
5631         No_base_constructor_has_the_specified_number_of_type_arguments: diag(2508, ts.DiagnosticCategory.Error, "No_base_constructor_has_the_specified_number_of_type_arguments_2508", "No base constructor has the specified number of type arguments."),
5632         Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members: diag(2509, ts.DiagnosticCategory.Error, "Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509", "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members."),
5633         Base_constructors_must_all_have_the_same_return_type: diag(2510, ts.DiagnosticCategory.Error, "Base_constructors_must_all_have_the_same_return_type_2510", "Base constructors must all have the same return type."),
5634         Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
5635         Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
5636         Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
5637         Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
5638         All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
5639         Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
5640         A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, ts.DiagnosticCategory.Error, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
5641         An_async_iterator_must_have_a_next_method: diag(2519, ts.DiagnosticCategory.Error, "An_async_iterator_must_have_a_next_method_2519", "An async iterator must have a 'next()' method."),
5642         Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: diag(2520, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."),
5643         The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: diag(2522, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."),
5644         yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, ts.DiagnosticCategory.Error, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."),
5645         await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, ts.DiagnosticCategory.Error, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."),
5646         Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, ts.DiagnosticCategory.Error, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."),
5647         A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, ts.DiagnosticCategory.Error, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."),
5648         The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, ts.DiagnosticCategory.Error, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),
5649         A_module_cannot_have_multiple_default_exports: diag(2528, ts.DiagnosticCategory.Error, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."),
5650         Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: diag(2529, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."),
5651         Property_0_is_incompatible_with_index_signature: diag(2530, ts.DiagnosticCategory.Error, "Property_0_is_incompatible_with_index_signature_2530", "Property '{0}' is incompatible with index signature."),
5652         Object_is_possibly_null: diag(2531, ts.DiagnosticCategory.Error, "Object_is_possibly_null_2531", "Object is possibly 'null'."),
5653         Object_is_possibly_undefined: diag(2532, ts.DiagnosticCategory.Error, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."),
5654         Object_is_possibly_null_or_undefined: diag(2533, ts.DiagnosticCategory.Error, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."),
5655         A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, ts.DiagnosticCategory.Error, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."),
5656         Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, ts.DiagnosticCategory.Error, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."),
5657         Type_0_cannot_be_used_to_index_type_1: diag(2536, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."),
5658         Type_0_has_no_matching_index_signature_for_type_1: diag(2537, ts.DiagnosticCategory.Error, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."),
5659         Type_0_cannot_be_used_as_an_index_type: diag(2538, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."),
5660         Cannot_assign_to_0_because_it_is_not_a_variable: diag(2539, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_not_a_variable_2539", "Cannot assign to '{0}' because it is not a variable."),
5661         Cannot_assign_to_0_because_it_is_a_read_only_property: diag(2540, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_read_only_property_2540", "Cannot assign to '{0}' because it is a read-only property."),
5662         Index_signature_in_type_0_only_permits_reading: diag(2542, ts.DiagnosticCategory.Error, "Index_signature_in_type_0_only_permits_reading_2542", "Index signature in type '{0}' only permits reading."),
5663         Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: diag(2543, ts.DiagnosticCategory.Error, "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."),
5664         Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: diag(2544, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."),
5665         A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: diag(2545, ts.DiagnosticCategory.Error, "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", "A mixin class must have a constructor with a single rest parameter of type 'any[]'."),
5666         The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: diag(2547, ts.DiagnosticCategory.Error, "The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_pro_2547", "The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property."),
5667         Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2548, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."),
5668         Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2549, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."),
5669         Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later: diag(2550, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_c_2550", "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{2}' or later."),
5670         Property_0_does_not_exist_on_type_1_Did_you_mean_2: diag(2551, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"),
5671         Cannot_find_name_0_Did_you_mean_1: diag(2552, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_1_2552", "Cannot find name '{0}'. Did you mean '{1}'?"),
5672         Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: diag(2553, ts.DiagnosticCategory.Error, "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", "Computed values are not permitted in an enum with string valued members."),
5673         Expected_0_arguments_but_got_1: diag(2554, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_2554", "Expected {0} arguments, but got {1}."),
5674         Expected_at_least_0_arguments_but_got_1: diag(2555, ts.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_1_2555", "Expected at least {0} arguments, but got {1}."),
5675         A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter: diag(2556, ts.DiagnosticCategory.Error, "A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter_2556", "A spread argument must either have a tuple type or be passed to a rest parameter."),
5676         Expected_0_type_arguments_but_got_1: diag(2558, ts.DiagnosticCategory.Error, "Expected_0_type_arguments_but_got_1_2558", "Expected {0} type arguments, but got {1}."),
5677         Type_0_has_no_properties_in_common_with_type_1: diag(2559, ts.DiagnosticCategory.Error, "Type_0_has_no_properties_in_common_with_type_1_2559", "Type '{0}' has no properties in common with type '{1}'."),
5678         Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it: diag(2560, ts.DiagnosticCategory.Error, "Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560", "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"),
5679         Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2: diag(2561, ts.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561", "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?"),
5680         Base_class_expressions_cannot_reference_class_type_parameters: diag(2562, ts.DiagnosticCategory.Error, "Base_class_expressions_cannot_reference_class_type_parameters_2562", "Base class expressions cannot reference class type parameters."),
5681         The_containing_function_or_module_body_is_too_large_for_control_flow_analysis: diag(2563, ts.DiagnosticCategory.Error, "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563", "The containing function or module body is too large for control flow analysis."),
5682         Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor: diag(2564, ts.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor_2564", "Property '{0}' has no initializer and is not definitely assigned in the constructor."),
5683         Property_0_is_used_before_being_assigned: diag(2565, ts.DiagnosticCategory.Error, "Property_0_is_used_before_being_assigned_2565", "Property '{0}' is used before being assigned."),
5684         A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."),
5685         Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."),
5686         Property_0_may_not_exist_on_type_1_Did_you_mean_2: diag(2568, ts.DiagnosticCategory.Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),
5687         Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."),
5688         Could_not_find_name_0_Did_you_mean_1: diag(2570, ts.DiagnosticCategory.Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"),
5689         Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
5690         A_rest_element_type_must_be_an_array_type: diag(2574, ts.DiagnosticCategory.Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."),
5691         No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments: diag(2575, ts.DiagnosticCategory.Error, "No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments_2575", "No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments."),
5692         Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead: diag(2576, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead_2576", "Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?"),
5693         Return_type_annotation_circularly_references_itself: diag(2577, ts.DiagnosticCategory.Error, "Return_type_annotation_circularly_references_itself_2577", "Return type annotation circularly references itself."),
5694         Unused_ts_expect_error_directive: diag(2578, ts.DiagnosticCategory.Error, "Unused_ts_expect_error_directive_2578", "Unused '@ts-expect-error' directive."),
5695         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode: diag(2580, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`."),
5696         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery: diag(2581, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`."),
5697         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha: diag(2582, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2582", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`."),
5698         Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later: diag(2583, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2583", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later."),
5699         Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'."),
5700         _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later."),
5701         Cannot_assign_to_0_because_it_is_a_constant: diag(2588, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_constant_2588", "Cannot assign to '{0}' because it is a constant."),
5702         Type_instantiation_is_excessively_deep_and_possibly_infinite: diag(2589, ts.DiagnosticCategory.Error, "Type_instantiation_is_excessively_deep_and_possibly_infinite_2589", "Type instantiation is excessively deep and possibly infinite."),
5703         Expression_produces_a_union_type_that_is_too_complex_to_represent: diag(2590, ts.DiagnosticCategory.Error, "Expression_produces_a_union_type_that_is_too_complex_to_represent_2590", "Expression produces a union type that is too complex to represent."),
5704         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),
5705         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),
5706         Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),
5707         This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
5708         _0_can_only_be_imported_by_using_a_default_import: diag(2595, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."),
5709         _0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),
5710         _0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."),
5711         _0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2598, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using__2598", "'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import."),
5712         JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
5713         Property_0_in_type_1_is_not_assignable_to_type_2: diag(2603, ts.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_type_2_2603", "Property '{0}' in type '{1}' is not assignable to type '{2}'."),
5714         JSX_element_type_0_does_not_have_any_construct_or_call_signatures: diag(2604, ts.DiagnosticCategory.Error, "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", "JSX element type '{0}' does not have any construct or call signatures."),
5715         Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: diag(2606, ts.DiagnosticCategory.Error, "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", "Property '{0}' of JSX spread attribute is not assignable to target property."),
5716         JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: diag(2607, ts.DiagnosticCategory.Error, "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", "JSX element class does not support attributes because it does not have a '{0}' property."),
5717         The_global_type_JSX_0_may_not_have_more_than_one_property: diag(2608, ts.DiagnosticCategory.Error, "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", "The global type 'JSX.{0}' may not have more than one property."),
5718         JSX_spread_child_must_be_an_array_type: diag(2609, ts.DiagnosticCategory.Error, "JSX_spread_child_must_be_an_array_type_2609", "JSX spread child must be an array type."),
5719         _0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property: diag(2610, ts.DiagnosticCategory.Error, "_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610", "'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property."),
5720         _0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor: diag(2611, ts.DiagnosticCategory.Error, "_0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor_2611", "'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor."),
5721         Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration: diag(2612, ts.DiagnosticCategory.Error, "Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_2612", "Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration."),
5722         Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead: diag(2613, ts.DiagnosticCategory.Error, "Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead_2613", "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?"),
5723         Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead: diag(2614, ts.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614", "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?"),
5724         Type_of_property_0_circularly_references_itself_in_mapped_type_1: diag(2615, ts.DiagnosticCategory.Error, "Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615", "Type of property '{0}' circularly references itself in mapped type '{1}'."),
5725         _0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import: diag(2616, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import_2616", "'{0}' can only be imported by using 'import {1} = require({2})' or a default import."),
5726         _0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2617, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_us_2617", "'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import."),
5727         Source_has_0_element_s_but_target_requires_1: diag(2618, ts.DiagnosticCategory.Error, "Source_has_0_element_s_but_target_requires_1_2618", "Source has {0} element(s) but target requires {1}."),
5728         Source_has_0_element_s_but_target_allows_only_1: diag(2619, ts.DiagnosticCategory.Error, "Source_has_0_element_s_but_target_allows_only_1_2619", "Source has {0} element(s) but target allows only {1}."),
5729         Target_requires_0_element_s_but_source_may_have_fewer: diag(2620, ts.DiagnosticCategory.Error, "Target_requires_0_element_s_but_source_may_have_fewer_2620", "Target requires {0} element(s) but source may have fewer."),
5730         Target_allows_only_0_element_s_but_source_may_have_more: diag(2621, ts.DiagnosticCategory.Error, "Target_allows_only_0_element_s_but_source_may_have_more_2621", "Target allows only {0} element(s) but source may have more."),
5731         Source_provides_no_match_for_required_element_at_position_0_in_target: diag(2623, ts.DiagnosticCategory.Error, "Source_provides_no_match_for_required_element_at_position_0_in_target_2623", "Source provides no match for required element at position {0} in target."),
5732         Source_provides_no_match_for_variadic_element_at_position_0_in_target: diag(2624, ts.DiagnosticCategory.Error, "Source_provides_no_match_for_variadic_element_at_position_0_in_target_2624", "Source provides no match for variadic element at position {0} in target."),
5733         Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target: diag(2625, ts.DiagnosticCategory.Error, "Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target_2625", "Variadic element at position {0} in source does not match element at position {1} in target."),
5734         Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target: diag(2626, ts.DiagnosticCategory.Error, "Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target_2626", "Type at position {0} in source is not compatible with type at position {1} in target."),
5735         Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target: diag(2627, ts.DiagnosticCategory.Error, "Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target_2627", "Type at positions {0} through {1} in source is not compatible with type at position {2} in target."),
5736         Cannot_assign_to_0_because_it_is_an_enum: diag(2628, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_enum_2628", "Cannot assign to '{0}' because it is an enum."),
5737         Cannot_assign_to_0_because_it_is_a_class: diag(2629, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_class_2629", "Cannot assign to '{0}' because it is a class."),
5738         Cannot_assign_to_0_because_it_is_a_function: diag(2630, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_function_2630", "Cannot assign to '{0}' because it is a function."),
5739         Cannot_assign_to_0_because_it_is_a_namespace: diag(2631, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_namespace_2631", "Cannot assign to '{0}' because it is a namespace."),
5740         Cannot_assign_to_0_because_it_is_an_import: diag(2632, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_an_import_2632", "Cannot assign to '{0}' because it is an import."),
5741         JSX_property_access_expressions_cannot_include_JSX_namespace_names: diag(2633, ts.DiagnosticCategory.Error, "JSX_property_access_expressions_cannot_include_JSX_namespace_names_2633", "JSX property access expressions cannot include JSX namespace names"),
5742         _0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
5743         Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
5744         A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
5745         Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
5746         Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, ts.DiagnosticCategory.Error, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
5747         JSX_expressions_must_have_one_parent_element: diag(2657, ts.DiagnosticCategory.Error, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
5748         Type_0_provides_no_match_for_the_signature_1: diag(2658, ts.DiagnosticCategory.Error, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
5749         super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, ts.DiagnosticCategory.Error, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
5750         super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: diag(2660, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", "'super' can only be referenced in members of derived classes or object literal expressions."),
5751         Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: diag(2661, ts.DiagnosticCategory.Error, "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", "Cannot export '{0}'. Only local declarations can be exported from a module."),
5752         Cannot_find_name_0_Did_you_mean_the_static_member_1_0: diag(2662, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"),
5753         Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: diag(2663, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"),
5754         Invalid_module_name_in_augmentation_module_0_cannot_be_found: diag(2664, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", "Invalid module name in augmentation, module '{0}' cannot be found."),
5755         Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: diag(2665, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."),
5756         Exports_and_export_assignments_are_not_permitted_in_module_augmentations: diag(2666, ts.DiagnosticCategory.Error, "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", "Exports and export assignments are not permitted in module augmentations."),
5757         Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: diag(2667, ts.DiagnosticCategory.Error, "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."),
5758         export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: diag(2668, ts.DiagnosticCategory.Error, "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."),
5759         Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: diag(2669, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."),
5760         Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: diag(2670, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."),
5761         Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: diag(2671, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", "Cannot augment module '{0}' because it resolves to a non-module entity."),
5762         Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: diag(2672, ts.DiagnosticCategory.Error, "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", "Cannot assign a '{0}' constructor type to a '{1}' constructor type."),
5763         Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: diag(2673, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", "Constructor of class '{0}' is private and only accessible within the class declaration."),
5764         Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: diag(2674, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", "Constructor of class '{0}' is protected and only accessible within the class declaration."),
5765         Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: diag(2675, ts.DiagnosticCategory.Error, "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", "Cannot extend a class '{0}'. Class constructor is marked as private."),
5766         Accessors_must_both_be_abstract_or_non_abstract: diag(2676, ts.DiagnosticCategory.Error, "Accessors_must_both_be_abstract_or_non_abstract_2676", "Accessors must both be abstract or non-abstract."),
5767         A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: diag(2677, ts.DiagnosticCategory.Error, "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", "A type predicate's type must be assignable to its parameter's type."),
5768         Type_0_is_not_comparable_to_type_1: diag(2678, ts.DiagnosticCategory.Error, "Type_0_is_not_comparable_to_type_1_2678", "Type '{0}' is not comparable to type '{1}'."),
5769         A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: diag(2679, ts.DiagnosticCategory.Error, "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."),
5770         A_0_parameter_must_be_the_first_parameter: diag(2680, ts.DiagnosticCategory.Error, "A_0_parameter_must_be_the_first_parameter_2680", "A '{0}' parameter must be the first parameter."),
5771         A_constructor_cannot_have_a_this_parameter: diag(2681, ts.DiagnosticCategory.Error, "A_constructor_cannot_have_a_this_parameter_2681", "A constructor cannot have a 'this' parameter."),
5772         this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: diag(2683, ts.DiagnosticCategory.Error, "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", "'this' implicitly has type 'any' because it does not have a type annotation."),
5773         The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: diag(2684, ts.DiagnosticCategory.Error, "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."),
5774         The_this_types_of_each_signature_are_incompatible: diag(2685, ts.DiagnosticCategory.Error, "The_this_types_of_each_signature_are_incompatible_2685", "The 'this' types of each signature are incompatible."),
5775         _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: diag(2686, ts.DiagnosticCategory.Error, "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."),
5776         All_declarations_of_0_must_have_identical_modifiers: diag(2687, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_modifiers_2687", "All declarations of '{0}' must have identical modifiers."),
5777         Cannot_find_type_definition_file_for_0: diag(2688, ts.DiagnosticCategory.Error, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
5778         Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, ts.DiagnosticCategory.Error, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
5779         _0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
5780         An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, ts.DiagnosticCategory.Error, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
5781         _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
5782         _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
5783         Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
5784         Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects.", true),
5785         The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"),
5786         An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),
5787         Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."),
5788         Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: diag(2699, ts.DiagnosticCategory.Error, "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."),
5789         Rest_types_may_only_be_created_from_object_types: diag(2700, ts.DiagnosticCategory.Error, "Rest_types_may_only_be_created_from_object_types_2700", "Rest types may only be created from object types."),
5790         The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: diag(2701, ts.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", "The target of an object rest assignment must be a variable or a property access."),
5791         _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: diag(2702, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", "'{0}' only refers to a type, but is being used as a namespace here."),
5792         The_operand_of_a_delete_operator_must_be_a_property_reference: diag(2703, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", "The operand of a 'delete' operator must be a property reference."),
5793         The_operand_of_a_delete_operator_cannot_be_a_read_only_property: diag(2704, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", "The operand of a 'delete' operator cannot be a read-only property."),
5794         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: diag(2705, ts.DiagnosticCategory.Error, "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", "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."),
5795         Required_type_parameters_may_not_follow_optional_type_parameters: diag(2706, ts.DiagnosticCategory.Error, "Required_type_parameters_may_not_follow_optional_type_parameters_2706", "Required type parameters may not follow optional type parameters."),
5796         Generic_type_0_requires_between_1_and_2_type_arguments: diag(2707, ts.DiagnosticCategory.Error, "Generic_type_0_requires_between_1_and_2_type_arguments_2707", "Generic type '{0}' requires between {1} and {2} type arguments."),
5797         Cannot_use_namespace_0_as_a_value: diag(2708, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_value_2708", "Cannot use namespace '{0}' as a value."),
5798         Cannot_use_namespace_0_as_a_type: diag(2709, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_type_2709", "Cannot use namespace '{0}' as a type."),
5799         _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: diag(2710, ts.DiagnosticCategory.Error, "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", "'{0}' are specified twice. The attribute named '{0}' will be overwritten."),
5800         A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2711, ts.DiagnosticCategory.Error, "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your '--lib' option."),
5801         A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2712, ts.DiagnosticCategory.Error, "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", "A dynamic import call in ES5/ES3 requires the 'Promise' constructor.  Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option."),
5802         Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1: diag(2713, ts.DiagnosticCategory.Error, "Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713", "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"),
5803         The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context: diag(2714, ts.DiagnosticCategory.Error, "The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context_2714", "The expression of an export assignment must be an identifier or qualified name in an ambient context."),
5804         Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor: diag(2715, ts.DiagnosticCategory.Error, "Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor_2715", "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor."),
5805         Type_parameter_0_has_a_circular_default: diag(2716, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_default_2716", "Type parameter '{0}' has a circular default."),
5806         Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2: diag(2717, ts.DiagnosticCategory.Error, "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717", "Subsequent property declarations must have the same type.  Property '{0}' must be of type '{1}', but here has type '{2}'."),
5807         Duplicate_property_0: diag(2718, ts.DiagnosticCategory.Error, "Duplicate_property_0_2718", "Duplicate property '{0}'."),
5808         Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: diag(2719, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_2719", "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."),
5809         Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass: diag(2720, ts.DiagnosticCategory.Error, "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720", "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?"),
5810         Cannot_invoke_an_object_which_is_possibly_null: diag(2721, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_2721", "Cannot invoke an object which is possibly 'null'."),
5811         Cannot_invoke_an_object_which_is_possibly_undefined: diag(2722, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_undefined_2722", "Cannot invoke an object which is possibly 'undefined'."),
5812         Cannot_invoke_an_object_which_is_possibly_null_or_undefined: diag(2723, ts.DiagnosticCategory.Error, "Cannot_invoke_an_object_which_is_possibly_null_or_undefined_2723", "Cannot invoke an object which is possibly 'null' or 'undefined'."),
5813         _0_has_no_exported_member_named_1_Did_you_mean_2: diag(2724, ts.DiagnosticCategory.Error, "_0_has_no_exported_member_named_1_Did_you_mean_2_2724", "'{0}' has no exported member named '{1}'. Did you mean '{2}'?"),
5814         Class_name_cannot_be_Object_when_targeting_ES5_with_module_0: diag(2725, ts.DiagnosticCategory.Error, "Class_name_cannot_be_Object_when_targeting_ES5_with_module_0_2725", "Class name cannot be 'Object' when targeting ES5 with module {0}."),
5815         Cannot_find_lib_definition_for_0: diag(2726, ts.DiagnosticCategory.Error, "Cannot_find_lib_definition_for_0_2726", "Cannot find lib definition for '{0}'."),
5816         Cannot_find_lib_definition_for_0_Did_you_mean_1: diag(2727, ts.DiagnosticCategory.Error, "Cannot_find_lib_definition_for_0_Did_you_mean_1_2727", "Cannot find lib definition for '{0}'. Did you mean '{1}'?"),
5817         _0_is_declared_here: diag(2728, ts.DiagnosticCategory.Message, "_0_is_declared_here_2728", "'{0}' is declared here."),
5818         Property_0_is_used_before_its_initialization: diag(2729, ts.DiagnosticCategory.Error, "Property_0_is_used_before_its_initialization_2729", "Property '{0}' is used before its initialization."),
5819         An_arrow_function_cannot_have_a_this_parameter: diag(2730, ts.DiagnosticCategory.Error, "An_arrow_function_cannot_have_a_this_parameter_2730", "An arrow function cannot have a 'this' parameter."),
5820         Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String: diag(2731, ts.DiagnosticCategory.Error, "Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_i_2731", "Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'."),
5821         Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension: diag(2732, ts.DiagnosticCategory.Error, "Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension_2732", "Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension."),
5822         Property_0_was_also_declared_here: diag(2733, ts.DiagnosticCategory.Error, "Property_0_was_also_declared_here_2733", "Property '{0}' was also declared here."),
5823         Are_you_missing_a_semicolon: diag(2734, ts.DiagnosticCategory.Error, "Are_you_missing_a_semicolon_2734", "Are you missing a semicolon?"),
5824         Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1: diag(2735, ts.DiagnosticCategory.Error, "Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1_2735", "Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?"),
5825         Operator_0_cannot_be_applied_to_type_1: diag(2736, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_type_1_2736", "Operator '{0}' cannot be applied to type '{1}'."),
5826         BigInt_literals_are_not_available_when_targeting_lower_than_ES2020: diag(2737, ts.DiagnosticCategory.Error, "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737", "BigInt literals are not available when targeting lower than ES2020."),
5827         An_outer_value_of_this_is_shadowed_by_this_container: diag(2738, ts.DiagnosticCategory.Message, "An_outer_value_of_this_is_shadowed_by_this_container_2738", "An outer value of 'this' is shadowed by this container."),
5828         Type_0_is_missing_the_following_properties_from_type_1_Colon_2: diag(2739, ts.DiagnosticCategory.Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_2739", "Type '{0}' is missing the following properties from type '{1}': {2}"),
5829         Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more: diag(2740, ts.DiagnosticCategory.Error, "Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more_2740", "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more."),
5830         Property_0_is_missing_in_type_1_but_required_in_type_2: diag(2741, ts.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_but_required_in_type_2_2741", "Property '{0}' is missing in type '{1}' but required in type '{2}'."),
5831         The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary: diag(2742, ts.DiagnosticCategory.Error, "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742", "The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary."),
5832         No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments: diag(2743, ts.DiagnosticCategory.Error, "No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments_2743", "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments."),
5833         Type_parameter_defaults_can_only_reference_previously_declared_type_parameters: diag(2744, ts.DiagnosticCategory.Error, "Type_parameter_defaults_can_only_reference_previously_declared_type_parameters_2744", "Type parameter defaults can only reference previously declared type parameters."),
5834         This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided: diag(2745, ts.DiagnosticCategory.Error, "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745", "This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided."),
5835         This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided: diag(2746, ts.DiagnosticCategory.Error, "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746", "This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided."),
5836         _0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2: diag(2747, ts.DiagnosticCategory.Error, "_0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_t_2747", "'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'."),
5837         Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided: diag(2748, ts.DiagnosticCategory.Error, "Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided_2748", "Cannot access ambient const enums when the '--isolatedModules' flag is provided."),
5838         _0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0: diag(2749, ts.DiagnosticCategory.Error, "_0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0_2749", "'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?"),
5839         The_implementation_signature_is_declared_here: diag(2750, ts.DiagnosticCategory.Error, "The_implementation_signature_is_declared_here_2750", "The implementation signature is declared here."),
5840         Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
5841         The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
5842         Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
5843         super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
5844         No_constituent_of_type_0_is_callable: diag(2755, ts.DiagnosticCategory.Error, "No_constituent_of_type_0_is_callable_2755", "No constituent of type '{0}' is callable."),
5845         Not_all_constituents_of_type_0_are_callable: diag(2756, ts.DiagnosticCategory.Error, "Not_all_constituents_of_type_0_are_callable_2756", "Not all constituents of type '{0}' are callable."),
5846         Type_0_has_no_call_signatures: diag(2757, ts.DiagnosticCategory.Error, "Type_0_has_no_call_signatures_2757", "Type '{0}' has no call signatures."),
5847         Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other: diag(2758, ts.DiagnosticCategory.Error, "Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758", "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other."),
5848         No_constituent_of_type_0_is_constructable: diag(2759, ts.DiagnosticCategory.Error, "No_constituent_of_type_0_is_constructable_2759", "No constituent of type '{0}' is constructable."),
5849         Not_all_constituents_of_type_0_are_constructable: diag(2760, ts.DiagnosticCategory.Error, "Not_all_constituents_of_type_0_are_constructable_2760", "Not all constituents of type '{0}' are constructable."),
5850         Type_0_has_no_construct_signatures: diag(2761, ts.DiagnosticCategory.Error, "Type_0_has_no_construct_signatures_2761", "Type '{0}' has no construct signatures."),
5851         Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other: diag(2762, ts.DiagnosticCategory.Error, "Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762", "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other."),
5852         Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0: diag(2763, ts.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_s_2763", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'."),
5853         Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0: diag(2764, ts.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_al_2764", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'."),
5854         Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0: diag(2765, ts.DiagnosticCategory.Error, "Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring__2765", "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'."),
5855         Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0: diag(2766, ts.DiagnosticCategory.Error, "Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766", "Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'."),
5856         The_0_property_of_an_iterator_must_be_a_method: diag(2767, ts.DiagnosticCategory.Error, "The_0_property_of_an_iterator_must_be_a_method_2767", "The '{0}' property of an iterator must be a method."),
5857         The_0_property_of_an_async_iterator_must_be_a_method: diag(2768, ts.DiagnosticCategory.Error, "The_0_property_of_an_async_iterator_must_be_a_method_2768", "The '{0}' property of an async iterator must be a method."),
5858         No_overload_matches_this_call: diag(2769, ts.DiagnosticCategory.Error, "No_overload_matches_this_call_2769", "No overload matches this call."),
5859         The_last_overload_gave_the_following_error: diag(2770, ts.DiagnosticCategory.Error, "The_last_overload_gave_the_following_error_2770", "The last overload gave the following error."),
5860         The_last_overload_is_declared_here: diag(2771, ts.DiagnosticCategory.Error, "The_last_overload_is_declared_here_2771", "The last overload is declared here."),
5861         Overload_0_of_1_2_gave_the_following_error: diag(2772, ts.DiagnosticCategory.Error, "Overload_0_of_1_2_gave_the_following_error_2772", "Overload {0} of {1}, '{2}', gave the following error."),
5862         Did_you_forget_to_use_await: diag(2773, ts.DiagnosticCategory.Error, "Did_you_forget_to_use_await_2773", "Did you forget to use 'await'?"),
5863         This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead: diag(2774, ts.DiagnosticCategory.Error, "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774", "This condition will always return true since this function is always defined. Did you mean to call it instead?"),
5864         Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation: diag(2775, ts.DiagnosticCategory.Error, "Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation_2775", "Assertions require every name in the call target to be declared with an explicit type annotation."),
5865         Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name: diag(2776, ts.DiagnosticCategory.Error, "Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name_2776", "Assertions require the call target to be an identifier or qualified name."),
5866         The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access: diag(2777, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777", "The operand of an increment or decrement operator may not be an optional property access."),
5867         The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access: diag(2778, ts.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access_2778", "The target of an object rest assignment may not be an optional property access."),
5868         The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access: diag(2779, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779", "The left-hand side of an assignment expression may not be an optional property access."),
5869         The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access: diag(2780, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780", "The left-hand side of a 'for...in' statement may not be an optional property access."),
5870         The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access: diag(2781, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781", "The left-hand side of a 'for...of' statement may not be an optional property access."),
5871         _0_needs_an_explicit_type_annotation: diag(2782, ts.DiagnosticCategory.Message, "_0_needs_an_explicit_type_annotation_2782", "'{0}' needs an explicit type annotation."),
5872         _0_is_specified_more_than_once_so_this_usage_will_be_overwritten: diag(2783, ts.DiagnosticCategory.Error, "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783", "'{0}' is specified more than once, so this usage will be overwritten."),
5873         get_and_set_accessors_cannot_declare_this_parameters: diag(2784, ts.DiagnosticCategory.Error, "get_and_set_accessors_cannot_declare_this_parameters_2784", "'get' and 'set' accessors cannot declare 'this' parameters."),
5874         This_spread_always_overwrites_this_property: diag(2785, ts.DiagnosticCategory.Error, "This_spread_always_overwrites_this_property_2785", "This spread always overwrites this property."),
5875         _0_cannot_be_used_as_a_JSX_component: diag(2786, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_JSX_component_2786", "'{0}' cannot be used as a JSX component."),
5876         Its_return_type_0_is_not_a_valid_JSX_element: diag(2787, ts.DiagnosticCategory.Error, "Its_return_type_0_is_not_a_valid_JSX_element_2787", "Its return type '{0}' is not a valid JSX element."),
5877         Its_instance_type_0_is_not_a_valid_JSX_element: diag(2788, ts.DiagnosticCategory.Error, "Its_instance_type_0_is_not_a_valid_JSX_element_2788", "Its instance type '{0}' is not a valid JSX element."),
5878         Its_element_type_0_is_not_a_valid_JSX_element: diag(2789, ts.DiagnosticCategory.Error, "Its_element_type_0_is_not_a_valid_JSX_element_2789", "Its element type '{0}' is not a valid JSX element."),
5879         The_operand_of_a_delete_operator_must_be_optional: diag(2790, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_optional_2790", "The operand of a 'delete' operator must be optional."),
5880         Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later: diag(2791, ts.DiagnosticCategory.Error, "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791", "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later."),
5881         Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option: diag(2792, ts.DiagnosticCategory.Error, "Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_th_2792", "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?"),
5882         The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible: diag(2793, ts.DiagnosticCategory.Error, "The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_2793", "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible."),
5883         Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise: diag(2794, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise_2794", "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?"),
5884         The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types: diag(2795, ts.DiagnosticCategory.Error, "The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types_2795", "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types."),
5885         It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked: diag(2796, ts.DiagnosticCategory.Error, "It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tag_2796", "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked."),
5886         A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract: diag(2797, ts.DiagnosticCategory.Error, "A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_2797", "A mixin class that extends from a type variable containing an abstract construct signature must also be declared 'abstract'."),
5887         The_declaration_was_marked_as_deprecated_here: diag(2798, ts.DiagnosticCategory.Error, "The_declaration_was_marked_as_deprecated_here_2798", "The declaration was marked as deprecated here."),
5888         Type_produces_a_tuple_type_that_is_too_large_to_represent: diag(2799, ts.DiagnosticCategory.Error, "Type_produces_a_tuple_type_that_is_too_large_to_represent_2799", "Type produces a tuple type that is too large to represent."),
5889         Expression_produces_a_tuple_type_that_is_too_large_to_represent: diag(2800, ts.DiagnosticCategory.Error, "Expression_produces_a_tuple_type_that_is_too_large_to_represent_2800", "Expression produces a tuple type that is too large to represent."),
5890         This_condition_will_always_return_true_since_this_0_is_always_defined: diag(2801, ts.DiagnosticCategory.Error, "This_condition_will_always_return_true_since_this_0_is_always_defined_2801", "This condition will always return true since this '{0}' is always defined."),
5891         Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher: diag(2802, ts.DiagnosticCategory.Error, "Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802", "Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."),
5892         Cannot_assign_to_private_method_0_Private_methods_are_not_writable: diag(2803, ts.DiagnosticCategory.Error, "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803", "Cannot assign to private method '{0}'. Private methods are not writable."),
5893         Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name: diag(2804, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804", "Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."),
5894         Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag: diag(2805, ts.DiagnosticCategory.Error, "Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_no_2805", "Static fields with private names can't have initializers when the '--useDefineForClassFields' flag is not specified with a '--target' of 'esnext'. Consider adding the '--useDefineForClassFields' flag."),
5895         Private_accessor_was_defined_without_a_getter: diag(2806, ts.DiagnosticCategory.Error, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
5896         This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
5897         A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
5898         Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
5899         Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false: diag(2810, ts.DiagnosticCategory.Error, "Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnex_2810", "Property '{0}' may not be used in a static property's initializer in the same class when 'target' is 'esnext' and 'useDefineForClassFields' is 'false'."),
5900         Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
5901         Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
5902         Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
5903         Function_with_bodies_can_only_merge_with_classes_that_are_ambient: diag(2814, ts.DiagnosticCategory.Error, "Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814", "Function with bodies can only merge with classes that are ambient."),
5904         arguments_cannot_be_referenced_in_property_initializers: diag(2815, ts.DiagnosticCategory.Error, "arguments_cannot_be_referenced_in_property_initializers_2815", "'arguments' cannot be referenced in property initializers."),
5905         Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class: diag(2816, ts.DiagnosticCategory.Error, "Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816", "Cannot use 'this' in a static property initializer of a decorated class."),
5906         Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, ts.DiagnosticCategory.Error, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."),
5907         Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
5908         Namespace_name_cannot_be_0: diag(2819, ts.DiagnosticCategory.Error, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
5909         Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
5910         Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
5911         Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
5912         Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
5913         Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
5914         Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
5915         Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
5916         Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
5917         Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
5918         Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4006, ts.DiagnosticCategory.Error, "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),
5919         Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4008, ts.DiagnosticCategory.Error, "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),
5920         Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4010, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."),
5921         Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4012, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", "Type parameter '{0}' of public method from exported class has or is using private name '{1}'."),
5922         Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4014, ts.DiagnosticCategory.Error, "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", "Type parameter '{0}' of method from exported interface has or is using private name '{1}'."),
5923         Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4016, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", "Type parameter '{0}' of exported function has or is using private name '{1}'."),
5924         Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4019, ts.DiagnosticCategory.Error, "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", "Implements clause of exported class '{0}' has or is using private name '{1}'."),
5925         extends_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4020, ts.DiagnosticCategory.Error, "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", "'extends' clause of exported class '{0}' has or is using private name '{1}'."),
5926         extends_clause_of_exported_class_has_or_is_using_private_name_0: diag(4021, ts.DiagnosticCategory.Error, "extends_clause_of_exported_class_has_or_is_using_private_name_0_4021", "'extends' clause of exported class has or is using private name '{0}'."),
5927         extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: diag(4022, ts.DiagnosticCategory.Error, "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", "'extends' clause of exported interface '{0}' has or is using private name '{1}'."),
5928         Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4023, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."),
5929         Exported_variable_0_has_or_is_using_name_1_from_private_module_2: diag(4024, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", "Exported variable '{0}' has or is using name '{1}' from private module '{2}'."),
5930         Exported_variable_0_has_or_is_using_private_name_1: diag(4025, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_private_name_1_4025", "Exported variable '{0}' has or is using private name '{1}'."),
5931         Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4026, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
5932         Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4027, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
5933         Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4028, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", "Public static property '{0}' of exported class has or is using private name '{1}'."),
5934         Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4029, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
5935         Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4030, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
5936         Public_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4031, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", "Public property '{0}' of exported class has or is using private name '{1}'."),
5937         Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4032, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
5938         Property_0_of_exported_interface_has_or_is_using_private_name_1: diag(4033, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", "Property '{0}' of exported interface has or is using private name '{1}'."),
5939         Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4034, ts.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_mod_4034", "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),
5940         Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4035, ts.DiagnosticCategory.Error, "Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1_4035", "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'."),
5941         Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4036, ts.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4036", "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),
5942         Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1: diag(4037, ts.DiagnosticCategory.Error, "Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1_4037", "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'."),
5943         Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4038, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_modul_4038", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),
5944         Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4039, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_4039", "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),
5945         Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4040, ts.DiagnosticCategory.Error, "Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1_4040", "Return type of public static getter '{0}' from exported class has or is using private name '{1}'."),
5946         Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4041, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_4041", "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named."),
5947         Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4042, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2_4042", "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'."),
5948         Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1: diag(4043, ts.DiagnosticCategory.Error, "Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1_4043", "Return type of public getter '{0}' from exported class has or is using private name '{1}'."),
5949         Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4044, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."),
5950         Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4045, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", "Return type of constructor signature from exported interface has or is using private name '{0}'."),
5951         Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4046, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."),
5952         Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4047, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", "Return type of call signature from exported interface has or is using private name '{0}'."),
5953         Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4048, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."),
5954         Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4049, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", "Return type of index signature from exported interface has or is using private name '{0}'."),
5955         Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4050, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."),
5956         Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4051, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."),
5957         Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: diag(4052, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", "Return type of public static method from exported class has or is using private name '{0}'."),
5958         Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4053, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."),
5959         Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4054, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", "Return type of public method from exported class has or is using name '{0}' from private module '{1}'."),
5960         Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: diag(4055, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", "Return type of public method from exported class has or is using private name '{0}'."),
5961         Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4056, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", "Return type of method from exported interface has or is using name '{0}' from private module '{1}'."),
5962         Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: diag(4057, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", "Return type of method from exported interface has or is using private name '{0}'."),
5963         Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4058, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."),
5964         Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: diag(4059, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", "Return type of exported function has or is using name '{0}' from private module '{1}'."),
5965         Return_type_of_exported_function_has_or_is_using_private_name_0: diag(4060, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", "Return type of exported function has or is using private name '{0}'."),
5966         Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4061, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."),
5967         Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4062, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."),
5968         Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: diag(4063, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", "Parameter '{0}' of constructor from exported class has or is using private name '{1}'."),
5969         Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4064, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."),
5970         Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4065, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."),
5971         Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4066, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."),
5972         Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4067, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."),
5973         Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4068, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."),
5974         Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4069, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."),
5975         Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4070, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", "Parameter '{0}' of public static method from exported class has or is using private name '{1}'."),
5976         Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4071, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."),
5977         Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4072, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."),
5978         Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4073, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", "Parameter '{0}' of public method from exported class has or is using private name '{1}'."),
5979         Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4074, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."),
5980         Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4075, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", "Parameter '{0}' of method from exported interface has or is using private name '{1}'."),
5981         Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4076, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."),
5982         Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: diag(4077, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."),
5983         Parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4078, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", "Parameter '{0}' of exported function has or is using private name '{1}'."),
5984         Exported_type_alias_0_has_or_is_using_private_name_1: diag(4081, ts.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_4081", "Exported type alias '{0}' has or is using private name '{1}'."),
5985         Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, ts.DiagnosticCategory.Error, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
5986         Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
5987         Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, ts.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
5988         Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, ts.DiagnosticCategory.Error, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
5989         Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
5990         Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
5991         Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, ts.DiagnosticCategory.Error, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."),
5992         Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
5993         Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
5994         Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, ts.DiagnosticCategory.Error, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."),
5995         Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4098, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098", "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
5996         Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4099, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099", "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
5997         Public_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4100, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100", "Public method '{0}' of exported class has or is using private name '{1}'."),
5998         Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
5999         Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
6000         Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
6001         The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
6002         Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter: diag(4105, ts.DiagnosticCategory.Error, "Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter_4105", "Private or protected member '{0}' cannot be accessed on a type parameter."),
6003         Parameter_0_of_accessor_has_or_is_using_private_name_1: diag(4106, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_private_name_1_4106", "Parameter '{0}' of accessor has or is using private name '{1}'."),
6004         Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2: diag(4107, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2_4107", "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'."),
6005         Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4108, ts.DiagnosticCategory.Error, "Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4108", "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named."),
6006         Type_arguments_for_0_circularly_reference_themselves: diag(4109, ts.DiagnosticCategory.Error, "Type_arguments_for_0_circularly_reference_themselves_4109", "Type arguments for '{0}' circularly reference themselves."),
6007         Tuple_type_arguments_circularly_reference_themselves: diag(4110, ts.DiagnosticCategory.Error, "Tuple_type_arguments_circularly_reference_themselves_4110", "Tuple type arguments circularly reference themselves."),
6008         Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0: diag(4111, ts.DiagnosticCategory.Error, "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111", "Property '{0}' comes from an index signature, so it must be accessed with ['{0}']."),
6009         This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class: diag(4112, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another__4112", "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class."),
6010         This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0: diag(4113, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_4113", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'."),
6011         This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0: diag(4114, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114", "This member must have an 'override' modifier because it overrides a member in the base class '{0}'."),
6012         This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0: diag(4115, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0_4115", "This parameter property must have an 'override' modifier because it overrides a member in base class '{0}'."),
6013         This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),
6014         This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
6015         The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."),
6016         This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
6017         This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
6018         This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
6019         This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
6020         This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
6021         Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6022         The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
6023         Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
6024         File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
6025         Cannot_read_file_0_Colon_1: diag(5012, ts.DiagnosticCategory.Error, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."),
6026         Failed_to_parse_file_0_Colon_1: diag(5014, ts.DiagnosticCategory.Error, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."),
6027         Unknown_compiler_option_0: diag(5023, ts.DiagnosticCategory.Error, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
6028         Compiler_option_0_requires_a_value_of_type_1: diag(5024, ts.DiagnosticCategory.Error, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."),
6029         Unknown_compiler_option_0_Did_you_mean_1: diag(5025, ts.DiagnosticCategory.Error, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"),
6030         Could_not_write_file_0_Colon_1: diag(5033, ts.DiagnosticCategory.Error, "Could_not_write_file_0_Colon_1_5033", "Could not write file '{0}': {1}."),
6031         Option_project_cannot_be_mixed_with_source_files_on_a_command_line: diag(5042, ts.DiagnosticCategory.Error, "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", "Option 'project' cannot be mixed with source files on a command line."),
6032         Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: diag(5047, ts.DiagnosticCategory.Error, "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."),
6033         Option_0_cannot_be_specified_when_option_target_is_ES3: diag(5048, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_when_option_target_is_ES3_5048", "Option '{0}' cannot be specified when option 'target' is 'ES3'."),
6034         Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: diag(5051, ts.DiagnosticCategory.Error, "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."),
6035         Option_0_cannot_be_specified_without_specifying_option_1: diag(5052, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_5052", "Option '{0}' cannot be specified without specifying option '{1}'."),
6036         Option_0_cannot_be_specified_with_option_1: diag(5053, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_with_option_1_5053", "Option '{0}' cannot be specified with option '{1}'."),
6037         A_tsconfig_json_file_is_already_defined_at_Colon_0: diag(5054, ts.DiagnosticCategory.Error, "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", "A 'tsconfig.json' file is already defined at: '{0}'."),
6038         Cannot_write_file_0_because_it_would_overwrite_input_file: diag(5055, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", "Cannot write file '{0}' because it would overwrite input file."),
6039         Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: diag(5056, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", "Cannot write file '{0}' because it would be overwritten by multiple input files."),
6040         Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: diag(5057, ts.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", "Cannot find a tsconfig.json file at the specified directory: '{0}'."),
6041         The_specified_path_does_not_exist_Colon_0: diag(5058, ts.DiagnosticCategory.Error, "The_specified_path_does_not_exist_Colon_0_5058", "The specified path does not exist: '{0}'."),
6042         Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: diag(5059, ts.DiagnosticCategory.Error, "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."),
6043         Pattern_0_can_have_at_most_one_Asterisk_character: diag(5061, ts.DiagnosticCategory.Error, "Pattern_0_can_have_at_most_one_Asterisk_character_5061", "Pattern '{0}' can have at most one '*' character."),
6044         Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character: diag(5062, ts.DiagnosticCategory.Error, "Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character_5062", "Substitution '{0}' in pattern '{1}' can have at most one '*' character."),
6045         Substitutions_for_pattern_0_should_be_an_array: diag(5063, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_should_be_an_array_5063", "Substitutions for pattern '{0}' should be an array."),
6046         Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: diag(5064, ts.DiagnosticCategory.Error, "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."),
6047         File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5065, ts.DiagnosticCategory.Error, "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."),
6048         Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: diag(5066, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", "Substitutions for pattern '{0}' shouldn't be an empty array."),
6049         Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(5067, ts.DiagnosticCategory.Error, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."),
6050         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: diag(5068, ts.DiagnosticCategory.Error, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),
6051         Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),
6052         Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy: diag(5070, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy_5070", "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy."),
6053         Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
6054         Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
6055         Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
6056         Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),
6057         _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
6058         _0_and_1_operations_cannot_be_mixed_without_parentheses: diag(5076, ts.DiagnosticCategory.Error, "_0_and_1_operations_cannot_be_mixed_without_parentheses_5076", "'{0}' and '{1}' operations cannot be mixed without parentheses."),
6059         Unknown_build_option_0_Did_you_mean_1: diag(5077, ts.DiagnosticCategory.Error, "Unknown_build_option_0_Did_you_mean_1_5077", "Unknown build option '{0}'. Did you mean '{1}'?"),
6060         Unknown_watch_option_0: diag(5078, ts.DiagnosticCategory.Error, "Unknown_watch_option_0_5078", "Unknown watch option '{0}'."),
6061         Unknown_watch_option_0_Did_you_mean_1: diag(5079, ts.DiagnosticCategory.Error, "Unknown_watch_option_0_Did_you_mean_1_5079", "Unknown watch option '{0}'. Did you mean '{1}'?"),
6062         Watch_option_0_requires_a_value_of_type_1: diag(5080, ts.DiagnosticCategory.Error, "Watch_option_0_requires_a_value_of_type_1_5080", "Watch option '{0}' requires a value of type {1}."),
6063         Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, ts.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."),
6064         _0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, ts.DiagnosticCategory.Error, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),
6065         Cannot_read_file_0: diag(5083, ts.DiagnosticCategory.Error, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
6066         Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, ts.DiagnosticCategory.Error, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."),
6067         A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, ts.DiagnosticCategory.Error, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."),
6068         A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, ts.DiagnosticCategory.Error, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),
6069         A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, ts.DiagnosticCategory.Error, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),
6070         The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary: diag(5088, ts.DiagnosticCategory.Error, "The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088", "The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary."),
6071         Option_0_cannot_be_specified_when_option_jsx_is_1: diag(5089, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_when_option_jsx_is_1_5089", "Option '{0}' cannot be specified when option 'jsx' is '{1}'."),
6072         Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash: diag(5090, ts.DiagnosticCategory.Error, "Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash_5090", "Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"),
6073         Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled: diag(5091, ts.DiagnosticCategory.Error, "Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled_5091", "Option 'preserveConstEnums' cannot be disabled when 'isolatedModules' is enabled."),
6074         The_root_value_of_a_0_file_must_be_an_object: diag(5092, ts.DiagnosticCategory.Error, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
6075         Compiler_option_0_may_only_be_used_with_build: diag(5093, ts.DiagnosticCategory.Error, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
6076         Compiler_option_0_may_not_be_used_with_build: diag(5094, ts.DiagnosticCategory.Error, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
6077         Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, ts.DiagnosticCategory.Error, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
6078         Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
6079         Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
6080         Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
6081         Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: diag(6004, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", "Specify the location where debugger should locate TypeScript files instead of source locations."),
6082         Watch_input_files: diag(6005, ts.DiagnosticCategory.Message, "Watch_input_files_6005", "Watch input files."),
6083         Redirect_output_structure_to_the_directory: diag(6006, ts.DiagnosticCategory.Message, "Redirect_output_structure_to_the_directory_6006", "Redirect output structure to the directory."),
6084         Do_not_erase_const_enum_declarations_in_generated_code: diag(6007, ts.DiagnosticCategory.Message, "Do_not_erase_const_enum_declarations_in_generated_code_6007", "Do not erase const enum declarations in generated code."),
6085         Do_not_emit_outputs_if_any_errors_were_reported: diag(6008, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_if_any_errors_were_reported_6008", "Do not emit outputs if any errors were reported."),
6086         Do_not_emit_comments_to_output: diag(6009, ts.DiagnosticCategory.Message, "Do_not_emit_comments_to_output_6009", "Do not emit comments to output."),
6087         Do_not_emit_outputs: diag(6010, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_6010", "Do not emit outputs."),
6088         Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: diag(6011, ts.DiagnosticCategory.Message, "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", "Allow default imports from modules with no default export. This does not affect code emit, just typechecking."),
6089         Skip_type_checking_of_declaration_files: diag(6012, ts.DiagnosticCategory.Message, "Skip_type_checking_of_declaration_files_6012", "Skip type checking of declaration files."),
6090         Do_not_resolve_the_real_path_of_symlinks: diag(6013, ts.DiagnosticCategory.Message, "Do_not_resolve_the_real_path_of_symlinks_6013", "Do not resolve the real path of symlinks."),
6091         Only_emit_d_ts_declaration_files: diag(6014, ts.DiagnosticCategory.Message, "Only_emit_d_ts_declaration_files_6014", "Only emit '.d.ts' declaration files."),
6092         Specify_ECMAScript_target_version: diag(6015, ts.DiagnosticCategory.Message, "Specify_ECMAScript_target_version_6015", "Specify ECMAScript target version."),
6093         Specify_module_code_generation: diag(6016, ts.DiagnosticCategory.Message, "Specify_module_code_generation_6016", "Specify module code generation."),
6094         Print_this_message: diag(6017, ts.DiagnosticCategory.Message, "Print_this_message_6017", "Print this message."),
6095         Print_the_compiler_s_version: diag(6019, ts.DiagnosticCategory.Message, "Print_the_compiler_s_version_6019", "Print the compiler's version."),
6096         Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: diag(6020, ts.DiagnosticCategory.Message, "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."),
6097         Syntax_Colon_0: diag(6023, ts.DiagnosticCategory.Message, "Syntax_Colon_0_6023", "Syntax: {0}"),
6098         options: diag(6024, ts.DiagnosticCategory.Message, "options_6024", "options"),
6099         file: diag(6025, ts.DiagnosticCategory.Message, "file_6025", "file"),
6100         Examples_Colon_0: diag(6026, ts.DiagnosticCategory.Message, "Examples_Colon_0_6026", "Examples: {0}"),
6101         Options_Colon: diag(6027, ts.DiagnosticCategory.Message, "Options_Colon_6027", "Options:"),
6102         Version_0: diag(6029, ts.DiagnosticCategory.Message, "Version_0_6029", "Version {0}"),
6103         Insert_command_line_options_and_files_from_a_file: diag(6030, ts.DiagnosticCategory.Message, "Insert_command_line_options_and_files_from_a_file_6030", "Insert command line options and files from a file."),
6104         Starting_compilation_in_watch_mode: diag(6031, ts.DiagnosticCategory.Message, "Starting_compilation_in_watch_mode_6031", "Starting compilation in watch mode..."),
6105         File_change_detected_Starting_incremental_compilation: diag(6032, ts.DiagnosticCategory.Message, "File_change_detected_Starting_incremental_compilation_6032", "File change detected. Starting incremental compilation..."),
6106         KIND: diag(6034, ts.DiagnosticCategory.Message, "KIND_6034", "KIND"),
6107         FILE: diag(6035, ts.DiagnosticCategory.Message, "FILE_6035", "FILE"),
6108         VERSION: diag(6036, ts.DiagnosticCategory.Message, "VERSION_6036", "VERSION"),
6109         LOCATION: diag(6037, ts.DiagnosticCategory.Message, "LOCATION_6037", "LOCATION"),
6110         DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"),
6111         STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"),
6112         FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"),
6113         Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."),
6114         Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."),
6115         Unterminated_quoted_string_in_response_file_0: diag(6045, ts.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."),
6116         Argument_for_0_option_must_be_Colon_1: diag(6046, ts.DiagnosticCategory.Error, "Argument_for_0_option_must_be_Colon_1_6046", "Argument for '{0}' option must be: {1}."),
6117         Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: diag(6048, ts.DiagnosticCategory.Error, "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'."),
6118         Unable_to_open_file_0: diag(6050, ts.DiagnosticCategory.Error, "Unable_to_open_file_0_6050", "Unable to open file '{0}'."),
6119         Corrupted_locale_file_0: diag(6051, ts.DiagnosticCategory.Error, "Corrupted_locale_file_0_6051", "Corrupted locale file {0}."),
6120         Raise_error_on_expressions_and_declarations_with_an_implied_any_type: diag(6052, ts.DiagnosticCategory.Message, "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", "Raise error on expressions and declarations with an implied 'any' type."),
6121         File_0_not_found: diag(6053, ts.DiagnosticCategory.Error, "File_0_not_found_6053", "File '{0}' not found."),
6122         File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1: diag(6054, ts.DiagnosticCategory.Error, "File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1_6054", "File '{0}' has an unsupported extension. The only supported extensions are {1}."),
6123         Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: diag(6055, ts.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", "Suppress noImplicitAny errors for indexing objects lacking index signatures."),
6124         Do_not_emit_declarations_for_code_that_has_an_internal_annotation: diag(6056, ts.DiagnosticCategory.Message, "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", "Do not emit declarations for code that has an '@internal' annotation."),
6125         Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: diag(6058, ts.DiagnosticCategory.Message, "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", "Specify the root directory of input files. Use to control the output directory structure with --outDir."),
6126         File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: diag(6059, ts.DiagnosticCategory.Error, "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."),
6127         Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: diag(6060, ts.DiagnosticCategory.Message, "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."),
6128         NEWLINE: diag(6061, ts.DiagnosticCategory.Message, "NEWLINE_6061", "NEWLINE"),
6129         Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line: diag(6064, ts.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line_6064", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line."),
6130         Enables_experimental_support_for_ES7_decorators: diag(6065, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_decorators_6065", "Enables experimental support for ES7 decorators."),
6131         Enables_experimental_support_for_emitting_type_metadata_for_decorators: diag(6066, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", "Enables experimental support for emitting type metadata for decorators."),
6132         Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: diag(6069, ts.DiagnosticCategory.Message, "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."),
6133         Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: diag(6070, ts.DiagnosticCategory.Message, "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", "Initializes a TypeScript project and creates a tsconfig.json file."),
6134         Successfully_created_a_tsconfig_json_file: diag(6071, ts.DiagnosticCategory.Message, "Successfully_created_a_tsconfig_json_file_6071", "Successfully created a tsconfig.json file."),
6135         Suppress_excess_property_checks_for_object_literals: diag(6072, ts.DiagnosticCategory.Message, "Suppress_excess_property_checks_for_object_literals_6072", "Suppress excess property checks for object literals."),
6136         Stylize_errors_and_messages_using_color_and_context_experimental: diag(6073, ts.DiagnosticCategory.Message, "Stylize_errors_and_messages_using_color_and_context_experimental_6073", "Stylize errors and messages using color and context (experimental)."),
6137         Do_not_report_errors_on_unused_labels: diag(6074, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unused_labels_6074", "Do not report errors on unused labels."),
6138         Report_error_when_not_all_code_paths_in_function_return_a_value: diag(6075, ts.DiagnosticCategory.Message, "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", "Report error when not all code paths in function return a value."),
6139         Report_errors_for_fallthrough_cases_in_switch_statement: diag(6076, ts.DiagnosticCategory.Message, "Report_errors_for_fallthrough_cases_in_switch_statement_6076", "Report errors for fallthrough cases in switch statement."),
6140         Do_not_report_errors_on_unreachable_code: diag(6077, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unreachable_code_6077", "Do not report errors on unreachable code."),
6141         Disallow_inconsistently_cased_references_to_the_same_file: diag(6078, ts.DiagnosticCategory.Message, "Disallow_inconsistently_cased_references_to_the_same_file_6078", "Disallow inconsistently-cased references to the same file."),
6142         Specify_library_files_to_be_included_in_the_compilation: diag(6079, ts.DiagnosticCategory.Message, "Specify_library_files_to_be_included_in_the_compilation_6079", "Specify library files to be included in the compilation."),
6143         Specify_JSX_code_generation: diag(6080, ts.DiagnosticCategory.Message, "Specify_JSX_code_generation_6080", "Specify JSX code generation."),
6144         File_0_has_an_unsupported_extension_so_skipping_it: diag(6081, ts.DiagnosticCategory.Message, "File_0_has_an_unsupported_extension_so_skipping_it_6081", "File '{0}' has an unsupported extension, so skipping it."),
6145         Only_amd_and_system_modules_are_supported_alongside_0: diag(6082, ts.DiagnosticCategory.Error, "Only_amd_and_system_modules_are_supported_alongside_0_6082", "Only 'amd' and 'system' modules are supported alongside --{0}."),
6146         Base_directory_to_resolve_non_absolute_module_names: diag(6083, ts.DiagnosticCategory.Message, "Base_directory_to_resolve_non_absolute_module_names_6083", "Base directory to resolve non-absolute module names."),
6147         Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: diag(6084, ts.DiagnosticCategory.Message, "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"),
6148         Enable_tracing_of_the_name_resolution_process: diag(6085, ts.DiagnosticCategory.Message, "Enable_tracing_of_the_name_resolution_process_6085", "Enable tracing of the name resolution process."),
6149         Resolving_module_0_from_1: diag(6086, ts.DiagnosticCategory.Message, "Resolving_module_0_from_1_6086", "======== Resolving module '{0}' from '{1}'. ========"),
6150         Explicitly_specified_module_resolution_kind_Colon_0: diag(6087, ts.DiagnosticCategory.Message, "Explicitly_specified_module_resolution_kind_Colon_0_6087", "Explicitly specified module resolution kind: '{0}'."),
6151         Module_resolution_kind_is_not_specified_using_0: diag(6088, ts.DiagnosticCategory.Message, "Module_resolution_kind_is_not_specified_using_0_6088", "Module resolution kind is not specified, using '{0}'."),
6152         Module_name_0_was_successfully_resolved_to_1: diag(6089, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_6089", "======== Module name '{0}' was successfully resolved to '{1}'. ========"),
6153         Module_name_0_was_not_resolved: diag(6090, ts.DiagnosticCategory.Message, "Module_name_0_was_not_resolved_6090", "======== Module name '{0}' was not resolved. ========"),
6154         paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: diag(6091, ts.DiagnosticCategory.Message, "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", "'paths' option is specified, looking for a pattern to match module name '{0}'."),
6155         Module_name_0_matched_pattern_1: diag(6092, ts.DiagnosticCategory.Message, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."),
6156         Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, ts.DiagnosticCategory.Message, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."),
6157         Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, ts.DiagnosticCategory.Message, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
6158         Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: diag(6095, ts.DiagnosticCategory.Message, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."),
6159         File_0_does_not_exist: diag(6096, ts.DiagnosticCategory.Message, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
6160         File_0_exist_use_it_as_a_name_resolution_result: diag(6097, ts.DiagnosticCategory.Message, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
6161         Loading_module_0_from_node_modules_folder_target_file_type_1: diag(6098, ts.DiagnosticCategory.Message, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."),
6162         Found_package_json_at_0: diag(6099, ts.DiagnosticCategory.Message, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
6163         package_json_does_not_have_a_0_field: diag(6100, ts.DiagnosticCategory.Message, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
6164         package_json_has_0_field_1_that_references_2: diag(6101, ts.DiagnosticCategory.Message, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."),
6165         Allow_javascript_files_to_be_compiled: diag(6102, ts.DiagnosticCategory.Message, "Allow_javascript_files_to_be_compiled_6102", "Allow javascript files to be compiled."),
6166         Checking_if_0_is_the_longest_matching_prefix_for_1_2: diag(6104, ts.DiagnosticCategory.Message, "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."),
6167         Expected_type_of_0_field_in_package_json_to_be_1_got_2: diag(6105, ts.DiagnosticCategory.Message, "Expected_type_of_0_field_in_package_json_to_be_1_got_2_6105", "Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'."),
6168         baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: diag(6106, ts.DiagnosticCategory.Message, "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."),
6169         rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: diag(6107, ts.DiagnosticCategory.Message, "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", "'rootDirs' option is set, using it to resolve relative module name '{0}'."),
6170         Longest_matching_prefix_for_0_is_1: diag(6108, ts.DiagnosticCategory.Message, "Longest_matching_prefix_for_0_is_1_6108", "Longest matching prefix for '{0}' is '{1}'."),
6171         Loading_0_from_the_root_dir_1_candidate_location_2: diag(6109, ts.DiagnosticCategory.Message, "Loading_0_from_the_root_dir_1_candidate_location_2_6109", "Loading '{0}' from the root dir '{1}', candidate location '{2}'."),
6172         Trying_other_entries_in_rootDirs: diag(6110, ts.DiagnosticCategory.Message, "Trying_other_entries_in_rootDirs_6110", "Trying other entries in 'rootDirs'."),
6173         Module_resolution_using_rootDirs_has_failed: diag(6111, ts.DiagnosticCategory.Message, "Module_resolution_using_rootDirs_has_failed_6111", "Module resolution using 'rootDirs' has failed."),
6174         Do_not_emit_use_strict_directives_in_module_output: diag(6112, ts.DiagnosticCategory.Message, "Do_not_emit_use_strict_directives_in_module_output_6112", "Do not emit 'use strict' directives in module output."),
6175         Enable_strict_null_checks: diag(6113, ts.DiagnosticCategory.Message, "Enable_strict_null_checks_6113", "Enable strict null checks."),
6176         Unknown_option_excludes_Did_you_mean_exclude: diag(6114, ts.DiagnosticCategory.Error, "Unknown_option_excludes_Did_you_mean_exclude_6114", "Unknown option 'excludes'. Did you mean 'exclude'?"),
6177         Raise_error_on_this_expressions_with_an_implied_any_type: diag(6115, ts.DiagnosticCategory.Message, "Raise_error_on_this_expressions_with_an_implied_any_type_6115", "Raise error on 'this' expressions with an implied 'any' type."),
6178         Resolving_type_reference_directive_0_containing_file_1_root_directory_2: diag(6116, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"),
6179         Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: diag(6119, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"),
6180         Type_reference_directive_0_was_not_resolved: diag(6120, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_not_resolved_6120", "======== Type reference directive '{0}' was not resolved. ========"),
6181         Resolving_with_primary_search_path_0: diag(6121, ts.DiagnosticCategory.Message, "Resolving_with_primary_search_path_0_6121", "Resolving with primary search path '{0}'."),
6182         Root_directory_cannot_be_determined_skipping_primary_search_paths: diag(6122, ts.DiagnosticCategory.Message, "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", "Root directory cannot be determined, skipping primary search paths."),
6183         Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: diag(6123, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"),
6184         Type_declaration_files_to_be_included_in_compilation: diag(6124, ts.DiagnosticCategory.Message, "Type_declaration_files_to_be_included_in_compilation_6124", "Type declaration files to be included in compilation."),
6185         Looking_up_in_node_modules_folder_initial_location_0: diag(6125, ts.DiagnosticCategory.Message, "Looking_up_in_node_modules_folder_initial_location_0_6125", "Looking up in 'node_modules' folder, initial location '{0}'."),
6186         Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: diag(6126, ts.DiagnosticCategory.Message, "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."),
6187         Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: diag(6127, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"),
6188         Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: diag(6128, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"),
6189         Resolving_real_path_for_0_result_1: diag(6130, ts.DiagnosticCategory.Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."),
6190         Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: diag(6131, ts.DiagnosticCategory.Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."),
6191         File_name_0_has_a_1_extension_stripping_it: diag(6132, ts.DiagnosticCategory.Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."),
6192         _0_is_declared_but_its_value_is_never_read: diag(6133, ts.DiagnosticCategory.Error, "_0_is_declared_but_its_value_is_never_read_6133", "'{0}' is declared but its value is never read.", true),
6193         Report_errors_on_unused_locals: diag(6134, ts.DiagnosticCategory.Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."),
6194         Report_errors_on_unused_parameters: diag(6135, ts.DiagnosticCategory.Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."),
6195         The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: diag(6136, ts.DiagnosticCategory.Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."),
6196         Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: diag(6137, ts.DiagnosticCategory.Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."),
6197         Property_0_is_declared_but_its_value_is_never_read: diag(6138, ts.DiagnosticCategory.Error, "Property_0_is_declared_but_its_value_is_never_read_6138", "Property '{0}' is declared but its value is never read.", true),
6198         Import_emit_helpers_from_tslib: diag(6139, ts.DiagnosticCategory.Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."),
6199         Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: diag(6140, ts.DiagnosticCategory.Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."),
6200         Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, ts.DiagnosticCategory.Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", "Parse in strict mode and emit \"use strict\" for each source file."),
6201         Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, ts.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."),
6202         Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."),
6203         Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),
6204         Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, ts.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),
6205         Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, ts.DiagnosticCategory.Message, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."),
6206         Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, ts.DiagnosticCategory.Message, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."),
6207         Show_diagnostic_information: diag(6149, ts.DiagnosticCategory.Message, "Show_diagnostic_information_6149", "Show diagnostic information."),
6208         Show_verbose_diagnostic_information: diag(6150, ts.DiagnosticCategory.Message, "Show_verbose_diagnostic_information_6150", "Show verbose diagnostic information."),
6209         Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: diag(6151, ts.DiagnosticCategory.Message, "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", "Emit a single file with source maps instead of having a separate file."),
6210         Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: diag(6152, ts.DiagnosticCategory.Message, "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."),
6211         Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: diag(6153, ts.DiagnosticCategory.Message, "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", "Transpile each file as a separate module (similar to 'ts.transpileModule')."),
6212         Print_names_of_generated_files_part_of_the_compilation: diag(6154, ts.DiagnosticCategory.Message, "Print_names_of_generated_files_part_of_the_compilation_6154", "Print names of generated files part of the compilation."),
6213         Print_names_of_files_part_of_the_compilation: diag(6155, ts.DiagnosticCategory.Message, "Print_names_of_files_part_of_the_compilation_6155", "Print names of files part of the compilation."),
6214         The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: diag(6156, ts.DiagnosticCategory.Message, "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", "The locale used when displaying messages to the user (e.g. 'en-us')"),
6215         Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: diag(6157, ts.DiagnosticCategory.Message, "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", "Do not generate custom helper functions like '__extends' in compiled output."),
6216         Do_not_include_the_default_library_file_lib_d_ts: diag(6158, ts.DiagnosticCategory.Message, "Do_not_include_the_default_library_file_lib_d_ts_6158", "Do not include the default library file (lib.d.ts)."),
6217         Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: diag(6159, ts.DiagnosticCategory.Message, "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", "Do not add triple-slash references or imported modules to the list of compiled files."),
6218         Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: diag(6160, ts.DiagnosticCategory.Message, "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."),
6219         List_of_folders_to_include_type_definitions_from: diag(6161, ts.DiagnosticCategory.Message, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."),
6220         Disable_size_limitations_on_JavaScript_projects: diag(6162, ts.DiagnosticCategory.Message, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."),
6221         The_character_set_of_the_input_files: diag(6163, ts.DiagnosticCategory.Message, "The_character_set_of_the_input_files_6163", "The character set of the input files."),
6222         Do_not_truncate_error_messages: diag(6165, ts.DiagnosticCategory.Message, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."),
6223         Output_directory_for_generated_declaration_files: diag(6166, ts.DiagnosticCategory.Message, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."),
6224         A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, ts.DiagnosticCategory.Message, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."),
6225         List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: diag(6168, ts.DiagnosticCategory.Message, "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", "List of root folders whose combined content represents the structure of the project at runtime."),
6226         Show_all_compiler_options: diag(6169, ts.DiagnosticCategory.Message, "Show_all_compiler_options_6169", "Show all compiler options."),
6227         Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: diag(6170, ts.DiagnosticCategory.Message, "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"),
6228         Command_line_Options: diag(6171, ts.DiagnosticCategory.Message, "Command_line_Options_6171", "Command-line Options"),
6229         Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: diag(6179, ts.DiagnosticCategory.Message, "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."),
6230         Enable_all_strict_type_checking_options: diag(6180, ts.DiagnosticCategory.Message, "Enable_all_strict_type_checking_options_6180", "Enable all strict type-checking options."),
6231         List_of_language_service_plugins: diag(6181, ts.DiagnosticCategory.Message, "List_of_language_service_plugins_6181", "List of language service plugins."),
6232         Scoped_package_detected_looking_in_0: diag(6182, ts.DiagnosticCategory.Message, "Scoped_package_detected_looking_in_0_6182", "Scoped package detected, looking in '{0}'"),
6233         Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2: diag(6183, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_6183", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),
6234         Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3: diag(6184, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package__6184", "Reusing resolution of module '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),
6235         Enable_strict_checking_of_function_types: diag(6186, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_function_types_6186", "Enable strict checking of function types."),
6236         Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
6237         Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
6238         Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
6239         Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
6240         All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", true),
6241         Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
6242         Found_0_errors_Watching_for_file_changes: diag(6194, ts.DiagnosticCategory.Message, "Found_0_errors_Watching_for_file_changes_6194", "Found {0} errors. Watching for file changes."),
6243         Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols: diag(6195, ts.DiagnosticCategory.Message, "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195", "Resolve 'keyof' to string valued property names only (no numbers or symbols)."),
6244         _0_is_declared_but_never_used: diag(6196, ts.DiagnosticCategory.Error, "_0_is_declared_but_never_used_6196", "'{0}' is declared but never used.", true),
6245         Include_modules_imported_with_json_extension: diag(6197, ts.DiagnosticCategory.Message, "Include_modules_imported_with_json_extension_6197", "Include modules imported with '.json' extension"),
6246         All_destructured_elements_are_unused: diag(6198, ts.DiagnosticCategory.Error, "All_destructured_elements_are_unused_6198", "All destructured elements are unused.", true),
6247         All_variables_are_unused: diag(6199, ts.DiagnosticCategory.Error, "All_variables_are_unused_6199", "All variables are unused.", true),
6248         Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0: diag(6200, ts.DiagnosticCategory.Error, "Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0_6200", "Definitions of the following identifiers conflict with those in another file: {0}"),
6249         Conflicts_are_in_this_file: diag(6201, ts.DiagnosticCategory.Message, "Conflicts_are_in_this_file_6201", "Conflicts are in this file."),
6250         Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
6251         _0_was_also_declared_here: diag(6203, ts.DiagnosticCategory.Message, "_0_was_also_declared_here_6203", "'{0}' was also declared here."),
6252         and_here: diag(6204, ts.DiagnosticCategory.Message, "and_here_6204", "and here."),
6253         All_type_parameters_are_unused: diag(6205, ts.DiagnosticCategory.Error, "All_type_parameters_are_unused_6205", "All type parameters are unused."),
6254         package_json_has_a_typesVersions_field_with_version_specific_path_mappings: diag(6206, ts.DiagnosticCategory.Message, "package_json_has_a_typesVersions_field_with_version_specific_path_mappings_6206", "'package.json' has a 'typesVersions' field with version-specific path mappings."),
6255         package_json_does_not_have_a_typesVersions_entry_that_matches_version_0: diag(6207, ts.DiagnosticCategory.Message, "package_json_does_not_have_a_typesVersions_entry_that_matches_version_0_6207", "'package.json' does not have a 'typesVersions' entry that matches version '{0}'."),
6256         package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2: diag(6208, ts.DiagnosticCategory.Message, "package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_ma_6208", "'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'."),
6257         package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range: diag(6209, ts.DiagnosticCategory.Message, "package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range_6209", "'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range."),
6258         An_argument_for_0_was_not_provided: diag(6210, ts.DiagnosticCategory.Message, "An_argument_for_0_was_not_provided_6210", "An argument for '{0}' was not provided."),
6259         An_argument_matching_this_binding_pattern_was_not_provided: diag(6211, ts.DiagnosticCategory.Message, "An_argument_matching_this_binding_pattern_was_not_provided_6211", "An argument matching this binding pattern was not provided."),
6260         Did_you_mean_to_call_this_expression: diag(6212, ts.DiagnosticCategory.Message, "Did_you_mean_to_call_this_expression_6212", "Did you mean to call this expression?"),
6261         Did_you_mean_to_use_new_with_this_expression: diag(6213, ts.DiagnosticCategory.Message, "Did_you_mean_to_use_new_with_this_expression_6213", "Did you mean to use 'new' with this expression?"),
6262         Enable_strict_bind_call_and_apply_methods_on_functions: diag(6214, ts.DiagnosticCategory.Message, "Enable_strict_bind_call_and_apply_methods_on_functions_6214", "Enable strict 'bind', 'call', and 'apply' methods on functions."),
6263         Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
6264         Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
6265         Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
6266         Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
6267         Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
6268         package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
6269         Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects: diag(6221, ts.DiagnosticCategory.Message, "Disable_use_of_source_files_instead_of_declaration_files_from_referenced_projects_6221", "Disable use of source files instead of declaration files from referenced projects."),
6270         Emit_class_fields_with_Define_instead_of_Set: diag(6222, ts.DiagnosticCategory.Message, "Emit_class_fields_with_Define_instead_of_Set_6222", "Emit class fields with Define instead of Set."),
6271         Generates_a_CPU_profile: diag(6223, ts.DiagnosticCategory.Message, "Generates_a_CPU_profile_6223", "Generates a CPU profile."),
6272         Disable_solution_searching_for_this_project: diag(6224, ts.DiagnosticCategory.Message, "Disable_solution_searching_for_this_project_6224", "Disable solution searching for this project."),
6273         Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling_UseFsEvents_UseFsEventsOnParentDirectory: diag(6225, ts.DiagnosticCategory.Message, "Specify_strategy_for_watching_file_Colon_FixedPollingInterval_default_PriorityPollingInterval_Dynami_6225", "Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'."),
6274         Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively_Colon_UseFsEvents_default_FixedPollingInterval_DynamicPriorityPolling_FixedChunkSizePolling: diag(6226, ts.DiagnosticCategory.Message, "Specify_strategy_for_watching_directory_on_platforms_that_don_t_support_recursive_watching_natively__6226", "Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling', 'FixedChunkSizePolling'."),
6275         Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_FixedInterval_default_PriorityInterval_DynamicPriority_FixedChunkSize: diag(6227, ts.DiagnosticCategory.Message, "Specify_strategy_for_creating_a_polling_watch_when_it_fails_to_create_using_file_system_events_Colon_6227", "Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority', 'FixedChunkSize'."),
6276         Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3: diag(6229, ts.DiagnosticCategory.Error, "Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3_6229", "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'."),
6277         Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line: diag(6230, ts.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line_6230", "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line."),
6278         Could_not_resolve_the_path_0_with_the_extensions_Colon_1: diag(6231, ts.DiagnosticCategory.Error, "Could_not_resolve_the_path_0_with_the_extensions_Colon_1_6231", "Could not resolve the path '{0}' with the extensions: {1}."),
6279         Declaration_augments_declaration_in_another_file_This_cannot_be_serialized: diag(6232, ts.DiagnosticCategory.Error, "Declaration_augments_declaration_in_another_file_This_cannot_be_serialized_6232", "Declaration augments declaration in another file. This cannot be serialized."),
6280         This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file: diag(6233, ts.DiagnosticCategory.Error, "This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_fil_6233", "This is the declaration being augmented. Consider moving the augmenting declaration into the same file."),
6281         This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without: diag(6234, ts.DiagnosticCategory.Error, "This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without_6234", "This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?"),
6282         Disable_loading_referenced_projects: diag(6235, ts.DiagnosticCategory.Message, "Disable_loading_referenced_projects_6235", "Disable loading referenced projects."),
6283         Arguments_for_the_rest_parameter_0_were_not_provided: diag(6236, ts.DiagnosticCategory.Error, "Arguments_for_the_rest_parameter_0_were_not_provided_6236", "Arguments for the rest parameter '{0}' were not provided."),
6284         Generates_an_event_trace_and_a_list_of_types: diag(6237, ts.DiagnosticCategory.Message, "Generates_an_event_trace_and_a_list_of_types_6237", "Generates an event trace and a list of types."),
6285         Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react: diag(6238, ts.DiagnosticCategory.Error, "Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react_6238", "Specify the module specifier to be used to import the 'jsx' and 'jsxs' factory functions from. eg, react"),
6286         File_0_exists_according_to_earlier_cached_lookups: diag(6239, ts.DiagnosticCategory.Message, "File_0_exists_according_to_earlier_cached_lookups_6239", "File '{0}' exists according to earlier cached lookups."),
6287         File_0_does_not_exist_according_to_earlier_cached_lookups: diag(6240, ts.DiagnosticCategory.Message, "File_0_does_not_exist_according_to_earlier_cached_lookups_6240", "File '{0}' does not exist according to earlier cached lookups."),
6288         Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1: diag(6241, ts.DiagnosticCategory.Message, "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241", "Resolution for type reference directive '{0}' was found in cache from location '{1}'."),
6289         Resolving_type_reference_directive_0_containing_file_1: diag(6242, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_6242", "======== Resolving type reference directive '{0}', containing file '{1}'. ========"),
6290         Interpret_optional_property_types_as_written_rather_than_adding_undefined: diag(6243, ts.DiagnosticCategory.Message, "Interpret_optional_property_types_as_written_rather_than_adding_undefined_6243", "Interpret optional property types as written, rather than adding 'undefined'."),
6291         Modules: diag(6244, ts.DiagnosticCategory.Message, "Modules_6244", "Modules"),
6292         File_Management: diag(6245, ts.DiagnosticCategory.Message, "File_Management_6245", "File Management"),
6293         Emit: diag(6246, ts.DiagnosticCategory.Message, "Emit_6246", "Emit"),
6294         JavaScript_Support: diag(6247, ts.DiagnosticCategory.Message, "JavaScript_Support_6247", "JavaScript Support"),
6295         Type_Checking: diag(6248, ts.DiagnosticCategory.Message, "Type_Checking_6248", "Type Checking"),
6296         Editor_Support: diag(6249, ts.DiagnosticCategory.Message, "Editor_Support_6249", "Editor Support"),
6297         Watch_and_Build_Modes: diag(6250, ts.DiagnosticCategory.Message, "Watch_and_Build_Modes_6250", "Watch and Build Modes"),
6298         Compiler_Diagnostics: diag(6251, ts.DiagnosticCategory.Message, "Compiler_Diagnostics_6251", "Compiler Diagnostics"),
6299         Interop_Constraints: diag(6252, ts.DiagnosticCategory.Message, "Interop_Constraints_6252", "Interop Constraints"),
6300         Backwards_Compatibility: diag(6253, ts.DiagnosticCategory.Message, "Backwards_Compatibility_6253", "Backwards Compatibility"),
6301         Language_and_Environment: diag(6254, ts.DiagnosticCategory.Message, "Language_and_Environment_6254", "Language and Environment"),
6302         Projects: diag(6255, ts.DiagnosticCategory.Message, "Projects_6255", "Projects"),
6303         Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
6304         Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
6305         _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
6306         Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
6307         Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
6308         Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
6309         package_json_scope_0_has_no_imports_defined: diag(6273, ts.DiagnosticCategory.Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."),
6310         package_json_scope_0_explicitly_maps_specifier_1_to_null: diag(6274, ts.DiagnosticCategory.Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."),
6311         package_json_scope_0_has_invalid_type_for_target_of_specifier_1: diag(6275, ts.DiagnosticCategory.Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"),
6312         Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, ts.DiagnosticCategory.Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."),
6313         Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
6314         Composite_projects_may_not_disable_declaration_emit: diag(6304, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
6315         Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
6316         Referenced_project_0_must_have_setting_composite_Colon_true: diag(6306, ts.DiagnosticCategory.Error, "Referenced_project_0_must_have_setting_composite_Colon_true_6306", "Referenced project '{0}' must have setting \"composite\": true."),
6317         File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern: diag(6307, ts.DiagnosticCategory.Error, "File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_includ_6307", "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern."),
6318         Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
6319         Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
6320         Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
6321         Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350", "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"),
6322         Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),
6323         Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
6324         Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
6325         Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
6326         Projects_in_this_build_Colon_0: diag(6355, ts.DiagnosticCategory.Message, "Projects_in_this_build_Colon_0_6355", "Projects in this build: {0}"),
6327         A_non_dry_build_would_delete_the_following_files_Colon_0: diag(6356, ts.DiagnosticCategory.Message, "A_non_dry_build_would_delete_the_following_files_Colon_0_6356", "A non-dry build would delete the following files: {0}"),
6328         A_non_dry_build_would_build_project_0: diag(6357, ts.DiagnosticCategory.Message, "A_non_dry_build_would_build_project_0_6357", "A non-dry build would build project '{0}'"),
6329         Building_project_0: diag(6358, ts.DiagnosticCategory.Message, "Building_project_0_6358", "Building project '{0}'..."),
6330         Updating_output_timestamps_of_project_0: diag(6359, ts.DiagnosticCategory.Message, "Updating_output_timestamps_of_project_0_6359", "Updating output timestamps of project '{0}'..."),
6331         Project_0_is_up_to_date: diag(6361, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_6361", "Project '{0}' is up to date"),
6332         Skipping_build_of_project_0_because_its_dependency_1_has_errors: diag(6362, ts.DiagnosticCategory.Message, "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362", "Skipping build of project '{0}' because its dependency '{1}' has errors"),
6333         Project_0_can_t_be_built_because_its_dependency_1_has_errors: diag(6363, ts.DiagnosticCategory.Message, "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363", "Project '{0}' can't be built because its dependency '{1}' has errors"),
6334         Build_one_or_more_projects_and_their_dependencies_if_out_of_date: diag(6364, ts.DiagnosticCategory.Message, "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364", "Build one or more projects and their dependencies, if out of date"),
6335         Delete_the_outputs_of_all_projects: diag(6365, ts.DiagnosticCategory.Message, "Delete_the_outputs_of_all_projects_6365", "Delete the outputs of all projects"),
6336         Show_what_would_be_built_or_deleted_if_specified_with_clean: diag(6367, ts.DiagnosticCategory.Message, "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367", "Show what would be built (or deleted, if specified with '--clean')"),
6337         Option_build_must_be_the_first_command_line_argument: diag(6369, ts.DiagnosticCategory.Error, "Option_build_must_be_the_first_command_line_argument_6369", "Option '--build' must be the first command line argument."),
6338         Options_0_and_1_cannot_be_combined: diag(6370, ts.DiagnosticCategory.Error, "Options_0_and_1_cannot_be_combined_6370", "Options '{0}' and '{1}' cannot be combined."),
6339         Updating_unchanged_output_timestamps_of_project_0: diag(6371, ts.DiagnosticCategory.Message, "Updating_unchanged_output_timestamps_of_project_0_6371", "Updating unchanged output timestamps of project '{0}'..."),
6340         Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed: diag(6372, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372", "Project '{0}' is out of date because output of its dependency '{1}' has changed"),
6341         Updating_output_of_project_0: diag(6373, ts.DiagnosticCategory.Message, "Updating_output_of_project_0_6373", "Updating output of project '{0}'..."),
6342         A_non_dry_build_would_update_timestamps_for_output_of_project_0: diag(6374, ts.DiagnosticCategory.Message, "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374", "A non-dry build would update timestamps for output of project '{0}'"),
6343         A_non_dry_build_would_update_output_of_project_0: diag(6375, ts.DiagnosticCategory.Message, "A_non_dry_build_would_update_output_of_project_0_6375", "A non-dry build would update output of project '{0}'"),
6344         Cannot_update_output_of_project_0_because_there_was_error_reading_file_1: diag(6376, ts.DiagnosticCategory.Message, "Cannot_update_output_of_project_0_because_there_was_error_reading_file_1_6376", "Cannot update output of project '{0}' because there was error reading file '{1}'"),
6345         Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1: diag(6377, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1_6377", "Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'"),
6346         Enable_incremental_compilation: diag(6378, ts.DiagnosticCategory.Message, "Enable_incremental_compilation_6378", "Enable incremental compilation"),
6347         Composite_projects_may_not_disable_incremental_compilation: diag(6379, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."),
6348         Specify_file_to_store_incremental_compilation_information: diag(6380, ts.DiagnosticCategory.Message, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"),
6349         Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2: diag(6381, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),
6350         Skipping_build_of_project_0_because_its_dependency_1_was_not_built: diag(6382, ts.DiagnosticCategory.Message, "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382", "Skipping build of project '{0}' because its dependency '{1}' was not built"),
6351         Project_0_can_t_be_built_because_its_dependency_1_was_not_built: diag(6383, ts.DiagnosticCategory.Message, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"),
6352         Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6384, ts.DiagnosticCategory.Message, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),
6353         _0_is_deprecated: diag(6385, ts.DiagnosticCategory.Suggestion, "_0_is_deprecated_6385", "'{0}' is deprecated.", undefined, undefined, true),
6354         Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found: diag(6386, ts.DiagnosticCategory.Message, "Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386", "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."),
6355         The_signature_0_of_1_is_deprecated: diag(6387, ts.DiagnosticCategory.Suggestion, "The_signature_0_of_1_is_deprecated_6387", "The signature '{0}' of '{1}' is deprecated.", undefined, undefined, true),
6356         Project_0_is_being_forcibly_rebuilt: diag(6388, ts.DiagnosticCategory.Message, "Project_0_is_being_forcibly_rebuilt_6388", "Project '{0}' is being forcibly rebuilt"),
6357         Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved: diag(6389, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389", "Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."),
6358         Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2: diag(6390, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6390", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}'."),
6359         Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3: diag(6391, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved__6391", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was successfully resolved to '{2}' with Package ID '{3}'."),
6360         Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved: diag(6392, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved_6392", "Reusing resolution of type reference directive '{0}' from '{1}' of old program, it was not resolved."),
6361         Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6393, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6393", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
6362         Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6394, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_6394", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
6363         Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6395, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved_6395", "Reusing resolution of module '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
6364         Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
6365         Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
6366         Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
6367         The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
6368         The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
6369         The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
6370         Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing: diag(6503, ts.DiagnosticCategory.Message, "Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing_6503", "Print names of files that are part of the compilation and then stop processing."),
6371         File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option: diag(6504, ts.DiagnosticCategory.Error, "File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option_6504", "File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?"),
6372         Print_names_of_files_and_the_reason_they_are_part_of_the_compilation: diag(6505, ts.DiagnosticCategory.Message, "Print_names_of_files_and_the_reason_they_are_part_of_the_compilation_6505", "Print names of files and the reason they are part of the compilation."),
6373         Consider_adding_a_declare_modifier_to_this_class: diag(6506, ts.DiagnosticCategory.Message, "Consider_adding_a_declare_modifier_to_this_class_6506", "Consider adding a 'declare' modifier to this class."),
6374         Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files: diag(6600, ts.DiagnosticCategory.Message, "Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600", "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files."),
6375         Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export: diag(6601, ts.DiagnosticCategory.Message, "Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export_6601", "Allow 'import x from y' when a module doesn't have a default export."),
6376         Allow_accessing_UMD_globals_from_modules: diag(6602, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_6602", "Allow accessing UMD globals from modules."),
6377         Disable_error_reporting_for_unreachable_code: diag(6603, ts.DiagnosticCategory.Message, "Disable_error_reporting_for_unreachable_code_6603", "Disable error reporting for unreachable code."),
6378         Disable_error_reporting_for_unused_labels: diag(6604, ts.DiagnosticCategory.Message, "Disable_error_reporting_for_unused_labels_6604", "Disable error reporting for unused labels."),
6379         Ensure_use_strict_is_always_emitted: diag(6605, ts.DiagnosticCategory.Message, "Ensure_use_strict_is_always_emitted_6605", "Ensure 'use strict' is always emitted."),
6380         Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6606, ts.DiagnosticCategory.Message, "Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_wi_6606", "Have recompiles in projects that use `incremental` and `watch` mode assume that changes within a file will only affect files directly depending on it."),
6381         Specify_the_base_directory_to_resolve_non_relative_module_names: diag(6607, ts.DiagnosticCategory.Message, "Specify_the_base_directory_to_resolve_non_relative_module_names_6607", "Specify the base directory to resolve non-relative module names."),
6382         No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files: diag(6608, ts.DiagnosticCategory.Message, "No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files_6608", "No longer supported. In early versions, manually set the text encoding for reading files."),
6383         Enable_error_reporting_in_type_checked_JavaScript_files: diag(6609, ts.DiagnosticCategory.Message, "Enable_error_reporting_in_type_checked_JavaScript_files_6609", "Enable error reporting in type-checked JavaScript files."),
6384         Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references: diag(6611, ts.DiagnosticCategory.Message, "Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references_6611", "Enable constraints that allow a TypeScript project to be used with project references."),
6385         Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project: diag(6612, ts.DiagnosticCategory.Message, "Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project_6612", "Generate .d.ts files from TypeScript and JavaScript files in your project."),
6386         Specify_the_output_directory_for_generated_declaration_files: diag(6613, ts.DiagnosticCategory.Message, "Specify_the_output_directory_for_generated_declaration_files_6613", "Specify the output directory for generated declaration files."),
6387         Create_sourcemaps_for_d_ts_files: diag(6614, ts.DiagnosticCategory.Message, "Create_sourcemaps_for_d_ts_files_6614", "Create sourcemaps for d.ts files."),
6388         Output_compiler_performance_information_after_building: diag(6615, ts.DiagnosticCategory.Message, "Output_compiler_performance_information_after_building_6615", "Output compiler performance information after building."),
6389         Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project: diag(6616, ts.DiagnosticCategory.Message, "Disables_inference_for_type_acquisition_by_looking_at_filenames_in_a_project_6616", "Disables inference for type acquisition by looking at filenames in a project."),
6390         Reduce_the_number_of_projects_loaded_automatically_by_TypeScript: diag(6617, ts.DiagnosticCategory.Message, "Reduce_the_number_of_projects_loaded_automatically_by_TypeScript_6617", "Reduce the number of projects loaded automatically by TypeScript."),
6391         Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server: diag(6618, ts.DiagnosticCategory.Message, "Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server_6618", "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."),
6392         Opt_a_project_out_of_multi_project_reference_checking_when_editing: diag(6619, ts.DiagnosticCategory.Message, "Opt_a_project_out_of_multi_project_reference_checking_when_editing_6619", "Opt a project out of multi-project reference checking when editing."),
6393         Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects: diag(6620, ts.DiagnosticCategory.Message, "Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects_6620", "Disable preferring source files instead of declaration files when referencing composite projects"),
6394         Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration: diag(6621, ts.DiagnosticCategory.Message, "Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration_6621", "Emit more compliant, but verbose and less performant JavaScript for iteration."),
6395         Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: diag(6622, ts.DiagnosticCategory.Message, "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6622", "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."),
6396         Only_output_d_ts_files_and_not_JavaScript_files: diag(6623, ts.DiagnosticCategory.Message, "Only_output_d_ts_files_and_not_JavaScript_files_6623", "Only output d.ts files and not JavaScript files."),
6397         Emit_design_type_metadata_for_decorated_declarations_in_source_files: diag(6624, ts.DiagnosticCategory.Message, "Emit_design_type_metadata_for_decorated_declarations_in_source_files_6624", "Emit design-type metadata for decorated declarations in source files."),
6398         Disable_the_type_acquisition_for_JavaScript_projects: diag(6625, ts.DiagnosticCategory.Message, "Disable_the_type_acquisition_for_JavaScript_projects_6625", "Disable the type acquisition for JavaScript projects"),
6399         Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility: diag(6626, ts.DiagnosticCategory.Message, "Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheti_6626", "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility."),
6400         Filters_results_from_the_include_option: diag(6627, ts.DiagnosticCategory.Message, "Filters_results_from_the_include_option_6627", "Filters results from the `include` option."),
6401         Remove_a_list_of_directories_from_the_watch_process: diag(6628, ts.DiagnosticCategory.Message, "Remove_a_list_of_directories_from_the_watch_process_6628", "Remove a list of directories from the watch process."),
6402         Remove_a_list_of_files_from_the_watch_mode_s_processing: diag(6629, ts.DiagnosticCategory.Message, "Remove_a_list_of_files_from_the_watch_mode_s_processing_6629", "Remove a list of files from the watch mode's processing."),
6403         Enable_experimental_support_for_TC39_stage_2_draft_decorators: diag(6630, ts.DiagnosticCategory.Message, "Enable_experimental_support_for_TC39_stage_2_draft_decorators_6630", "Enable experimental support for TC39 stage 2 draft decorators."),
6404         Print_files_read_during_the_compilation_including_why_it_was_included: diag(6631, ts.DiagnosticCategory.Message, "Print_files_read_during_the_compilation_including_why_it_was_included_6631", "Print files read during the compilation including why it was included."),
6405         Output_more_detailed_compiler_performance_information_after_building: diag(6632, ts.DiagnosticCategory.Message, "Output_more_detailed_compiler_performance_information_after_building_6632", "Output more detailed compiler performance information after building."),
6406         Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_are_inherited: diag(6633, ts.DiagnosticCategory.Message, "Specify_one_or_more_path_or_node_module_references_to_base_configuration_files_from_which_settings_a_6633", "Specify one or more path or node module references to base configuration files from which settings are inherited."),
6407         Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers: diag(6634, ts.DiagnosticCategory.Message, "Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers_6634", "Specify what approach the watcher should use if the system runs out of native file watchers."),
6408         Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include: diag(6635, ts.DiagnosticCategory.Message, "Include_a_list_of_files_This_does_not_support_glob_patterns_as_opposed_to_include_6635", "Include a list of files. This does not support glob patterns, as opposed to `include`."),
6409         Build_all_projects_including_those_that_appear_to_be_up_to_date: diag(6636, ts.DiagnosticCategory.Message, "Build_all_projects_including_those_that_appear_to_be_up_to_date_6636", "Build all projects, including those that appear to be up to date"),
6410         Ensure_that_casing_is_correct_in_imports: diag(6637, ts.DiagnosticCategory.Message, "Ensure_that_casing_is_correct_in_imports_6637", "Ensure that casing is correct in imports."),
6411         Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging: diag(6638, ts.DiagnosticCategory.Message, "Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638", "Emit a v8 CPU profile of the compiler run for debugging."),
6412         Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file: diag(6639, ts.DiagnosticCategory.Message, "Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639", "Allow importing helper functions from tslib once per project, instead of including them per-file."),
6413         Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation: diag(6641, ts.DiagnosticCategory.Message, "Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641", "Specify a list of glob patterns that match files to be included in compilation."),
6414         Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects: diag(6642, ts.DiagnosticCategory.Message, "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642", "Save .tsbuildinfo files to allow for incremental compilation of projects."),
6415         Include_sourcemap_files_inside_the_emitted_JavaScript: diag(6643, ts.DiagnosticCategory.Message, "Include_sourcemap_files_inside_the_emitted_JavaScript_6643", "Include sourcemap files inside the emitted JavaScript."),
6416         Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript: diag(6644, ts.DiagnosticCategory.Message, "Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript_6644", "Include source code in the sourcemaps inside the emitted JavaScript."),
6417         Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports: diag(6645, ts.DiagnosticCategory.Message, "Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports_6645", "Ensure that each file can be safely transpiled without relying on other imports."),
6418         Specify_what_JSX_code_is_generated: diag(6646, ts.DiagnosticCategory.Message, "Specify_what_JSX_code_is_generated_6646", "Specify what JSX code is generated."),
6419         Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h: diag(6647, ts.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h_6647", "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'"),
6420         Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment: diag(6648, ts.DiagnosticCategory.Message, "Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragme_6648", "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."),
6421         Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk: diag(6649, ts.DiagnosticCategory.Message, "Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Ast_6649", "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.`"),
6422         Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option: diag(6650, ts.DiagnosticCategory.Message, "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650", "Make keyof only return strings instead of string, numbers or symbols. Legacy option."),
6423         Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment: diag(6651, ts.DiagnosticCategory.Message, "Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment_6651", "Specify a set of bundled library declaration files that describe the target runtime environment."),
6424         Print_the_names_of_emitted_files_after_a_compilation: diag(6652, ts.DiagnosticCategory.Message, "Print_the_names_of_emitted_files_after_a_compilation_6652", "Print the names of emitted files after a compilation."),
6425         Print_all_of_the_files_read_during_the_compilation: diag(6653, ts.DiagnosticCategory.Message, "Print_all_of_the_files_read_during_the_compilation_6653", "Print all of the files read during the compilation."),
6426         Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit: diag(6654, ts.DiagnosticCategory.Message, "Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit_6654", "Set the language of the messaging from TypeScript. This does not affect emit."),
6427         Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: diag(6655, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6655", "Specify the location where debugger should locate map files instead of generated locations."),
6428         Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs: diag(6656, ts.DiagnosticCategory.Message, "Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicabl_6656", "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`."),
6429         Specify_what_module_code_is_generated: diag(6657, ts.DiagnosticCategory.Message, "Specify_what_module_code_is_generated_6657", "Specify what module code is generated."),
6430         Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier: diag(6658, ts.DiagnosticCategory.Message, "Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier_6658", "Specify how TypeScript looks up a file from a given module specifier."),
6431         Set_the_newline_character_for_emitting_files: diag(6659, ts.DiagnosticCategory.Message, "Set_the_newline_character_for_emitting_files_6659", "Set the newline character for emitting files."),
6432         Disable_emitting_files_from_a_compilation: diag(6660, ts.DiagnosticCategory.Message, "Disable_emitting_files_from_a_compilation_6660", "Disable emitting files from a compilation."),
6433         Disable_generating_custom_helper_functions_like_extends_in_compiled_output: diag(6661, ts.DiagnosticCategory.Message, "Disable_generating_custom_helper_functions_like_extends_in_compiled_output_6661", "Disable generating custom helper functions like `__extends` in compiled output."),
6434         Disable_emitting_files_if_any_type_checking_errors_are_reported: diag(6662, ts.DiagnosticCategory.Message, "Disable_emitting_files_if_any_type_checking_errors_are_reported_6662", "Disable emitting files if any type checking errors are reported."),
6435         Disable_truncating_types_in_error_messages: diag(6663, ts.DiagnosticCategory.Message, "Disable_truncating_types_in_error_messages_6663", "Disable truncating types in error messages."),
6436         Enable_error_reporting_for_fallthrough_cases_in_switch_statements: diag(6664, ts.DiagnosticCategory.Message, "Enable_error_reporting_for_fallthrough_cases_in_switch_statements_6664", "Enable error reporting for fallthrough cases in switch statements."),
6437         Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type: diag(6665, ts.DiagnosticCategory.Message, "Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type_6665", "Enable error reporting for expressions and declarations with an implied `any` type.."),
6438         Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier: diag(6666, ts.DiagnosticCategory.Message, "Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier_6666", "Ensure overriding members in derived classes are marked with an override modifier."),
6439         Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function: diag(6667, ts.DiagnosticCategory.Message, "Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function_6667", "Enable error reporting for codepaths that do not explicitly return in a function."),
6440         Enable_error_reporting_when_this_is_given_the_type_any: diag(6668, ts.DiagnosticCategory.Message, "Enable_error_reporting_when_this_is_given_the_type_any_6668", "Enable error reporting when `this` is given the type `any`."),
6441         Disable_adding_use_strict_directives_in_emitted_JavaScript_files: diag(6669, ts.DiagnosticCategory.Message, "Disable_adding_use_strict_directives_in_emitted_JavaScript_files_6669", "Disable adding 'use strict' directives in emitted JavaScript files."),
6442         Disable_including_any_library_files_including_the_default_lib_d_ts: diag(6670, ts.DiagnosticCategory.Message, "Disable_including_any_library_files_including_the_default_lib_d_ts_6670", "Disable including any library files, including the default lib.d.ts."),
6443         Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type: diag(6671, ts.DiagnosticCategory.Message, "Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type_6671", "Enforces using indexed accessors for keys declared using an indexed type"),
6444         Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project: diag(6672, ts.DiagnosticCategory.Message, "Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add__6672", "Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project."),
6445         Disable_strict_checking_of_generic_signatures_in_function_types: diag(6673, ts.DiagnosticCategory.Message, "Disable_strict_checking_of_generic_signatures_in_function_types_6673", "Disable strict checking of generic signatures in function types."),
6446         Add_undefined_to_a_type_when_accessed_using_an_index: diag(6674, ts.DiagnosticCategory.Message, "Add_undefined_to_a_type_when_accessed_using_an_index_6674", "Add `undefined` to a type when accessed using an index."),
6447         Enable_error_reporting_when_a_local_variables_aren_t_read: diag(6675, ts.DiagnosticCategory.Message, "Enable_error_reporting_when_a_local_variables_aren_t_read_6675", "Enable error reporting when a local variables aren't read."),
6448         Raise_an_error_when_a_function_parameter_isn_t_read: diag(6676, ts.DiagnosticCategory.Message, "Raise_an_error_when_a_function_parameter_isn_t_read_6676", "Raise an error when a function parameter isn't read"),
6449         Deprecated_setting_Use_outFile_instead: diag(6677, ts.DiagnosticCategory.Message, "Deprecated_setting_Use_outFile_instead_6677", "Deprecated setting. Use `outFile` instead."),
6450         Specify_an_output_folder_for_all_emitted_files: diag(6678, ts.DiagnosticCategory.Message, "Specify_an_output_folder_for_all_emitted_files_6678", "Specify an output folder for all emitted files."),
6451         Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output: diag(6679, ts.DiagnosticCategory.Message, "Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679", "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output."),
6452         Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations: diag(6680, ts.DiagnosticCategory.Message, "Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations_6680", "Specify a set of entries that re-map imports to additional lookup locations."),
6453         Specify_a_list_of_language_service_plugins_to_include: diag(6681, ts.DiagnosticCategory.Message, "Specify_a_list_of_language_service_plugins_to_include_6681", "Specify a list of language service plugins to include."),
6454         Disable_erasing_const_enum_declarations_in_generated_code: diag(6682, ts.DiagnosticCategory.Message, "Disable_erasing_const_enum_declarations_in_generated_code_6682", "Disable erasing `const enum` declarations in generated code."),
6455         Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node: diag(6683, ts.DiagnosticCategory.Message, "Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node_6683", "Disable resolving symlinks to their realpath. This correlates to the same flag in node."),
6456         Disable_wiping_the_console_in_watch_mode: diag(6684, ts.DiagnosticCategory.Message, "Disable_wiping_the_console_in_watch_mode_6684", "Disable wiping the console in watch mode"),
6457         Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read: diag(6685, ts.DiagnosticCategory.Message, "Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read_6685", "Enable color and formatting in TypeScript's output to make compiler errors easier to read"),
6458         Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit: diag(6686, ts.DiagnosticCategory.Message, "Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit_6686", "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit."),
6459         Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references: diag(6687, ts.DiagnosticCategory.Message, "Specify_an_array_of_objects_that_specify_paths_for_projects_Used_in_project_references_6687", "Specify an array of objects that specify paths for projects. Used in project references."),
6460         Disable_emitting_comments: diag(6688, ts.DiagnosticCategory.Message, "Disable_emitting_comments_6688", "Disable emitting comments."),
6461         Enable_importing_json_files: diag(6689, ts.DiagnosticCategory.Message, "Enable_importing_json_files_6689", "Enable importing .json files"),
6462         Specify_the_root_folder_within_your_source_files: diag(6690, ts.DiagnosticCategory.Message, "Specify_the_root_folder_within_your_source_files_6690", "Specify the root folder within your source files."),
6463         Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules: diag(6691, ts.DiagnosticCategory.Message, "Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules_6691", "Allow multiple folders to be treated as one when resolving modules."),
6464         Skip_type_checking_d_ts_files_that_are_included_with_TypeScript: diag(6692, ts.DiagnosticCategory.Message, "Skip_type_checking_d_ts_files_that_are_included_with_TypeScript_6692", "Skip type checking .d.ts files that are included with TypeScript."),
6465         Skip_type_checking_all_d_ts_files: diag(6693, ts.DiagnosticCategory.Message, "Skip_type_checking_all_d_ts_files_6693", "Skip type checking all .d.ts files."),
6466         Create_source_map_files_for_emitted_JavaScript_files: diag(6694, ts.DiagnosticCategory.Message, "Create_source_map_files_for_emitted_JavaScript_files_6694", "Create source map files for emitted JavaScript files."),
6467         Specify_the_root_path_for_debuggers_to_find_the_reference_source_code: diag(6695, ts.DiagnosticCategory.Message, "Specify_the_root_path_for_debuggers_to_find_the_reference_source_code_6695", "Specify the root path for debuggers to find the reference source code."),
6468         Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function: diag(6697, ts.DiagnosticCategory.Message, "Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function_6697", "Check that the arguments for `bind`, `call`, and `apply` methods match the original function."),
6469         When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible: diag(6698, ts.DiagnosticCategory.Message, "When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible_6698", "When assigning functions, check to ensure parameters and the return values are subtype-compatible."),
6470         When_type_checking_take_into_account_null_and_undefined: diag(6699, ts.DiagnosticCategory.Message, "When_type_checking_take_into_account_null_and_undefined_6699", "When type checking, take into account `null` and `undefined`."),
6471         Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor: diag(6700, ts.DiagnosticCategory.Message, "Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700", "Check for class properties that are declared but not set in the constructor."),
6472         Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments: diag(6701, ts.DiagnosticCategory.Message, "Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments_6701", "Disable emitting declarations that have `@internal` in their JSDoc comments."),
6473         Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals: diag(6702, ts.DiagnosticCategory.Message, "Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals_6702", "Disable reporting of excess property errors during the creation of object literals."),
6474         Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures: diag(6703, ts.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703", "Suppress `noImplicitAny` errors when indexing objects that lack index signatures."),
6475         Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively: diag(6704, ts.DiagnosticCategory.Message, "Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_supp_6704", "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."),
6476         Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations: diag(6705, ts.DiagnosticCategory.Message, "Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declaratio_6705", "Set the JavaScript language version for emitted JavaScript and include compatible library declarations."),
6477         Log_paths_used_during_the_moduleResolution_process: diag(6706, ts.DiagnosticCategory.Message, "Log_paths_used_during_the_moduleResolution_process_6706", "Log paths used during the `moduleResolution` process."),
6478         Specify_the_folder_for_tsbuildinfo_incremental_compilation_files: diag(6707, ts.DiagnosticCategory.Message, "Specify_the_folder_for_tsbuildinfo_incremental_compilation_files_6707", "Specify the folder for .tsbuildinfo incremental compilation files."),
6479         Specify_options_for_automatic_acquisition_of_declaration_files: diag(6709, ts.DiagnosticCategory.Message, "Specify_options_for_automatic_acquisition_of_declaration_files_6709", "Specify options for automatic acquisition of declaration files."),
6480         Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types: diag(6710, ts.DiagnosticCategory.Message, "Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types_6710", "Specify multiple folders that act like `./node_modules/@types`."),
6481         Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file: diag(6711, ts.DiagnosticCategory.Message, "Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file_6711", "Specify type package names to be included without being referenced in a source file."),
6482         Emit_ECMAScript_standard_compliant_class_fields: diag(6712, ts.DiagnosticCategory.Message, "Emit_ECMAScript_standard_compliant_class_fields_6712", "Emit ECMAScript-standard-compliant class fields."),
6483         Enable_verbose_logging: diag(6713, ts.DiagnosticCategory.Message, "Enable_verbose_logging_6713", "Enable verbose logging"),
6484         Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality: diag(6714, ts.DiagnosticCategory.Message, "Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality_6714", "Specify how directories are watched on systems that lack recursive file-watching functionality."),
6485         Specify_how_the_TypeScript_watch_mode_works: diag(6715, ts.DiagnosticCategory.Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
6486         Include_undefined_in_index_signature_results: diag(6716, ts.DiagnosticCategory.Message, "Include_undefined_in_index_signature_results_6716", "Include 'undefined' in index signature results"),
6487         Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, ts.DiagnosticCategory.Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
6488         Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, ts.DiagnosticCategory.Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types"),
6489         Type_catch_clause_variables_as_unknown_instead_of_any: diag(6803, ts.DiagnosticCategory.Message, "Type_catch_clause_variables_as_unknown_instead_of_any_6803", "Type catch clause variables as 'unknown' instead of 'any'."),
6490         one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
6491         one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
6492         type_Colon: diag(6902, ts.DiagnosticCategory.Message, "type_Colon_6902", "type:"),
6493         default_Colon: diag(6903, ts.DiagnosticCategory.Message, "default_Colon_6903", "default:"),
6494         module_system_or_esModuleInterop: diag(6904, ts.DiagnosticCategory.Message, "module_system_or_esModuleInterop_6904", "module === \"system\" or esModuleInterop"),
6495         false_unless_strict_is_set: diag(6905, ts.DiagnosticCategory.Message, "false_unless_strict_is_set_6905", "`false`, unless `strict` is set"),
6496         false_unless_composite_is_set: diag(6906, ts.DiagnosticCategory.Message, "false_unless_composite_is_set_6906", "`false`, unless `composite` is set"),
6497         node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified: diag(6907, ts.DiagnosticCategory.Message, "node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907", "`[\"node_modules\", \"bower_components\", \"jspm_packages\"]`, plus the value of `outDir` if one is specified."),
6498         if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk: diag(6908, ts.DiagnosticCategory.Message, "if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908", "`[]` if `files` is specified, otherwise `[\"**/*\"]`"),
6499         true_if_composite_false_otherwise: diag(6909, ts.DiagnosticCategory.Message, "true_if_composite_false_otherwise_6909", "`true` if `composite`, `false` otherwise"),
6500         module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node: diag(69010, ts.DiagnosticCategory.Message, "module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010", "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"),
6501         Computed_from_the_list_of_input_files: diag(6911, ts.DiagnosticCategory.Message, "Computed_from_the_list_of_input_files_6911", "Computed from the list of input files"),
6502         Platform_specific: diag(6912, ts.DiagnosticCategory.Message, "Platform_specific_6912", "Platform specific"),
6503         You_can_learn_about_all_of_the_compiler_options_at_0: diag(6913, ts.DiagnosticCategory.Message, "You_can_learn_about_all_of_the_compiler_options_at_0_6913", "You can learn about all of the compiler options at {0}"),
6504         Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon: diag(6914, ts.DiagnosticCategory.Message, "Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_conf_6914", "Including --watch, -w will start watching the current project for the file changes. Once set, you can config watch mode with:"),
6505         Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0: diag(6915, ts.DiagnosticCategory.Message, "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915", "Using --build, -b will make tsc behave more like a build orchestrator than a compiler. This is used to trigger building composite projects which you can learn more about at {0}"),
6506         COMMON_COMMANDS: diag(6916, ts.DiagnosticCategory.Message, "COMMON_COMMANDS_6916", "COMMON COMMANDS"),
6507         ALL_COMPILER_OPTIONS: diag(6917, ts.DiagnosticCategory.Message, "ALL_COMPILER_OPTIONS_6917", "ALL COMPILER OPTIONS"),
6508         WATCH_OPTIONS: diag(6918, ts.DiagnosticCategory.Message, "WATCH_OPTIONS_6918", "WATCH OPTIONS"),
6509         BUILD_OPTIONS: diag(6919, ts.DiagnosticCategory.Message, "BUILD_OPTIONS_6919", "BUILD OPTIONS"),
6510         COMMON_COMPILER_OPTIONS: diag(6920, ts.DiagnosticCategory.Message, "COMMON_COMPILER_OPTIONS_6920", "COMMON COMPILER OPTIONS"),
6511         COMMAND_LINE_FLAGS: diag(6921, ts.DiagnosticCategory.Message, "COMMAND_LINE_FLAGS_6921", "COMMAND LINE FLAGS"),
6512         tsc_Colon_The_TypeScript_Compiler: diag(6922, ts.DiagnosticCategory.Message, "tsc_Colon_The_TypeScript_Compiler_6922", "tsc: The TypeScript Compiler"),
6513         Compiles_the_current_project_tsconfig_json_in_the_working_directory: diag(6923, ts.DiagnosticCategory.Message, "Compiles_the_current_project_tsconfig_json_in_the_working_directory_6923", "Compiles the current project (tsconfig.json in the working directory.)"),
6514         Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options: diag(6924, ts.DiagnosticCategory.Message, "Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options_6924", "Ignoring tsconfig.json, compiles the specified files with default compiler options."),
6515         Build_a_composite_project_in_the_working_directory: diag(6925, ts.DiagnosticCategory.Message, "Build_a_composite_project_in_the_working_directory_6925", "Build a composite project in the working directory."),
6516         Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory: diag(6926, ts.DiagnosticCategory.Message, "Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory_6926", "Creates a tsconfig.json with the recommended settings in the working directory."),
6517         Compiles_the_TypeScript_project_located_at_the_specified_path: diag(6927, ts.DiagnosticCategory.Message, "Compiles_the_TypeScript_project_located_at_the_specified_path_6927", "Compiles the TypeScript project located at the specified path."),
6518         An_expanded_version_of_this_information_showing_all_possible_compiler_options: diag(6928, ts.DiagnosticCategory.Message, "An_expanded_version_of_this_information_showing_all_possible_compiler_options_6928", "An expanded version of this information, showing all possible compiler options"),
6519         Compiles_the_current_project_with_additional_settings: diag(6929, ts.DiagnosticCategory.Message, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."),
6520         true_for_ES2022_and_above_including_ESNext: diag(6930, ts.DiagnosticCategory.Message, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."),
6521         Variable_0_implicitly_has_an_1_type: diag(7005, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."),
6522         Parameter_0_implicitly_has_an_1_type: diag(7006, ts.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."),
6523         Member_0_implicitly_has_an_1_type: diag(7008, ts.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."),
6524         new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, ts.DiagnosticCategory.Error, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
6525         _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, ts.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
6526         Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, ts.DiagnosticCategory.Error, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
6527         Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, ts.DiagnosticCategory.Error, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
6528         Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, ts.DiagnosticCategory.Error, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
6529         Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
6530         Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: diag(7016, ts.DiagnosticCategory.Error, "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."),
6531         Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: diag(7017, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", "Element implicitly has an 'any' type because type '{0}' has no index signature."),
6532         Object_literal_s_property_0_implicitly_has_an_1_type: diag(7018, ts.DiagnosticCategory.Error, "Object_literal_s_property_0_implicitly_has_an_1_type_7018", "Object literal's property '{0}' implicitly has an '{1}' type."),
6533         Rest_parameter_0_implicitly_has_an_any_type: diag(7019, ts.DiagnosticCategory.Error, "Rest_parameter_0_implicitly_has_an_any_type_7019", "Rest parameter '{0}' implicitly has an 'any[]' type."),
6534         Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7020, ts.DiagnosticCategory.Error, "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", "Call signature, which lacks return-type annotation, implicitly has an 'any' return type."),
6535         _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: diag(7022, ts.DiagnosticCategory.Error, "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."),
6536         _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: diag(7023, ts.DiagnosticCategory.Error, "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", "'{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."),
6537         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: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "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."),
6538         Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_retu_7025", "Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation."),
6539         JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."),
6540         Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected.", true),
6541         Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label.", true),
6542         Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."),
6543         Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."),
6544         Binding_element_0_implicitly_has_an_1_type: diag(7031, ts.DiagnosticCategory.Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."),
6545         Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: diag(7032, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."),
6546         Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: diag(7033, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."),
6547         Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: diag(7034, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."),
6548         Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035", "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"),
6549         Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."),
6550         Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for_all_imports_Implies_allowSyntheticDefaultImports: diag(7037, ts.DiagnosticCategory.Message, "Enables_emit_interoperability_between_CommonJS_and_ES_Modules_via_creation_of_namespace_objects_for__7037", "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'."),
6551         Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead: diag(7038, ts.DiagnosticCategory.Message, "Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cau_7038", "Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead."),
6552         Mapped_object_type_implicitly_has_an_any_template_type: diag(7039, ts.DiagnosticCategory.Error, "Mapped_object_type_implicitly_has_an_any_template_type_7039", "Mapped object type implicitly has an 'any' template type."),
6553         If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1: diag(7040, ts.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_S_7040", "If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}'"),
6554         The_containing_arrow_function_captures_the_global_value_of_this: diag(7041, ts.DiagnosticCategory.Error, "The_containing_arrow_function_captures_the_global_value_of_this_7041", "The containing arrow function captures the global value of 'this'."),
6555         Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used: diag(7042, ts.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used_7042", "Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used."),
6556         Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7043, ts.DiagnosticCategory.Suggestion, "Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7043", "Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),
6557         Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7044, ts.DiagnosticCategory.Suggestion, "Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7044", "Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),
6558         Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage: diag(7045, ts.DiagnosticCategory.Suggestion, "Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage_7045", "Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage."),
6559         Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage: diag(7046, ts.DiagnosticCategory.Suggestion, "Variable_0_implicitly_has_type_1_in_some_locations_but_a_better_type_may_be_inferred_from_usage_7046", "Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage."),
6560         Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage: diag(7047, ts.DiagnosticCategory.Suggestion, "Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage_7047", "Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage."),
6561         Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage: diag(7048, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_get_accessor_may_be_inferred_from_usage_7048", "Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage."),
6562         Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
6563         _0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
6564         Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
6565         Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?"),
6566         Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
6567         No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
6568         _0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type: diag(7055, ts.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055", "'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type."),
6569         The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed: diag(7056, ts.DiagnosticCategory.Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),
6570         yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation: diag(7057, ts.DiagnosticCategory.Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),
6571         If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1: diag(7058, ts.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),
6572         This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
6573         This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
6574         A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
6575         JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
6576         You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
6577         You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
6578         import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
6579         export_can_only_be_used_in_TypeScript_files: diag(8003, ts.DiagnosticCategory.Error, "export_can_only_be_used_in_TypeScript_files_8003", "'export =' can only be used in TypeScript files."),
6580         Type_parameter_declarations_can_only_be_used_in_TypeScript_files: diag(8004, ts.DiagnosticCategory.Error, "Type_parameter_declarations_can_only_be_used_in_TypeScript_files_8004", "Type parameter declarations can only be used in TypeScript files."),
6581         implements_clauses_can_only_be_used_in_TypeScript_files: diag(8005, ts.DiagnosticCategory.Error, "implements_clauses_can_only_be_used_in_TypeScript_files_8005", "'implements' clauses can only be used in TypeScript files."),
6582         _0_declarations_can_only_be_used_in_TypeScript_files: diag(8006, ts.DiagnosticCategory.Error, "_0_declarations_can_only_be_used_in_TypeScript_files_8006", "'{0}' declarations can only be used in TypeScript files."),
6583         Type_aliases_can_only_be_used_in_TypeScript_files: diag(8008, ts.DiagnosticCategory.Error, "Type_aliases_can_only_be_used_in_TypeScript_files_8008", "Type aliases can only be used in TypeScript files."),
6584         The_0_modifier_can_only_be_used_in_TypeScript_files: diag(8009, ts.DiagnosticCategory.Error, "The_0_modifier_can_only_be_used_in_TypeScript_files_8009", "The '{0}' modifier can only be used in TypeScript files."),
6585         Type_annotations_can_only_be_used_in_TypeScript_files: diag(8010, ts.DiagnosticCategory.Error, "Type_annotations_can_only_be_used_in_TypeScript_files_8010", "Type annotations can only be used in TypeScript files."),
6586         Type_arguments_can_only_be_used_in_TypeScript_files: diag(8011, ts.DiagnosticCategory.Error, "Type_arguments_can_only_be_used_in_TypeScript_files_8011", "Type arguments can only be used in TypeScript files."),
6587         Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, ts.DiagnosticCategory.Error, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."),
6588         Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, ts.DiagnosticCategory.Error, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."),
6589         Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, ts.DiagnosticCategory.Error, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."),
6590         Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, ts.DiagnosticCategory.Error, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."),
6591         Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."),
6592         Report_errors_in_js_files: diag(8019, ts.DiagnosticCategory.Message, "Report_errors_in_js_files_8019", "Report errors in .js files."),
6593         JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, ts.DiagnosticCategory.Error, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."),
6594         JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, ts.DiagnosticCategory.Error, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),
6595         JSDoc_0_is_not_attached_to_a_class: diag(8022, ts.DiagnosticCategory.Error, "JSDoc_0_is_not_attached_to_a_class_8022", "JSDoc '@{0}' is not attached to a class."),
6596         JSDoc_0_1_does_not_match_the_extends_2_clause: diag(8023, ts.DiagnosticCategory.Error, "JSDoc_0_1_does_not_match_the_extends_2_clause_8023", "JSDoc '@{0} {1}' does not match the 'extends {2}' clause."),
6597         JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name: diag(8024, ts.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_8024", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name."),
6598         Class_declarations_cannot_have_more_than_one_augments_or_extends_tag: diag(8025, ts.DiagnosticCategory.Error, "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025", "Class declarations cannot have more than one '@augments' or '@extends' tag."),
6599         Expected_0_type_arguments_provide_these_with_an_extends_tag: diag(8026, ts.DiagnosticCategory.Error, "Expected_0_type_arguments_provide_these_with_an_extends_tag_8026", "Expected {0} type arguments; provide these with an '@extends' tag."),
6600         Expected_0_1_type_arguments_provide_these_with_an_extends_tag: diag(8027, ts.DiagnosticCategory.Error, "Expected_0_1_type_arguments_provide_these_with_an_extends_tag_8027", "Expected {0}-{1} type arguments; provide these with an '@extends' tag."),
6601         JSDoc_may_only_appear_in_the_last_parameter_of_a_signature: diag(8028, ts.DiagnosticCategory.Error, "JSDoc_may_only_appear_in_the_last_parameter_of_a_signature_8028", "JSDoc '...' may only appear in the last parameter of a signature."),
6602         JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type: diag(8029, ts.DiagnosticCategory.Error, "JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_h_8029", "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type."),
6603         The_type_of_a_function_declaration_must_match_the_function_s_signature: diag(8030, ts.DiagnosticCategory.Error, "The_type_of_a_function_declaration_must_match_the_function_s_signature_8030", "The type of a function declaration must match the function's signature."),
6604         You_cannot_rename_a_module_via_a_global_import: diag(8031, ts.DiagnosticCategory.Error, "You_cannot_rename_a_module_via_a_global_import_8031", "You cannot rename a module via a global import."),
6605         Qualified_name_0_is_not_allowed_without_a_leading_param_object_1: diag(8032, ts.DiagnosticCategory.Error, "Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032", "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."),
6606         A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags: diag(8033, ts.DiagnosticCategory.Error, "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033", "A JSDoc '@typedef' comment may not contain multiple '@type' tags."),
6607         The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."),
6608         Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
6609         Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
6610         JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
6611         JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, ts.DiagnosticCategory.Error, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
6612         Expected_corresponding_JSX_closing_tag_for_0: diag(17002, ts.DiagnosticCategory.Error, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
6613         Cannot_use_JSX_unless_the_jsx_flag_is_provided: diag(17004, ts.DiagnosticCategory.Error, "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", "Cannot use JSX unless the '--jsx' flag is provided."),
6614         A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: diag(17005, ts.DiagnosticCategory.Error, "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", "A constructor cannot contain a 'super' call when its class extends 'null'."),
6615         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: diag(17006, ts.DiagnosticCategory.Error, "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", "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."),
6616         A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17007, ts.DiagnosticCategory.Error, "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."),
6617         JSX_element_0_has_no_corresponding_closing_tag: diag(17008, ts.DiagnosticCategory.Error, "JSX_element_0_has_no_corresponding_closing_tag_17008", "JSX element '{0}' has no corresponding closing tag."),
6618         super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: diag(17009, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", "'super' must be called before accessing 'this' in the constructor of a derived class."),
6619         Unknown_type_acquisition_option_0: diag(17010, ts.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_17010", "Unknown type acquisition option '{0}'."),
6620         super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."),
6621         _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"),
6622         Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."),
6623         JSX_fragment_has_no_corresponding_closing_tag: diag(17014, ts.DiagnosticCategory.Error, "JSX_fragment_has_no_corresponding_closing_tag_17014", "JSX fragment has no corresponding closing tag."),
6624         Expected_corresponding_closing_tag_for_JSX_fragment: diag(17015, ts.DiagnosticCategory.Error, "Expected_corresponding_closing_tag_for_JSX_fragment_17015", "Expected corresponding closing tag for JSX fragment."),
6625         The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option: diag(17016, ts.DiagnosticCategory.Error, "The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016", "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option."),
6626         An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments: diag(17017, ts.DiagnosticCategory.Error, "An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments_17017", "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments."),
6627         Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, ts.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
6628         Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
6629         The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
6630         No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, ts.DiagnosticCategory.Error, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
6631         File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module: diag(80001, ts.DiagnosticCategory.Suggestion, "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001", "File is a CommonJS module; it may be converted to an ES module."),
6632         This_constructor_function_may_be_converted_to_a_class_declaration: diag(80002, ts.DiagnosticCategory.Suggestion, "This_constructor_function_may_be_converted_to_a_class_declaration_80002", "This constructor function may be converted to a class declaration."),
6633         Import_may_be_converted_to_a_default_import: diag(80003, ts.DiagnosticCategory.Suggestion, "Import_may_be_converted_to_a_default_import_80003", "Import may be converted to a default import."),
6634         JSDoc_types_may_be_moved_to_TypeScript_types: diag(80004, ts.DiagnosticCategory.Suggestion, "JSDoc_types_may_be_moved_to_TypeScript_types_80004", "JSDoc types may be moved to TypeScript types."),
6635         require_call_may_be_converted_to_an_import: diag(80005, ts.DiagnosticCategory.Suggestion, "require_call_may_be_converted_to_an_import_80005", "'require' call may be converted to an import."),
6636         This_may_be_converted_to_an_async_function: diag(80006, ts.DiagnosticCategory.Suggestion, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
6637         await_has_no_effect_on_the_type_of_this_expression: diag(80007, ts.DiagnosticCategory.Suggestion, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
6638         Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, ts.DiagnosticCategory.Suggestion, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
6639         Add_missing_super_call: diag(90001, ts.DiagnosticCategory.Message, "Add_missing_super_call_90001", "Add missing 'super()' call"),
6640         Make_super_call_the_first_statement_in_the_constructor: diag(90002, ts.DiagnosticCategory.Message, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
6641         Change_extends_to_implements: diag(90003, ts.DiagnosticCategory.Message, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
6642         Remove_unused_declaration_for_Colon_0: diag(90004, ts.DiagnosticCategory.Message, "Remove_unused_declaration_for_Colon_0_90004", "Remove unused declaration for: '{0}'"),
6643         Remove_import_from_0: diag(90005, ts.DiagnosticCategory.Message, "Remove_import_from_0_90005", "Remove import from '{0}'"),
6644         Implement_interface_0: diag(90006, ts.DiagnosticCategory.Message, "Implement_interface_0_90006", "Implement interface '{0}'"),
6645         Implement_inherited_abstract_class: diag(90007, ts.DiagnosticCategory.Message, "Implement_inherited_abstract_class_90007", "Implement inherited abstract class"),
6646         Add_0_to_unresolved_variable: diag(90008, ts.DiagnosticCategory.Message, "Add_0_to_unresolved_variable_90008", "Add '{0}.' to unresolved variable"),
6647         Remove_variable_statement: diag(90010, ts.DiagnosticCategory.Message, "Remove_variable_statement_90010", "Remove variable statement"),
6648         Remove_template_tag: diag(90011, ts.DiagnosticCategory.Message, "Remove_template_tag_90011", "Remove template tag"),
6649         Remove_type_parameters: diag(90012, ts.DiagnosticCategory.Message, "Remove_type_parameters_90012", "Remove type parameters"),
6650         Import_0_from_module_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_module_1_90013", "Import '{0}' from module \"{1}\""),
6651         Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change '{0}' to '{1}'"),
6652         Add_0_to_existing_import_declaration_from_1: diag(90015, ts.DiagnosticCategory.Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add '{0}' to existing import declaration from \"{1}\""),
6653         Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'"),
6654         Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'"),
6655         Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file"),
6656         Ignore_this_error_message: diag(90019, ts.DiagnosticCategory.Message, "Ignore_this_error_message_90019", "Ignore this error message"),
6657         Initialize_property_0_in_the_constructor: diag(90020, ts.DiagnosticCategory.Message, "Initialize_property_0_in_the_constructor_90020", "Initialize property '{0}' in the constructor"),
6658         Initialize_static_property_0: diag(90021, ts.DiagnosticCategory.Message, "Initialize_static_property_0_90021", "Initialize static property '{0}'"),
6659         Change_spelling_to_0: diag(90022, ts.DiagnosticCategory.Message, "Change_spelling_to_0_90022", "Change spelling to '{0}'"),
6660         Declare_method_0: diag(90023, ts.DiagnosticCategory.Message, "Declare_method_0_90023", "Declare method '{0}'"),
6661         Declare_static_method_0: diag(90024, ts.DiagnosticCategory.Message, "Declare_static_method_0_90024", "Declare static method '{0}'"),
6662         Prefix_0_with_an_underscore: diag(90025, ts.DiagnosticCategory.Message, "Prefix_0_with_an_underscore_90025", "Prefix '{0}' with an underscore"),
6663         Rewrite_as_the_indexed_access_type_0: diag(90026, ts.DiagnosticCategory.Message, "Rewrite_as_the_indexed_access_type_0_90026", "Rewrite as the indexed access type '{0}'"),
6664         Declare_static_property_0: diag(90027, ts.DiagnosticCategory.Message, "Declare_static_property_0_90027", "Declare static property '{0}'"),
6665         Call_decorator_expression: diag(90028, ts.DiagnosticCategory.Message, "Call_decorator_expression_90028", "Call decorator expression"),
6666         Add_async_modifier_to_containing_function: diag(90029, ts.DiagnosticCategory.Message, "Add_async_modifier_to_containing_function_90029", "Add async modifier to containing function"),
6667         Replace_infer_0_with_unknown: diag(90030, ts.DiagnosticCategory.Message, "Replace_infer_0_with_unknown_90030", "Replace 'infer {0}' with 'unknown'"),
6668         Replace_all_unused_infer_with_unknown: diag(90031, ts.DiagnosticCategory.Message, "Replace_all_unused_infer_with_unknown_90031", "Replace all unused 'infer' with 'unknown'"),
6669         Import_default_0_from_module_1: diag(90032, ts.DiagnosticCategory.Message, "Import_default_0_from_module_1_90032", "Import default '{0}' from module \"{1}\""),
6670         Add_default_import_0_to_existing_import_declaration_from_1: diag(90033, ts.DiagnosticCategory.Message, "Add_default_import_0_to_existing_import_declaration_from_1_90033", "Add default import '{0}' to existing import declaration from \"{1}\""),
6671         Add_parameter_name: diag(90034, ts.DiagnosticCategory.Message, "Add_parameter_name_90034", "Add parameter name"),
6672         Declare_private_property_0: diag(90035, ts.DiagnosticCategory.Message, "Declare_private_property_0_90035", "Declare private property '{0}'"),
6673         Replace_0_with_Promise_1: diag(90036, ts.DiagnosticCategory.Message, "Replace_0_with_Promise_1_90036", "Replace '{0}' with 'Promise<{1}>'"),
6674         Fix_all_incorrect_return_type_of_an_async_functions: diag(90037, ts.DiagnosticCategory.Message, "Fix_all_incorrect_return_type_of_an_async_functions_90037", "Fix all incorrect return type of an async functions"),
6675         Declare_private_method_0: diag(90038, ts.DiagnosticCategory.Message, "Declare_private_method_0_90038", "Declare private method '{0}'"),
6676         Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
6677         Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
6678         Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
6679         Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
6680         Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
6681         Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
6682         Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
6683         Extract_function: diag(95005, ts.DiagnosticCategory.Message, "Extract_function_95005", "Extract function"),
6684         Extract_constant: diag(95006, ts.DiagnosticCategory.Message, "Extract_constant_95006", "Extract constant"),
6685         Extract_to_0_in_enclosing_scope: diag(95007, ts.DiagnosticCategory.Message, "Extract_to_0_in_enclosing_scope_95007", "Extract to {0} in enclosing scope"),
6686         Extract_to_0_in_1_scope: diag(95008, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_scope_95008", "Extract to {0} in {1} scope"),
6687         Annotate_with_type_from_JSDoc: diag(95009, ts.DiagnosticCategory.Message, "Annotate_with_type_from_JSDoc_95009", "Annotate with type from JSDoc"),
6688         Infer_type_of_0_from_usage: diag(95011, ts.DiagnosticCategory.Message, "Infer_type_of_0_from_usage_95011", "Infer type of '{0}' from usage"),
6689         Infer_parameter_types_from_usage: diag(95012, ts.DiagnosticCategory.Message, "Infer_parameter_types_from_usage_95012", "Infer parameter types from usage"),
6690         Convert_to_default_import: diag(95013, ts.DiagnosticCategory.Message, "Convert_to_default_import_95013", "Convert to default import"),
6691         Install_0: diag(95014, ts.DiagnosticCategory.Message, "Install_0_95014", "Install '{0}'"),
6692         Replace_import_with_0: diag(95015, ts.DiagnosticCategory.Message, "Replace_import_with_0_95015", "Replace import with '{0}'."),
6693         Use_synthetic_default_member: diag(95016, ts.DiagnosticCategory.Message, "Use_synthetic_default_member_95016", "Use synthetic 'default' member."),
6694         Convert_to_ES_module: diag(95017, ts.DiagnosticCategory.Message, "Convert_to_ES_module_95017", "Convert to ES module"),
6695         Add_undefined_type_to_property_0: diag(95018, ts.DiagnosticCategory.Message, "Add_undefined_type_to_property_0_95018", "Add 'undefined' type to property '{0}'"),
6696         Add_initializer_to_property_0: diag(95019, ts.DiagnosticCategory.Message, "Add_initializer_to_property_0_95019", "Add initializer to property '{0}'"),
6697         Add_definite_assignment_assertion_to_property_0: diag(95020, ts.DiagnosticCategory.Message, "Add_definite_assignment_assertion_to_property_0_95020", "Add definite assignment assertion to property '{0}'"),
6698         Convert_all_type_literals_to_mapped_type: diag(95021, ts.DiagnosticCategory.Message, "Convert_all_type_literals_to_mapped_type_95021", "Convert all type literals to mapped type"),
6699         Add_all_missing_members: diag(95022, ts.DiagnosticCategory.Message, "Add_all_missing_members_95022", "Add all missing members"),
6700         Infer_all_types_from_usage: diag(95023, ts.DiagnosticCategory.Message, "Infer_all_types_from_usage_95023", "Infer all types from usage"),
6701         Delete_all_unused_declarations: diag(95024, ts.DiagnosticCategory.Message, "Delete_all_unused_declarations_95024", "Delete all unused declarations"),
6702         Prefix_all_unused_declarations_with_where_possible: diag(95025, ts.DiagnosticCategory.Message, "Prefix_all_unused_declarations_with_where_possible_95025", "Prefix all unused declarations with '_' where possible"),
6703         Fix_all_detected_spelling_errors: diag(95026, ts.DiagnosticCategory.Message, "Fix_all_detected_spelling_errors_95026", "Fix all detected spelling errors"),
6704         Add_initializers_to_all_uninitialized_properties: diag(95027, ts.DiagnosticCategory.Message, "Add_initializers_to_all_uninitialized_properties_95027", "Add initializers to all uninitialized properties"),
6705         Add_definite_assignment_assertions_to_all_uninitialized_properties: diag(95028, ts.DiagnosticCategory.Message, "Add_definite_assignment_assertions_to_all_uninitialized_properties_95028", "Add definite assignment assertions to all uninitialized properties"),
6706         Add_undefined_type_to_all_uninitialized_properties: diag(95029, ts.DiagnosticCategory.Message, "Add_undefined_type_to_all_uninitialized_properties_95029", "Add undefined type to all uninitialized properties"),
6707         Change_all_jsdoc_style_types_to_TypeScript: diag(95030, ts.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_95030", "Change all jsdoc-style types to TypeScript"),
6708         Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types: diag(95031, ts.DiagnosticCategory.Message, "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031", "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)"),
6709         Implement_all_unimplemented_interfaces: diag(95032, ts.DiagnosticCategory.Message, "Implement_all_unimplemented_interfaces_95032", "Implement all unimplemented interfaces"),
6710         Install_all_missing_types_packages: diag(95033, ts.DiagnosticCategory.Message, "Install_all_missing_types_packages_95033", "Install all missing types packages"),
6711         Rewrite_all_as_indexed_access_types: diag(95034, ts.DiagnosticCategory.Message, "Rewrite_all_as_indexed_access_types_95034", "Rewrite all as indexed access types"),
6712         Convert_all_to_default_imports: diag(95035, ts.DiagnosticCategory.Message, "Convert_all_to_default_imports_95035", "Convert all to default imports"),
6713         Make_all_super_calls_the_first_statement_in_their_constructor: diag(95036, ts.DiagnosticCategory.Message, "Make_all_super_calls_the_first_statement_in_their_constructor_95036", "Make all 'super()' calls the first statement in their constructor"),
6714         Add_qualifier_to_all_unresolved_variables_matching_a_member_name: diag(95037, ts.DiagnosticCategory.Message, "Add_qualifier_to_all_unresolved_variables_matching_a_member_name_95037", "Add qualifier to all unresolved variables matching a member name"),
6715         Change_all_extended_interfaces_to_implements: diag(95038, ts.DiagnosticCategory.Message, "Change_all_extended_interfaces_to_implements_95038", "Change all extended interfaces to 'implements'"),
6716         Add_all_missing_super_calls: diag(95039, ts.DiagnosticCategory.Message, "Add_all_missing_super_calls_95039", "Add all missing super calls"),
6717         Implement_all_inherited_abstract_classes: diag(95040, ts.DiagnosticCategory.Message, "Implement_all_inherited_abstract_classes_95040", "Implement all inherited abstract classes"),
6718         Add_all_missing_async_modifiers: diag(95041, ts.DiagnosticCategory.Message, "Add_all_missing_async_modifiers_95041", "Add all missing 'async' modifiers"),
6719         Add_ts_ignore_to_all_error_messages: diag(95042, ts.DiagnosticCategory.Message, "Add_ts_ignore_to_all_error_messages_95042", "Add '@ts-ignore' to all error messages"),
6720         Annotate_everything_with_types_from_JSDoc: diag(95043, ts.DiagnosticCategory.Message, "Annotate_everything_with_types_from_JSDoc_95043", "Annotate everything with types from JSDoc"),
6721         Add_to_all_uncalled_decorators: diag(95044, ts.DiagnosticCategory.Message, "Add_to_all_uncalled_decorators_95044", "Add '()' to all uncalled decorators"),
6722         Convert_all_constructor_functions_to_classes: diag(95045, ts.DiagnosticCategory.Message, "Convert_all_constructor_functions_to_classes_95045", "Convert all constructor functions to classes"),
6723         Generate_get_and_set_accessors: diag(95046, ts.DiagnosticCategory.Message, "Generate_get_and_set_accessors_95046", "Generate 'get' and 'set' accessors"),
6724         Convert_require_to_import: diag(95047, ts.DiagnosticCategory.Message, "Convert_require_to_import_95047", "Convert 'require' to 'import'"),
6725         Convert_all_require_to_import: diag(95048, ts.DiagnosticCategory.Message, "Convert_all_require_to_import_95048", "Convert all 'require' to 'import'"),
6726         Move_to_a_new_file: diag(95049, ts.DiagnosticCategory.Message, "Move_to_a_new_file_95049", "Move to a new file"),
6727         Remove_unreachable_code: diag(95050, ts.DiagnosticCategory.Message, "Remove_unreachable_code_95050", "Remove unreachable code"),
6728         Remove_all_unreachable_code: diag(95051, ts.DiagnosticCategory.Message, "Remove_all_unreachable_code_95051", "Remove all unreachable code"),
6729         Add_missing_typeof: diag(95052, ts.DiagnosticCategory.Message, "Add_missing_typeof_95052", "Add missing 'typeof'"),
6730         Remove_unused_label: diag(95053, ts.DiagnosticCategory.Message, "Remove_unused_label_95053", "Remove unused label"),
6731         Remove_all_unused_labels: diag(95054, ts.DiagnosticCategory.Message, "Remove_all_unused_labels_95054", "Remove all unused labels"),
6732         Convert_0_to_mapped_object_type: diag(95055, ts.DiagnosticCategory.Message, "Convert_0_to_mapped_object_type_95055", "Convert '{0}' to mapped object type"),
6733         Convert_namespace_import_to_named_imports: diag(95056, ts.DiagnosticCategory.Message, "Convert_namespace_import_to_named_imports_95056", "Convert namespace import to named imports"),
6734         Convert_named_imports_to_namespace_import: diag(95057, ts.DiagnosticCategory.Message, "Convert_named_imports_to_namespace_import_95057", "Convert named imports to namespace import"),
6735         Add_or_remove_braces_in_an_arrow_function: diag(95058, ts.DiagnosticCategory.Message, "Add_or_remove_braces_in_an_arrow_function_95058", "Add or remove braces in an arrow function"),
6736         Add_braces_to_arrow_function: diag(95059, ts.DiagnosticCategory.Message, "Add_braces_to_arrow_function_95059", "Add braces to arrow function"),
6737         Remove_braces_from_arrow_function: diag(95060, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_95060", "Remove braces from arrow function"),
6738         Convert_default_export_to_named_export: diag(95061, ts.DiagnosticCategory.Message, "Convert_default_export_to_named_export_95061", "Convert default export to named export"),
6739         Convert_named_export_to_default_export: diag(95062, ts.DiagnosticCategory.Message, "Convert_named_export_to_default_export_95062", "Convert named export to default export"),
6740         Add_missing_enum_member_0: diag(95063, ts.DiagnosticCategory.Message, "Add_missing_enum_member_0_95063", "Add missing enum member '{0}'"),
6741         Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
6742         Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
6743         Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
6744         Add_missing_call_parentheses: diag(95067, ts.DiagnosticCategory.Message, "Add_missing_call_parentheses_95067", "Add missing call parentheses"),
6745         Add_all_missing_call_parentheses: diag(95068, ts.DiagnosticCategory.Message, "Add_all_missing_call_parentheses_95068", "Add all missing call parentheses"),
6746         Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
6747         Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
6748         Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
6749         Add_missing_new_operator_to_all_calls: diag(95072, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_all_calls_95072", "Add missing 'new' operator to all calls"),
6750         Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
6751         Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
6752         Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
6753         Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
6754         Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
6755         Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
6756         Infer_this_type_of_0_from_usage: diag(95080, ts.DiagnosticCategory.Message, "Infer_this_type_of_0_from_usage_95080", "Infer 'this' type of '{0}' from usage"),
6757         Add_const_to_unresolved_variable: diag(95081, ts.DiagnosticCategory.Message, "Add_const_to_unresolved_variable_95081", "Add 'const' to unresolved variable"),
6758         Add_const_to_all_unresolved_variables: diag(95082, ts.DiagnosticCategory.Message, "Add_const_to_all_unresolved_variables_95082", "Add 'const' to all unresolved variables"),
6759         Add_await: diag(95083, ts.DiagnosticCategory.Message, "Add_await_95083", "Add 'await'"),
6760         Add_await_to_initializer_for_0: diag(95084, ts.DiagnosticCategory.Message, "Add_await_to_initializer_for_0_95084", "Add 'await' to initializer for '{0}'"),
6761         Fix_all_expressions_possibly_missing_await: diag(95085, ts.DiagnosticCategory.Message, "Fix_all_expressions_possibly_missing_await_95085", "Fix all expressions possibly missing 'await'"),
6762         Remove_unnecessary_await: diag(95086, ts.DiagnosticCategory.Message, "Remove_unnecessary_await_95086", "Remove unnecessary 'await'"),
6763         Remove_all_unnecessary_uses_of_await: diag(95087, ts.DiagnosticCategory.Message, "Remove_all_unnecessary_uses_of_await_95087", "Remove all unnecessary uses of 'await'"),
6764         Enable_the_jsx_flag_in_your_configuration_file: diag(95088, ts.DiagnosticCategory.Message, "Enable_the_jsx_flag_in_your_configuration_file_95088", "Enable the '--jsx' flag in your configuration file"),
6765         Add_await_to_initializers: diag(95089, ts.DiagnosticCategory.Message, "Add_await_to_initializers_95089", "Add 'await' to initializers"),
6766         Extract_to_interface: diag(95090, ts.DiagnosticCategory.Message, "Extract_to_interface_95090", "Extract to interface"),
6767         Convert_to_a_bigint_numeric_literal: diag(95091, ts.DiagnosticCategory.Message, "Convert_to_a_bigint_numeric_literal_95091", "Convert to a bigint numeric literal"),
6768         Convert_all_to_bigint_numeric_literals: diag(95092, ts.DiagnosticCategory.Message, "Convert_all_to_bigint_numeric_literals_95092", "Convert all to bigint numeric literals"),
6769         Convert_const_to_let: diag(95093, ts.DiagnosticCategory.Message, "Convert_const_to_let_95093", "Convert 'const' to 'let'"),
6770         Prefix_with_declare: diag(95094, ts.DiagnosticCategory.Message, "Prefix_with_declare_95094", "Prefix with 'declare'"),
6771         Prefix_all_incorrect_property_declarations_with_declare: diag(95095, ts.DiagnosticCategory.Message, "Prefix_all_incorrect_property_declarations_with_declare_95095", "Prefix all incorrect property declarations with 'declare'"),
6772         Convert_to_template_string: diag(95096, ts.DiagnosticCategory.Message, "Convert_to_template_string_95096", "Convert to template string"),
6773         Add_export_to_make_this_file_into_a_module: diag(95097, ts.DiagnosticCategory.Message, "Add_export_to_make_this_file_into_a_module_95097", "Add 'export {}' to make this file into a module"),
6774         Set_the_target_option_in_your_configuration_file_to_0: diag(95098, ts.DiagnosticCategory.Message, "Set_the_target_option_in_your_configuration_file_to_0_95098", "Set the 'target' option in your configuration file to '{0}'"),
6775         Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"),
6776         Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"),
6777         Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"),
6778         Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"),
6779         Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"),
6780         Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"),
6781         Wrap_invalid_character_in_an_expression_container: diag(95108, ts.DiagnosticCategory.Message, "Wrap_invalid_character_in_an_expression_container_95108", "Wrap invalid character in an expression container"),
6782         Wrap_all_invalid_characters_in_an_expression_container: diag(95109, ts.DiagnosticCategory.Message, "Wrap_all_invalid_characters_in_an_expression_container_95109", "Wrap all invalid characters in an expression container"),
6783         Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file: diag(95110, ts.DiagnosticCategory.Message, "Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file_95110", "Visit https://aka.ms/tsconfig.json to read more about this file"),
6784         Add_a_return_statement: diag(95111, ts.DiagnosticCategory.Message, "Add_a_return_statement_95111", "Add a return statement"),
6785         Remove_braces_from_arrow_function_body: diag(95112, ts.DiagnosticCategory.Message, "Remove_braces_from_arrow_function_body_95112", "Remove braces from arrow function body"),
6786         Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal: diag(95113, ts.DiagnosticCategory.Message, "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113", "Wrap the following body with parentheses which should be an object literal"),
6787         Add_all_missing_return_statement: diag(95114, ts.DiagnosticCategory.Message, "Add_all_missing_return_statement_95114", "Add all missing return statement"),
6788         Remove_braces_from_all_arrow_function_bodies_with_relevant_issues: diag(95115, ts.DiagnosticCategory.Message, "Remove_braces_from_all_arrow_function_bodies_with_relevant_issues_95115", "Remove braces from all arrow function bodies with relevant issues"),
6789         Wrap_all_object_literal_with_parentheses: diag(95116, ts.DiagnosticCategory.Message, "Wrap_all_object_literal_with_parentheses_95116", "Wrap all object literal with parentheses"),
6790         Move_labeled_tuple_element_modifiers_to_labels: diag(95117, ts.DiagnosticCategory.Message, "Move_labeled_tuple_element_modifiers_to_labels_95117", "Move labeled tuple element modifiers to labels"),
6791         Convert_overload_list_to_single_signature: diag(95118, ts.DiagnosticCategory.Message, "Convert_overload_list_to_single_signature_95118", "Convert overload list to single signature"),
6792         Generate_get_and_set_accessors_for_all_overriding_properties: diag(95119, ts.DiagnosticCategory.Message, "Generate_get_and_set_accessors_for_all_overriding_properties_95119", "Generate 'get' and 'set' accessors for all overriding properties"),
6793         Wrap_in_JSX_fragment: diag(95120, ts.DiagnosticCategory.Message, "Wrap_in_JSX_fragment_95120", "Wrap in JSX fragment"),
6794         Wrap_all_unparented_JSX_in_JSX_fragment: diag(95121, ts.DiagnosticCategory.Message, "Wrap_all_unparented_JSX_in_JSX_fragment_95121", "Wrap all unparented JSX in JSX fragment"),
6795         Convert_arrow_function_or_function_expression: diag(95122, ts.DiagnosticCategory.Message, "Convert_arrow_function_or_function_expression_95122", "Convert arrow function or function expression"),
6796         Convert_to_anonymous_function: diag(95123, ts.DiagnosticCategory.Message, "Convert_to_anonymous_function_95123", "Convert to anonymous function"),
6797         Convert_to_named_function: diag(95124, ts.DiagnosticCategory.Message, "Convert_to_named_function_95124", "Convert to named function"),
6798         Convert_to_arrow_function: diag(95125, ts.DiagnosticCategory.Message, "Convert_to_arrow_function_95125", "Convert to arrow function"),
6799         Remove_parentheses: diag(95126, ts.DiagnosticCategory.Message, "Remove_parentheses_95126", "Remove parentheses"),
6800         Could_not_find_a_containing_arrow_function: diag(95127, ts.DiagnosticCategory.Message, "Could_not_find_a_containing_arrow_function_95127", "Could not find a containing arrow function"),
6801         Containing_function_is_not_an_arrow_function: diag(95128, ts.DiagnosticCategory.Message, "Containing_function_is_not_an_arrow_function_95128", "Containing function is not an arrow function"),
6802         Could_not_find_export_statement: diag(95129, ts.DiagnosticCategory.Message, "Could_not_find_export_statement_95129", "Could not find export statement"),
6803         This_file_already_has_a_default_export: diag(95130, ts.DiagnosticCategory.Message, "This_file_already_has_a_default_export_95130", "This file already has a default export"),
6804         Could_not_find_import_clause: diag(95131, ts.DiagnosticCategory.Message, "Could_not_find_import_clause_95131", "Could not find import clause"),
6805         Could_not_find_namespace_import_or_named_imports: diag(95132, ts.DiagnosticCategory.Message, "Could_not_find_namespace_import_or_named_imports_95132", "Could not find namespace import or named imports"),
6806         Selection_is_not_a_valid_type_node: diag(95133, ts.DiagnosticCategory.Message, "Selection_is_not_a_valid_type_node_95133", "Selection is not a valid type node"),
6807         No_type_could_be_extracted_from_this_type_node: diag(95134, ts.DiagnosticCategory.Message, "No_type_could_be_extracted_from_this_type_node_95134", "No type could be extracted from this type node"),
6808         Could_not_find_property_for_which_to_generate_accessor: diag(95135, ts.DiagnosticCategory.Message, "Could_not_find_property_for_which_to_generate_accessor_95135", "Could not find property for which to generate accessor"),
6809         Name_is_not_valid: diag(95136, ts.DiagnosticCategory.Message, "Name_is_not_valid_95136", "Name is not valid"),
6810         Can_only_convert_property_with_modifier: diag(95137, ts.DiagnosticCategory.Message, "Can_only_convert_property_with_modifier_95137", "Can only convert property with modifier"),
6811         Switch_each_misused_0_to_1: diag(95138, ts.DiagnosticCategory.Message, "Switch_each_misused_0_to_1_95138", "Switch each misused '{0}' to '{1}'"),
6812         Convert_to_optional_chain_expression: diag(95139, ts.DiagnosticCategory.Message, "Convert_to_optional_chain_expression_95139", "Convert to optional chain expression"),
6813         Could_not_find_convertible_access_expression: diag(95140, ts.DiagnosticCategory.Message, "Could_not_find_convertible_access_expression_95140", "Could not find convertible access expression"),
6814         Could_not_find_matching_access_expressions: diag(95141, ts.DiagnosticCategory.Message, "Could_not_find_matching_access_expressions_95141", "Could not find matching access expressions"),
6815         Can_only_convert_logical_AND_access_chains: diag(95142, ts.DiagnosticCategory.Message, "Can_only_convert_logical_AND_access_chains_95142", "Can only convert logical AND access chains"),
6816         Add_void_to_Promise_resolved_without_a_value: diag(95143, ts.DiagnosticCategory.Message, "Add_void_to_Promise_resolved_without_a_value_95143", "Add 'void' to Promise resolved without a value"),
6817         Add_void_to_all_Promises_resolved_without_a_value: diag(95144, ts.DiagnosticCategory.Message, "Add_void_to_all_Promises_resolved_without_a_value_95144", "Add 'void' to all Promises resolved without a value"),
6818         Use_element_access_for_0: diag(95145, ts.DiagnosticCategory.Message, "Use_element_access_for_0_95145", "Use element access for '{0}'"),
6819         Use_element_access_for_all_undeclared_properties: diag(95146, ts.DiagnosticCategory.Message, "Use_element_access_for_all_undeclared_properties_95146", "Use element access for all undeclared properties."),
6820         Delete_all_unused_imports: diag(95147, ts.DiagnosticCategory.Message, "Delete_all_unused_imports_95147", "Delete all unused imports"),
6821         Infer_function_return_type: diag(95148, ts.DiagnosticCategory.Message, "Infer_function_return_type_95148", "Infer function return type"),
6822         Return_type_must_be_inferred_from_a_function: diag(95149, ts.DiagnosticCategory.Message, "Return_type_must_be_inferred_from_a_function_95149", "Return type must be inferred from a function"),
6823         Could_not_determine_function_return_type: diag(95150, ts.DiagnosticCategory.Message, "Could_not_determine_function_return_type_95150", "Could not determine function return type"),
6824         Could_not_convert_to_arrow_function: diag(95151, ts.DiagnosticCategory.Message, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
6825         Could_not_convert_to_named_function: diag(95152, ts.DiagnosticCategory.Message, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
6826         Could_not_convert_to_anonymous_function: diag(95153, ts.DiagnosticCategory.Message, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
6827         Can_only_convert_string_concatenation: diag(95154, ts.DiagnosticCategory.Message, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
6828         Selection_is_not_a_valid_statement_or_statements: diag(95155, ts.DiagnosticCategory.Message, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
6829         Add_missing_function_declaration_0: diag(95156, ts.DiagnosticCategory.Message, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
6830         Add_all_missing_function_declarations: diag(95157, ts.DiagnosticCategory.Message, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
6831         Method_not_implemented: diag(95158, ts.DiagnosticCategory.Message, "Method_not_implemented_95158", "Method not implemented."),
6832         Function_not_implemented: diag(95159, ts.DiagnosticCategory.Message, "Function_not_implemented_95159", "Function not implemented."),
6833         Add_override_modifier: diag(95160, ts.DiagnosticCategory.Message, "Add_override_modifier_95160", "Add 'override' modifier"),
6834         Remove_override_modifier: diag(95161, ts.DiagnosticCategory.Message, "Remove_override_modifier_95161", "Remove 'override' modifier"),
6835         Add_all_missing_override_modifiers: diag(95162, ts.DiagnosticCategory.Message, "Add_all_missing_override_modifiers_95162", "Add all missing 'override' modifiers"),
6836         Remove_all_unnecessary_override_modifiers: diag(95163, ts.DiagnosticCategory.Message, "Remove_all_unnecessary_override_modifiers_95163", "Remove all unnecessary 'override' modifiers"),
6837         Can_only_convert_named_export: diag(95164, ts.DiagnosticCategory.Message, "Can_only_convert_named_export_95164", "Can only convert named export"),
6838         Add_missing_properties: diag(95165, ts.DiagnosticCategory.Message, "Add_missing_properties_95165", "Add missing properties"),
6839         Add_all_missing_properties: diag(95166, ts.DiagnosticCategory.Message, "Add_all_missing_properties_95166", "Add all missing properties"),
6840         Add_missing_attributes: diag(95167, ts.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"),
6841         Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
6842         Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
6843         No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
6844         Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
6845         JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
6846         Private_identifiers_cannot_be_used_as_parameters: diag(18009, ts.DiagnosticCategory.Error, "Private_identifiers_cannot_be_used_as_parameters_18009", "Private identifiers cannot be used as parameters."),
6847         An_accessibility_modifier_cannot_be_used_with_a_private_identifier: diag(18010, ts.DiagnosticCategory.Error, "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010", "An accessibility modifier cannot be used with a private identifier."),
6848         The_operand_of_a_delete_operator_cannot_be_a_private_identifier: diag(18011, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_private_identifier_18011", "The operand of a 'delete' operator cannot be a private identifier."),
6849         constructor_is_a_reserved_word: diag(18012, ts.DiagnosticCategory.Error, "constructor_is_a_reserved_word_18012", "'#constructor' is a reserved word."),
6850         Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier: diag(18013, ts.DiagnosticCategory.Error, "Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier_18013", "Property '{0}' is not accessible outside class '{1}' because it has a private identifier."),
6851         The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling: diag(18014, ts.DiagnosticCategory.Error, "The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014", "The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling."),
6852         Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2: diag(18015, ts.DiagnosticCategory.Error, "Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2_18015", "Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'."),
6853         Private_identifiers_are_not_allowed_outside_class_bodies: diag(18016, ts.DiagnosticCategory.Error, "Private_identifiers_are_not_allowed_outside_class_bodies_18016", "Private identifiers are not allowed outside class bodies."),
6854         The_shadowing_declaration_of_0_is_defined_here: diag(18017, ts.DiagnosticCategory.Error, "The_shadowing_declaration_of_0_is_defined_here_18017", "The shadowing declaration of '{0}' is defined here"),
6855         The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here: diag(18018, ts.DiagnosticCategory.Error, "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018", "The declaration of '{0}' that you probably intended to use is defined here"),
6856         _0_modifier_cannot_be_used_with_a_private_identifier: diag(18019, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_a_private_identifier_18019", "'{0}' modifier cannot be used with a private identifier."),
6857         An_enum_member_cannot_be_named_with_a_private_identifier: diag(18024, ts.DiagnosticCategory.Error, "An_enum_member_cannot_be_named_with_a_private_identifier_18024", "An enum member cannot be named with a private identifier."),
6858         can_only_be_used_at_the_start_of_a_file: diag(18026, ts.DiagnosticCategory.Error, "can_only_be_used_at_the_start_of_a_file_18026", "'#!' can only be used at the start of a file."),
6859         Compiler_reserves_name_0_when_emitting_private_identifier_downlevel: diag(18027, ts.DiagnosticCategory.Error, "Compiler_reserves_name_0_when_emitting_private_identifier_downlevel_18027", "Compiler reserves name '{0}' when emitting private identifier downlevel."),
6860         Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18028, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher_18028", "Private identifiers are only available when targeting ECMAScript 2015 and higher."),
6861         Private_identifiers_are_not_allowed_in_variable_declarations: diag(18029, ts.DiagnosticCategory.Error, "Private_identifiers_are_not_allowed_in_variable_declarations_18029", "Private identifiers are not allowed in variable declarations."),
6862         An_optional_chain_cannot_contain_private_identifiers: diag(18030, ts.DiagnosticCategory.Error, "An_optional_chain_cannot_contain_private_identifiers_18030", "An optional chain cannot contain private identifiers."),
6863         The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents: diag(18031, ts.DiagnosticCategory.Error, "The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031", "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."),
6864         The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some: diag(18032, ts.DiagnosticCategory.Error, "The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032", "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."),
6865         Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead: diag(18033, ts.DiagnosticCategory.Error, "Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhau_18033", "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead."),
6866         Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment: diag(18034, ts.DiagnosticCategory.Message, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."),
6867         Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(18035, ts.DiagnosticCategory.Error, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."),
6868         Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator: diag(18036, ts.DiagnosticCategory.Error, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."),
6869         Await_expression_cannot_be_used_inside_a_class_static_block: diag(18037, ts.DiagnosticCategory.Error, "Await_expression_cannot_be_used_inside_a_class_static_block_18037", "Await expression cannot be used inside a class static block."),
6870         For_await_loops_cannot_be_used_inside_a_class_static_block: diag(18038, ts.DiagnosticCategory.Error, "For_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'For await' loops cannot be used inside a class static block."),
6871         Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block: diag(18039, ts.DiagnosticCategory.Error, "Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039", "Invalid use of '{0}'. It cannot be used inside a class static block."),
6872         A_return_statement_cannot_be_used_inside_a_class_static_block: diag(18041, ts.DiagnosticCategory.Error, "A_return_statement_cannot_be_used_inside_a_class_static_block_18041", "A 'return' statement cannot be used inside a class static block."),
6873     };
6874 })(ts || (ts = {}));
6875 var ts;
6876 (function (ts) {
6877     var _a;
6878     function tokenIsIdentifierOrKeyword(token) {
6879         return token >= 79;
6880     }
6881     ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
6882     function tokenIsIdentifierOrKeywordOrGreaterThan(token) {
6883         return token === 31 || tokenIsIdentifierOrKeyword(token);
6884     }
6885     ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
6886     ts.textToKeywordObj = (_a = {
6887             abstract: 126,
6888             any: 130,
6889             as: 127,
6890             asserts: 128,
6891             assert: 129,
6892             bigint: 157,
6893             boolean: 133,
6894             break: 81,
6895             case: 82,
6896             catch: 83,
6897             class: 84,
6898             continue: 86,
6899             const: 85
6900         },
6901         _a["" + "constructor"] = 134,
6902         _a.debugger = 87,
6903         _a.declare = 135,
6904         _a.default = 88,
6905         _a.delete = 89,
6906         _a.do = 90,
6907         _a.else = 91,
6908         _a.enum = 92,
6909         _a.export = 93,
6910         _a.extends = 94,
6911         _a.false = 95,
6912         _a.finally = 96,
6913         _a.for = 97,
6914         _a.from = 155,
6915         _a.function = 98,
6916         _a.get = 136,
6917         _a.if = 99,
6918         _a.implements = 117,
6919         _a.import = 100,
6920         _a.in = 101,
6921         _a.infer = 137,
6922         _a.instanceof = 102,
6923         _a.interface = 118,
6924         _a.intrinsic = 138,
6925         _a.is = 139,
6926         _a.keyof = 140,
6927         _a.let = 119,
6928         _a.module = 141,
6929         _a.namespace = 142,
6930         _a.never = 143,
6931         _a.new = 103,
6932         _a.null = 104,
6933         _a.number = 146,
6934         _a.object = 147,
6935         _a.package = 120,
6936         _a.private = 121,
6937         _a.protected = 122,
6938         _a.public = 123,
6939         _a.override = 158,
6940         _a.readonly = 144,
6941         _a.require = 145,
6942         _a.global = 156,
6943         _a.return = 105,
6944         _a.set = 148,
6945         _a.static = 124,
6946         _a.string = 149,
6947         _a.super = 106,
6948         _a.switch = 107,
6949         _a.symbol = 150,
6950         _a.this = 108,
6951         _a.throw = 109,
6952         _a.true = 110,
6953         _a.try = 111,
6954         _a.type = 151,
6955         _a.typeof = 112,
6956         _a.undefined = 152,
6957         _a.unique = 153,
6958         _a.unknown = 154,
6959         _a.var = 113,
6960         _a.void = 114,
6961         _a.while = 115,
6962         _a.with = 116,
6963         _a.yield = 125,
6964         _a.async = 131,
6965         _a.await = 132,
6966         _a.of = 159,
6967         _a);
6968     var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj));
6969     var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 29, ">": 31, "<=": 32, ">=": 33, "==": 34, "!=": 35, "===": 36, "!==": 37, "=>": 38, "+": 39, "-": 40, "**": 42, "*": 41, "/": 43, "%": 44, "++": 45, "--": 46, "<<": 47, "</": 30, ">>": 48, ">>>": 49, "&": 50, "|": 51, "^": 52, "!": 53, "~": 54, "&&": 55, "||": 56, "?": 57, "??": 60, "?.": 28, ":": 58, "=": 63, "+=": 64, "-=": 65, "*=": 66, "**=": 67, "/=": 68, "%=": 69, "<<=": 70, ">>=": 71, ">>>=": 72, "&=": 73, "|=": 74, "^=": 78, "||=": 75, "&&=": 76, "??=": 77, "@": 59, "#": 62, "`": 61 })));
6970     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,];
6971     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,];
6972     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,];
6973     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,];
6974     var unicodeESNextIdentifierStart = [65, 90, 97, 122, 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, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 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, 2144, 2154, 2208, 2228, 2230, 2237, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 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, 2809, 2809, 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, 3129, 3133, 3133, 3160, 3162, 3168, 3169, 3200, 3200, 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, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 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, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 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, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 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, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 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, 43824, 43866, 43868, 43879, 43888, 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, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69376, 69404, 69415, 69415, 69424, 69445, 69600, 69622, 69635, 69687, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70751, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71680, 71723, 71840, 71903, 71935, 71935, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 123136, 123180, 123191, 123197, 123214, 123214, 123584, 123627, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101];
6975     var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 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, 2556, 2556, 2558, 2558, 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, 2809, 2815, 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, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 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, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 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, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 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, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 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, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 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, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 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, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 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, 65071, 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, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
6976     var commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
6977     var commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
6978     function lookupInUnicodeMap(code, map) {
6979         if (code < map[0]) {
6980             return false;
6981         }
6982         var lo = 0;
6983         var hi = map.length;
6984         var mid;
6985         while (lo + 1 < hi) {
6986             mid = lo + (hi - lo) / 2;
6987             mid -= mid % 2;
6988             if (map[mid] <= code && code <= map[mid + 1]) {
6989                 return true;
6990             }
6991             if (code < map[mid]) {
6992                 hi = mid;
6993             }
6994             else {
6995                 lo = mid + 2;
6996             }
6997         }
6998         return false;
6999     }
7000     function isUnicodeIdentifierStart(code, languageVersion) {
7001         return languageVersion >= 2 ?
7002             lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
7003             languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
7004                 lookupInUnicodeMap(code, unicodeES3IdentifierStart);
7005     }
7006     ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart;
7007     function isUnicodeIdentifierPart(code, languageVersion) {
7008         return languageVersion >= 2 ?
7009             lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
7010             languageVersion === 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
7011                 lookupInUnicodeMap(code, unicodeES3IdentifierPart);
7012     }
7013     function makeReverseMap(source) {
7014         var result = [];
7015         source.forEach(function (value, name) {
7016             result[value] = name;
7017         });
7018         return result;
7019     }
7020     var tokenStrings = makeReverseMap(textToToken);
7021     function tokenToString(t) {
7022         return tokenStrings[t];
7023     }
7024     ts.tokenToString = tokenToString;
7025     function stringToToken(s) {
7026         return textToToken.get(s);
7027     }
7028     ts.stringToToken = stringToToken;
7029     function computeLineStarts(text) {
7030         var result = new Array();
7031         var pos = 0;
7032         var lineStart = 0;
7033         while (pos < text.length) {
7034             var ch = text.charCodeAt(pos);
7035             pos++;
7036             switch (ch) {
7037                 case 13:
7038                     if (text.charCodeAt(pos) === 10) {
7039                         pos++;
7040                     }
7041                 case 10:
7042                     result.push(lineStart);
7043                     lineStart = pos;
7044                     break;
7045                 default:
7046                     if (ch > 127 && isLineBreak(ch)) {
7047                         result.push(lineStart);
7048                         lineStart = pos;
7049                     }
7050                     break;
7051             }
7052         }
7053         result.push(lineStart);
7054         return result;
7055     }
7056     ts.computeLineStarts = computeLineStarts;
7057     function getPositionOfLineAndCharacter(sourceFile, line, character, allowEdits) {
7058         return sourceFile.getPositionOfLineAndCharacter ?
7059             sourceFile.getPositionOfLineAndCharacter(line, character, allowEdits) :
7060             computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text, allowEdits);
7061     }
7062     ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter;
7063     function computePositionOfLineAndCharacter(lineStarts, line, character, debugText, allowEdits) {
7064         if (line < 0 || line >= lineStarts.length) {
7065             if (allowEdits) {
7066                 line = line < 0 ? 0 : line >= lineStarts.length ? lineStarts.length - 1 : line;
7067             }
7068             else {
7069                 ts.Debug.fail("Bad line number. Line: ".concat(line, ", lineStarts.length: ").concat(lineStarts.length, " , line map is correct? ").concat(debugText !== undefined ? ts.arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown"));
7070             }
7071         }
7072         var res = lineStarts[line] + character;
7073         if (allowEdits) {
7074             return res > lineStarts[line + 1] ? lineStarts[line + 1] : typeof debugText === "string" && res > debugText.length ? debugText.length : res;
7075         }
7076         if (line < lineStarts.length - 1) {
7077             ts.Debug.assert(res < lineStarts[line + 1]);
7078         }
7079         else if (debugText !== undefined) {
7080             ts.Debug.assert(res <= debugText.length);
7081         }
7082         return res;
7083     }
7084     ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter;
7085     function getLineStarts(sourceFile) {
7086         return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
7087     }
7088     ts.getLineStarts = getLineStarts;
7089     function computeLineAndCharacterOfPosition(lineStarts, position) {
7090         var lineNumber = computeLineOfPosition(lineStarts, position);
7091         return {
7092             line: lineNumber,
7093             character: position - lineStarts[lineNumber]
7094         };
7095     }
7096     ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition;
7097     function computeLineOfPosition(lineStarts, position, lowerBound) {
7098         var lineNumber = ts.binarySearch(lineStarts, position, ts.identity, ts.compareValues, lowerBound);
7099         if (lineNumber < 0) {
7100             lineNumber = ~lineNumber - 1;
7101             ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file");
7102         }
7103         return lineNumber;
7104     }
7105     ts.computeLineOfPosition = computeLineOfPosition;
7106     function getLinesBetweenPositions(sourceFile, pos1, pos2) {
7107         if (pos1 === pos2)
7108             return 0;
7109         var lineStarts = getLineStarts(sourceFile);
7110         var lower = Math.min(pos1, pos2);
7111         var isNegative = lower === pos2;
7112         var upper = isNegative ? pos1 : pos2;
7113         var lowerLine = computeLineOfPosition(lineStarts, lower);
7114         var upperLine = computeLineOfPosition(lineStarts, upper, lowerLine);
7115         return isNegative ? lowerLine - upperLine : upperLine - lowerLine;
7116     }
7117     ts.getLinesBetweenPositions = getLinesBetweenPositions;
7118     function getLineAndCharacterOfPosition(sourceFile, position) {
7119         return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
7120     }
7121     ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition;
7122     function isWhiteSpaceLike(ch) {
7123         return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
7124     }
7125     ts.isWhiteSpaceLike = isWhiteSpaceLike;
7126     function isWhiteSpaceSingleLine(ch) {
7127         return ch === 32 ||
7128             ch === 9 ||
7129             ch === 11 ||
7130             ch === 12 ||
7131             ch === 160 ||
7132             ch === 133 ||
7133             ch === 5760 ||
7134             ch >= 8192 && ch <= 8203 ||
7135             ch === 8239 ||
7136             ch === 8287 ||
7137             ch === 12288 ||
7138             ch === 65279;
7139     }
7140     ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine;
7141     function isLineBreak(ch) {
7142         return ch === 10 ||
7143             ch === 13 ||
7144             ch === 8232 ||
7145             ch === 8233;
7146     }
7147     ts.isLineBreak = isLineBreak;
7148     function isDigit(ch) {
7149         return ch >= 48 && ch <= 57;
7150     }
7151     function isHexDigit(ch) {
7152         return isDigit(ch) || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102;
7153     }
7154     function isCodePoint(code) {
7155         return code <= 0x10FFFF;
7156     }
7157     function isOctalDigit(ch) {
7158         return ch >= 48 && ch <= 55;
7159     }
7160     ts.isOctalDigit = isOctalDigit;
7161     function couldStartTrivia(text, pos) {
7162         var ch = text.charCodeAt(pos);
7163         switch (ch) {
7164             case 13:
7165             case 10:
7166             case 9:
7167             case 11:
7168             case 12:
7169             case 32:
7170             case 47:
7171             case 60:
7172             case 124:
7173             case 61:
7174             case 62:
7175                 return true;
7176             case 35:
7177                 return pos === 0;
7178             default:
7179                 return ch > 127;
7180         }
7181     }
7182     ts.couldStartTrivia = couldStartTrivia;
7183     function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
7184         if (ts.positionIsSynthesized(pos)) {
7185             return pos;
7186         }
7187         var canConsumeStar = false;
7188         while (true) {
7189             var ch = text.charCodeAt(pos);
7190             switch (ch) {
7191                 case 13:
7192                     if (text.charCodeAt(pos + 1) === 10) {
7193                         pos++;
7194                     }
7195                 case 10:
7196                     pos++;
7197                     if (stopAfterLineBreak) {
7198                         return pos;
7199                     }
7200                     canConsumeStar = !!inJSDoc;
7201                     continue;
7202                 case 9:
7203                 case 11:
7204                 case 12:
7205                 case 32:
7206                     pos++;
7207                     continue;
7208                 case 47:
7209                     if (stopAtComments) {
7210                         break;
7211                     }
7212                     if (text.charCodeAt(pos + 1) === 47) {
7213                         pos += 2;
7214                         while (pos < text.length) {
7215                             if (isLineBreak(text.charCodeAt(pos))) {
7216                                 break;
7217                             }
7218                             pos++;
7219                         }
7220                         canConsumeStar = false;
7221                         continue;
7222                     }
7223                     if (text.charCodeAt(pos + 1) === 42) {
7224                         pos += 2;
7225                         while (pos < text.length) {
7226                             if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
7227                                 pos += 2;
7228                                 break;
7229                             }
7230                             pos++;
7231                         }
7232                         canConsumeStar = false;
7233                         continue;
7234                     }
7235                     break;
7236                 case 60:
7237                 case 124:
7238                 case 61:
7239                 case 62:
7240                     if (isConflictMarkerTrivia(text, pos)) {
7241                         pos = scanConflictMarkerTrivia(text, pos);
7242                         canConsumeStar = false;
7243                         continue;
7244                     }
7245                     break;
7246                 case 35:
7247                     if (pos === 0 && isShebangTrivia(text, pos)) {
7248                         pos = scanShebangTrivia(text, pos);
7249                         canConsumeStar = false;
7250                         continue;
7251                     }
7252                     break;
7253                 case 42:
7254                     if (canConsumeStar) {
7255                         pos++;
7256                         canConsumeStar = false;
7257                         continue;
7258                     }
7259                     break;
7260                 default:
7261                     if (ch > 127 && (isWhiteSpaceLike(ch))) {
7262                         pos++;
7263                         continue;
7264                     }
7265                     break;
7266             }
7267             return pos;
7268         }
7269     }
7270     ts.skipTrivia = skipTrivia;
7271     var mergeConflictMarkerLength = "<<<<<<<".length;
7272     function isConflictMarkerTrivia(text, pos) {
7273         ts.Debug.assert(pos >= 0);
7274         if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
7275             var ch = text.charCodeAt(pos);
7276             if ((pos + mergeConflictMarkerLength) < text.length) {
7277                 for (var i = 0; i < mergeConflictMarkerLength; i++) {
7278                     if (text.charCodeAt(pos + i) !== ch) {
7279                         return false;
7280                     }
7281                 }
7282                 return ch === 61 ||
7283                     text.charCodeAt(pos + mergeConflictMarkerLength) === 32;
7284             }
7285         }
7286         return false;
7287     }
7288     function scanConflictMarkerTrivia(text, pos, error) {
7289         if (error) {
7290             error(ts.Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength);
7291         }
7292         var ch = text.charCodeAt(pos);
7293         var len = text.length;
7294         if (ch === 60 || ch === 62) {
7295             while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
7296                 pos++;
7297             }
7298         }
7299         else {
7300             ts.Debug.assert(ch === 124 || ch === 61);
7301             while (pos < len) {
7302                 var currentChar = text.charCodeAt(pos);
7303                 if ((currentChar === 61 || currentChar === 62) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) {
7304                     break;
7305                 }
7306                 pos++;
7307             }
7308         }
7309         return pos;
7310     }
7311     var shebangTriviaRegex = /^#!.*/;
7312     function isShebangTrivia(text, pos) {
7313         ts.Debug.assert(pos === 0);
7314         return shebangTriviaRegex.test(text);
7315     }
7316     ts.isShebangTrivia = isShebangTrivia;
7317     function scanShebangTrivia(text, pos) {
7318         var shebang = shebangTriviaRegex.exec(text)[0];
7319         pos = pos + shebang.length;
7320         return pos;
7321     }
7322     ts.scanShebangTrivia = scanShebangTrivia;
7323     function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
7324         var pendingPos;
7325         var pendingEnd;
7326         var pendingKind;
7327         var pendingHasTrailingNewLine;
7328         var hasPendingCommentRange = false;
7329         var collecting = trailing;
7330         var accumulator = initial;
7331         if (pos === 0) {
7332             collecting = true;
7333             var shebang = getShebang(text);
7334             if (shebang) {
7335                 pos = shebang.length;
7336             }
7337         }
7338         scan: while (pos >= 0 && pos < text.length) {
7339             var ch = text.charCodeAt(pos);
7340             switch (ch) {
7341                 case 13:
7342                     if (text.charCodeAt(pos + 1) === 10) {
7343                         pos++;
7344                     }
7345                 case 10:
7346                     pos++;
7347                     if (trailing) {
7348                         break scan;
7349                     }
7350                     collecting = true;
7351                     if (hasPendingCommentRange) {
7352                         pendingHasTrailingNewLine = true;
7353                     }
7354                     continue;
7355                 case 9:
7356                 case 11:
7357                 case 12:
7358                 case 32:
7359                     pos++;
7360                     continue;
7361                 case 47:
7362                     var nextChar = text.charCodeAt(pos + 1);
7363                     var hasTrailingNewLine = false;
7364                     if (nextChar === 47 || nextChar === 42) {
7365                         var kind = nextChar === 47 ? 2 : 3;
7366                         var startPos = pos;
7367                         pos += 2;
7368                         if (nextChar === 47) {
7369                             while (pos < text.length) {
7370                                 if (isLineBreak(text.charCodeAt(pos))) {
7371                                     hasTrailingNewLine = true;
7372                                     break;
7373                                 }
7374                                 pos++;
7375                             }
7376                         }
7377                         else {
7378                             while (pos < text.length) {
7379                                 if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) {
7380                                     pos += 2;
7381                                     break;
7382                                 }
7383                                 pos++;
7384                             }
7385                         }
7386                         if (collecting) {
7387                             if (hasPendingCommentRange) {
7388                                 accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
7389                                 if (!reduce && accumulator) {
7390                                     return accumulator;
7391                                 }
7392                             }
7393                             pendingPos = startPos;
7394                             pendingEnd = pos;
7395                             pendingKind = kind;
7396                             pendingHasTrailingNewLine = hasTrailingNewLine;
7397                             hasPendingCommentRange = true;
7398                         }
7399                         continue;
7400                     }
7401                     break scan;
7402                 default:
7403                     if (ch > 127 && (isWhiteSpaceLike(ch))) {
7404                         if (hasPendingCommentRange && isLineBreak(ch)) {
7405                             pendingHasTrailingNewLine = true;
7406                         }
7407                         pos++;
7408                         continue;
7409                     }
7410                     break scan;
7411             }
7412         }
7413         if (hasPendingCommentRange) {
7414             accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
7415         }
7416         return accumulator;
7417     }
7418     function forEachLeadingCommentRange(text, pos, cb, state) {
7419         return iterateCommentRanges(false, text, pos, false, cb, state);
7420     }
7421     ts.forEachLeadingCommentRange = forEachLeadingCommentRange;
7422     function forEachTrailingCommentRange(text, pos, cb, state) {
7423         return iterateCommentRanges(false, text, pos, true, cb, state);
7424     }
7425     ts.forEachTrailingCommentRange = forEachTrailingCommentRange;
7426     function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
7427         return iterateCommentRanges(true, text, pos, false, cb, state, initial);
7428     }
7429     ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange;
7430     function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
7431         return iterateCommentRanges(true, text, pos, true, cb, state, initial);
7432     }
7433     ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange;
7434     function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) {
7435         if (!comments) {
7436             comments = [];
7437         }
7438         comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine });
7439         return comments;
7440     }
7441     function getLeadingCommentRanges(text, pos) {
7442         return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);
7443     }
7444     ts.getLeadingCommentRanges = getLeadingCommentRanges;
7445     function getTrailingCommentRanges(text, pos) {
7446         return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);
7447     }
7448     ts.getTrailingCommentRanges = getTrailingCommentRanges;
7449     function getShebang(text) {
7450         var match = shebangTriviaRegex.exec(text);
7451         if (match) {
7452             return match[0];
7453         }
7454     }
7455     ts.getShebang = getShebang;
7456     function isIdentifierStart(ch, languageVersion) {
7457         return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
7458             ch === 36 || ch === 95 ||
7459             ch > 127 && isUnicodeIdentifierStart(ch, languageVersion);
7460     }
7461     ts.isIdentifierStart = isIdentifierStart;
7462     function isIdentifierPart(ch, languageVersion, identifierVariant) {
7463         return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 ||
7464             ch >= 48 && ch <= 57 || ch === 36 || ch === 95 ||
7465             (identifierVariant === 1 ? (ch === 45 || ch === 58) : false) ||
7466             ch > 127 && isUnicodeIdentifierPart(ch, languageVersion);
7467     }
7468     ts.isIdentifierPart = isIdentifierPart;
7469     function isIdentifierText(name, languageVersion, identifierVariant) {
7470         var ch = codePointAt(name, 0);
7471         if (!isIdentifierStart(ch, languageVersion)) {
7472             return false;
7473         }
7474         for (var i = charSize(ch); i < name.length; i += charSize(ch)) {
7475             if (!isIdentifierPart(ch = codePointAt(name, i), languageVersion, identifierVariant)) {
7476                 return false;
7477             }
7478         }
7479         return true;
7480     }
7481     ts.isIdentifierText = isIdentifierText;
7482     function createScanner(languageVersion, skipTrivia, languageVariant, textInitial, onError, start, length) {
7483         if (languageVariant === void 0) { languageVariant = 0; }
7484         var text = textInitial;
7485         var pos;
7486         var end;
7487         var startPos;
7488         var tokenPos;
7489         var token;
7490         var tokenValue;
7491         var tokenFlags;
7492         var commentDirectives;
7493         var inJSDocType = 0;
7494         setText(text, start, length);
7495         var scanner = {
7496             getStartPos: function () { return startPos; },
7497             getTextPos: function () { return pos; },
7498             getToken: function () { return token; },
7499             getTokenPos: function () { return tokenPos; },
7500             getTokenText: function () { return text.substring(tokenPos, pos); },
7501             getTokenValue: function () { return tokenValue; },
7502             hasUnicodeEscape: function () { return (tokenFlags & 1024) !== 0; },
7503             hasExtendedUnicodeEscape: function () { return (tokenFlags & 8) !== 0; },
7504             hasPrecedingLineBreak: function () { return (tokenFlags & 1) !== 0; },
7505             hasPrecedingJSDocComment: function () { return (tokenFlags & 2) !== 0; },
7506             isIdentifier: function () { return token === 79 || token > 116; },
7507             isReservedWord: function () { return token >= 81 && token <= 116; },
7508             isUnterminated: function () { return (tokenFlags & 4) !== 0; },
7509             getCommentDirectives: function () { return commentDirectives; },
7510             getNumericLiteralFlags: function () { return tokenFlags & 1008; },
7511             getTokenFlags: function () { return tokenFlags; },
7512             reScanGreaterToken: reScanGreaterToken,
7513             reScanAsteriskEqualsToken: reScanAsteriskEqualsToken,
7514             reScanSlashToken: reScanSlashToken,
7515             reScanTemplateToken: reScanTemplateToken,
7516             reScanTemplateHeadOrNoSubstitutionTemplate: reScanTemplateHeadOrNoSubstitutionTemplate,
7517             scanJsxIdentifier: scanJsxIdentifier,
7518             scanJsxAttributeValue: scanJsxAttributeValue,
7519             reScanJsxAttributeValue: reScanJsxAttributeValue,
7520             reScanJsxToken: reScanJsxToken,
7521             reScanLessThanToken: reScanLessThanToken,
7522             reScanHashToken: reScanHashToken,
7523             reScanQuestionToken: reScanQuestionToken,
7524             reScanInvalidIdentifier: reScanInvalidIdentifier,
7525             scanJsxToken: scanJsxToken,
7526             scanJsDocToken: scanJsDocToken,
7527             scan: scan,
7528             getText: getText,
7529             clearCommentDirectives: clearCommentDirectives,
7530             setText: setText,
7531             setScriptTarget: setScriptTarget,
7532             setLanguageVariant: setLanguageVariant,
7533             setOnError: setOnError,
7534             setTextPos: setTextPos,
7535             setInJSDocType: setInJSDocType,
7536             tryScan: tryScan,
7537             lookAhead: lookAhead,
7538             scanRange: scanRange,
7539         };
7540         if (ts.Debug.isDebugging) {
7541             Object.defineProperty(scanner, "__debugShowCurrentPositionInText", {
7542                 get: function () {
7543                     var text = scanner.getText();
7544                     return text.slice(0, scanner.getStartPos()) + "â•‘" + text.slice(scanner.getStartPos());
7545                 },
7546             });
7547         }
7548         return scanner;
7549         function error(message, errPos, length) {
7550             if (errPos === void 0) { errPos = pos; }
7551             if (onError) {
7552                 var oldPos = pos;
7553                 pos = errPos;
7554                 onError(message, length || 0);
7555                 pos = oldPos;
7556             }
7557         }
7558         function scanNumberFragment() {
7559             var start = pos;
7560             var allowSeparator = false;
7561             var isPreviousTokenSeparator = false;
7562             var result = "";
7563             while (true) {
7564                 var ch = text.charCodeAt(pos);
7565                 if (ch === 95) {
7566                     tokenFlags |= 512;
7567                     if (allowSeparator) {
7568                         allowSeparator = false;
7569                         isPreviousTokenSeparator = true;
7570                         result += text.substring(start, pos);
7571                     }
7572                     else if (isPreviousTokenSeparator) {
7573                         error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
7574                     }
7575                     else {
7576                         error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
7577                     }
7578                     pos++;
7579                     start = pos;
7580                     continue;
7581                 }
7582                 if (isDigit(ch)) {
7583                     allowSeparator = true;
7584                     isPreviousTokenSeparator = false;
7585                     pos++;
7586                     continue;
7587                 }
7588                 break;
7589             }
7590             if (text.charCodeAt(pos - 1) === 95) {
7591                 error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
7592             }
7593             return result + text.substring(start, pos);
7594         }
7595         function scanNumber() {
7596             var start = pos;
7597             var mainFragment = scanNumberFragment();
7598             var decimalFragment;
7599             var scientificFragment;
7600             if (text.charCodeAt(pos) === 46) {
7601                 pos++;
7602                 decimalFragment = scanNumberFragment();
7603             }
7604             var end = pos;
7605             if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) {
7606                 pos++;
7607                 tokenFlags |= 16;
7608                 if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45)
7609                     pos++;
7610                 var preNumericPart = pos;
7611                 var finalFragment = scanNumberFragment();
7612                 if (!finalFragment) {
7613                     error(ts.Diagnostics.Digit_expected);
7614                 }
7615                 else {
7616                     scientificFragment = text.substring(end, preNumericPart) + finalFragment;
7617                     end = pos;
7618                 }
7619             }
7620             var result;
7621             if (tokenFlags & 512) {
7622                 result = mainFragment;
7623                 if (decimalFragment) {
7624                     result += "." + decimalFragment;
7625                 }
7626                 if (scientificFragment) {
7627                     result += scientificFragment;
7628                 }
7629             }
7630             else {
7631                 result = text.substring(start, end);
7632             }
7633             if (decimalFragment !== undefined || tokenFlags & 16) {
7634                 checkForIdentifierStartAfterNumericLiteral(start, decimalFragment === undefined && !!(tokenFlags & 16));
7635                 return {
7636                     type: 8,
7637                     value: "" + +result
7638                 };
7639             }
7640             else {
7641                 tokenValue = result;
7642                 var type = checkBigIntSuffix();
7643                 checkForIdentifierStartAfterNumericLiteral(start);
7644                 return { type: type, value: tokenValue };
7645             }
7646         }
7647         function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
7648             if (!isIdentifierStart(codePointAt(text, pos), languageVersion)) {
7649                 return;
7650             }
7651             var identifierStart = pos;
7652             var length = scanIdentifierParts().length;
7653             if (length === 1 && text[identifierStart] === "n") {
7654                 if (isScientific) {
7655                     error(ts.Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1);
7656                 }
7657                 else {
7658                     error(ts.Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1);
7659                 }
7660             }
7661             else {
7662                 error(ts.Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length);
7663                 pos = identifierStart;
7664             }
7665         }
7666         function scanOctalDigits() {
7667             var start = pos;
7668             while (isOctalDigit(text.charCodeAt(pos))) {
7669                 pos++;
7670             }
7671             return +(text.substring(start, pos));
7672         }
7673         function scanExactNumberOfHexDigits(count, canHaveSeparators) {
7674             var valueString = scanHexDigits(count, false, canHaveSeparators);
7675             return valueString ? parseInt(valueString, 16) : -1;
7676         }
7677         function scanMinimumNumberOfHexDigits(count, canHaveSeparators) {
7678             return scanHexDigits(count, true, canHaveSeparators);
7679         }
7680         function scanHexDigits(minCount, scanAsManyAsPossible, canHaveSeparators) {
7681             var valueChars = [];
7682             var allowSeparator = false;
7683             var isPreviousTokenSeparator = false;
7684             while (valueChars.length < minCount || scanAsManyAsPossible) {
7685                 var ch = text.charCodeAt(pos);
7686                 if (canHaveSeparators && ch === 95) {
7687                     tokenFlags |= 512;
7688                     if (allowSeparator) {
7689                         allowSeparator = false;
7690                         isPreviousTokenSeparator = true;
7691                     }
7692                     else if (isPreviousTokenSeparator) {
7693                         error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
7694                     }
7695                     else {
7696                         error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
7697                     }
7698                     pos++;
7699                     continue;
7700                 }
7701                 allowSeparator = canHaveSeparators;
7702                 if (ch >= 65 && ch <= 70) {
7703                     ch += 97 - 65;
7704                 }
7705                 else if (!((ch >= 48 && ch <= 57) ||
7706                     (ch >= 97 && ch <= 102))) {
7707                     break;
7708                 }
7709                 valueChars.push(ch);
7710                 pos++;
7711                 isPreviousTokenSeparator = false;
7712             }
7713             if (valueChars.length < minCount) {
7714                 valueChars = [];
7715             }
7716             if (text.charCodeAt(pos - 1) === 95) {
7717                 error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
7718             }
7719             return String.fromCharCode.apply(String, valueChars);
7720         }
7721         function scanString(jsxAttributeString) {
7722             if (jsxAttributeString === void 0) { jsxAttributeString = false; }
7723             var quote = text.charCodeAt(pos);
7724             pos++;
7725             var result = "";
7726             var start = pos;
7727             while (true) {
7728                 if (pos >= end) {
7729                     result += text.substring(start, pos);
7730                     tokenFlags |= 4;
7731                     error(ts.Diagnostics.Unterminated_string_literal);
7732                     break;
7733                 }
7734                 var ch = text.charCodeAt(pos);
7735                 if (ch === quote) {
7736                     result += text.substring(start, pos);
7737                     pos++;
7738                     break;
7739                 }
7740                 if (ch === 92 && !jsxAttributeString) {
7741                     result += text.substring(start, pos);
7742                     result += scanEscapeSequence();
7743                     start = pos;
7744                     continue;
7745                 }
7746                 if (isLineBreak(ch) && !jsxAttributeString) {
7747                     result += text.substring(start, pos);
7748                     tokenFlags |= 4;
7749                     error(ts.Diagnostics.Unterminated_string_literal);
7750                     break;
7751                 }
7752                 pos++;
7753             }
7754             return result;
7755         }
7756         function scanTemplateAndSetTokenValue(isTaggedTemplate) {
7757             var startedWithBacktick = text.charCodeAt(pos) === 96;
7758             pos++;
7759             var start = pos;
7760             var contents = "";
7761             var resultingToken;
7762             while (true) {
7763                 if (pos >= end) {
7764                     contents += text.substring(start, pos);
7765                     tokenFlags |= 4;
7766                     error(ts.Diagnostics.Unterminated_template_literal);
7767                     resultingToken = startedWithBacktick ? 14 : 17;
7768                     break;
7769                 }
7770                 var currChar = text.charCodeAt(pos);
7771                 if (currChar === 96) {
7772                     contents += text.substring(start, pos);
7773                     pos++;
7774                     resultingToken = startedWithBacktick ? 14 : 17;
7775                     break;
7776                 }
7777                 if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) {
7778                     contents += text.substring(start, pos);
7779                     pos += 2;
7780                     resultingToken = startedWithBacktick ? 15 : 16;
7781                     break;
7782                 }
7783                 if (currChar === 92) {
7784                     contents += text.substring(start, pos);
7785                     contents += scanEscapeSequence(isTaggedTemplate);
7786                     start = pos;
7787                     continue;
7788                 }
7789                 if (currChar === 13) {
7790                     contents += text.substring(start, pos);
7791                     pos++;
7792                     if (pos < end && text.charCodeAt(pos) === 10) {
7793                         pos++;
7794                     }
7795                     contents += "\n";
7796                     start = pos;
7797                     continue;
7798                 }
7799                 pos++;
7800             }
7801             ts.Debug.assert(resultingToken !== undefined);
7802             tokenValue = contents;
7803             return resultingToken;
7804         }
7805         function scanEscapeSequence(isTaggedTemplate) {
7806             var start = pos;
7807             pos++;
7808             if (pos >= end) {
7809                 error(ts.Diagnostics.Unexpected_end_of_text);
7810                 return "";
7811             }
7812             var ch = text.charCodeAt(pos);
7813             pos++;
7814             switch (ch) {
7815                 case 48:
7816                     if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) {
7817                         pos++;
7818                         tokenFlags |= 2048;
7819                         return text.substring(start, pos);
7820                     }
7821                     return "\0";
7822                 case 98:
7823                     return "\b";
7824                 case 116:
7825                     return "\t";
7826                 case 110:
7827                     return "\n";
7828                 case 118:
7829                     return "\v";
7830                 case 102:
7831                     return "\f";
7832                 case 114:
7833                     return "\r";
7834                 case 39:
7835                     return "\'";
7836                 case 34:
7837                     return "\"";
7838                 case 117:
7839                     if (isTaggedTemplate) {
7840                         for (var escapePos = pos; escapePos < pos + 4; escapePos++) {
7841                             if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123) {
7842                                 pos = escapePos;
7843                                 tokenFlags |= 2048;
7844                                 return text.substring(start, pos);
7845                             }
7846                         }
7847                     }
7848                     if (pos < end && text.charCodeAt(pos) === 123) {
7849                         pos++;
7850                         if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) {
7851                             tokenFlags |= 2048;
7852                             return text.substring(start, pos);
7853                         }
7854                         if (isTaggedTemplate) {
7855                             var savePos = pos;
7856                             var escapedValueString = scanMinimumNumberOfHexDigits(1, false);
7857                             var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
7858                             if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125) {
7859                                 tokenFlags |= 2048;
7860                                 return text.substring(start, pos);
7861                             }
7862                             else {
7863                                 pos = savePos;
7864                             }
7865                         }
7866                         tokenFlags |= 8;
7867                         return scanExtendedUnicodeEscape();
7868                     }
7869                     tokenFlags |= 1024;
7870                     return scanHexadecimalEscape(4);
7871                 case 120:
7872                     if (isTaggedTemplate) {
7873                         if (!isHexDigit(text.charCodeAt(pos))) {
7874                             tokenFlags |= 2048;
7875                             return text.substring(start, pos);
7876                         }
7877                         else if (!isHexDigit(text.charCodeAt(pos + 1))) {
7878                             pos++;
7879                             tokenFlags |= 2048;
7880                             return text.substring(start, pos);
7881                         }
7882                     }
7883                     return scanHexadecimalEscape(2);
7884                 case 13:
7885                     if (pos < end && text.charCodeAt(pos) === 10) {
7886                         pos++;
7887                     }
7888                 case 10:
7889                 case 8232:
7890                 case 8233:
7891                     return "";
7892                 default:
7893                     return String.fromCharCode(ch);
7894             }
7895         }
7896         function scanHexadecimalEscape(numDigits) {
7897             var escapedValue = scanExactNumberOfHexDigits(numDigits, false);
7898             if (escapedValue >= 0) {
7899                 return String.fromCharCode(escapedValue);
7900             }
7901             else {
7902                 error(ts.Diagnostics.Hexadecimal_digit_expected);
7903                 return "";
7904             }
7905         }
7906         function scanExtendedUnicodeEscape() {
7907             var escapedValueString = scanMinimumNumberOfHexDigits(1, false);
7908             var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
7909             var isInvalidExtendedEscape = false;
7910             if (escapedValue < 0) {
7911                 error(ts.Diagnostics.Hexadecimal_digit_expected);
7912                 isInvalidExtendedEscape = true;
7913             }
7914             else if (escapedValue > 0x10FFFF) {
7915                 error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
7916                 isInvalidExtendedEscape = true;
7917             }
7918             if (pos >= end) {
7919                 error(ts.Diagnostics.Unexpected_end_of_text);
7920                 isInvalidExtendedEscape = true;
7921             }
7922             else if (text.charCodeAt(pos) === 125) {
7923                 pos++;
7924             }
7925             else {
7926                 error(ts.Diagnostics.Unterminated_Unicode_escape_sequence);
7927                 isInvalidExtendedEscape = true;
7928             }
7929             if (isInvalidExtendedEscape) {
7930                 return "";
7931             }
7932             return utf16EncodeAsString(escapedValue);
7933         }
7934         function peekUnicodeEscape() {
7935             if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) {
7936                 var start_1 = pos;
7937                 pos += 2;
7938                 var value = scanExactNumberOfHexDigits(4, false);
7939                 pos = start_1;
7940                 return value;
7941             }
7942             return -1;
7943         }
7944         function peekExtendedUnicodeEscape() {
7945             if (languageVersion >= 2 && codePointAt(text, pos + 1) === 117 && codePointAt(text, pos + 2) === 123) {
7946                 var start_2 = pos;
7947                 pos += 3;
7948                 var escapedValueString = scanMinimumNumberOfHexDigits(1, false);
7949                 var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
7950                 pos = start_2;
7951                 return escapedValue;
7952             }
7953             return -1;
7954         }
7955         function scanIdentifierParts() {
7956             var result = "";
7957             var start = pos;
7958             while (pos < end) {
7959                 var ch = codePointAt(text, pos);
7960                 if (isIdentifierPart(ch, languageVersion)) {
7961                     pos += charSize(ch);
7962                 }
7963                 else if (ch === 92) {
7964                     ch = peekExtendedUnicodeEscape();
7965                     if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
7966                         pos += 3;
7967                         tokenFlags |= 8;
7968                         result += scanExtendedUnicodeEscape();
7969                         start = pos;
7970                         continue;
7971                     }
7972                     ch = peekUnicodeEscape();
7973                     if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) {
7974                         break;
7975                     }
7976                     tokenFlags |= 1024;
7977                     result += text.substring(start, pos);
7978                     result += utf16EncodeAsString(ch);
7979                     pos += 6;
7980                     start = pos;
7981                 }
7982                 else {
7983                     break;
7984                 }
7985             }
7986             result += text.substring(start, pos);
7987             return result;
7988         }
7989         function getIdentifierToken() {
7990             var len = tokenValue.length;
7991             if (len >= 2 && len <= 12) {
7992                 var ch = tokenValue.charCodeAt(0);
7993                 if (ch >= 97 && ch <= 122) {
7994                     var keyword = textToKeyword.get(tokenValue);
7995                     if (keyword !== undefined) {
7996                         return token = keyword;
7997                     }
7998                 }
7999             }
8000             return token = 79;
8001         }
8002         function scanBinaryOrOctalDigits(base) {
8003             var value = "";
8004             var separatorAllowed = false;
8005             var isPreviousTokenSeparator = false;
8006             while (true) {
8007                 var ch = text.charCodeAt(pos);
8008                 if (ch === 95) {
8009                     tokenFlags |= 512;
8010                     if (separatorAllowed) {
8011                         separatorAllowed = false;
8012                         isPreviousTokenSeparator = true;
8013                     }
8014                     else if (isPreviousTokenSeparator) {
8015                         error(ts.Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1);
8016                     }
8017                     else {
8018                         error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1);
8019                     }
8020                     pos++;
8021                     continue;
8022                 }
8023                 separatorAllowed = true;
8024                 if (!isDigit(ch) || ch - 48 >= base) {
8025                     break;
8026                 }
8027                 value += text[pos];
8028                 pos++;
8029                 isPreviousTokenSeparator = false;
8030             }
8031             if (text.charCodeAt(pos - 1) === 95) {
8032                 error(ts.Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1);
8033             }
8034             return value;
8035         }
8036         function checkBigIntSuffix() {
8037             if (text.charCodeAt(pos) === 110) {
8038                 tokenValue += "n";
8039                 if (tokenFlags & 384) {
8040                     tokenValue = ts.parsePseudoBigInt(tokenValue) + "n";
8041                 }
8042                 pos++;
8043                 return 9;
8044             }
8045             else {
8046                 var numericValue = tokenFlags & 128
8047                     ? parseInt(tokenValue.slice(2), 2)
8048                     : tokenFlags & 256
8049                         ? parseInt(tokenValue.slice(2), 8)
8050                         : +tokenValue;
8051                 tokenValue = "" + numericValue;
8052                 return 8;
8053             }
8054         }
8055         function scan() {
8056             var _a;
8057             startPos = pos;
8058             tokenFlags = 0;
8059             var asteriskSeen = false;
8060             while (true) {
8061                 tokenPos = pos;
8062                 if (pos >= end) {
8063                     return token = 1;
8064                 }
8065                 var ch = codePointAt(text, pos);
8066                 if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) {
8067                     pos = scanShebangTrivia(text, pos);
8068                     if (skipTrivia) {
8069                         continue;
8070                     }
8071                     else {
8072                         return token = 6;
8073                     }
8074                 }
8075                 switch (ch) {
8076                     case 10:
8077                     case 13:
8078                         tokenFlags |= 1;
8079                         if (skipTrivia) {
8080                             pos++;
8081                             continue;
8082                         }
8083                         else {
8084                             if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) {
8085                                 pos += 2;
8086                             }
8087                             else {
8088                                 pos++;
8089                             }
8090                             return token = 4;
8091                         }
8092                     case 9:
8093                     case 11:
8094                     case 12:
8095                     case 32:
8096                     case 160:
8097                     case 5760:
8098                     case 8192:
8099                     case 8193:
8100                     case 8194:
8101                     case 8195:
8102                     case 8196:
8103                     case 8197:
8104                     case 8198:
8105                     case 8199:
8106                     case 8200:
8107                     case 8201:
8108                     case 8202:
8109                     case 8203:
8110                     case 8239:
8111                     case 8287:
8112                     case 12288:
8113                     case 65279:
8114                         if (skipTrivia) {
8115                             pos++;
8116                             continue;
8117                         }
8118                         else {
8119                             while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
8120                                 pos++;
8121                             }
8122                             return token = 5;
8123                         }
8124                     case 33:
8125                         if (text.charCodeAt(pos + 1) === 61) {
8126                             if (text.charCodeAt(pos + 2) === 61) {
8127                                 return pos += 3, token = 37;
8128                             }
8129                             return pos += 2, token = 35;
8130                         }
8131                         pos++;
8132                         return token = 53;
8133                     case 34:
8134                     case 39:
8135                         tokenValue = scanString();
8136                         return token = 10;
8137                     case 96:
8138                         return token = scanTemplateAndSetTokenValue(false);
8139                     case 37:
8140                         if (text.charCodeAt(pos + 1) === 61) {
8141                             return pos += 2, token = 69;
8142                         }
8143                         pos++;
8144                         return token = 44;
8145                     case 38:
8146                         if (text.charCodeAt(pos + 1) === 38) {
8147                             if (text.charCodeAt(pos + 2) === 61) {
8148                                 return pos += 3, token = 76;
8149                             }
8150                             return pos += 2, token = 55;
8151                         }
8152                         if (text.charCodeAt(pos + 1) === 61) {
8153                             return pos += 2, token = 73;
8154                         }
8155                         pos++;
8156                         return token = 50;
8157                     case 40:
8158                         pos++;
8159                         return token = 20;
8160                     case 41:
8161                         pos++;
8162                         return token = 21;
8163                     case 42:
8164                         if (text.charCodeAt(pos + 1) === 61) {
8165                             return pos += 2, token = 66;
8166                         }
8167                         if (text.charCodeAt(pos + 1) === 42) {
8168                             if (text.charCodeAt(pos + 2) === 61) {
8169                                 return pos += 3, token = 67;
8170                             }
8171                             return pos += 2, token = 42;
8172                         }
8173                         pos++;
8174                         if (inJSDocType && !asteriskSeen && (tokenFlags & 1)) {
8175                             asteriskSeen = true;
8176                             continue;
8177                         }
8178                         return token = 41;
8179                     case 43:
8180                         if (text.charCodeAt(pos + 1) === 43) {
8181                             return pos += 2, token = 45;
8182                         }
8183                         if (text.charCodeAt(pos + 1) === 61) {
8184                             return pos += 2, token = 64;
8185                         }
8186                         pos++;
8187                         return token = 39;
8188                     case 44:
8189                         pos++;
8190                         return token = 27;
8191                     case 45:
8192                         if (text.charCodeAt(pos + 1) === 45) {
8193                             return pos += 2, token = 46;
8194                         }
8195                         if (text.charCodeAt(pos + 1) === 61) {
8196                             return pos += 2, token = 65;
8197                         }
8198                         pos++;
8199                         return token = 40;
8200                     case 46:
8201                         if (isDigit(text.charCodeAt(pos + 1))) {
8202                             tokenValue = scanNumber().value;
8203                             return token = 8;
8204                         }
8205                         if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) {
8206                             return pos += 3, token = 25;
8207                         }
8208                         pos++;
8209                         return token = 24;
8210                     case 47:
8211                         if (text.charCodeAt(pos + 1) === 47) {
8212                             pos += 2;
8213                             while (pos < end) {
8214                                 if (isLineBreak(text.charCodeAt(pos))) {
8215                                     break;
8216                                 }
8217                                 pos++;
8218                             }
8219                             commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(tokenPos, pos), commentDirectiveRegExSingleLine, tokenPos);
8220                             if (skipTrivia) {
8221                                 continue;
8222                             }
8223                             else {
8224                                 return token = 2;
8225                             }
8226                         }
8227                         if (text.charCodeAt(pos + 1) === 42) {
8228                             pos += 2;
8229                             if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) !== 47) {
8230                                 tokenFlags |= 2;
8231                             }
8232                             var commentClosed = false;
8233                             var lastLineStart = tokenPos;
8234                             while (pos < end) {
8235                                 var ch_1 = text.charCodeAt(pos);
8236                                 if (ch_1 === 42 && text.charCodeAt(pos + 1) === 47) {
8237                                     pos += 2;
8238                                     commentClosed = true;
8239                                     break;
8240                                 }
8241                                 pos++;
8242                                 if (isLineBreak(ch_1)) {
8243                                     lastLineStart = pos;
8244                                     tokenFlags |= 1;
8245                                 }
8246                             }
8247                             commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
8248                             if (!commentClosed) {
8249                                 error(ts.Diagnostics.Asterisk_Slash_expected);
8250                             }
8251                             if (skipTrivia) {
8252                                 continue;
8253                             }
8254                             else {
8255                                 if (!commentClosed) {
8256                                     tokenFlags |= 4;
8257                                 }
8258                                 return token = 3;
8259                             }
8260                         }
8261                         if (text.charCodeAt(pos + 1) === 61) {
8262                             return pos += 2, token = 68;
8263                         }
8264                         pos++;
8265                         return token = 43;
8266                     case 48:
8267                         if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) {
8268                             pos += 2;
8269                             tokenValue = scanMinimumNumberOfHexDigits(1, true);
8270                             if (!tokenValue) {
8271                                 error(ts.Diagnostics.Hexadecimal_digit_expected);
8272                                 tokenValue = "0";
8273                             }
8274                             tokenValue = "0x" + tokenValue;
8275                             tokenFlags |= 64;
8276                             return token = checkBigIntSuffix();
8277                         }
8278                         else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) {
8279                             pos += 2;
8280                             tokenValue = scanBinaryOrOctalDigits(2);
8281                             if (!tokenValue) {
8282                                 error(ts.Diagnostics.Binary_digit_expected);
8283                                 tokenValue = "0";
8284                             }
8285                             tokenValue = "0b" + tokenValue;
8286                             tokenFlags |= 128;
8287                             return token = checkBigIntSuffix();
8288                         }
8289                         else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) {
8290                             pos += 2;
8291                             tokenValue = scanBinaryOrOctalDigits(8);
8292                             if (!tokenValue) {
8293                                 error(ts.Diagnostics.Octal_digit_expected);
8294                                 tokenValue = "0";
8295                             }
8296                             tokenValue = "0o" + tokenValue;
8297                             tokenFlags |= 256;
8298                             return token = checkBigIntSuffix();
8299                         }
8300                         if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
8301                             tokenValue = "" + scanOctalDigits();
8302                             tokenFlags |= 32;
8303                             return token = 8;
8304                         }
8305                     case 49:
8306                     case 50:
8307                     case 51:
8308                     case 52:
8309                     case 53:
8310                     case 54:
8311                     case 55:
8312                     case 56:
8313                     case 57:
8314                         (_a = scanNumber(), token = _a.type, tokenValue = _a.value);
8315                         return token;
8316                     case 58:
8317                         pos++;
8318                         return token = 58;
8319                     case 59:
8320                         pos++;
8321                         return token = 26;
8322                     case 60:
8323                         if (isConflictMarkerTrivia(text, pos)) {
8324                             pos = scanConflictMarkerTrivia(text, pos, error);
8325                             if (skipTrivia) {
8326                                 continue;
8327                             }
8328                             else {
8329                                 return token = 7;
8330                             }
8331                         }
8332                         if (text.charCodeAt(pos + 1) === 60) {
8333                             if (text.charCodeAt(pos + 2) === 61) {
8334                                 return pos += 3, token = 70;
8335                             }
8336                             return pos += 2, token = 47;
8337                         }
8338                         if (text.charCodeAt(pos + 1) === 61) {
8339                             return pos += 2, token = 32;
8340                         }
8341                         if (languageVariant === 1 &&
8342                             text.charCodeAt(pos + 1) === 47 &&
8343                             text.charCodeAt(pos + 2) !== 42) {
8344                             return pos += 2, token = 30;
8345                         }
8346                         pos++;
8347                         return token = 29;
8348                     case 61:
8349                         if (isConflictMarkerTrivia(text, pos)) {
8350                             pos = scanConflictMarkerTrivia(text, pos, error);
8351                             if (skipTrivia) {
8352                                 continue;
8353                             }
8354                             else {
8355                                 return token = 7;
8356                             }
8357                         }
8358                         if (text.charCodeAt(pos + 1) === 61) {
8359                             if (text.charCodeAt(pos + 2) === 61) {
8360                                 return pos += 3, token = 36;
8361                             }
8362                             return pos += 2, token = 34;
8363                         }
8364                         if (text.charCodeAt(pos + 1) === 62) {
8365                             return pos += 2, token = 38;
8366                         }
8367                         pos++;
8368                         return token = 63;
8369                     case 62:
8370                         if (isConflictMarkerTrivia(text, pos)) {
8371                             pos = scanConflictMarkerTrivia(text, pos, error);
8372                             if (skipTrivia) {
8373                                 continue;
8374                             }
8375                             else {
8376                                 return token = 7;
8377                             }
8378                         }
8379                         pos++;
8380                         return token = 31;
8381                     case 63:
8382                         if (text.charCodeAt(pos + 1) === 46 && !isDigit(text.charCodeAt(pos + 2))) {
8383                             return pos += 2, token = 28;
8384                         }
8385                         if (text.charCodeAt(pos + 1) === 63) {
8386                             if (text.charCodeAt(pos + 2) === 61) {
8387                                 return pos += 3, token = 77;
8388                             }
8389                             return pos += 2, token = 60;
8390                         }
8391                         pos++;
8392                         return token = 57;
8393                     case 91:
8394                         pos++;
8395                         return token = 22;
8396                     case 93:
8397                         pos++;
8398                         return token = 23;
8399                     case 94:
8400                         if (text.charCodeAt(pos + 1) === 61) {
8401                             return pos += 2, token = 78;
8402                         }
8403                         pos++;
8404                         return token = 52;
8405                     case 123:
8406                         pos++;
8407                         return token = 18;
8408                     case 124:
8409                         if (isConflictMarkerTrivia(text, pos)) {
8410                             pos = scanConflictMarkerTrivia(text, pos, error);
8411                             if (skipTrivia) {
8412                                 continue;
8413                             }
8414                             else {
8415                                 return token = 7;
8416                             }
8417                         }
8418                         if (text.charCodeAt(pos + 1) === 124) {
8419                             if (text.charCodeAt(pos + 2) === 61) {
8420                                 return pos += 3, token = 75;
8421                             }
8422                             return pos += 2, token = 56;
8423                         }
8424                         if (text.charCodeAt(pos + 1) === 61) {
8425                             return pos += 2, token = 74;
8426                         }
8427                         pos++;
8428                         return token = 51;
8429                     case 125:
8430                         pos++;
8431                         return token = 19;
8432                     case 126:
8433                         pos++;
8434                         return token = 54;
8435                     case 64:
8436                         pos++;
8437                         return token = 59;
8438                     case 92:
8439                         var extendedCookedChar = peekExtendedUnicodeEscape();
8440                         if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
8441                             pos += 3;
8442                             tokenFlags |= 8;
8443                             tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
8444                             return token = getIdentifierToken();
8445                         }
8446                         var cookedChar = peekUnicodeEscape();
8447                         if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
8448                             pos += 6;
8449                             tokenFlags |= 1024;
8450                             tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
8451                             return token = getIdentifierToken();
8452                         }
8453                         error(ts.Diagnostics.Invalid_character);
8454                         pos++;
8455                         return token = 0;
8456                     case 35:
8457                         if (pos !== 0 && text[pos + 1] === "!") {
8458                             error(ts.Diagnostics.can_only_be_used_at_the_start_of_a_file);
8459                             pos++;
8460                             return token = 0;
8461                         }
8462                         if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) {
8463                             pos++;
8464                             scanIdentifier(codePointAt(text, pos), languageVersion);
8465                         }
8466                         else {
8467                             tokenValue = String.fromCharCode(codePointAt(text, pos));
8468                             error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
8469                         }
8470                         return token = 80;
8471                     default:
8472                         var identifierKind = scanIdentifier(ch, languageVersion);
8473                         if (identifierKind) {
8474                             return token = identifierKind;
8475                         }
8476                         else if (isWhiteSpaceSingleLine(ch)) {
8477                             pos += charSize(ch);
8478                             continue;
8479                         }
8480                         else if (isLineBreak(ch)) {
8481                             tokenFlags |= 1;
8482                             pos += charSize(ch);
8483                             continue;
8484                         }
8485                         var size = charSize(ch);
8486                         error(ts.Diagnostics.Invalid_character, pos, size);
8487                         pos += size;
8488                         return token = 0;
8489                 }
8490             }
8491         }
8492         function reScanInvalidIdentifier() {
8493             ts.Debug.assert(token === 0, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
8494             pos = tokenPos = startPos;
8495             tokenFlags = 0;
8496             var ch = codePointAt(text, pos);
8497             var identifierKind = scanIdentifier(ch, 99);
8498             if (identifierKind) {
8499                 return token = identifierKind;
8500             }
8501             pos += charSize(ch);
8502             return token;
8503         }
8504         function scanIdentifier(startCharacter, languageVersion) {
8505             var ch = startCharacter;
8506             if (isIdentifierStart(ch, languageVersion)) {
8507                 pos += charSize(ch);
8508                 while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion))
8509                     pos += charSize(ch);
8510                 tokenValue = text.substring(tokenPos, pos);
8511                 if (ch === 92) {
8512                     tokenValue += scanIdentifierParts();
8513                 }
8514                 return getIdentifierToken();
8515             }
8516         }
8517         function reScanGreaterToken() {
8518             if (token === 31) {
8519                 if (text.charCodeAt(pos) === 62) {
8520                     if (text.charCodeAt(pos + 1) === 62) {
8521                         if (text.charCodeAt(pos + 2) === 61) {
8522                             return pos += 3, token = 72;
8523                         }
8524                         return pos += 2, token = 49;
8525                     }
8526                     if (text.charCodeAt(pos + 1) === 61) {
8527                         return pos += 2, token = 71;
8528                     }
8529                     pos++;
8530                     return token = 48;
8531                 }
8532                 if (text.charCodeAt(pos) === 61) {
8533                     pos++;
8534                     return token = 33;
8535                 }
8536             }
8537             return token;
8538         }
8539         function reScanAsteriskEqualsToken() {
8540             ts.Debug.assert(token === 66, "'reScanAsteriskEqualsToken' should only be called on a '*='");
8541             pos = tokenPos + 1;
8542             return token = 63;
8543         }
8544         function reScanSlashToken() {
8545             if (token === 43 || token === 68) {
8546                 var p = tokenPos + 1;
8547                 var inEscape = false;
8548                 var inCharacterClass = false;
8549                 while (true) {
8550                     if (p >= end) {
8551                         tokenFlags |= 4;
8552                         error(ts.Diagnostics.Unterminated_regular_expression_literal);
8553                         break;
8554                     }
8555                     var ch = text.charCodeAt(p);
8556                     if (isLineBreak(ch)) {
8557                         tokenFlags |= 4;
8558                         error(ts.Diagnostics.Unterminated_regular_expression_literal);
8559                         break;
8560                     }
8561                     if (inEscape) {
8562                         inEscape = false;
8563                     }
8564                     else if (ch === 47 && !inCharacterClass) {
8565                         p++;
8566                         break;
8567                     }
8568                     else if (ch === 91) {
8569                         inCharacterClass = true;
8570                     }
8571                     else if (ch === 92) {
8572                         inEscape = true;
8573                     }
8574                     else if (ch === 93) {
8575                         inCharacterClass = false;
8576                     }
8577                     p++;
8578                 }
8579                 while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
8580                     p++;
8581                 }
8582                 pos = p;
8583                 tokenValue = text.substring(tokenPos, pos);
8584                 token = 13;
8585             }
8586             return token;
8587         }
8588         function appendIfCommentDirective(commentDirectives, text, commentDirectiveRegEx, lineStart) {
8589             var type = getDirectiveFromComment(ts.trimStringStart(text), commentDirectiveRegEx);
8590             if (type === undefined) {
8591                 return commentDirectives;
8592             }
8593             return ts.append(commentDirectives, {
8594                 range: { pos: lineStart, end: pos },
8595                 type: type,
8596             });
8597         }
8598         function getDirectiveFromComment(text, commentDirectiveRegEx) {
8599             var match = commentDirectiveRegEx.exec(text);
8600             if (!match) {
8601                 return undefined;
8602             }
8603             switch (match[1]) {
8604                 case "ts-expect-error":
8605                     return 0;
8606                 case "ts-ignore":
8607                     return 1;
8608             }
8609             return undefined;
8610         }
8611         function reScanTemplateToken(isTaggedTemplate) {
8612             ts.Debug.assert(token === 19, "'reScanTemplateToken' should only be called on a '}'");
8613             pos = tokenPos;
8614             return token = scanTemplateAndSetTokenValue(isTaggedTemplate);
8615         }
8616         function reScanTemplateHeadOrNoSubstitutionTemplate() {
8617             pos = tokenPos;
8618             return token = scanTemplateAndSetTokenValue(true);
8619         }
8620         function reScanJsxToken(allowMultilineJsxText) {
8621             if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; }
8622             pos = tokenPos = startPos;
8623             return token = scanJsxToken(allowMultilineJsxText);
8624         }
8625         function reScanLessThanToken() {
8626             if (token === 47) {
8627                 pos = tokenPos + 1;
8628                 return token = 29;
8629             }
8630             return token;
8631         }
8632         function reScanHashToken() {
8633             if (token === 80) {
8634                 pos = tokenPos + 1;
8635                 return token = 62;
8636             }
8637             return token;
8638         }
8639         function reScanQuestionToken() {
8640             ts.Debug.assert(token === 60, "'reScanQuestionToken' should only be called on a '??'");
8641             pos = tokenPos + 1;
8642             return token = 57;
8643         }
8644         function scanJsxToken(allowMultilineJsxText) {
8645             if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; }
8646             startPos = tokenPos = pos;
8647             if (pos >= end) {
8648                 return token = 1;
8649             }
8650             var char = text.charCodeAt(pos);
8651             if (char === 60) {
8652                 if (text.charCodeAt(pos + 1) === 47) {
8653                     pos += 2;
8654                     return token = 30;
8655                 }
8656                 pos++;
8657                 return token = 29;
8658             }
8659             if (char === 123) {
8660                 pos++;
8661                 return token = 18;
8662             }
8663             var firstNonWhitespace = 0;
8664             while (pos < end) {
8665                 char = text.charCodeAt(pos);
8666                 if (char === 123) {
8667                     break;
8668                 }
8669                 if (char === 60) {
8670                     if (isConflictMarkerTrivia(text, pos)) {
8671                         pos = scanConflictMarkerTrivia(text, pos, error);
8672                         return token = 7;
8673                     }
8674                     break;
8675                 }
8676                 if (char === 62) {
8677                     error(ts.Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
8678                 }
8679                 if (char === 125) {
8680                     error(ts.Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
8681                 }
8682                 if (isLineBreak(char) && firstNonWhitespace === 0) {
8683                     firstNonWhitespace = -1;
8684                 }
8685                 else if (!allowMultilineJsxText && isLineBreak(char) && firstNonWhitespace > 0) {
8686                     break;
8687                 }
8688                 else if (!isWhiteSpaceLike(char)) {
8689                     firstNonWhitespace = pos;
8690                 }
8691                 pos++;
8692             }
8693             tokenValue = text.substring(startPos, pos);
8694             return firstNonWhitespace === -1 ? 12 : 11;
8695         }
8696         function scanJsxIdentifier() {
8697             if (tokenIsIdentifierOrKeyword(token)) {
8698                 var namespaceSeparator = false;
8699                 while (pos < end) {
8700                     var ch = text.charCodeAt(pos);
8701                     if (ch === 45) {
8702                         tokenValue += "-";
8703                         pos++;
8704                         continue;
8705                     }
8706                     else if (ch === 58 && !namespaceSeparator) {
8707                         tokenValue += ":";
8708                         pos++;
8709                         namespaceSeparator = true;
8710                         token = 79;
8711                         continue;
8712                     }
8713                     var oldPos = pos;
8714                     tokenValue += scanIdentifierParts();
8715                     if (pos === oldPos) {
8716                         break;
8717                     }
8718                 }
8719                 if (tokenValue.slice(-1) === ":") {
8720                     tokenValue = tokenValue.slice(0, -1);
8721                     pos--;
8722                 }
8723             }
8724             return token;
8725         }
8726         function scanJsxAttributeValue() {
8727             startPos = pos;
8728             switch (text.charCodeAt(pos)) {
8729                 case 34:
8730                 case 39:
8731                     tokenValue = scanString(true);
8732                     return token = 10;
8733                 default:
8734                     return scan();
8735             }
8736         }
8737         function reScanJsxAttributeValue() {
8738             pos = tokenPos = startPos;
8739             return scanJsxAttributeValue();
8740         }
8741         function scanJsDocToken() {
8742             startPos = tokenPos = pos;
8743             tokenFlags = 0;
8744             if (pos >= end) {
8745                 return token = 1;
8746             }
8747             var ch = codePointAt(text, pos);
8748             pos += charSize(ch);
8749             switch (ch) {
8750                 case 9:
8751                 case 11:
8752                 case 12:
8753                 case 32:
8754                     while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) {
8755                         pos++;
8756                     }
8757                     return token = 5;
8758                 case 64:
8759                     return token = 59;
8760                 case 13:
8761                     if (text.charCodeAt(pos) === 10) {
8762                         pos++;
8763                     }
8764                 case 10:
8765                     tokenFlags |= 1;
8766                     return token = 4;
8767                 case 42:
8768                     return token = 41;
8769                 case 123:
8770                     return token = 18;
8771                 case 125:
8772                     return token = 19;
8773                 case 91:
8774                     return token = 22;
8775                 case 93:
8776                     return token = 23;
8777                 case 60:
8778                     return token = 29;
8779                 case 62:
8780                     return token = 31;
8781                 case 61:
8782                     return token = 63;
8783                 case 44:
8784                     return token = 27;
8785                 case 46:
8786                     return token = 24;
8787                 case 96:
8788                     return token = 61;
8789                 case 35:
8790                     return token = 62;
8791                 case 92:
8792                     pos--;
8793                     var extendedCookedChar = peekExtendedUnicodeEscape();
8794                     if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
8795                         pos += 3;
8796                         tokenFlags |= 8;
8797                         tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
8798                         return token = getIdentifierToken();
8799                     }
8800                     var cookedChar = peekUnicodeEscape();
8801                     if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
8802                         pos += 6;
8803                         tokenFlags |= 1024;
8804                         tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
8805                         return token = getIdentifierToken();
8806                     }
8807                     pos++;
8808                     return token = 0;
8809             }
8810             if (isIdentifierStart(ch, languageVersion)) {
8811                 var char = ch;
8812                 while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === 45)
8813                     pos += charSize(char);
8814                 tokenValue = text.substring(tokenPos, pos);
8815                 if (char === 92) {
8816                     tokenValue += scanIdentifierParts();
8817                 }
8818                 return token = getIdentifierToken();
8819             }
8820             else {
8821                 return token = 0;
8822             }
8823         }
8824         function speculationHelper(callback, isLookahead) {
8825             var savePos = pos;
8826             var saveStartPos = startPos;
8827             var saveTokenPos = tokenPos;
8828             var saveToken = token;
8829             var saveTokenValue = tokenValue;
8830             var saveTokenFlags = tokenFlags;
8831             var result = callback();
8832             if (!result || isLookahead) {
8833                 pos = savePos;
8834                 startPos = saveStartPos;
8835                 tokenPos = saveTokenPos;
8836                 token = saveToken;
8837                 tokenValue = saveTokenValue;
8838                 tokenFlags = saveTokenFlags;
8839             }
8840             return result;
8841         }
8842         function scanRange(start, length, callback) {
8843             var saveEnd = end;
8844             var savePos = pos;
8845             var saveStartPos = startPos;
8846             var saveTokenPos = tokenPos;
8847             var saveToken = token;
8848             var saveTokenValue = tokenValue;
8849             var saveTokenFlags = tokenFlags;
8850             var saveErrorExpectations = commentDirectives;
8851             setText(text, start, length);
8852             var result = callback();
8853             end = saveEnd;
8854             pos = savePos;
8855             startPos = saveStartPos;
8856             tokenPos = saveTokenPos;
8857             token = saveToken;
8858             tokenValue = saveTokenValue;
8859             tokenFlags = saveTokenFlags;
8860             commentDirectives = saveErrorExpectations;
8861             return result;
8862         }
8863         function lookAhead(callback) {
8864             return speculationHelper(callback, true);
8865         }
8866         function tryScan(callback) {
8867             return speculationHelper(callback, false);
8868         }
8869         function getText() {
8870             return text;
8871         }
8872         function clearCommentDirectives() {
8873             commentDirectives = undefined;
8874         }
8875         function setText(newText, start, length) {
8876             text = newText || "";
8877             end = length === undefined ? text.length : start + length;
8878             setTextPos(start || 0);
8879         }
8880         function setOnError(errorCallback) {
8881             onError = errorCallback;
8882         }
8883         function setScriptTarget(scriptTarget) {
8884             languageVersion = scriptTarget;
8885         }
8886         function setLanguageVariant(variant) {
8887             languageVariant = variant;
8888         }
8889         function setTextPos(textPos) {
8890             ts.Debug.assert(textPos >= 0);
8891             pos = textPos;
8892             startPos = textPos;
8893             tokenPos = textPos;
8894             token = 0;
8895             tokenValue = undefined;
8896             tokenFlags = 0;
8897         }
8898         function setInJSDocType(inType) {
8899             inJSDocType += inType ? 1 : -1;
8900         }
8901     }
8902     ts.createScanner = createScanner;
8903     var codePointAt = String.prototype.codePointAt ? function (s, i) { return s.codePointAt(i); } : function codePointAt(str, i) {
8904         var size = str.length;
8905         if (i < 0 || i >= size) {
8906             return undefined;
8907         }
8908         var first = str.charCodeAt(i);
8909         if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
8910             var second = str.charCodeAt(i + 1);
8911             if (second >= 0xDC00 && second <= 0xDFFF) {
8912                 return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
8913             }
8914         }
8915         return first;
8916     };
8917     function charSize(ch) {
8918         if (ch >= 0x10000) {
8919             return 2;
8920         }
8921         return 1;
8922     }
8923     function utf16EncodeAsStringFallback(codePoint) {
8924         ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);
8925         if (codePoint <= 65535) {
8926             return String.fromCharCode(codePoint);
8927         }
8928         var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;
8929         var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;
8930         return String.fromCharCode(codeUnit1, codeUnit2);
8931     }
8932     var utf16EncodeAsStringWorker = String.fromCodePoint ? function (codePoint) { return String.fromCodePoint(codePoint); } : utf16EncodeAsStringFallback;
8933     function utf16EncodeAsString(codePoint) {
8934         return utf16EncodeAsStringWorker(codePoint);
8935     }
8936     ts.utf16EncodeAsString = utf16EncodeAsString;
8937 })(ts || (ts = {}));
8938 var ts;
8939 (function (ts) {
8940     function isExternalModuleNameRelative(moduleName) {
8941         return ts.pathIsRelative(moduleName) || ts.isRootedDiskPath(moduleName);
8942     }
8943     ts.isExternalModuleNameRelative = isExternalModuleNameRelative;
8944     function sortAndDeduplicateDiagnostics(diagnostics) {
8945         return ts.sortAndDeduplicate(diagnostics, ts.compareDiagnostics);
8946     }
8947     ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
8948     function getDefaultLibFileName(options) {
8949         switch (ts.getEmitScriptTarget(options)) {
8950             case 99:
8951                 return "lib.esnext.full.d.ts";
8952             case 8:
8953                 return "lib.es2021.full.d.ts";
8954             case 7:
8955                 return "lib.es2020.full.d.ts";
8956             case 6:
8957                 return "lib.es2019.full.d.ts";
8958             case 5:
8959                 return "lib.es2018.full.d.ts";
8960             case 4:
8961                 return "lib.es2017.full.d.ts";
8962             case 3:
8963                 return "lib.es2016.full.d.ts";
8964             case 2:
8965                 return "lib.es6.d.ts";
8966             default:
8967                 return "lib.d.ts";
8968         }
8969     }
8970     ts.getDefaultLibFileName = getDefaultLibFileName;
8971     function textSpanEnd(span) {
8972         return span.start + span.length;
8973     }
8974     ts.textSpanEnd = textSpanEnd;
8975     function textSpanIsEmpty(span) {
8976         return span.length === 0;
8977     }
8978     ts.textSpanIsEmpty = textSpanIsEmpty;
8979     function textSpanContainsPosition(span, position) {
8980         return position >= span.start && position < textSpanEnd(span);
8981     }
8982     ts.textSpanContainsPosition = textSpanContainsPosition;
8983     function textRangeContainsPositionInclusive(span, position) {
8984         return position >= span.pos && position <= span.end;
8985     }
8986     ts.textRangeContainsPositionInclusive = textRangeContainsPositionInclusive;
8987     function textSpanContainsTextSpan(span, other) {
8988         return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
8989     }
8990     ts.textSpanContainsTextSpan = textSpanContainsTextSpan;
8991     function textSpanOverlapsWith(span, other) {
8992         return textSpanOverlap(span, other) !== undefined;
8993     }
8994     ts.textSpanOverlapsWith = textSpanOverlapsWith;
8995     function textSpanOverlap(span1, span2) {
8996         var overlap = textSpanIntersection(span1, span2);
8997         return overlap && overlap.length === 0 ? undefined : overlap;
8998     }
8999     ts.textSpanOverlap = textSpanOverlap;
9000     function textSpanIntersectsWithTextSpan(span, other) {
9001         return decodedTextSpanIntersectsWith(span.start, span.length, other.start, other.length);
9002     }
9003     ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan;
9004     function textSpanIntersectsWith(span, start, length) {
9005         return decodedTextSpanIntersectsWith(span.start, span.length, start, length);
9006     }
9007     ts.textSpanIntersectsWith = textSpanIntersectsWith;
9008     function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
9009         var end1 = start1 + length1;
9010         var end2 = start2 + length2;
9011         return start2 <= end1 && end2 >= start1;
9012     }
9013     ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith;
9014     function textSpanIntersectsWithPosition(span, position) {
9015         return position <= textSpanEnd(span) && position >= span.start;
9016     }
9017     ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition;
9018     function textSpanIntersection(span1, span2) {
9019         var start = Math.max(span1.start, span2.start);
9020         var end = Math.min(textSpanEnd(span1), textSpanEnd(span2));
9021         return start <= end ? createTextSpanFromBounds(start, end) : undefined;
9022     }
9023     ts.textSpanIntersection = textSpanIntersection;
9024     function createTextSpan(start, length) {
9025         if (start < 0) {
9026             throw new Error("start < 0");
9027         }
9028         if (length < 0) {
9029             throw new Error("length < 0");
9030         }
9031         return { start: start, length: length };
9032     }
9033     ts.createTextSpan = createTextSpan;
9034     function createTextSpanFromBounds(start, end) {
9035         return createTextSpan(start, end - start);
9036     }
9037     ts.createTextSpanFromBounds = createTextSpanFromBounds;
9038     function textChangeRangeNewSpan(range) {
9039         return createTextSpan(range.span.start, range.newLength);
9040     }
9041     ts.textChangeRangeNewSpan = textChangeRangeNewSpan;
9042     function textChangeRangeIsUnchanged(range) {
9043         return textSpanIsEmpty(range.span) && range.newLength === 0;
9044     }
9045     ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged;
9046     function createTextChangeRange(span, newLength) {
9047         if (newLength < 0) {
9048             throw new Error("newLength < 0");
9049         }
9050         return { span: span, newLength: newLength };
9051     }
9052     ts.createTextChangeRange = createTextChangeRange;
9053     ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
9054     function collapseTextChangeRangesAcrossMultipleVersions(changes) {
9055         if (changes.length === 0) {
9056             return ts.unchangedTextChangeRange;
9057         }
9058         if (changes.length === 1) {
9059             return changes[0];
9060         }
9061         var change0 = changes[0];
9062         var oldStartN = change0.span.start;
9063         var oldEndN = textSpanEnd(change0.span);
9064         var newEndN = oldStartN + change0.newLength;
9065         for (var i = 1; i < changes.length; i++) {
9066             var nextChange = changes[i];
9067             var oldStart1 = oldStartN;
9068             var oldEnd1 = oldEndN;
9069             var newEnd1 = newEndN;
9070             var oldStart2 = nextChange.span.start;
9071             var oldEnd2 = textSpanEnd(nextChange.span);
9072             var newEnd2 = oldStart2 + nextChange.newLength;
9073             oldStartN = Math.min(oldStart1, oldStart2);
9074             oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
9075             newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
9076         }
9077         return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN);
9078     }
9079     ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
9080     function getTypeParameterOwner(d) {
9081         if (d && d.kind === 162) {
9082             for (var current = d; current; current = current.parent) {
9083                 if (isFunctionLike(current) || isClassLike(current) || current.kind === 257) {
9084                     return current;
9085                 }
9086             }
9087         }
9088     }
9089     ts.getTypeParameterOwner = getTypeParameterOwner;
9090     function isParameterPropertyDeclaration(node, parent) {
9091         return ts.hasSyntacticModifier(node, 16476) && parent.kind === 170;
9092     }
9093     ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
9094     function isEmptyBindingPattern(node) {
9095         if (isBindingPattern(node)) {
9096             return ts.every(node.elements, isEmptyBindingElement);
9097         }
9098         return false;
9099     }
9100     ts.isEmptyBindingPattern = isEmptyBindingPattern;
9101     function isEmptyBindingElement(node) {
9102         if (ts.isOmittedExpression(node)) {
9103             return true;
9104         }
9105         return isEmptyBindingPattern(node.name);
9106     }
9107     ts.isEmptyBindingElement = isEmptyBindingElement;
9108     function walkUpBindingElementsAndPatterns(binding) {
9109         var node = binding.parent;
9110         while (ts.isBindingElement(node.parent)) {
9111             node = node.parent.parent;
9112         }
9113         return node.parent;
9114     }
9115     ts.walkUpBindingElementsAndPatterns = walkUpBindingElementsAndPatterns;
9116     function getCombinedFlags(node, getFlags) {
9117         if (ts.isBindingElement(node)) {
9118             node = walkUpBindingElementsAndPatterns(node);
9119         }
9120         var flags = getFlags(node);
9121         if (node.kind === 253) {
9122             node = node.parent;
9123         }
9124         if (node && node.kind === 254) {
9125             flags |= getFlags(node);
9126             node = node.parent;
9127         }
9128         if (node && node.kind === 236) {
9129             flags |= getFlags(node);
9130         }
9131         return flags;
9132     }
9133     function getCombinedModifierFlags(node) {
9134         return getCombinedFlags(node, ts.getEffectiveModifierFlags);
9135     }
9136     ts.getCombinedModifierFlags = getCombinedModifierFlags;
9137     function getCombinedNodeFlagsAlwaysIncludeJSDoc(node) {
9138         return getCombinedFlags(node, ts.getEffectiveModifierFlagsAlwaysIncludeJSDoc);
9139     }
9140     ts.getCombinedNodeFlagsAlwaysIncludeJSDoc = getCombinedNodeFlagsAlwaysIncludeJSDoc;
9141     function getCombinedNodeFlags(node) {
9142         return getCombinedFlags(node, function (n) { return n.flags; });
9143     }
9144     ts.getCombinedNodeFlags = getCombinedNodeFlags;
9145     ts.supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
9146     function validateLocaleAndSetLanguage(locale, sys, errors) {
9147         var lowerCaseLocale = locale.toLowerCase();
9148         var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(lowerCaseLocale);
9149         if (!matchResult) {
9150             if (errors) {
9151                 errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
9152             }
9153             return;
9154         }
9155         var language = matchResult[1];
9156         var territory = matchResult[3];
9157         if (ts.contains(ts.supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
9158             trySetLanguageAndTerritory(language, undefined, errors);
9159         }
9160         ts.setUILocale(locale);
9161         function trySetLanguageAndTerritory(language, territory, errors) {
9162             var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath());
9163             var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath);
9164             var filePath = ts.combinePaths(containingDirectoryPath, language);
9165             if (territory) {
9166                 filePath = filePath + "-" + territory;
9167             }
9168             filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json"));
9169             if (!sys.fileExists(filePath)) {
9170                 return false;
9171             }
9172             var fileContents = "";
9173             try {
9174                 fileContents = sys.readFile(filePath);
9175             }
9176             catch (e) {
9177                 if (errors) {
9178                     errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath));
9179                 }
9180                 return false;
9181             }
9182             try {
9183                 ts.setLocalizedDiagnosticMessages(JSON.parse(fileContents));
9184             }
9185             catch (_a) {
9186                 if (errors) {
9187                     errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath));
9188                 }
9189                 return false;
9190             }
9191             return true;
9192         }
9193     }
9194     ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage;
9195     function getOriginalNode(node, nodeTest) {
9196         if (node) {
9197             while (node.original !== undefined) {
9198                 node = node.original;
9199             }
9200         }
9201         return !nodeTest || nodeTest(node) ? node : undefined;
9202     }
9203     ts.getOriginalNode = getOriginalNode;
9204     function findAncestor(node, callback) {
9205         while (node) {
9206             var result = callback(node);
9207             if (result === "quit") {
9208                 return undefined;
9209             }
9210             else if (result) {
9211                 return node;
9212             }
9213             node = node.parent;
9214         }
9215         return undefined;
9216     }
9217     ts.findAncestor = findAncestor;
9218     function isParseTreeNode(node) {
9219         return (node.flags & 8) === 0;
9220     }
9221     ts.isParseTreeNode = isParseTreeNode;
9222     function getParseTreeNode(node, nodeTest) {
9223         if (node === undefined || isParseTreeNode(node)) {
9224             return node;
9225         }
9226         node = node.original;
9227         while (node) {
9228             if (isParseTreeNode(node)) {
9229                 return !nodeTest || nodeTest(node) ? node : undefined;
9230             }
9231             node = node.original;
9232         }
9233     }
9234     ts.getParseTreeNode = getParseTreeNode;
9235     function escapeLeadingUnderscores(identifier) {
9236         return (identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier);
9237     }
9238     ts.escapeLeadingUnderscores = escapeLeadingUnderscores;
9239     function unescapeLeadingUnderscores(identifier) {
9240         var id = identifier;
9241         return id.length >= 3 && id.charCodeAt(0) === 95 && id.charCodeAt(1) === 95 && id.charCodeAt(2) === 95 ? id.substr(1) : id;
9242     }
9243     ts.unescapeLeadingUnderscores = unescapeLeadingUnderscores;
9244     function idText(identifierOrPrivateName) {
9245         return unescapeLeadingUnderscores(identifierOrPrivateName.escapedText);
9246     }
9247     ts.idText = idText;
9248     function symbolName(symbol) {
9249         if (symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
9250             return idText(symbol.valueDeclaration.name);
9251         }
9252         return unescapeLeadingUnderscores(symbol.escapedName);
9253     }
9254     ts.symbolName = symbolName;
9255     function nameForNamelessJSDocTypedef(declaration) {
9256         var hostNode = declaration.parent.parent;
9257         if (!hostNode) {
9258             return undefined;
9259         }
9260         if (isDeclaration(hostNode)) {
9261             return getDeclarationIdentifier(hostNode);
9262         }
9263         switch (hostNode.kind) {
9264             case 236:
9265                 if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
9266                     return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
9267                 }
9268                 break;
9269             case 237:
9270                 var expr = hostNode.expression;
9271                 if (expr.kind === 220 && expr.operatorToken.kind === 63) {
9272                     expr = expr.left;
9273                 }
9274                 switch (expr.kind) {
9275                     case 205:
9276                         return expr.name;
9277                     case 206:
9278                         var arg = expr.argumentExpression;
9279                         if (ts.isIdentifier(arg)) {
9280                             return arg;
9281                         }
9282                 }
9283                 break;
9284             case 211: {
9285                 return getDeclarationIdentifier(hostNode.expression);
9286             }
9287             case 249: {
9288                 if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) {
9289                     return getDeclarationIdentifier(hostNode.statement);
9290                 }
9291                 break;
9292             }
9293         }
9294     }
9295     function getDeclarationIdentifier(node) {
9296         var name = getNameOfDeclaration(node);
9297         return name && ts.isIdentifier(name) ? name : undefined;
9298     }
9299     function nodeHasName(statement, name) {
9300         if (isNamedDeclaration(statement) && ts.isIdentifier(statement.name) && idText(statement.name) === idText(name)) {
9301             return true;
9302         }
9303         if (ts.isVariableStatement(statement) && ts.some(statement.declarationList.declarations, function (d) { return nodeHasName(d, name); })) {
9304             return true;
9305         }
9306         return false;
9307     }
9308     ts.nodeHasName = nodeHasName;
9309     function getNameOfJSDocTypedef(declaration) {
9310         return declaration.name || nameForNamelessJSDocTypedef(declaration);
9311     }
9312     ts.getNameOfJSDocTypedef = getNameOfJSDocTypedef;
9313     function isNamedDeclaration(node) {
9314         return !!node.name;
9315     }
9316     ts.isNamedDeclaration = isNamedDeclaration;
9317     function getNonAssignedNameOfDeclaration(declaration) {
9318         switch (declaration.kind) {
9319             case 79:
9320                 return declaration;
9321             case 345:
9322             case 338: {
9323                 var name = declaration.name;
9324                 if (name.kind === 160) {
9325                     return name.right;
9326                 }
9327                 break;
9328             }
9329             case 207:
9330             case 220: {
9331                 var expr_1 = declaration;
9332                 switch (ts.getAssignmentDeclarationKind(expr_1)) {
9333                     case 1:
9334                     case 4:
9335                     case 5:
9336                     case 3:
9337                         return ts.getElementOrPropertyAccessArgumentExpressionOrName(expr_1.left);
9338                     case 7:
9339                     case 8:
9340                     case 9:
9341                         return expr_1.arguments[1];
9342                     default:
9343                         return undefined;
9344                 }
9345             }
9346             case 343:
9347                 return getNameOfJSDocTypedef(declaration);
9348             case 337:
9349                 return nameForNamelessJSDocTypedef(declaration);
9350             case 270: {
9351                 var expression = declaration.expression;
9352                 return ts.isIdentifier(expression) ? expression : undefined;
9353             }
9354             case 206:
9355                 var expr = declaration;
9356                 if (ts.isBindableStaticElementAccessExpression(expr)) {
9357                     return expr.argumentExpression;
9358                 }
9359         }
9360         return declaration.name;
9361     }
9362     ts.getNonAssignedNameOfDeclaration = getNonAssignedNameOfDeclaration;
9363     function getNameOfDeclaration(declaration) {
9364         if (declaration === undefined)
9365             return undefined;
9366         return getNonAssignedNameOfDeclaration(declaration) ||
9367             (ts.isFunctionExpression(declaration) || ts.isArrowFunction(declaration) || ts.isClassExpression(declaration) ? getAssignedName(declaration) : undefined);
9368     }
9369     ts.getNameOfDeclaration = getNameOfDeclaration;
9370     function getAssignedName(node) {
9371         if (!node.parent) {
9372             return undefined;
9373         }
9374         else if (ts.isPropertyAssignment(node.parent) || ts.isBindingElement(node.parent)) {
9375             return node.parent.name;
9376         }
9377         else if (ts.isBinaryExpression(node.parent) && node === node.parent.right) {
9378             if (ts.isIdentifier(node.parent.left)) {
9379                 return node.parent.left;
9380             }
9381             else if (ts.isAccessExpression(node.parent.left)) {
9382                 return ts.getElementOrPropertyAccessArgumentExpressionOrName(node.parent.left);
9383             }
9384         }
9385         else if (ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {
9386             return node.parent.name;
9387         }
9388     }
9389     ts.getAssignedName = getAssignedName;
9390     function getJSDocParameterTagsWorker(param, noCache) {
9391         if (param.name) {
9392             if (ts.isIdentifier(param.name)) {
9393                 var name_1 = param.name.escapedText;
9394                 return getJSDocTagsWorker(param.parent, noCache).filter(function (tag) { return ts.isJSDocParameterTag(tag) && ts.isIdentifier(tag.name) && tag.name.escapedText === name_1; });
9395             }
9396             else {
9397                 var i = param.parent.parameters.indexOf(param);
9398                 ts.Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
9399                 var paramTags = getJSDocTagsWorker(param.parent, noCache).filter(ts.isJSDocParameterTag);
9400                 if (i < paramTags.length) {
9401                     return [paramTags[i]];
9402                 }
9403             }
9404         }
9405         return ts.emptyArray;
9406     }
9407     function getJSDocParameterTags(param) {
9408         return getJSDocParameterTagsWorker(param, false);
9409     }
9410     ts.getJSDocParameterTags = getJSDocParameterTags;
9411     function getJSDocParameterTagsNoCache(param) {
9412         return getJSDocParameterTagsWorker(param, true);
9413     }
9414     ts.getJSDocParameterTagsNoCache = getJSDocParameterTagsNoCache;
9415     function getJSDocTypeParameterTagsWorker(param, noCache) {
9416         var name = param.name.escapedText;
9417         return getJSDocTagsWorker(param.parent, noCache).filter(function (tag) {
9418             return ts.isJSDocTemplateTag(tag) && tag.typeParameters.some(function (tp) { return tp.name.escapedText === name; });
9419         });
9420     }
9421     function getJSDocTypeParameterTags(param) {
9422         return getJSDocTypeParameterTagsWorker(param, false);
9423     }
9424     ts.getJSDocTypeParameterTags = getJSDocTypeParameterTags;
9425     function getJSDocTypeParameterTagsNoCache(param) {
9426         return getJSDocTypeParameterTagsWorker(param, true);
9427     }
9428     ts.getJSDocTypeParameterTagsNoCache = getJSDocTypeParameterTagsNoCache;
9429     function hasJSDocParameterTags(node) {
9430         return !!getFirstJSDocTag(node, ts.isJSDocParameterTag);
9431     }
9432     ts.hasJSDocParameterTags = hasJSDocParameterTags;
9433     function getJSDocAugmentsTag(node) {
9434         return getFirstJSDocTag(node, ts.isJSDocAugmentsTag);
9435     }
9436     ts.getJSDocAugmentsTag = getJSDocAugmentsTag;
9437     function getJSDocImplementsTags(node) {
9438         return getAllJSDocTags(node, ts.isJSDocImplementsTag);
9439     }
9440     ts.getJSDocImplementsTags = getJSDocImplementsTags;
9441     function getJSDocClassTag(node) {
9442         return getFirstJSDocTag(node, ts.isJSDocClassTag);
9443     }
9444     ts.getJSDocClassTag = getJSDocClassTag;
9445     function getJSDocPublicTag(node) {
9446         return getFirstJSDocTag(node, ts.isJSDocPublicTag);
9447     }
9448     ts.getJSDocPublicTag = getJSDocPublicTag;
9449     function getJSDocPublicTagNoCache(node) {
9450         return getFirstJSDocTag(node, ts.isJSDocPublicTag, true);
9451     }
9452     ts.getJSDocPublicTagNoCache = getJSDocPublicTagNoCache;
9453     function getJSDocPrivateTag(node) {
9454         return getFirstJSDocTag(node, ts.isJSDocPrivateTag);
9455     }
9456     ts.getJSDocPrivateTag = getJSDocPrivateTag;
9457     function getJSDocPrivateTagNoCache(node) {
9458         return getFirstJSDocTag(node, ts.isJSDocPrivateTag, true);
9459     }
9460     ts.getJSDocPrivateTagNoCache = getJSDocPrivateTagNoCache;
9461     function getJSDocProtectedTag(node) {
9462         return getFirstJSDocTag(node, ts.isJSDocProtectedTag);
9463     }
9464     ts.getJSDocProtectedTag = getJSDocProtectedTag;
9465     function getJSDocProtectedTagNoCache(node) {
9466         return getFirstJSDocTag(node, ts.isJSDocProtectedTag, true);
9467     }
9468     ts.getJSDocProtectedTagNoCache = getJSDocProtectedTagNoCache;
9469     function getJSDocReadonlyTag(node) {
9470         return getFirstJSDocTag(node, ts.isJSDocReadonlyTag);
9471     }
9472     ts.getJSDocReadonlyTag = getJSDocReadonlyTag;
9473     function getJSDocReadonlyTagNoCache(node) {
9474         return getFirstJSDocTag(node, ts.isJSDocReadonlyTag, true);
9475     }
9476     ts.getJSDocReadonlyTagNoCache = getJSDocReadonlyTagNoCache;
9477     function getJSDocOverrideTagNoCache(node) {
9478         return getFirstJSDocTag(node, ts.isJSDocOverrideTag, true);
9479     }
9480     ts.getJSDocOverrideTagNoCache = getJSDocOverrideTagNoCache;
9481     function getJSDocDeprecatedTag(node) {
9482         return getFirstJSDocTag(node, ts.isJSDocDeprecatedTag);
9483     }
9484     ts.getJSDocDeprecatedTag = getJSDocDeprecatedTag;
9485     function getJSDocDeprecatedTagNoCache(node) {
9486         return getFirstJSDocTag(node, ts.isJSDocDeprecatedTag, true);
9487     }
9488     ts.getJSDocDeprecatedTagNoCache = getJSDocDeprecatedTagNoCache;
9489     function getJSDocEnumTag(node) {
9490         return getFirstJSDocTag(node, ts.isJSDocEnumTag);
9491     }
9492     ts.getJSDocEnumTag = getJSDocEnumTag;
9493     function getJSDocThisTag(node) {
9494         return getFirstJSDocTag(node, ts.isJSDocThisTag);
9495     }
9496     ts.getJSDocThisTag = getJSDocThisTag;
9497     function getJSDocReturnTag(node) {
9498         return getFirstJSDocTag(node, ts.isJSDocReturnTag);
9499     }
9500     ts.getJSDocReturnTag = getJSDocReturnTag;
9501     function getJSDocTemplateTag(node) {
9502         return getFirstJSDocTag(node, ts.isJSDocTemplateTag);
9503     }
9504     ts.getJSDocTemplateTag = getJSDocTemplateTag;
9505     function getJSDocTypeTag(node) {
9506         var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag);
9507         if (tag && tag.typeExpression && tag.typeExpression.type) {
9508             return tag;
9509         }
9510         return undefined;
9511     }
9512     ts.getJSDocTypeTag = getJSDocTypeTag;
9513     function getJSDocType(node) {
9514         var tag = getFirstJSDocTag(node, ts.isJSDocTypeTag);
9515         if (!tag && ts.isParameter(node)) {
9516             tag = ts.find(getJSDocParameterTags(node), function (tag) { return !!tag.typeExpression; });
9517         }
9518         return tag && tag.typeExpression && tag.typeExpression.type;
9519     }
9520     ts.getJSDocType = getJSDocType;
9521     function getJSDocReturnType(node) {
9522         var returnTag = getJSDocReturnTag(node);
9523         if (returnTag && returnTag.typeExpression) {
9524             return returnTag.typeExpression.type;
9525         }
9526         var typeTag = getJSDocTypeTag(node);
9527         if (typeTag && typeTag.typeExpression) {
9528             var type = typeTag.typeExpression.type;
9529             if (ts.isTypeLiteralNode(type)) {
9530                 var sig = ts.find(type.members, ts.isCallSignatureDeclaration);
9531                 return sig && sig.type;
9532             }
9533             if (ts.isFunctionTypeNode(type) || ts.isJSDocFunctionType(type)) {
9534                 return type.type;
9535             }
9536         }
9537     }
9538     ts.getJSDocReturnType = getJSDocReturnType;
9539     function getJSDocTagsWorker(node, noCache) {
9540         var tags = node.jsDocCache;
9541         if (tags === undefined || noCache) {
9542             var comments = ts.getJSDocCommentsAndTags(node, noCache);
9543             ts.Debug.assert(comments.length < 2 || comments[0] !== comments[1]);
9544             tags = ts.flatMap(comments, function (j) { return ts.isJSDoc(j) ? j.tags : j; });
9545             if (!noCache) {
9546                 node.jsDocCache = tags;
9547             }
9548         }
9549         return tags;
9550     }
9551     function getJSDocTags(node) {
9552         return getJSDocTagsWorker(node, false);
9553     }
9554     ts.getJSDocTags = getJSDocTags;
9555     function getJSDocTagsNoCache(node) {
9556         return getJSDocTagsWorker(node, true);
9557     }
9558     ts.getJSDocTagsNoCache = getJSDocTagsNoCache;
9559     function getFirstJSDocTag(node, predicate, noCache) {
9560         return ts.find(getJSDocTagsWorker(node, noCache), predicate);
9561     }
9562     function getAllJSDocTags(node, predicate) {
9563         return getJSDocTags(node).filter(predicate);
9564     }
9565     ts.getAllJSDocTags = getAllJSDocTags;
9566     function getAllJSDocTagsOfKind(node, kind) {
9567         return getJSDocTags(node).filter(function (doc) { return doc.kind === kind; });
9568     }
9569     ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind;
9570     function getTextOfJSDocComment(comment) {
9571         return typeof comment === "string" ? comment
9572             : comment === null || comment === void 0 ? void 0 : comment.map(function (c) {
9573                 return c.kind === 319 ? c.text : "{@link ".concat(c.name ? ts.entityNameToString(c.name) + " " : "").concat(c.text, "}");
9574             }).join("");
9575     }
9576     ts.getTextOfJSDocComment = getTextOfJSDocComment;
9577     function getEffectiveTypeParameterDeclarations(node) {
9578         if (ts.isJSDocSignature(node)) {
9579             return ts.emptyArray;
9580         }
9581         if (ts.isJSDocTypeAlias(node)) {
9582             ts.Debug.assert(node.parent.kind === 318);
9583             return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
9584         }
9585         if (node.typeParameters) {
9586             return node.typeParameters;
9587         }
9588         if (ts.isInJSFile(node)) {
9589             var decls = ts.getJSDocTypeParameterDeclarations(node);
9590             if (decls.length) {
9591                 return decls;
9592             }
9593             var typeTag = getJSDocType(node);
9594             if (typeTag && ts.isFunctionTypeNode(typeTag) && typeTag.typeParameters) {
9595                 return typeTag.typeParameters;
9596             }
9597         }
9598         return ts.emptyArray;
9599     }
9600     ts.getEffectiveTypeParameterDeclarations = getEffectiveTypeParameterDeclarations;
9601     function getEffectiveConstraintOfTypeParameter(node) {
9602         return node.constraint ? node.constraint :
9603             ts.isJSDocTemplateTag(node.parent) && node === node.parent.typeParameters[0] ? node.parent.constraint :
9604                 undefined;
9605     }
9606     ts.getEffectiveConstraintOfTypeParameter = getEffectiveConstraintOfTypeParameter;
9607     function isMemberName(node) {
9608         return node.kind === 79 || node.kind === 80;
9609     }
9610     ts.isMemberName = isMemberName;
9611     function isGetOrSetAccessorDeclaration(node) {
9612         return node.kind === 172 || node.kind === 171;
9613     }
9614     ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
9615     function isPropertyAccessChain(node) {
9616         return ts.isPropertyAccessExpression(node) && !!(node.flags & 32);
9617     }
9618     ts.isPropertyAccessChain = isPropertyAccessChain;
9619     function isElementAccessChain(node) {
9620         return ts.isElementAccessExpression(node) && !!(node.flags & 32);
9621     }
9622     ts.isElementAccessChain = isElementAccessChain;
9623     function isCallChain(node) {
9624         return ts.isCallExpression(node) && !!(node.flags & 32);
9625     }
9626     ts.isCallChain = isCallChain;
9627     function isOptionalChain(node) {
9628         var kind = node.kind;
9629         return !!(node.flags & 32) &&
9630             (kind === 205
9631                 || kind === 206
9632                 || kind === 207
9633                 || kind === 229);
9634     }
9635     ts.isOptionalChain = isOptionalChain;
9636     function isOptionalChainRoot(node) {
9637         return isOptionalChain(node) && !ts.isNonNullExpression(node) && !!node.questionDotToken;
9638     }
9639     ts.isOptionalChainRoot = isOptionalChainRoot;
9640     function isExpressionOfOptionalChainRoot(node) {
9641         return isOptionalChainRoot(node.parent) && node.parent.expression === node;
9642     }
9643     ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
9644     function isOutermostOptionalChain(node) {
9645         return !isOptionalChain(node.parent)
9646             || isOptionalChainRoot(node.parent)
9647             || node !== node.parent.expression;
9648     }
9649     ts.isOutermostOptionalChain = isOutermostOptionalChain;
9650     function isNullishCoalesce(node) {
9651         return node.kind === 220 && node.operatorToken.kind === 60;
9652     }
9653     ts.isNullishCoalesce = isNullishCoalesce;
9654     function isConstTypeReference(node) {
9655         return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) &&
9656             node.typeName.escapedText === "const" && !node.typeArguments;
9657     }
9658     ts.isConstTypeReference = isConstTypeReference;
9659     function skipPartiallyEmittedExpressions(node) {
9660         return ts.skipOuterExpressions(node, 8);
9661     }
9662     ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
9663     function isNonNullChain(node) {
9664         return ts.isNonNullExpression(node) && !!(node.flags & 32);
9665     }
9666     ts.isNonNullChain = isNonNullChain;
9667     function isBreakOrContinueStatement(node) {
9668         return node.kind === 245 || node.kind === 244;
9669     }
9670     ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
9671     function isNamedExportBindings(node) {
9672         return node.kind === 273 || node.kind === 272;
9673     }
9674     ts.isNamedExportBindings = isNamedExportBindings;
9675     function isUnparsedTextLike(node) {
9676         switch (node.kind) {
9677             case 300:
9678             case 301:
9679                 return true;
9680             default:
9681                 return false;
9682         }
9683     }
9684     ts.isUnparsedTextLike = isUnparsedTextLike;
9685     function isUnparsedNode(node) {
9686         return isUnparsedTextLike(node) ||
9687             node.kind === 298 ||
9688             node.kind === 302;
9689     }
9690     ts.isUnparsedNode = isUnparsedNode;
9691     function isJSDocPropertyLikeTag(node) {
9692         return node.kind === 345 || node.kind === 338;
9693     }
9694     ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
9695     function isNode(node) {
9696         return isNodeKind(node.kind);
9697     }
9698     ts.isNode = isNode;
9699     function isNodeKind(kind) {
9700         return kind >= 160;
9701     }
9702     ts.isNodeKind = isNodeKind;
9703     function isTokenKind(kind) {
9704         return kind >= 0 && kind <= 159;
9705     }
9706     ts.isTokenKind = isTokenKind;
9707     function isToken(n) {
9708         return isTokenKind(n.kind);
9709     }
9710     ts.isToken = isToken;
9711     function isNodeArray(array) {
9712         return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
9713     }
9714     ts.isNodeArray = isNodeArray;
9715     function isLiteralKind(kind) {
9716         return 8 <= kind && kind <= 14;
9717     }
9718     ts.isLiteralKind = isLiteralKind;
9719     function isLiteralExpression(node) {
9720         return isLiteralKind(node.kind);
9721     }
9722     ts.isLiteralExpression = isLiteralExpression;
9723     function isTemplateLiteralKind(kind) {
9724         return 14 <= kind && kind <= 17;
9725     }
9726     ts.isTemplateLiteralKind = isTemplateLiteralKind;
9727     function isTemplateLiteralToken(node) {
9728         return isTemplateLiteralKind(node.kind);
9729     }
9730     ts.isTemplateLiteralToken = isTemplateLiteralToken;
9731     function isTemplateMiddleOrTemplateTail(node) {
9732         var kind = node.kind;
9733         return kind === 16
9734             || kind === 17;
9735     }
9736     ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail;
9737     function isImportOrExportSpecifier(node) {
9738         return ts.isImportSpecifier(node) || ts.isExportSpecifier(node);
9739     }
9740     ts.isImportOrExportSpecifier = isImportOrExportSpecifier;
9741     function isTypeOnlyImportOrExportDeclaration(node) {
9742         switch (node.kind) {
9743             case 269:
9744             case 274:
9745                 return node.isTypeOnly || node.parent.parent.isTypeOnly;
9746             case 267:
9747                 return node.parent.isTypeOnly;
9748             case 266:
9749             case 264:
9750                 return node.isTypeOnly;
9751             default:
9752                 return false;
9753         }
9754     }
9755     ts.isTypeOnlyImportOrExportDeclaration = isTypeOnlyImportOrExportDeclaration;
9756     function isAssertionKey(node) {
9757         return ts.isStringLiteral(node) || ts.isIdentifier(node);
9758     }
9759     ts.isAssertionKey = isAssertionKey;
9760     function isStringTextContainingNode(node) {
9761         return node.kind === 10 || isTemplateLiteralKind(node.kind);
9762     }
9763     ts.isStringTextContainingNode = isStringTextContainingNode;
9764     function isGeneratedIdentifier(node) {
9765         return ts.isIdentifier(node) && (node.autoGenerateFlags & 7) > 0;
9766     }
9767     ts.isGeneratedIdentifier = isGeneratedIdentifier;
9768     function isPrivateIdentifierClassElementDeclaration(node) {
9769         return (ts.isPropertyDeclaration(node) || isMethodOrAccessor(node)) && ts.isPrivateIdentifier(node.name);
9770     }
9771     ts.isPrivateIdentifierClassElementDeclaration = isPrivateIdentifierClassElementDeclaration;
9772     function isPrivateIdentifierPropertyAccessExpression(node) {
9773         return ts.isPropertyAccessExpression(node) && ts.isPrivateIdentifier(node.name);
9774     }
9775     ts.isPrivateIdentifierPropertyAccessExpression = isPrivateIdentifierPropertyAccessExpression;
9776     function isModifierKind(token) {
9777         switch (token) {
9778             case 126:
9779             case 131:
9780             case 85:
9781             case 135:
9782             case 88:
9783             case 93:
9784             case 123:
9785             case 121:
9786             case 122:
9787             case 144:
9788             case 124:
9789             case 158:
9790                 return true;
9791         }
9792         return false;
9793     }
9794     ts.isModifierKind = isModifierKind;
9795     function isParameterPropertyModifier(kind) {
9796         return !!(ts.modifierToFlag(kind) & 16476);
9797     }
9798     ts.isParameterPropertyModifier = isParameterPropertyModifier;
9799     function isClassMemberModifier(idToken) {
9800         return isParameterPropertyModifier(idToken) || idToken === 124 || idToken === 158;
9801     }
9802     ts.isClassMemberModifier = isClassMemberModifier;
9803     function isModifier(node) {
9804         return isModifierKind(node.kind);
9805     }
9806     ts.isModifier = isModifier;
9807     function isEntityName(node) {
9808         var kind = node.kind;
9809         return kind === 160
9810             || kind === 79;
9811     }
9812     ts.isEntityName = isEntityName;
9813     function isPropertyName(node) {
9814         var kind = node.kind;
9815         return kind === 79
9816             || kind === 80
9817             || kind === 10
9818             || kind === 8
9819             || kind === 161;
9820     }
9821     ts.isPropertyName = isPropertyName;
9822     function isBindingName(node) {
9823         var kind = node.kind;
9824         return kind === 79
9825             || kind === 200
9826             || kind === 201;
9827     }
9828     ts.isBindingName = isBindingName;
9829     function isFunctionLike(node) {
9830         return !!node && isFunctionLikeKind(node.kind);
9831     }
9832     ts.isFunctionLike = isFunctionLike;
9833     function isFunctionLikeOrClassStaticBlockDeclaration(node) {
9834         return !!node && (isFunctionLikeKind(node.kind) || ts.isClassStaticBlockDeclaration(node));
9835     }
9836     ts.isFunctionLikeOrClassStaticBlockDeclaration = isFunctionLikeOrClassStaticBlockDeclaration;
9837     function isFunctionLikeDeclaration(node) {
9838         return node && isFunctionLikeDeclarationKind(node.kind);
9839     }
9840     ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
9841     function isBooleanLiteral(node) {
9842         return node.kind === 110 || node.kind === 95;
9843     }
9844     ts.isBooleanLiteral = isBooleanLiteral;
9845     function isFunctionLikeDeclarationKind(kind) {
9846         switch (kind) {
9847             case 255:
9848             case 168:
9849             case 170:
9850             case 171:
9851             case 172:
9852             case 212:
9853             case 213:
9854                 return true;
9855             default:
9856                 return false;
9857         }
9858     }
9859     function isFunctionLikeKind(kind) {
9860         switch (kind) {
9861             case 167:
9862             case 173:
9863             case 321:
9864             case 174:
9865             case 175:
9866             case 178:
9867             case 315:
9868             case 179:
9869                 return true;
9870             default:
9871                 return isFunctionLikeDeclarationKind(kind);
9872         }
9873     }
9874     ts.isFunctionLikeKind = isFunctionLikeKind;
9875     function isFunctionOrModuleBlock(node) {
9876         return ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isBlock(node) && isFunctionLike(node.parent);
9877     }
9878     ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock;
9879     function isClassElement(node) {
9880         var kind = node.kind;
9881         return kind === 170
9882             || kind === 166
9883             || kind === 168
9884             || kind === 171
9885             || kind === 172
9886             || kind === 175
9887             || kind === 169
9888             || kind === 233;
9889     }
9890     ts.isClassElement = isClassElement;
9891     function isClassLike(node) {
9892         return node && (node.kind === 256 || node.kind === 225);
9893     }
9894     ts.isClassLike = isClassLike;
9895     function isAccessor(node) {
9896         return node && (node.kind === 171 || node.kind === 172);
9897     }
9898     ts.isAccessor = isAccessor;
9899     function isMethodOrAccessor(node) {
9900         switch (node.kind) {
9901             case 168:
9902             case 171:
9903             case 172:
9904                 return true;
9905             default:
9906                 return false;
9907         }
9908     }
9909     ts.isMethodOrAccessor = isMethodOrAccessor;
9910     function isTypeElement(node) {
9911         var kind = node.kind;
9912         return kind === 174
9913             || kind === 173
9914             || kind === 165
9915             || kind === 167
9916             || kind === 175;
9917     }
9918     ts.isTypeElement = isTypeElement;
9919     function isClassOrTypeElement(node) {
9920         return isTypeElement(node) || isClassElement(node);
9921     }
9922     ts.isClassOrTypeElement = isClassOrTypeElement;
9923     function isObjectLiteralElementLike(node) {
9924         var kind = node.kind;
9925         return kind === 294
9926             || kind === 295
9927             || kind === 296
9928             || kind === 168
9929             || kind === 171
9930             || kind === 172;
9931     }
9932     ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
9933     function isTypeNode(node) {
9934         return ts.isTypeNodeKind(node.kind);
9935     }
9936     ts.isTypeNode = isTypeNode;
9937     function isFunctionOrConstructorTypeNode(node) {
9938         switch (node.kind) {
9939             case 178:
9940             case 179:
9941                 return true;
9942         }
9943         return false;
9944     }
9945     ts.isFunctionOrConstructorTypeNode = isFunctionOrConstructorTypeNode;
9946     function isBindingPattern(node) {
9947         if (node) {
9948             var kind = node.kind;
9949             return kind === 201
9950                 || kind === 200;
9951         }
9952         return false;
9953     }
9954     ts.isBindingPattern = isBindingPattern;
9955     function isAssignmentPattern(node) {
9956         var kind = node.kind;
9957         return kind === 203
9958             || kind === 204;
9959     }
9960     ts.isAssignmentPattern = isAssignmentPattern;
9961     function isArrayBindingElement(node) {
9962         var kind = node.kind;
9963         return kind === 202
9964             || kind === 226;
9965     }
9966     ts.isArrayBindingElement = isArrayBindingElement;
9967     function isDeclarationBindingElement(bindingElement) {
9968         switch (bindingElement.kind) {
9969             case 253:
9970             case 163:
9971             case 202:
9972                 return true;
9973         }
9974         return false;
9975     }
9976     ts.isDeclarationBindingElement = isDeclarationBindingElement;
9977     function isBindingOrAssignmentPattern(node) {
9978         return isObjectBindingOrAssignmentPattern(node)
9979             || isArrayBindingOrAssignmentPattern(node);
9980     }
9981     ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
9982     function isObjectBindingOrAssignmentPattern(node) {
9983         switch (node.kind) {
9984             case 200:
9985             case 204:
9986                 return true;
9987         }
9988         return false;
9989     }
9990     ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
9991     function isObjectBindingOrAssignmentElement(node) {
9992         switch (node.kind) {
9993             case 202:
9994             case 294:
9995             case 295:
9996             case 296:
9997                 return true;
9998         }
9999         return false;
10000     }
10001     ts.isObjectBindingOrAssignmentElement = isObjectBindingOrAssignmentElement;
10002     function isArrayBindingOrAssignmentPattern(node) {
10003         switch (node.kind) {
10004             case 201:
10005             case 203:
10006                 return true;
10007         }
10008         return false;
10009     }
10010     ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
10011     function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
10012         var kind = node.kind;
10013         return kind === 205
10014             || kind === 160
10015             || kind === 199;
10016     }
10017     ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
10018     function isPropertyAccessOrQualifiedName(node) {
10019         var kind = node.kind;
10020         return kind === 205
10021             || kind === 160;
10022     }
10023     ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
10024     function isCallLikeExpression(node) {
10025         switch (node.kind) {
10026             case 279:
10027             case 278:
10028             case 207:
10029             case 208:
10030             case 209:
10031             case 164:
10032                 return true;
10033             default:
10034                 return false;
10035         }
10036     }
10037     ts.isCallLikeExpression = isCallLikeExpression;
10038     function isCallOrNewExpression(node) {
10039         return node.kind === 207 || node.kind === 208;
10040     }
10041     ts.isCallOrNewExpression = isCallOrNewExpression;
10042     function isTemplateLiteral(node) {
10043         var kind = node.kind;
10044         return kind === 222
10045             || kind === 14;
10046     }
10047     ts.isTemplateLiteral = isTemplateLiteral;
10048     function isLeftHandSideExpression(node) {
10049         return isLeftHandSideExpressionKind(skipPartiallyEmittedExpressions(node).kind);
10050     }
10051     ts.isLeftHandSideExpression = isLeftHandSideExpression;
10052     function isLeftHandSideExpressionKind(kind) {
10053         switch (kind) {
10054             case 205:
10055             case 206:
10056             case 208:
10057             case 207:
10058             case 277:
10059             case 278:
10060             case 281:
10061             case 209:
10062             case 203:
10063             case 211:
10064             case 204:
10065             case 225:
10066             case 212:
10067             case 79:
10068             case 80:
10069             case 13:
10070             case 8:
10071             case 9:
10072             case 10:
10073             case 14:
10074             case 222:
10075             case 95:
10076             case 104:
10077             case 108:
10078             case 110:
10079             case 106:
10080             case 229:
10081             case 230:
10082             case 100:
10083                 return true;
10084             default:
10085                 return false;
10086         }
10087     }
10088     function isUnaryExpression(node) {
10089         return isUnaryExpressionKind(skipPartiallyEmittedExpressions(node).kind);
10090     }
10091     ts.isUnaryExpression = isUnaryExpression;
10092     function isUnaryExpressionKind(kind) {
10093         switch (kind) {
10094             case 218:
10095             case 219:
10096             case 214:
10097             case 215:
10098             case 216:
10099             case 217:
10100             case 210:
10101                 return true;
10102             default:
10103                 return isLeftHandSideExpressionKind(kind);
10104         }
10105     }
10106     function isUnaryExpressionWithWrite(expr) {
10107         switch (expr.kind) {
10108             case 219:
10109                 return true;
10110             case 218:
10111                 return expr.operator === 45 ||
10112                     expr.operator === 46;
10113             default:
10114                 return false;
10115         }
10116     }
10117     ts.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite;
10118     function isExpression(node) {
10119         return isExpressionKind(skipPartiallyEmittedExpressions(node).kind);
10120     }
10121     ts.isExpression = isExpression;
10122     function isExpressionKind(kind) {
10123         switch (kind) {
10124             case 221:
10125             case 223:
10126             case 213:
10127             case 220:
10128             case 224:
10129             case 228:
10130             case 226:
10131             case 349:
10132             case 348:
10133                 return true;
10134             default:
10135                 return isUnaryExpressionKind(kind);
10136         }
10137     }
10138     function isAssertionExpression(node) {
10139         var kind = node.kind;
10140         return kind === 210
10141             || kind === 228;
10142     }
10143     ts.isAssertionExpression = isAssertionExpression;
10144     function isNotEmittedOrPartiallyEmittedNode(node) {
10145         return ts.isNotEmittedStatement(node)
10146             || ts.isPartiallyEmittedExpression(node);
10147     }
10148     ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
10149     function isIterationStatement(node, lookInLabeledStatements) {
10150         switch (node.kind) {
10151             case 241:
10152             case 242:
10153             case 243:
10154             case 239:
10155             case 240:
10156                 return true;
10157             case 249:
10158                 return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
10159         }
10160         return false;
10161     }
10162     ts.isIterationStatement = isIterationStatement;
10163     function isScopeMarker(node) {
10164         return ts.isExportAssignment(node) || ts.isExportDeclaration(node);
10165     }
10166     ts.isScopeMarker = isScopeMarker;
10167     function hasScopeMarker(statements) {
10168         return ts.some(statements, isScopeMarker);
10169     }
10170     ts.hasScopeMarker = hasScopeMarker;
10171     function needsScopeMarker(result) {
10172         return !ts.isAnyImportOrReExport(result) && !ts.isExportAssignment(result) && !ts.hasSyntacticModifier(result, 1) && !ts.isAmbientModule(result);
10173     }
10174     ts.needsScopeMarker = needsScopeMarker;
10175     function isExternalModuleIndicator(result) {
10176         return ts.isAnyImportOrReExport(result) || ts.isExportAssignment(result) || ts.hasSyntacticModifier(result, 1);
10177     }
10178     ts.isExternalModuleIndicator = isExternalModuleIndicator;
10179     function isForInOrOfStatement(node) {
10180         return node.kind === 242 || node.kind === 243;
10181     }
10182     ts.isForInOrOfStatement = isForInOrOfStatement;
10183     function isConciseBody(node) {
10184         return ts.isBlock(node)
10185             || isExpression(node);
10186     }
10187     ts.isConciseBody = isConciseBody;
10188     function isFunctionBody(node) {
10189         return ts.isBlock(node);
10190     }
10191     ts.isFunctionBody = isFunctionBody;
10192     function isForInitializer(node) {
10193         return ts.isVariableDeclarationList(node)
10194             || isExpression(node);
10195     }
10196     ts.isForInitializer = isForInitializer;
10197     function isModuleBody(node) {
10198         var kind = node.kind;
10199         return kind === 261
10200             || kind === 260
10201             || kind === 79;
10202     }
10203     ts.isModuleBody = isModuleBody;
10204     function isNamespaceBody(node) {
10205         var kind = node.kind;
10206         return kind === 261
10207             || kind === 260;
10208     }
10209     ts.isNamespaceBody = isNamespaceBody;
10210     function isJSDocNamespaceBody(node) {
10211         var kind = node.kind;
10212         return kind === 79
10213             || kind === 260;
10214     }
10215     ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
10216     function isNamedImportBindings(node) {
10217         var kind = node.kind;
10218         return kind === 268
10219             || kind === 267;
10220     }
10221     ts.isNamedImportBindings = isNamedImportBindings;
10222     function isModuleOrEnumDeclaration(node) {
10223         return node.kind === 260 || node.kind === 259;
10224     }
10225     ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
10226     function isDeclarationKind(kind) {
10227         return kind === 213
10228             || kind === 202
10229             || kind === 256
10230             || kind === 225
10231             || kind === 169
10232             || kind === 170
10233             || kind === 259
10234             || kind === 297
10235             || kind === 274
10236             || kind === 255
10237             || kind === 212
10238             || kind === 171
10239             || kind === 266
10240             || kind === 264
10241             || kind === 269
10242             || kind === 257
10243             || kind === 284
10244             || kind === 168
10245             || kind === 167
10246             || kind === 260
10247             || kind === 263
10248             || kind === 267
10249             || kind === 273
10250             || kind === 163
10251             || kind === 294
10252             || kind === 166
10253             || kind === 165
10254             || kind === 172
10255             || kind === 295
10256             || kind === 258
10257             || kind === 162
10258             || kind === 253
10259             || kind === 343
10260             || kind === 336
10261             || kind === 345;
10262     }
10263     function isDeclarationStatementKind(kind) {
10264         return kind === 255
10265             || kind === 275
10266             || kind === 256
10267             || kind === 257
10268             || kind === 258
10269             || kind === 259
10270             || kind === 260
10271             || kind === 265
10272             || kind === 264
10273             || kind === 271
10274             || kind === 270
10275             || kind === 263;
10276     }
10277     function isStatementKindButNotDeclarationKind(kind) {
10278         return kind === 245
10279             || kind === 244
10280             || kind === 252
10281             || kind === 239
10282             || kind === 237
10283             || kind === 235
10284             || kind === 242
10285             || kind === 243
10286             || kind === 241
10287             || kind === 238
10288             || kind === 249
10289             || kind === 246
10290             || kind === 248
10291             || kind === 250
10292             || kind === 251
10293             || kind === 236
10294             || kind === 240
10295             || kind === 247
10296             || kind === 347
10297             || kind === 351
10298             || kind === 350;
10299     }
10300     function isDeclaration(node) {
10301         if (node.kind === 162) {
10302             return (node.parent && node.parent.kind !== 342) || ts.isInJSFile(node);
10303         }
10304         return isDeclarationKind(node.kind);
10305     }
10306     ts.isDeclaration = isDeclaration;
10307     function isDeclarationStatement(node) {
10308         return isDeclarationStatementKind(node.kind);
10309     }
10310     ts.isDeclarationStatement = isDeclarationStatement;
10311     function isStatementButNotDeclaration(node) {
10312         return isStatementKindButNotDeclarationKind(node.kind);
10313     }
10314     ts.isStatementButNotDeclaration = isStatementButNotDeclaration;
10315     function isStatement(node) {
10316         var kind = node.kind;
10317         return isStatementKindButNotDeclarationKind(kind)
10318             || isDeclarationStatementKind(kind)
10319             || isBlockStatement(node);
10320     }
10321     ts.isStatement = isStatement;
10322     function isBlockStatement(node) {
10323         if (node.kind !== 234)
10324             return false;
10325         if (node.parent !== undefined) {
10326             if (node.parent.kind === 251 || node.parent.kind === 291) {
10327                 return false;
10328             }
10329         }
10330         return !ts.isFunctionBlock(node);
10331     }
10332     function isStatementOrBlock(node) {
10333         var kind = node.kind;
10334         return isStatementKindButNotDeclarationKind(kind)
10335             || isDeclarationStatementKind(kind)
10336             || kind === 234;
10337     }
10338     ts.isStatementOrBlock = isStatementOrBlock;
10339     function isModuleReference(node) {
10340         var kind = node.kind;
10341         return kind === 276
10342             || kind === 160
10343             || kind === 79;
10344     }
10345     ts.isModuleReference = isModuleReference;
10346     function isJsxTagNameExpression(node) {
10347         var kind = node.kind;
10348         return kind === 108
10349             || kind === 79
10350             || kind === 205;
10351     }
10352     ts.isJsxTagNameExpression = isJsxTagNameExpression;
10353     function isJsxChild(node) {
10354         var kind = node.kind;
10355         return kind === 277
10356             || kind === 287
10357             || kind === 278
10358             || kind === 11
10359             || kind === 281;
10360     }
10361     ts.isJsxChild = isJsxChild;
10362     function isJsxAttributeLike(node) {
10363         var kind = node.kind;
10364         return kind === 284
10365             || kind === 286;
10366     }
10367     ts.isJsxAttributeLike = isJsxAttributeLike;
10368     function isStringLiteralOrJsxExpression(node) {
10369         var kind = node.kind;
10370         return kind === 10
10371             || kind === 287;
10372     }
10373     ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
10374     function isJsxOpeningLikeElement(node) {
10375         var kind = node.kind;
10376         return kind === 279
10377             || kind === 278;
10378     }
10379     ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
10380     function isCaseOrDefaultClause(node) {
10381         var kind = node.kind;
10382         return kind === 288
10383             || kind === 289;
10384     }
10385     ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
10386     function isJSDocNode(node) {
10387         return node.kind >= 307 && node.kind <= 345;
10388     }
10389     ts.isJSDocNode = isJSDocNode;
10390     function isJSDocCommentContainingNode(node) {
10391         return node.kind === 318
10392             || node.kind === 317
10393             || node.kind === 319
10394             || isJSDocLinkLike(node)
10395             || isJSDocTag(node)
10396             || ts.isJSDocTypeLiteral(node)
10397             || ts.isJSDocSignature(node);
10398     }
10399     ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
10400     function isJSDocTag(node) {
10401         return node.kind >= 325 && node.kind <= 345;
10402     }
10403     ts.isJSDocTag = isJSDocTag;
10404     function isSetAccessor(node) {
10405         return node.kind === 172;
10406     }
10407     ts.isSetAccessor = isSetAccessor;
10408     function isGetAccessor(node) {
10409         return node.kind === 171;
10410     }
10411     ts.isGetAccessor = isGetAccessor;
10412     function hasJSDocNodes(node) {
10413         var jsDoc = node.jsDoc;
10414         return !!jsDoc && jsDoc.length > 0;
10415     }
10416     ts.hasJSDocNodes = hasJSDocNodes;
10417     function hasType(node) {
10418         return !!node.type;
10419     }
10420     ts.hasType = hasType;
10421     function hasInitializer(node) {
10422         return !!node.initializer;
10423     }
10424     ts.hasInitializer = hasInitializer;
10425     function hasOnlyExpressionInitializer(node) {
10426         switch (node.kind) {
10427             case 253:
10428             case 163:
10429             case 202:
10430             case 165:
10431             case 166:
10432             case 294:
10433             case 297:
10434                 return true;
10435             default:
10436                 return false;
10437         }
10438     }
10439     ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
10440     function isObjectLiteralElement(node) {
10441         return node.kind === 284 || node.kind === 286 || isObjectLiteralElementLike(node);
10442     }
10443     ts.isObjectLiteralElement = isObjectLiteralElement;
10444     function isTypeReferenceType(node) {
10445         return node.kind === 177 || node.kind === 227;
10446     }
10447     ts.isTypeReferenceType = isTypeReferenceType;
10448     var MAX_SMI_X86 = 1073741823;
10449     function guessIndentation(lines) {
10450         var indentation = MAX_SMI_X86;
10451         for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
10452             var line = lines_1[_i];
10453             if (!line.length) {
10454                 continue;
10455             }
10456             var i = 0;
10457             for (; i < line.length && i < indentation; i++) {
10458                 if (!ts.isWhiteSpaceLike(line.charCodeAt(i))) {
10459                     break;
10460                 }
10461             }
10462             if (i < indentation) {
10463                 indentation = i;
10464             }
10465             if (indentation === 0) {
10466                 return 0;
10467             }
10468         }
10469         return indentation === MAX_SMI_X86 ? undefined : indentation;
10470     }
10471     ts.guessIndentation = guessIndentation;
10472     function isStringLiteralLike(node) {
10473         return node.kind === 10 || node.kind === 14;
10474     }
10475     ts.isStringLiteralLike = isStringLiteralLike;
10476     function isJSDocLinkLike(node) {
10477         return node.kind === 322 || node.kind === 323 || node.kind === 324;
10478     }
10479     ts.isJSDocLinkLike = isJSDocLinkLike;
10480 })(ts || (ts = {}));
10481 var ts;
10482 (function (ts) {
10483     ts.resolvingEmptyArray = [];
10484     ts.externalHelpersModuleNameText = "tslib";
10485     ts.defaultMaximumTruncationLength = 160;
10486     ts.noTruncationMaximumTruncationLength = 1000000;
10487     function getDeclarationOfKind(symbol, kind) {
10488         var declarations = symbol.declarations;
10489         if (declarations) {
10490             for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
10491                 var declaration = declarations_1[_i];
10492                 if (declaration.kind === kind) {
10493                     return declaration;
10494                 }
10495             }
10496         }
10497         return undefined;
10498     }
10499     ts.getDeclarationOfKind = getDeclarationOfKind;
10500     function createUnderscoreEscapedMap() {
10501         return new ts.Map();
10502     }
10503     ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
10504     function hasEntries(map) {
10505         return !!map && !!map.size;
10506     }
10507     ts.hasEntries = hasEntries;
10508     function createSymbolTable(symbols) {
10509         var result = new ts.Map();
10510         if (symbols) {
10511             for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
10512                 var symbol = symbols_1[_i];
10513                 result.set(symbol.escapedName, symbol);
10514             }
10515         }
10516         return result;
10517     }
10518     ts.createSymbolTable = createSymbolTable;
10519     function isTransientSymbol(symbol) {
10520         return (symbol.flags & 33554432) !== 0;
10521     }
10522     ts.isTransientSymbol = isTransientSymbol;
10523     var stringWriter = createSingleLineStringWriter();
10524     function createSingleLineStringWriter() {
10525         var str = "";
10526         var writeText = function (text) { return str += text; };
10527         return {
10528             getText: function () { return str; },
10529             write: writeText,
10530             rawWrite: writeText,
10531             writeKeyword: writeText,
10532             writeOperator: writeText,
10533             writePunctuation: writeText,
10534             writeSpace: writeText,
10535             writeStringLiteral: writeText,
10536             writeLiteral: writeText,
10537             writeParameter: writeText,
10538             writeProperty: writeText,
10539             writeSymbol: function (s, _) { return writeText(s); },
10540             writeTrailingSemicolon: writeText,
10541             writeComment: writeText,
10542             getTextPos: function () { return str.length; },
10543             getLine: function () { return 0; },
10544             getColumn: function () { return 0; },
10545             getIndent: function () { return 0; },
10546             isAtStartOfLine: function () { return false; },
10547             hasTrailingComment: function () { return false; },
10548             hasTrailingWhitespace: function () { return !!str.length && ts.isWhiteSpaceLike(str.charCodeAt(str.length - 1)); },
10549             writeLine: function () { return str += " "; },
10550             increaseIndent: ts.noop,
10551             decreaseIndent: ts.noop,
10552             clear: function () { return str = ""; },
10553             trackSymbol: function () { return false; },
10554             reportInaccessibleThisError: ts.noop,
10555             reportInaccessibleUniqueSymbolError: ts.noop,
10556             reportPrivateInBaseOfClassExpression: ts.noop,
10557         };
10558     }
10559     function changesAffectModuleResolution(oldOptions, newOptions) {
10560         return oldOptions.configFilePath !== newOptions.configFilePath ||
10561             optionsHaveModuleResolutionChanges(oldOptions, newOptions);
10562     }
10563     ts.changesAffectModuleResolution = changesAffectModuleResolution;
10564     function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
10565         return optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
10566     }
10567     ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
10568     function changesAffectingProgramStructure(oldOptions, newOptions) {
10569         return optionsHaveChanges(oldOptions, newOptions, ts.optionsAffectingProgramStructure);
10570     }
10571     ts.changesAffectingProgramStructure = changesAffectingProgramStructure;
10572     function optionsHaveChanges(oldOptions, newOptions, optionDeclarations) {
10573         return oldOptions !== newOptions && optionDeclarations.some(function (o) {
10574             return !isJsonEqual(getCompilerOptionValue(oldOptions, o), getCompilerOptionValue(newOptions, o));
10575         });
10576     }
10577     ts.optionsHaveChanges = optionsHaveChanges;
10578     function forEachAncestor(node, callback) {
10579         while (true) {
10580             var res = callback(node);
10581             if (res === "quit")
10582                 return undefined;
10583             if (res !== undefined)
10584                 return res;
10585             if (ts.isSourceFile(node))
10586                 return undefined;
10587             node = node.parent;
10588         }
10589     }
10590     ts.forEachAncestor = forEachAncestor;
10591     function forEachEntry(map, callback) {
10592         var iterator = map.entries();
10593         for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
10594             var _a = iterResult.value, key = _a[0], value = _a[1];
10595             var result = callback(value, key);
10596             if (result) {
10597                 return result;
10598             }
10599         }
10600         return undefined;
10601     }
10602     ts.forEachEntry = forEachEntry;
10603     function forEachKey(map, callback) {
10604         var iterator = map.keys();
10605         for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
10606             var result = callback(iterResult.value);
10607             if (result) {
10608                 return result;
10609             }
10610         }
10611         return undefined;
10612     }
10613     ts.forEachKey = forEachKey;
10614     function copyEntries(source, target) {
10615         source.forEach(function (value, key) {
10616             target.set(key, value);
10617         });
10618     }
10619     ts.copyEntries = copyEntries;
10620     function usingSingleLineStringWriter(action) {
10621         var oldString = stringWriter.getText();
10622         try {
10623             action(stringWriter);
10624             return stringWriter.getText();
10625         }
10626         finally {
10627             stringWriter.clear();
10628             stringWriter.writeKeyword(oldString);
10629         }
10630     }
10631     ts.usingSingleLineStringWriter = usingSingleLineStringWriter;
10632     function getFullWidth(node) {
10633         return node.end - node.pos;
10634     }
10635     ts.getFullWidth = getFullWidth;
10636     function getResolvedModule(sourceFile, moduleNameText, mode) {
10637         return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
10638     }
10639     ts.getResolvedModule = getResolvedModule;
10640     function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
10641         if (!sourceFile.resolvedModules) {
10642             sourceFile.resolvedModules = ts.createModeAwareCache();
10643         }
10644         sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
10645     }
10646     ts.setResolvedModule = setResolvedModule;
10647     function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
10648         if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
10649             sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
10650         }
10651         sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, undefined, resolvedTypeReferenceDirective);
10652     }
10653     ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
10654     function projectReferenceIsEqualTo(oldRef, newRef) {
10655         return oldRef.path === newRef.path &&
10656             !oldRef.prepend === !newRef.prepend &&
10657             !oldRef.circular === !newRef.circular;
10658     }
10659     ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
10660     function moduleResolutionIsEqualTo(oldResolution, newResolution) {
10661         return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
10662             oldResolution.extension === newResolution.extension &&
10663             oldResolution.resolvedFileName === newResolution.resolvedFileName &&
10664             oldResolution.originalPath === newResolution.originalPath &&
10665             packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
10666     }
10667     ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
10668     function packageIdIsEqual(a, b) {
10669         return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
10670     }
10671     function packageIdToString(_a) {
10672         var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
10673         var fullName = subModuleName ? "".concat(name, "/").concat(subModuleName) : name;
10674         return "".concat(fullName, "@").concat(version);
10675     }
10676     ts.packageIdToString = packageIdToString;
10677     function typeDirectiveIsEqualTo(oldResolution, newResolution) {
10678         return oldResolution.resolvedFileName === newResolution.resolvedFileName
10679             && oldResolution.primary === newResolution.primary
10680             && oldResolution.originalPath === newResolution.originalPath;
10681     }
10682     ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
10683     function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
10684         ts.Debug.assert(names.length === newResolutions.length);
10685         for (var i = 0; i < names.length; i++) {
10686             var newResolution = newResolutions[i];
10687             var oldResolution = oldResolutions && oldResolutions.get(names[i], oldSourceFile && ts.getModeForResolutionAtIndex(oldSourceFile, i));
10688             var changed = oldResolution
10689                 ? !newResolution || !comparer(oldResolution, newResolution)
10690                 : newResolution;
10691             if (changed) {
10692                 return true;
10693             }
10694         }
10695         return false;
10696     }
10697     ts.hasChangesInResolutions = hasChangesInResolutions;
10698     function containsParseError(node) {
10699         aggregateChildData(node);
10700         return (node.flags & 262144) !== 0;
10701     }
10702     ts.containsParseError = containsParseError;
10703     function aggregateChildData(node) {
10704         if (!(node.flags & 524288)) {
10705             var thisNodeOrAnySubNodesHasError = ((node.flags & 65536) !== 0) ||
10706                 ts.forEachChild(node, containsParseError);
10707             if (thisNodeOrAnySubNodesHasError) {
10708                 node.flags |= 262144;
10709             }
10710             node.flags |= 524288;
10711         }
10712     }
10713     function getSourceFileOfNode(node) {
10714         while (node && node.kind !== 303) {
10715             node = node.parent;
10716         }
10717         return node;
10718     }
10719     ts.getSourceFileOfNode = getSourceFileOfNode;
10720     function getSourceFileOfModule(module) {
10721         return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
10722     }
10723     ts.getSourceFileOfModule = getSourceFileOfModule;
10724     function isStatementWithLocals(node) {
10725         switch (node.kind) {
10726             case 234:
10727             case 262:
10728             case 241:
10729             case 242:
10730             case 243:
10731                 return true;
10732         }
10733         return false;
10734     }
10735     ts.isStatementWithLocals = isStatementWithLocals;
10736     function getStartPositionOfLine(line, sourceFile) {
10737         ts.Debug.assert(line >= 0);
10738         return ts.getLineStarts(sourceFile)[line];
10739     }
10740     ts.getStartPositionOfLine = getStartPositionOfLine;
10741     function nodePosToString(node) {
10742         var file = getSourceFileOfNode(node);
10743         var loc = ts.getLineAndCharacterOfPosition(file, node.pos);
10744         return "".concat(file.fileName, "(").concat(loc.line + 1, ",").concat(loc.character + 1, ")");
10745     }
10746     ts.nodePosToString = nodePosToString;
10747     function getEndLinePosition(line, sourceFile) {
10748         ts.Debug.assert(line >= 0);
10749         var lineStarts = ts.getLineStarts(sourceFile);
10750         var lineIndex = line;
10751         var sourceText = sourceFile.text;
10752         if (lineIndex + 1 === lineStarts.length) {
10753             return sourceText.length - 1;
10754         }
10755         else {
10756             var start = lineStarts[lineIndex];
10757             var pos = lineStarts[lineIndex + 1] - 1;
10758             ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos)));
10759             while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) {
10760                 pos--;
10761             }
10762             return pos;
10763         }
10764     }
10765     ts.getEndLinePosition = getEndLinePosition;
10766     function isFileLevelUniqueName(sourceFile, name, hasGlobalName) {
10767         return !(hasGlobalName && hasGlobalName(name)) && !sourceFile.identifiers.has(name);
10768     }
10769     ts.isFileLevelUniqueName = isFileLevelUniqueName;
10770     function nodeIsMissing(node) {
10771         if (node === undefined) {
10772             return true;
10773         }
10774         return node.pos === node.end && node.pos >= 0 && node.kind !== 1;
10775     }
10776     ts.nodeIsMissing = nodeIsMissing;
10777     function nodeIsPresent(node) {
10778         return !nodeIsMissing(node);
10779     }
10780     ts.nodeIsPresent = nodeIsPresent;
10781     function insertStatementsAfterPrologue(to, from, isPrologueDirective) {
10782         if (from === undefined || from.length === 0)
10783             return to;
10784         var statementIndex = 0;
10785         for (; statementIndex < to.length; ++statementIndex) {
10786             if (!isPrologueDirective(to[statementIndex])) {
10787                 break;
10788             }
10789         }
10790         to.splice.apply(to, __spreadArray([statementIndex, 0], from, false));
10791         return to;
10792     }
10793     function insertStatementAfterPrologue(to, statement, isPrologueDirective) {
10794         if (statement === undefined)
10795             return to;
10796         var statementIndex = 0;
10797         for (; statementIndex < to.length; ++statementIndex) {
10798             if (!isPrologueDirective(to[statementIndex])) {
10799                 break;
10800             }
10801         }
10802         to.splice(statementIndex, 0, statement);
10803         return to;
10804     }
10805     function isAnyPrologueDirective(node) {
10806         return isPrologueDirective(node) || !!(getEmitFlags(node) & 1048576);
10807     }
10808     function insertStatementsAfterStandardPrologue(to, from) {
10809         return insertStatementsAfterPrologue(to, from, isPrologueDirective);
10810     }
10811     ts.insertStatementsAfterStandardPrologue = insertStatementsAfterStandardPrologue;
10812     function insertStatementsAfterCustomPrologue(to, from) {
10813         return insertStatementsAfterPrologue(to, from, isAnyPrologueDirective);
10814     }
10815     ts.insertStatementsAfterCustomPrologue = insertStatementsAfterCustomPrologue;
10816     function insertStatementAfterStandardPrologue(to, statement) {
10817         return insertStatementAfterPrologue(to, statement, isPrologueDirective);
10818     }
10819     ts.insertStatementAfterStandardPrologue = insertStatementAfterStandardPrologue;
10820     function insertStatementAfterCustomPrologue(to, statement) {
10821         return insertStatementAfterPrologue(to, statement, isAnyPrologueDirective);
10822     }
10823     ts.insertStatementAfterCustomPrologue = insertStatementAfterCustomPrologue;
10824     function isRecognizedTripleSlashComment(text, commentPos, commentEnd) {
10825         if (text.charCodeAt(commentPos + 1) === 47 &&
10826             commentPos + 2 < commentEnd &&
10827             text.charCodeAt(commentPos + 2) === 47) {
10828             var textSubStr = text.substring(commentPos, commentEnd);
10829             return ts.fullTripleSlashReferencePathRegEx.test(textSubStr) ||
10830                 ts.fullTripleSlashAMDReferencePathRegEx.test(textSubStr) ||
10831                 fullTripleSlashReferenceTypeReferenceDirectiveRegEx.test(textSubStr) ||
10832                 defaultLibReferenceRegEx.test(textSubStr) ?
10833                 true : false;
10834         }
10835         return false;
10836     }
10837     ts.isRecognizedTripleSlashComment = isRecognizedTripleSlashComment;
10838     function isPinnedComment(text, start) {
10839         return text.charCodeAt(start + 1) === 42 &&
10840             text.charCodeAt(start + 2) === 33;
10841     }
10842     ts.isPinnedComment = isPinnedComment;
10843     function createCommentDirectivesMap(sourceFile, commentDirectives) {
10844         var directivesByLine = new ts.Map(commentDirectives.map(function (commentDirective) { return ([
10845             "".concat(ts.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line),
10846             commentDirective,
10847         ]); }));
10848         var usedLines = new ts.Map();
10849         return { getUnusedExpectations: getUnusedExpectations, markUsed: markUsed };
10850         function getUnusedExpectations() {
10851             return ts.arrayFrom(directivesByLine.entries())
10852                 .filter(function (_a) {
10853                 var line = _a[0], directive = _a[1];
10854                 return directive.type === 0 && !usedLines.get(line);
10855             })
10856                 .map(function (_a) {
10857                 var _ = _a[0], directive = _a[1];
10858                 return directive;
10859             });
10860         }
10861         function markUsed(line) {
10862             if (!directivesByLine.has("".concat(line))) {
10863                 return false;
10864             }
10865             usedLines.set("".concat(line), true);
10866             return true;
10867         }
10868     }
10869     ts.createCommentDirectivesMap = createCommentDirectivesMap;
10870     function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
10871         if (nodeIsMissing(node)) {
10872             return node.pos;
10873         }
10874         if (ts.isJSDocNode(node) || node.kind === 11) {
10875             return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true);
10876         }
10877         if (includeJsDoc && ts.hasJSDocNodes(node)) {
10878             return getTokenPosOfNode(node.jsDoc[0], sourceFile);
10879         }
10880         if (node.kind === 346 && node._children.length > 0) {
10881             return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
10882         }
10883         return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, false, isInJSDoc(node));
10884     }
10885     ts.getTokenPosOfNode = getTokenPosOfNode;
10886     function getNonDecoratorTokenPosOfNode(node, sourceFile) {
10887         if (nodeIsMissing(node) || !node.decorators) {
10888             return getTokenPosOfNode(node, sourceFile);
10889         }
10890         return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);
10891     }
10892     ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode;
10893     function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) {
10894         if (includeTrivia === void 0) { includeTrivia = false; }
10895         return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia);
10896     }
10897     ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
10898     function isJSDocTypeExpressionOrChild(node) {
10899         return !!ts.findAncestor(node, ts.isJSDocTypeExpression);
10900     }
10901     function isExportNamespaceAsDefaultDeclaration(node) {
10902         return !!(ts.isExportDeclaration(node) && node.exportClause && ts.isNamespaceExport(node.exportClause) && node.exportClause.name.escapedText === "default");
10903     }
10904     ts.isExportNamespaceAsDefaultDeclaration = isExportNamespaceAsDefaultDeclaration;
10905     function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
10906         if (includeTrivia === void 0) { includeTrivia = false; }
10907         if (nodeIsMissing(node)) {
10908             return "";
10909         }
10910         var text = sourceText.substring(includeTrivia ? node.pos : ts.skipTrivia(sourceText, node.pos), node.end);
10911         if (isJSDocTypeExpressionOrChild(node)) {
10912             text = text.split(/\r\n|\n|\r/).map(function (line) { return ts.trimStringStart(line.replace(/^\s*\*/, "")); }).join("\n");
10913         }
10914         return text;
10915     }
10916     ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;
10917     function getTextOfNode(node, includeTrivia) {
10918         if (includeTrivia === void 0) { includeTrivia = false; }
10919         return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia);
10920     }
10921     ts.getTextOfNode = getTextOfNode;
10922     function getPos(range) {
10923         return range.pos;
10924     }
10925     function indexOfNode(nodeArray, node) {
10926         return ts.binarySearch(nodeArray, node, getPos, ts.compareValues);
10927     }
10928     ts.indexOfNode = indexOfNode;
10929     function getEmitFlags(node) {
10930         var emitNode = node.emitNode;
10931         return emitNode && emitNode.flags || 0;
10932     }
10933     ts.getEmitFlags = getEmitFlags;
10934     ;
10935     function getScriptTargetFeatures() {
10936         return {
10937             es2015: {
10938                 Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
10939                 RegExp: ["flags", "sticky", "unicode"],
10940                 Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
10941                 ArrayConstructor: ["from", "of"],
10942                 ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
10943                 NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
10944                 Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
10945                 Map: ["entries", "keys", "values"],
10946                 Set: ["entries", "keys", "values"],
10947                 Promise: ts.emptyArray,
10948                 PromiseConstructor: ["all", "race", "reject", "resolve"],
10949                 Symbol: ["for", "keyFor"],
10950                 WeakMap: ["entries", "keys", "values"],
10951                 WeakSet: ["entries", "keys", "values"],
10952                 Iterator: ts.emptyArray,
10953                 AsyncIterator: ts.emptyArray,
10954                 String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
10955                 StringConstructor: ["fromCodePoint", "raw"]
10956             },
10957             es2016: {
10958                 Array: ["includes"]
10959             },
10960             es2017: {
10961                 Atomics: ts.emptyArray,
10962                 SharedArrayBuffer: ts.emptyArray,
10963                 String: ["padStart", "padEnd"],
10964                 ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
10965                 DateTimeFormat: ["formatToParts"]
10966             },
10967             es2018: {
10968                 Promise: ["finally"],
10969                 RegExpMatchArray: ["groups"],
10970                 RegExpExecArray: ["groups"],
10971                 RegExp: ["dotAll"],
10972                 Intl: ["PluralRules"],
10973                 AsyncIterable: ts.emptyArray,
10974                 AsyncIterableIterator: ts.emptyArray,
10975                 AsyncGenerator: ts.emptyArray,
10976                 AsyncGeneratorFunction: ts.emptyArray,
10977             },
10978             es2019: {
10979                 Array: ["flat", "flatMap"],
10980                 ObjectConstructor: ["fromEntries"],
10981                 String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
10982                 Symbol: ["description"]
10983             },
10984             es2020: {
10985                 BigInt: ts.emptyArray,
10986                 BigInt64Array: ts.emptyArray,
10987                 BigUint64Array: ts.emptyArray,
10988                 PromiseConstructor: ["allSettled"],
10989                 SymbolConstructor: ["matchAll"],
10990                 String: ["matchAll"],
10991                 DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
10992                 RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
10993             },
10994             es2021: {
10995                 PromiseConstructor: ["any"],
10996                 String: ["replaceAll"]
10997             },
10998             esnext: {
10999                 NumberFormat: ["formatToParts"]
11000             }
11001         };
11002     }
11003     ts.getScriptTargetFeatures = getScriptTargetFeatures;
11004     function getLiteralText(node, sourceFile, flags) {
11005         var _a;
11006         if (canUseOriginalText(node, flags)) {
11007             return getSourceTextOfNodeFromSourceFile(sourceFile, node);
11008         }
11009         switch (node.kind) {
11010             case 10: {
11011                 var escapeText = flags & 2 ? escapeJsxAttributeString :
11012                     flags & 1 || (getEmitFlags(node) & 16777216) ? escapeString :
11013                         escapeNonAsciiString;
11014                 if (node.singleQuote) {
11015                     return "'" + escapeText(node.text, 39) + "'";
11016                 }
11017                 else {
11018                     return '"' + escapeText(node.text, 34) + '"';
11019                 }
11020             }
11021             case 14:
11022             case 15:
11023             case 16:
11024             case 17: {
11025                 var escapeText = flags & 1 || (getEmitFlags(node) & 16777216) ? escapeString :
11026                     escapeNonAsciiString;
11027                 var rawText = (_a = node.rawText) !== null && _a !== void 0 ? _a : escapeTemplateSubstitution(escapeText(node.text, 96));
11028                 switch (node.kind) {
11029                     case 14:
11030                         return "`" + rawText + "`";
11031                     case 15:
11032                         return "`" + rawText + "${";
11033                     case 16:
11034                         return "}" + rawText + "${";
11035                     case 17:
11036                         return "}" + rawText + "`";
11037                 }
11038                 break;
11039             }
11040             case 8:
11041             case 9:
11042                 return node.text;
11043             case 13:
11044                 if (flags & 4 && node.isUnterminated) {
11045                     return node.text + (node.text.charCodeAt(node.text.length - 1) === 92 ? " /" : "/");
11046                 }
11047                 return node.text;
11048         }
11049         return ts.Debug.fail("Literal kind '".concat(node.kind, "' not accounted for."));
11050     }
11051     ts.getLiteralText = getLiteralText;
11052     function canUseOriginalText(node, flags) {
11053         if (nodeIsSynthesized(node) || !node.parent || (flags & 4 && node.isUnterminated)) {
11054             return false;
11055         }
11056         if (ts.isNumericLiteral(node) && node.numericLiteralFlags & 512) {
11057             return !!(flags & 8);
11058         }
11059         return !ts.isBigIntLiteral(node);
11060     }
11061     function getTextOfConstantValue(value) {
11062         return ts.isString(value) ? '"' + escapeNonAsciiString(value) + '"' : "" + value;
11063     }
11064     ts.getTextOfConstantValue = getTextOfConstantValue;
11065     function makeIdentifierFromModuleName(moduleName) {
11066         return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
11067     }
11068     ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName;
11069     function isBlockOrCatchScoped(declaration) {
11070         return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 ||
11071             isCatchClauseVariableDeclarationOrBindingElement(declaration);
11072     }
11073     ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
11074     function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
11075         var node = getRootDeclaration(declaration);
11076         return node.kind === 253 && node.parent.kind === 291;
11077     }
11078     ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
11079     function isAmbientModule(node) {
11080         return ts.isModuleDeclaration(node) && (node.name.kind === 10 || isGlobalScopeAugmentation(node));
11081     }
11082     ts.isAmbientModule = isAmbientModule;
11083     function isModuleWithStringLiteralName(node) {
11084         return ts.isModuleDeclaration(node) && node.name.kind === 10;
11085     }
11086     ts.isModuleWithStringLiteralName = isModuleWithStringLiteralName;
11087     function isNonGlobalAmbientModule(node) {
11088         return ts.isModuleDeclaration(node) && ts.isStringLiteral(node.name);
11089     }
11090     ts.isNonGlobalAmbientModule = isNonGlobalAmbientModule;
11091     function isEffectiveModuleDeclaration(node) {
11092         return ts.isModuleDeclaration(node) || ts.isIdentifier(node);
11093     }
11094     ts.isEffectiveModuleDeclaration = isEffectiveModuleDeclaration;
11095     function isShorthandAmbientModuleSymbol(moduleSymbol) {
11096         return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
11097     }
11098     ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
11099     function isShorthandAmbientModule(node) {
11100         return !!node && node.kind === 260 && (!node.body);
11101     }
11102     function isBlockScopedContainerTopLevel(node) {
11103         return node.kind === 303 ||
11104             node.kind === 260 ||
11105             ts.isFunctionLikeOrClassStaticBlockDeclaration(node);
11106     }
11107     ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
11108     function isGlobalScopeAugmentation(module) {
11109         return !!(module.flags & 1024);
11110     }
11111     ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation;
11112     function isExternalModuleAugmentation(node) {
11113         return isAmbientModule(node) && isModuleAugmentationExternal(node);
11114     }
11115     ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
11116     function isModuleAugmentationExternal(node) {
11117         switch (node.parent.kind) {
11118             case 303:
11119                 return ts.isExternalModule(node.parent);
11120             case 261:
11121                 return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
11122         }
11123         return false;
11124     }
11125     ts.isModuleAugmentationExternal = isModuleAugmentationExternal;
11126     function getNonAugmentationDeclaration(symbol) {
11127         var _a;
11128         return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return !isExternalModuleAugmentation(d) && !(ts.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); });
11129     }
11130     ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
11131     function isCommonJSContainingModuleKind(kind) {
11132         return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
11133     }
11134     function isEffectiveExternalModule(node, compilerOptions) {
11135         return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
11136     }
11137     ts.isEffectiveExternalModule = isEffectiveExternalModule;
11138     function isEffectiveStrictModeSourceFile(node, compilerOptions) {
11139         switch (node.scriptKind) {
11140             case 1:
11141             case 3:
11142             case 2:
11143             case 4:
11144                 break;
11145             default:
11146                 return false;
11147         }
11148         if (node.isDeclarationFile) {
11149             return false;
11150         }
11151         if (getStrictOptionValue(compilerOptions, "alwaysStrict")) {
11152             return true;
11153         }
11154         if (ts.startsWithUseStrict(node.statements)) {
11155             return true;
11156         }
11157         if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
11158             if (getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015) {
11159                 return true;
11160             }
11161             return !compilerOptions.noImplicitUseStrict;
11162         }
11163         return false;
11164     }
11165     ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile;
11166     function isBlockScope(node, parentNode) {
11167         switch (node.kind) {
11168             case 303:
11169             case 262:
11170             case 291:
11171             case 260:
11172             case 241:
11173             case 242:
11174             case 243:
11175             case 170:
11176             case 168:
11177             case 171:
11178             case 172:
11179             case 255:
11180             case 212:
11181             case 213:
11182             case 166:
11183             case 169:
11184                 return true;
11185             case 234:
11186                 return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode);
11187         }
11188         return false;
11189     }
11190     ts.isBlockScope = isBlockScope;
11191     function isDeclarationWithTypeParameters(node) {
11192         switch (node.kind) {
11193             case 336:
11194             case 343:
11195             case 321:
11196                 return true;
11197             default:
11198                 ts.assertType(node);
11199                 return isDeclarationWithTypeParameterChildren(node);
11200         }
11201     }
11202     ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
11203     function isDeclarationWithTypeParameterChildren(node) {
11204         switch (node.kind) {
11205             case 173:
11206             case 174:
11207             case 167:
11208             case 175:
11209             case 178:
11210             case 179:
11211             case 315:
11212             case 256:
11213             case 225:
11214             case 257:
11215             case 258:
11216             case 342:
11217             case 255:
11218             case 168:
11219             case 170:
11220             case 171:
11221             case 172:
11222             case 212:
11223             case 213:
11224                 return true;
11225             default:
11226                 ts.assertType(node);
11227                 return false;
11228         }
11229     }
11230     ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
11231     function isAnyImportSyntax(node) {
11232         switch (node.kind) {
11233             case 265:
11234             case 264:
11235                 return true;
11236             default:
11237                 return false;
11238         }
11239     }
11240     ts.isAnyImportSyntax = isAnyImportSyntax;
11241     function isLateVisibilityPaintedStatement(node) {
11242         switch (node.kind) {
11243             case 265:
11244             case 264:
11245             case 236:
11246             case 256:
11247             case 255:
11248             case 260:
11249             case 258:
11250             case 257:
11251             case 259:
11252                 return true;
11253             default:
11254                 return false;
11255         }
11256     }
11257     ts.isLateVisibilityPaintedStatement = isLateVisibilityPaintedStatement;
11258     function hasPossibleExternalModuleReference(node) {
11259         return isAnyImportOrReExport(node) || ts.isModuleDeclaration(node) || ts.isImportTypeNode(node) || isImportCall(node);
11260     }
11261     ts.hasPossibleExternalModuleReference = hasPossibleExternalModuleReference;
11262     function isAnyImportOrReExport(node) {
11263         return isAnyImportSyntax(node) || ts.isExportDeclaration(node);
11264     }
11265     ts.isAnyImportOrReExport = isAnyImportOrReExport;
11266     function getEnclosingBlockScopeContainer(node) {
11267         return ts.findAncestor(node.parent, function (current) { return isBlockScope(current, current.parent); });
11268     }
11269     ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer;
11270     function forEachEnclosingBlockScopeContainer(node, cb) {
11271         var container = getEnclosingBlockScopeContainer(node);
11272         while (container) {
11273             cb(container);
11274             container = getEnclosingBlockScopeContainer(container);
11275         }
11276     }
11277     ts.forEachEnclosingBlockScopeContainer = forEachEnclosingBlockScopeContainer;
11278     function declarationNameToString(name) {
11279         return !name || getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
11280     }
11281     ts.declarationNameToString = declarationNameToString;
11282     function getNameFromIndexInfo(info) {
11283         return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined;
11284     }
11285     ts.getNameFromIndexInfo = getNameFromIndexInfo;
11286     function isComputedNonLiteralName(name) {
11287         return name.kind === 161 && !isStringOrNumericLiteralLike(name.expression);
11288     }
11289     ts.isComputedNonLiteralName = isComputedNonLiteralName;
11290     function getTextOfPropertyName(name) {
11291         switch (name.kind) {
11292             case 79:
11293             case 80:
11294                 return name.escapedText;
11295             case 10:
11296             case 8:
11297             case 14:
11298                 return ts.escapeLeadingUnderscores(name.text);
11299             case 161:
11300                 if (isStringOrNumericLiteralLike(name.expression))
11301                     return ts.escapeLeadingUnderscores(name.expression.text);
11302                 return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
11303             default:
11304                 return ts.Debug.assertNever(name);
11305         }
11306     }
11307     ts.getTextOfPropertyName = getTextOfPropertyName;
11308     function entityNameToString(name) {
11309         switch (name.kind) {
11310             case 108:
11311                 return "this";
11312             case 80:
11313             case 79:
11314                 return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
11315             case 160:
11316                 return entityNameToString(name.left) + "." + entityNameToString(name.right);
11317             case 205:
11318                 if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) {
11319                     return entityNameToString(name.expression) + "." + entityNameToString(name.name);
11320                 }
11321                 else {
11322                     return ts.Debug.assertNever(name.name);
11323                 }
11324             case 309:
11325                 return entityNameToString(name.left) + entityNameToString(name.right);
11326             default:
11327                 return ts.Debug.assertNever(name);
11328         }
11329     }
11330     ts.entityNameToString = entityNameToString;
11331     function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) {
11332         var sourceFile = getSourceFileOfNode(node);
11333         return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3);
11334     }
11335     ts.createDiagnosticForNode = createDiagnosticForNode;
11336     function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) {
11337         var start = ts.skipTrivia(sourceFile.text, nodes.pos);
11338         return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3);
11339     }
11340     ts.createDiagnosticForNodeArray = createDiagnosticForNodeArray;
11341     function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) {
11342         var span = getErrorSpanForNode(sourceFile, node);
11343         return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
11344     }
11345     ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile;
11346     function createDiagnosticForNodeFromMessageChain(node, messageChain, relatedInformation) {
11347         var sourceFile = getSourceFileOfNode(node);
11348         var span = getErrorSpanForNode(sourceFile, node);
11349         return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation);
11350     }
11351     ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
11352     function assertDiagnosticLocation(file, start, length) {
11353         ts.Debug.assertGreaterThanOrEqual(start, 0);
11354         ts.Debug.assertGreaterThanOrEqual(length, 0);
11355         if (file) {
11356             ts.Debug.assertLessThanOrEqual(start, file.text.length);
11357             ts.Debug.assertLessThanOrEqual(start + length, file.text.length);
11358         }
11359     }
11360     function createFileDiagnosticFromMessageChain(file, start, length, messageChain, relatedInformation) {
11361         assertDiagnosticLocation(file, start, length);
11362         return {
11363             file: file,
11364             start: start,
11365             length: length,
11366             code: messageChain.code,
11367             category: messageChain.category,
11368             messageText: messageChain.next ? messageChain : messageChain.messageText,
11369             relatedInformation: relatedInformation
11370         };
11371     }
11372     ts.createFileDiagnosticFromMessageChain = createFileDiagnosticFromMessageChain;
11373     function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
11374         return {
11375             file: sourceFile,
11376             start: 0,
11377             length: 0,
11378             code: messageChain.code,
11379             category: messageChain.category,
11380             messageText: messageChain.next ? messageChain : messageChain.messageText,
11381             relatedInformation: relatedInformation
11382         };
11383     }
11384     ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
11385     function createDiagnosticForRange(sourceFile, range, message) {
11386         return {
11387             file: sourceFile,
11388             start: range.pos,
11389             length: range.end - range.pos,
11390             code: message.code,
11391             category: message.category,
11392             messageText: message.message,
11393         };
11394     }
11395     ts.createDiagnosticForRange = createDiagnosticForRange;
11396     function getSpanOfTokenAtPosition(sourceFile, pos) {
11397         var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos);
11398         scanner.scan();
11399         var start = scanner.getTokenPos();
11400         return ts.createTextSpanFromBounds(start, scanner.getTextPos());
11401     }
11402     ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
11403     function getErrorSpanForArrowFunction(sourceFile, node) {
11404         var pos = ts.skipTrivia(sourceFile.text, node.pos);
11405         if (node.body && node.body.kind === 234) {
11406             var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
11407             var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
11408             if (startLine < endLine) {
11409                 return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
11410             }
11411         }
11412         return ts.createTextSpanFromBounds(pos, node.end);
11413     }
11414     function getErrorSpanForNode(sourceFile, node) {
11415         var errorNode = node;
11416         switch (node.kind) {
11417             case 303:
11418                 var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);
11419                 if (pos_1 === sourceFile.text.length) {
11420                     return ts.createTextSpan(0, 0);
11421                 }
11422                 return getSpanOfTokenAtPosition(sourceFile, pos_1);
11423             case 253:
11424             case 202:
11425             case 256:
11426             case 225:
11427             case 257:
11428             case 260:
11429             case 259:
11430             case 297:
11431             case 255:
11432             case 212:
11433             case 168:
11434             case 171:
11435             case 172:
11436             case 258:
11437             case 166:
11438             case 165:
11439             case 267:
11440                 errorNode = node.name;
11441                 break;
11442             case 213:
11443                 return getErrorSpanForArrowFunction(sourceFile, node);
11444             case 288:
11445             case 289:
11446                 var start = ts.skipTrivia(sourceFile.text, node.pos);
11447                 var end = node.statements.length > 0 ? node.statements[0].pos : node.end;
11448                 return ts.createTextSpanFromBounds(start, end);
11449         }
11450         if (errorNode === undefined) {
11451             return getSpanOfTokenAtPosition(sourceFile, node.pos);
11452         }
11453         ts.Debug.assert(!ts.isJSDoc(errorNode));
11454         var isMissing = nodeIsMissing(errorNode);
11455         var pos = isMissing || ts.isJsxText(node)
11456             ? errorNode.pos
11457             : ts.skipTrivia(sourceFile.text, errorNode.pos);
11458         if (isMissing) {
11459             ts.Debug.assert(pos === errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
11460             ts.Debug.assert(pos === errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
11461         }
11462         else {
11463             ts.Debug.assert(pos >= errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
11464             ts.Debug.assert(pos <= errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
11465         }
11466         return ts.createTextSpanFromBounds(pos, errorNode.end);
11467     }
11468     ts.getErrorSpanForNode = getErrorSpanForNode;
11469     function isExternalOrCommonJsModule(file) {
11470         return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined;
11471     }
11472     ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule;
11473     function isJsonSourceFile(file) {
11474         return file.scriptKind === 6;
11475     }
11476     ts.isJsonSourceFile = isJsonSourceFile;
11477     function isEnumConst(node) {
11478         return !!(ts.getCombinedModifierFlags(node) & 2048);
11479     }
11480     ts.isEnumConst = isEnumConst;
11481     function isDeclarationReadonly(declaration) {
11482         return !!(ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration, declaration.parent));
11483     }
11484     ts.isDeclarationReadonly = isDeclarationReadonly;
11485     function isVarConst(node) {
11486         return !!(ts.getCombinedNodeFlags(node) & 2);
11487     }
11488     ts.isVarConst = isVarConst;
11489     function isLet(node) {
11490         return !!(ts.getCombinedNodeFlags(node) & 1);
11491     }
11492     ts.isLet = isLet;
11493     function isSuperCall(n) {
11494         return n.kind === 207 && n.expression.kind === 106;
11495     }
11496     ts.isSuperCall = isSuperCall;
11497     function isImportCall(n) {
11498         return n.kind === 207 && n.expression.kind === 100;
11499     }
11500     ts.isImportCall = isImportCall;
11501     function isImportMeta(n) {
11502         return ts.isMetaProperty(n)
11503             && n.keywordToken === 100
11504             && n.name.escapedText === "meta";
11505     }
11506     ts.isImportMeta = isImportMeta;
11507     function isLiteralImportTypeNode(n) {
11508         return ts.isImportTypeNode(n) && ts.isLiteralTypeNode(n.argument) && ts.isStringLiteral(n.argument.literal);
11509     }
11510     ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
11511     function isPrologueDirective(node) {
11512         return node.kind === 237
11513             && node.expression.kind === 10;
11514     }
11515     ts.isPrologueDirective = isPrologueDirective;
11516     function isCustomPrologue(node) {
11517         return !!(getEmitFlags(node) & 1048576);
11518     }
11519     ts.isCustomPrologue = isCustomPrologue;
11520     function isHoistedFunction(node) {
11521         return isCustomPrologue(node)
11522             && ts.isFunctionDeclaration(node);
11523     }
11524     ts.isHoistedFunction = isHoistedFunction;
11525     function isHoistedVariable(node) {
11526         return ts.isIdentifier(node.name)
11527             && !node.initializer;
11528     }
11529     function isHoistedVariableStatement(node) {
11530         return isCustomPrologue(node)
11531             && ts.isVariableStatement(node)
11532             && ts.every(node.declarationList.declarations, isHoistedVariable);
11533     }
11534     ts.isHoistedVariableStatement = isHoistedVariableStatement;
11535     function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
11536         return node.kind !== 11 ? ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
11537     }
11538     ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
11539     function getJSDocCommentRanges(node, text) {
11540         var commentRanges = (node.kind === 163 ||
11541             node.kind === 162 ||
11542             node.kind === 212 ||
11543             node.kind === 213 ||
11544             node.kind === 211 ||
11545             node.kind === 253) ?
11546             ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
11547             ts.getLeadingCommentRanges(text, node.pos);
11548         return ts.filter(commentRanges, function (comment) {
11549             return text.charCodeAt(comment.pos + 1) === 42 &&
11550                 text.charCodeAt(comment.pos + 2) === 42 &&
11551                 text.charCodeAt(comment.pos + 3) !== 47;
11552         });
11553     }
11554     ts.getJSDocCommentRanges = getJSDocCommentRanges;
11555     ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
11556     var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
11557     ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
11558     var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)(('[^']*')|("[^"]*"))\s*\/>/;
11559     function isPartOfTypeNode(node) {
11560         if (176 <= node.kind && node.kind <= 199) {
11561             return true;
11562         }
11563         switch (node.kind) {
11564             case 130:
11565             case 154:
11566             case 146:
11567             case 157:
11568             case 149:
11569             case 133:
11570             case 150:
11571             case 147:
11572             case 152:
11573             case 143:
11574                 return true;
11575             case 114:
11576                 return node.parent.kind !== 216;
11577             case 227:
11578                 return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
11579             case 162:
11580                 return node.parent.kind === 194 || node.parent.kind === 189;
11581             case 79:
11582                 if (node.parent.kind === 160 && node.parent.right === node) {
11583                     node = node.parent;
11584                 }
11585                 else if (node.parent.kind === 205 && node.parent.name === node) {
11586                     node = node.parent;
11587                 }
11588                 ts.Debug.assert(node.kind === 79 || node.kind === 160 || node.kind === 205, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
11589             case 160:
11590             case 205:
11591             case 108: {
11592                 var parent = node.parent;
11593                 if (parent.kind === 180) {
11594                     return false;
11595                 }
11596                 if (parent.kind === 199) {
11597                     return !parent.isTypeOf;
11598                 }
11599                 if (176 <= parent.kind && parent.kind <= 199) {
11600                     return true;
11601                 }
11602                 switch (parent.kind) {
11603                     case 227:
11604                         return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
11605                     case 162:
11606                         return node === parent.constraint;
11607                     case 342:
11608                         return node === parent.constraint;
11609                     case 166:
11610                     case 165:
11611                     case 163:
11612                     case 253:
11613                         return node === parent.type;
11614                     case 255:
11615                     case 212:
11616                     case 213:
11617                     case 170:
11618                     case 168:
11619                     case 167:
11620                     case 171:
11621                     case 172:
11622                         return node === parent.type;
11623                     case 173:
11624                     case 174:
11625                     case 175:
11626                         return node === parent.type;
11627                     case 210:
11628                         return node === parent.type;
11629                     case 207:
11630                     case 208:
11631                         return ts.contains(parent.typeArguments, node);
11632                     case 209:
11633                         return false;
11634                 }
11635             }
11636         }
11637         return false;
11638     }
11639     ts.isPartOfTypeNode = isPartOfTypeNode;
11640     function isChildOfNodeWithKind(node, kind) {
11641         while (node) {
11642             if (node.kind === kind) {
11643                 return true;
11644             }
11645             node = node.parent;
11646         }
11647         return false;
11648     }
11649     ts.isChildOfNodeWithKind = isChildOfNodeWithKind;
11650     function forEachReturnStatement(body, visitor) {
11651         return traverse(body);
11652         function traverse(node) {
11653             switch (node.kind) {
11654                 case 246:
11655                     return visitor(node);
11656                 case 262:
11657                 case 234:
11658                 case 238:
11659                 case 239:
11660                 case 240:
11661                 case 241:
11662                 case 242:
11663                 case 243:
11664                 case 247:
11665                 case 248:
11666                 case 288:
11667                 case 289:
11668                 case 249:
11669                 case 251:
11670                 case 291:
11671                     return ts.forEachChild(node, traverse);
11672             }
11673         }
11674     }
11675     ts.forEachReturnStatement = forEachReturnStatement;
11676     function forEachYieldExpression(body, visitor) {
11677         return traverse(body);
11678         function traverse(node) {
11679             switch (node.kind) {
11680                 case 223:
11681                     visitor(node);
11682                     var operand = node.expression;
11683                     if (operand) {
11684                         traverse(operand);
11685                     }
11686                     return;
11687                 case 259:
11688                 case 257:
11689                 case 260:
11690                 case 258:
11691                     return;
11692                 default:
11693                     if (ts.isFunctionLike(node)) {
11694                         if (node.name && node.name.kind === 161) {
11695                             traverse(node.name.expression);
11696                             return;
11697                         }
11698                     }
11699                     else if (!isPartOfTypeNode(node)) {
11700                         ts.forEachChild(node, traverse);
11701                     }
11702             }
11703         }
11704     }
11705     ts.forEachYieldExpression = forEachYieldExpression;
11706     function getRestParameterElementType(node) {
11707         if (node && node.kind === 182) {
11708             return node.elementType;
11709         }
11710         else if (node && node.kind === 177) {
11711             return ts.singleOrUndefined(node.typeArguments);
11712         }
11713         else {
11714             return undefined;
11715         }
11716     }
11717     ts.getRestParameterElementType = getRestParameterElementType;
11718     function getMembersOfDeclaration(node) {
11719         switch (node.kind) {
11720             case 257:
11721             case 256:
11722             case 225:
11723             case 181:
11724                 return node.members;
11725             case 204:
11726                 return node.properties;
11727         }
11728     }
11729     ts.getMembersOfDeclaration = getMembersOfDeclaration;
11730     function isVariableLike(node) {
11731         if (node) {
11732             switch (node.kind) {
11733                 case 202:
11734                 case 297:
11735                 case 163:
11736                 case 294:
11737                 case 166:
11738                 case 165:
11739                 case 295:
11740                 case 253:
11741                     return true;
11742             }
11743         }
11744         return false;
11745     }
11746     ts.isVariableLike = isVariableLike;
11747     function isVariableLikeOrAccessor(node) {
11748         return isVariableLike(node) || ts.isAccessor(node);
11749     }
11750     ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
11751     function isVariableDeclarationInVariableStatement(node) {
11752         return node.parent.kind === 254
11753             && node.parent.parent.kind === 236;
11754     }
11755     ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
11756     function isValidESSymbolDeclaration(node) {
11757         return ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
11758             ts.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) :
11759                 ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node);
11760     }
11761     ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
11762     function introducesArgumentsExoticObject(node) {
11763         switch (node.kind) {
11764             case 168:
11765             case 167:
11766             case 170:
11767             case 171:
11768             case 172:
11769             case 255:
11770             case 212:
11771                 return true;
11772         }
11773         return false;
11774     }
11775     ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject;
11776     function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) {
11777         while (true) {
11778             if (beforeUnwrapLabelCallback) {
11779                 beforeUnwrapLabelCallback(node);
11780             }
11781             if (node.statement.kind !== 249) {
11782                 return node.statement;
11783             }
11784             node = node.statement;
11785         }
11786     }
11787     ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
11788     function isFunctionBlock(node) {
11789         return node && node.kind === 234 && ts.isFunctionLike(node.parent);
11790     }
11791     ts.isFunctionBlock = isFunctionBlock;
11792     function isObjectLiteralMethod(node) {
11793         return node && node.kind === 168 && node.parent.kind === 204;
11794     }
11795     ts.isObjectLiteralMethod = isObjectLiteralMethod;
11796     function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
11797         return (node.kind === 168 || node.kind === 171 || node.kind === 172) &&
11798             (node.parent.kind === 204 ||
11799                 node.parent.kind === 225);
11800     }
11801     ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor;
11802     function isIdentifierTypePredicate(predicate) {
11803         return predicate && predicate.kind === 1;
11804     }
11805     ts.isIdentifierTypePredicate = isIdentifierTypePredicate;
11806     function isThisTypePredicate(predicate) {
11807         return predicate && predicate.kind === 0;
11808     }
11809     ts.isThisTypePredicate = isThisTypePredicate;
11810     function getPropertyAssignment(objectLiteral, key, key2) {
11811         return objectLiteral.properties.filter(function (property) {
11812             if (property.kind === 294) {
11813                 var propName = getTextOfPropertyName(property.name);
11814                 return key === propName || (!!key2 && key2 === propName);
11815             }
11816             return false;
11817         });
11818     }
11819     ts.getPropertyAssignment = getPropertyAssignment;
11820     function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
11821         return ts.firstDefined(getPropertyAssignment(objectLiteral, propKey), function (property) {
11822             return ts.isArrayLiteralExpression(property.initializer) ?
11823                 ts.find(property.initializer.elements, function (element) { return ts.isStringLiteral(element) && element.text === elementValue; }) :
11824                 undefined;
11825         });
11826     }
11827     ts.getPropertyArrayElementValue = getPropertyArrayElementValue;
11828     function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
11829         if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
11830             var expression = tsConfigSourceFile.statements[0].expression;
11831             return ts.tryCast(expression, ts.isObjectLiteralExpression);
11832         }
11833     }
11834     ts.getTsConfigObjectLiteralExpression = getTsConfigObjectLiteralExpression;
11835     function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) {
11836         return ts.firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), function (property) {
11837             return ts.isArrayLiteralExpression(property.initializer) ?
11838                 ts.find(property.initializer.elements, function (element) { return ts.isStringLiteral(element) && element.text === elementValue; }) :
11839                 undefined;
11840         });
11841     }
11842     ts.getTsConfigPropArrayElementValue = getTsConfigPropArrayElementValue;
11843     function getTsConfigPropArray(tsConfigSourceFile, propKey) {
11844         var jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile);
11845         return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : ts.emptyArray;
11846     }
11847     ts.getTsConfigPropArray = getTsConfigPropArray;
11848     function getContainingFunction(node) {
11849         return ts.findAncestor(node.parent, ts.isFunctionLike);
11850     }
11851     ts.getContainingFunction = getContainingFunction;
11852     function getContainingFunctionDeclaration(node) {
11853         return ts.findAncestor(node.parent, ts.isFunctionLikeDeclaration);
11854     }
11855     ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
11856     function getContainingClass(node) {
11857         return ts.findAncestor(node.parent, ts.isClassLike);
11858     }
11859     ts.getContainingClass = getContainingClass;
11860     function getContainingClassStaticBlock(node) {
11861         return ts.findAncestor(node.parent, function (n) {
11862             if (ts.isClassLike(n) || ts.isFunctionLike(n)) {
11863                 return "quit";
11864             }
11865             return ts.isClassStaticBlockDeclaration(n);
11866         });
11867     }
11868     ts.getContainingClassStaticBlock = getContainingClassStaticBlock;
11869     function getContainingFunctionOrClassStaticBlock(node) {
11870         return ts.findAncestor(node.parent, ts.isFunctionLikeOrClassStaticBlockDeclaration);
11871     }
11872     ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock;
11873     function getThisContainer(node, includeArrowFunctions) {
11874         ts.Debug.assert(node.kind !== 303);
11875         while (true) {
11876             node = node.parent;
11877             if (!node) {
11878                 return ts.Debug.fail();
11879             }
11880             switch (node.kind) {
11881                 case 161:
11882                     if (ts.isClassLike(node.parent.parent)) {
11883                         return node;
11884                     }
11885                     node = node.parent;
11886                     break;
11887                 case 164:
11888                     if (node.parent.kind === 163 && ts.isClassElement(node.parent.parent)) {
11889                         node = node.parent.parent;
11890                     }
11891                     else if (ts.isClassElement(node.parent)) {
11892                         node = node.parent;
11893                     }
11894                     break;
11895                 case 213:
11896                     if (!includeArrowFunctions) {
11897                         continue;
11898                     }
11899                 case 255:
11900                 case 212:
11901                 case 260:
11902                 case 169:
11903                 case 166:
11904                 case 165:
11905                 case 168:
11906                 case 167:
11907                 case 170:
11908                 case 171:
11909                 case 172:
11910                 case 173:
11911                 case 174:
11912                 case 175:
11913                 case 259:
11914                 case 303:
11915                     return node;
11916             }
11917         }
11918     }
11919     ts.getThisContainer = getThisContainer;
11920     function isInTopLevelContext(node) {
11921         if (ts.isIdentifier(node) && (ts.isClassDeclaration(node.parent) || ts.isFunctionDeclaration(node.parent)) && node.parent.name === node) {
11922             node = node.parent;
11923         }
11924         var container = getThisContainer(node, true);
11925         return ts.isSourceFile(container);
11926     }
11927     ts.isInTopLevelContext = isInTopLevelContext;
11928     function getNewTargetContainer(node) {
11929         var container = getThisContainer(node, false);
11930         if (container) {
11931             switch (container.kind) {
11932                 case 170:
11933                 case 255:
11934                 case 212:
11935                     return container;
11936             }
11937         }
11938         return undefined;
11939     }
11940     ts.getNewTargetContainer = getNewTargetContainer;
11941     function getSuperContainer(node, stopOnFunctions) {
11942         while (true) {
11943             node = node.parent;
11944             if (!node) {
11945                 return node;
11946             }
11947             switch (node.kind) {
11948                 case 161:
11949                     node = node.parent;
11950                     break;
11951                 case 255:
11952                 case 212:
11953                 case 213:
11954                     if (!stopOnFunctions) {
11955                         continue;
11956                     }
11957                 case 166:
11958                 case 165:
11959                 case 168:
11960                 case 167:
11961                 case 170:
11962                 case 171:
11963                 case 172:
11964                 case 169:
11965                     return node;
11966                 case 164:
11967                     if (node.parent.kind === 163 && ts.isClassElement(node.parent.parent)) {
11968                         node = node.parent.parent;
11969                     }
11970                     else if (ts.isClassElement(node.parent)) {
11971                         node = node.parent;
11972                     }
11973                     break;
11974             }
11975         }
11976     }
11977     ts.getSuperContainer = getSuperContainer;
11978     function getImmediatelyInvokedFunctionExpression(func) {
11979         if (func.kind === 212 || func.kind === 213) {
11980             var prev = func;
11981             var parent = func.parent;
11982             while (parent.kind === 211) {
11983                 prev = parent;
11984                 parent = parent.parent;
11985             }
11986             if (parent.kind === 207 && parent.expression === prev) {
11987                 return parent;
11988             }
11989         }
11990     }
11991     ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
11992     function isSuperOrSuperProperty(node) {
11993         return node.kind === 106
11994             || isSuperProperty(node);
11995     }
11996     ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
11997     function isSuperProperty(node) {
11998         var kind = node.kind;
11999         return (kind === 205 || kind === 206)
12000             && node.expression.kind === 106;
12001     }
12002     ts.isSuperProperty = isSuperProperty;
12003     function isThisProperty(node) {
12004         var kind = node.kind;
12005         return (kind === 205 || kind === 206)
12006             && node.expression.kind === 108;
12007     }
12008     ts.isThisProperty = isThisProperty;
12009     function isThisInitializedDeclaration(node) {
12010         var _a;
12011         return !!node && ts.isVariableDeclaration(node) && ((_a = node.initializer) === null || _a === void 0 ? void 0 : _a.kind) === 108;
12012     }
12013     ts.isThisInitializedDeclaration = isThisInitializedDeclaration;
12014     function isThisInitializedObjectBindingExpression(node) {
12015         return !!node
12016             && (ts.isShorthandPropertyAssignment(node) || ts.isPropertyAssignment(node))
12017             && ts.isBinaryExpression(node.parent.parent)
12018             && node.parent.parent.operatorToken.kind === 63
12019             && node.parent.parent.right.kind === 108;
12020     }
12021     ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression;
12022     function getEntityNameFromTypeNode(node) {
12023         switch (node.kind) {
12024             case 177:
12025                 return node.typeName;
12026             case 227:
12027                 return isEntityNameExpression(node.expression)
12028                     ? node.expression
12029                     : undefined;
12030             case 79:
12031             case 160:
12032                 return node;
12033         }
12034         return undefined;
12035     }
12036     ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
12037     function getInvokedExpression(node) {
12038         switch (node.kind) {
12039             case 209:
12040                 return node.tag;
12041             case 279:
12042             case 278:
12043                 return node.tagName;
12044             default:
12045                 return node.expression;
12046         }
12047     }
12048     ts.getInvokedExpression = getInvokedExpression;
12049     function nodeCanBeDecorated(node, parent, grandparent) {
12050         if (ts.isNamedDeclaration(node) && ts.isPrivateIdentifier(node.name)) {
12051             return false;
12052         }
12053         switch (node.kind) {
12054             case 256:
12055                 return true;
12056             case 166:
12057                 return parent.kind === 256;
12058             case 171:
12059             case 172:
12060             case 168:
12061                 return node.body !== undefined
12062                     && parent.kind === 256;
12063             case 163:
12064                 return parent.body !== undefined
12065                     && (parent.kind === 170
12066                         || parent.kind === 168
12067                         || parent.kind === 172)
12068                     && grandparent.kind === 256;
12069         }
12070         return false;
12071     }
12072     ts.nodeCanBeDecorated = nodeCanBeDecorated;
12073     function nodeIsDecorated(node, parent, grandparent) {
12074         return node.decorators !== undefined
12075             && nodeCanBeDecorated(node, parent, grandparent);
12076     }
12077     ts.nodeIsDecorated = nodeIsDecorated;
12078     function nodeOrChildIsDecorated(node, parent, grandparent) {
12079         return nodeIsDecorated(node, parent, grandparent) || childIsDecorated(node, parent);
12080     }
12081     ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
12082     function childIsDecorated(node, parent) {
12083         switch (node.kind) {
12084             case 256:
12085                 return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); });
12086             case 168:
12087             case 172:
12088             case 170:
12089                 return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); });
12090             default:
12091                 return false;
12092         }
12093     }
12094     ts.childIsDecorated = childIsDecorated;
12095     function classOrConstructorParameterIsDecorated(node) {
12096         if (nodeIsDecorated(node))
12097             return true;
12098         var constructor = getFirstConstructorWithBody(node);
12099         return !!constructor && childIsDecorated(constructor, node);
12100     }
12101     ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated;
12102     function isJSXTagName(node) {
12103         var parent = node.parent;
12104         if (parent.kind === 279 ||
12105             parent.kind === 278 ||
12106             parent.kind === 280) {
12107             return parent.tagName === node;
12108         }
12109         return false;
12110     }
12111     ts.isJSXTagName = isJSXTagName;
12112     function isExpressionNode(node) {
12113         switch (node.kind) {
12114             case 106:
12115             case 104:
12116             case 110:
12117             case 95:
12118             case 13:
12119             case 203:
12120             case 204:
12121             case 205:
12122             case 206:
12123             case 207:
12124             case 208:
12125             case 209:
12126             case 228:
12127             case 210:
12128             case 229:
12129             case 211:
12130             case 212:
12131             case 225:
12132             case 213:
12133             case 216:
12134             case 214:
12135             case 215:
12136             case 218:
12137             case 219:
12138             case 220:
12139             case 221:
12140             case 224:
12141             case 222:
12142             case 226:
12143             case 277:
12144             case 278:
12145             case 281:
12146             case 223:
12147             case 217:
12148             case 230:
12149                 return true;
12150             case 160:
12151                 while (node.parent.kind === 160) {
12152                     node = node.parent;
12153                 }
12154                 return node.parent.kind === 180 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node);
12155             case 309:
12156                 while (ts.isJSDocMemberName(node.parent)) {
12157                     node = node.parent;
12158                 }
12159                 return node.parent.kind === 180 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node);
12160             case 80:
12161                 return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101;
12162             case 79:
12163                 if (node.parent.kind === 180 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) {
12164                     return true;
12165                 }
12166             case 8:
12167             case 9:
12168             case 10:
12169             case 14:
12170             case 108:
12171                 return isInExpressionContext(node);
12172             default:
12173                 return false;
12174         }
12175     }
12176     ts.isExpressionNode = isExpressionNode;
12177     function isInExpressionContext(node) {
12178         var parent = node.parent;
12179         switch (parent.kind) {
12180             case 253:
12181             case 163:
12182             case 166:
12183             case 165:
12184             case 297:
12185             case 294:
12186             case 202:
12187                 return parent.initializer === node;
12188             case 237:
12189             case 238:
12190             case 239:
12191             case 240:
12192             case 246:
12193             case 247:
12194             case 248:
12195             case 288:
12196             case 250:
12197                 return parent.expression === node;
12198             case 241:
12199                 var forStatement = parent;
12200                 return (forStatement.initializer === node && forStatement.initializer.kind !== 254) ||
12201                     forStatement.condition === node ||
12202                     forStatement.incrementor === node;
12203             case 242:
12204             case 243:
12205                 var forInStatement = parent;
12206                 return (forInStatement.initializer === node && forInStatement.initializer.kind !== 254) ||
12207                     forInStatement.expression === node;
12208             case 210:
12209             case 228:
12210                 return node === parent.expression;
12211             case 232:
12212                 return node === parent.expression;
12213             case 161:
12214                 return node === parent.expression;
12215             case 164:
12216             case 287:
12217             case 286:
12218             case 296:
12219                 return true;
12220             case 227:
12221                 return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
12222             case 295:
12223                 return parent.objectAssignmentInitializer === node;
12224             default:
12225                 return isExpressionNode(parent);
12226         }
12227     }
12228     ts.isInExpressionContext = isInExpressionContext;
12229     function isPartOfTypeQuery(node) {
12230         while (node.kind === 160 || node.kind === 79) {
12231             node = node.parent;
12232         }
12233         return node.kind === 180;
12234     }
12235     ts.isPartOfTypeQuery = isPartOfTypeQuery;
12236     function isNamespaceReexportDeclaration(node) {
12237         return ts.isNamespaceExport(node) && !!node.parent.moduleSpecifier;
12238     }
12239     ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration;
12240     function isExternalModuleImportEqualsDeclaration(node) {
12241         return node.kind === 264 && node.moduleReference.kind === 276;
12242     }
12243     ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
12244     function getExternalModuleImportEqualsDeclarationExpression(node) {
12245         ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node));
12246         return node.moduleReference.expression;
12247     }
12248     ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
12249     function getExternalModuleRequireArgument(node) {
12250         return isRequireVariableDeclaration(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
12251     }
12252     ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
12253     function isInternalModuleImportEqualsDeclaration(node) {
12254         return node.kind === 264 && node.moduleReference.kind !== 276;
12255     }
12256     ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
12257     function isSourceFileJS(file) {
12258         return isInJSFile(file);
12259     }
12260     ts.isSourceFileJS = isSourceFileJS;
12261     function isSourceFileNotJS(file) {
12262         return !isInJSFile(file);
12263     }
12264     ts.isSourceFileNotJS = isSourceFileNotJS;
12265     function isInJSFile(node) {
12266         return !!node && !!(node.flags & 131072);
12267     }
12268     ts.isInJSFile = isInJSFile;
12269     function isInJsonFile(node) {
12270         return !!node && !!(node.flags & 33554432);
12271     }
12272     ts.isInJsonFile = isInJsonFile;
12273     function isSourceFileNotJson(file) {
12274         return !isJsonSourceFile(file);
12275     }
12276     ts.isSourceFileNotJson = isSourceFileNotJson;
12277     function isInJSDoc(node) {
12278         return !!node && !!(node.flags & 4194304);
12279     }
12280     ts.isInJSDoc = isInJSDoc;
12281     function isJSDocIndexSignature(node) {
12282         return ts.isTypeReferenceNode(node) &&
12283             ts.isIdentifier(node.typeName) &&
12284             node.typeName.escapedText === "Object" &&
12285             node.typeArguments && node.typeArguments.length === 2 &&
12286             (node.typeArguments[0].kind === 149 || node.typeArguments[0].kind === 146);
12287     }
12288     ts.isJSDocIndexSignature = isJSDocIndexSignature;
12289     function isRequireCall(callExpression, requireStringLiteralLikeArgument) {
12290         if (callExpression.kind !== 207) {
12291             return false;
12292         }
12293         var _a = callExpression, expression = _a.expression, args = _a.arguments;
12294         if (expression.kind !== 79 || expression.escapedText !== "require") {
12295             return false;
12296         }
12297         if (args.length !== 1) {
12298             return false;
12299         }
12300         var arg = args[0];
12301         return !requireStringLiteralLikeArgument || ts.isStringLiteralLike(arg);
12302     }
12303     ts.isRequireCall = isRequireCall;
12304     function isRequireVariableDeclaration(node) {
12305         if (node.kind === 202) {
12306             node = node.parent.parent;
12307         }
12308         return ts.isVariableDeclaration(node) && !!node.initializer && isRequireCall(getLeftmostAccessExpression(node.initializer), true);
12309     }
12310     ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
12311     function isRequireVariableStatement(node) {
12312         return ts.isVariableStatement(node)
12313             && node.declarationList.declarations.length > 0
12314             && ts.every(node.declarationList.declarations, function (decl) { return isRequireVariableDeclaration(decl); });
12315     }
12316     ts.isRequireVariableStatement = isRequireVariableStatement;
12317     function isSingleOrDoubleQuote(charCode) {
12318         return charCode === 39 || charCode === 34;
12319     }
12320     ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote;
12321     function isStringDoubleQuoted(str, sourceFile) {
12322         return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === 34;
12323     }
12324     ts.isStringDoubleQuoted = isStringDoubleQuoted;
12325     function isAssignmentDeclaration(decl) {
12326         return ts.isBinaryExpression(decl) || isAccessExpression(decl) || ts.isIdentifier(decl) || ts.isCallExpression(decl);
12327     }
12328     ts.isAssignmentDeclaration = isAssignmentDeclaration;
12329     function getEffectiveInitializer(node) {
12330         if (isInJSFile(node) && node.initializer &&
12331             ts.isBinaryExpression(node.initializer) &&
12332             (node.initializer.operatorToken.kind === 56 || node.initializer.operatorToken.kind === 60) &&
12333             node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) {
12334             return node.initializer.right;
12335         }
12336         return node.initializer;
12337     }
12338     ts.getEffectiveInitializer = getEffectiveInitializer;
12339     function getDeclaredExpandoInitializer(node) {
12340         var init = getEffectiveInitializer(node);
12341         return init && getExpandoInitializer(init, isPrototypeAccess(node.name));
12342     }
12343     ts.getDeclaredExpandoInitializer = getDeclaredExpandoInitializer;
12344     function hasExpandoValueProperty(node, isPrototypeAssignment) {
12345         return ts.forEach(node.properties, function (p) {
12346             return ts.isPropertyAssignment(p) &&
12347                 ts.isIdentifier(p.name) &&
12348                 p.name.escapedText === "value" &&
12349                 p.initializer &&
12350                 getExpandoInitializer(p.initializer, isPrototypeAssignment);
12351         });
12352     }
12353     function getAssignedExpandoInitializer(node) {
12354         if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63) {
12355             var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
12356             return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
12357                 getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
12358         }
12359         if (node && ts.isCallExpression(node) && isBindableObjectDefinePropertyCall(node)) {
12360             var result = hasExpandoValueProperty(node.arguments[2], node.arguments[1].text === "prototype");
12361             if (result) {
12362                 return result;
12363             }
12364         }
12365     }
12366     ts.getAssignedExpandoInitializer = getAssignedExpandoInitializer;
12367     function getExpandoInitializer(initializer, isPrototypeAssignment) {
12368         if (ts.isCallExpression(initializer)) {
12369             var e = skipParentheses(initializer.expression);
12370             return e.kind === 212 || e.kind === 213 ? initializer : undefined;
12371         }
12372         if (initializer.kind === 212 ||
12373             initializer.kind === 225 ||
12374             initializer.kind === 213) {
12375             return initializer;
12376         }
12377         if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
12378             return initializer;
12379         }
12380     }
12381     ts.getExpandoInitializer = getExpandoInitializer;
12382     function getDefaultedExpandoInitializer(name, initializer, isPrototypeAssignment) {
12383         var e = ts.isBinaryExpression(initializer)
12384             && (initializer.operatorToken.kind === 56 || initializer.operatorToken.kind === 60)
12385             && getExpandoInitializer(initializer.right, isPrototypeAssignment);
12386         if (e && isSameEntityName(name, initializer.left)) {
12387             return e;
12388         }
12389     }
12390     function isDefaultedExpandoInitializer(node) {
12391         var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
12392             ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63 ? node.parent.left :
12393                 undefined;
12394         return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
12395     }
12396     ts.isDefaultedExpandoInitializer = isDefaultedExpandoInitializer;
12397     function getNameOfExpando(node) {
12398         if (ts.isBinaryExpression(node.parent)) {
12399             var parent = ((node.parent.operatorToken.kind === 56 || node.parent.operatorToken.kind === 60) && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
12400             if (parent.operatorToken.kind === 63 && ts.isIdentifier(parent.left)) {
12401                 return parent.left;
12402             }
12403         }
12404         else if (ts.isVariableDeclaration(node.parent)) {
12405             return node.parent.name;
12406         }
12407     }
12408     ts.getNameOfExpando = getNameOfExpando;
12409     function isSameEntityName(name, initializer) {
12410         if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
12411             return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
12412         }
12413         if (ts.isIdentifier(name) && isLiteralLikeAccess(initializer) &&
12414             (initializer.expression.kind === 108 ||
12415                 ts.isIdentifier(initializer.expression) &&
12416                     (initializer.expression.escapedText === "window" ||
12417                         initializer.expression.escapedText === "self" ||
12418                         initializer.expression.escapedText === "global"))) {
12419             var nameOrArgument = getNameOrArgument(initializer);
12420             if (ts.isPrivateIdentifier(nameOrArgument)) {
12421                 ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
12422             }
12423             return isSameEntityName(name, nameOrArgument);
12424         }
12425         if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
12426             return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
12427                 && isSameEntityName(name.expression, initializer.expression);
12428         }
12429         return false;
12430     }
12431     ts.isSameEntityName = isSameEntityName;
12432     function getRightMostAssignedExpression(node) {
12433         while (isAssignmentExpression(node, true)) {
12434             node = node.right;
12435         }
12436         return node;
12437     }
12438     ts.getRightMostAssignedExpression = getRightMostAssignedExpression;
12439     function isExportsIdentifier(node) {
12440         return ts.isIdentifier(node) && node.escapedText === "exports";
12441     }
12442     ts.isExportsIdentifier = isExportsIdentifier;
12443     function isModuleIdentifier(node) {
12444         return ts.isIdentifier(node) && node.escapedText === "module";
12445     }
12446     ts.isModuleIdentifier = isModuleIdentifier;
12447     function isModuleExportsAccessExpression(node) {
12448         return (ts.isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node))
12449             && isModuleIdentifier(node.expression)
12450             && getElementOrPropertyAccessName(node) === "exports";
12451     }
12452     ts.isModuleExportsAccessExpression = isModuleExportsAccessExpression;
12453     function getAssignmentDeclarationKind(expr) {
12454         var special = getAssignmentDeclarationKindWorker(expr);
12455         return special === 5 || isInJSFile(expr) ? special : 0;
12456     }
12457     ts.getAssignmentDeclarationKind = getAssignmentDeclarationKind;
12458     function isBindableObjectDefinePropertyCall(expr) {
12459         return ts.length(expr.arguments) === 3 &&
12460             ts.isPropertyAccessExpression(expr.expression) &&
12461             ts.isIdentifier(expr.expression.expression) &&
12462             ts.idText(expr.expression.expression) === "Object" &&
12463             ts.idText(expr.expression.name) === "defineProperty" &&
12464             isStringOrNumericLiteralLike(expr.arguments[1]) &&
12465             isBindableStaticNameExpression(expr.arguments[0], true);
12466     }
12467     ts.isBindableObjectDefinePropertyCall = isBindableObjectDefinePropertyCall;
12468     function isLiteralLikeAccess(node) {
12469         return ts.isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node);
12470     }
12471     ts.isLiteralLikeAccess = isLiteralLikeAccess;
12472     function isLiteralLikeElementAccess(node) {
12473         return ts.isElementAccessExpression(node) && isStringOrNumericLiteralLike(node.argumentExpression);
12474     }
12475     ts.isLiteralLikeElementAccess = isLiteralLikeElementAccess;
12476     function isBindableStaticAccessExpression(node, excludeThisKeyword) {
12477         return ts.isPropertyAccessExpression(node) && (!excludeThisKeyword && node.expression.kind === 108 || ts.isIdentifier(node.name) && isBindableStaticNameExpression(node.expression, true))
12478             || isBindableStaticElementAccessExpression(node, excludeThisKeyword);
12479     }
12480     ts.isBindableStaticAccessExpression = isBindableStaticAccessExpression;
12481     function isBindableStaticElementAccessExpression(node, excludeThisKeyword) {
12482         return isLiteralLikeElementAccess(node)
12483             && ((!excludeThisKeyword && node.expression.kind === 108) ||
12484                 isEntityNameExpression(node.expression) ||
12485                 isBindableStaticAccessExpression(node.expression, true));
12486     }
12487     ts.isBindableStaticElementAccessExpression = isBindableStaticElementAccessExpression;
12488     function isBindableStaticNameExpression(node, excludeThisKeyword) {
12489         return isEntityNameExpression(node) || isBindableStaticAccessExpression(node, excludeThisKeyword);
12490     }
12491     ts.isBindableStaticNameExpression = isBindableStaticNameExpression;
12492     function getNameOrArgument(expr) {
12493         if (ts.isPropertyAccessExpression(expr)) {
12494             return expr.name;
12495         }
12496         return expr.argumentExpression;
12497     }
12498     ts.getNameOrArgument = getNameOrArgument;
12499     function getAssignmentDeclarationKindWorker(expr) {
12500         if (ts.isCallExpression(expr)) {
12501             if (!isBindableObjectDefinePropertyCall(expr)) {
12502                 return 0;
12503             }
12504             var entityName = expr.arguments[0];
12505             if (isExportsIdentifier(entityName) || isModuleExportsAccessExpression(entityName)) {
12506                 return 8;
12507             }
12508             if (isBindableStaticAccessExpression(entityName) && getElementOrPropertyAccessName(entityName) === "prototype") {
12509                 return 9;
12510             }
12511             return 7;
12512         }
12513         if (expr.operatorToken.kind !== 63 || !isAccessExpression(expr.left) || isVoidZero(getRightMostAssignedExpression(expr))) {
12514             return 0;
12515         }
12516         if (isBindableStaticNameExpression(expr.left.expression, true) && getElementOrPropertyAccessName(expr.left) === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) {
12517             return 6;
12518         }
12519         return getAssignmentDeclarationPropertyAccessKind(expr.left);
12520     }
12521     function isVoidZero(node) {
12522         return ts.isVoidExpression(node) && ts.isNumericLiteral(node.expression) && node.expression.text === "0";
12523     }
12524     function getElementOrPropertyAccessArgumentExpressionOrName(node) {
12525         if (ts.isPropertyAccessExpression(node)) {
12526             return node.name;
12527         }
12528         var arg = skipParentheses(node.argumentExpression);
12529         if (ts.isNumericLiteral(arg) || ts.isStringLiteralLike(arg)) {
12530             return arg;
12531         }
12532         return node;
12533     }
12534     ts.getElementOrPropertyAccessArgumentExpressionOrName = getElementOrPropertyAccessArgumentExpressionOrName;
12535     function getElementOrPropertyAccessName(node) {
12536         var name = getElementOrPropertyAccessArgumentExpressionOrName(node);
12537         if (name) {
12538             if (ts.isIdentifier(name)) {
12539                 return name.escapedText;
12540             }
12541             if (ts.isStringLiteralLike(name) || ts.isNumericLiteral(name)) {
12542                 return ts.escapeLeadingUnderscores(name.text);
12543             }
12544         }
12545         return undefined;
12546     }
12547     ts.getElementOrPropertyAccessName = getElementOrPropertyAccessName;
12548     function getAssignmentDeclarationPropertyAccessKind(lhs) {
12549         if (lhs.expression.kind === 108) {
12550             return 4;
12551         }
12552         else if (isModuleExportsAccessExpression(lhs)) {
12553             return 2;
12554         }
12555         else if (isBindableStaticNameExpression(lhs.expression, true)) {
12556             if (isPrototypeAccess(lhs.expression)) {
12557                 return 3;
12558             }
12559             var nextToLast = lhs;
12560             while (!ts.isIdentifier(nextToLast.expression)) {
12561                 nextToLast = nextToLast.expression;
12562             }
12563             var id = nextToLast.expression;
12564             if ((id.escapedText === "exports" ||
12565                 id.escapedText === "module" && getElementOrPropertyAccessName(nextToLast) === "exports") &&
12566                 isBindableStaticAccessExpression(lhs)) {
12567                 return 1;
12568             }
12569             if (isBindableStaticNameExpression(lhs, true) || (ts.isElementAccessExpression(lhs) && isDynamicName(lhs))) {
12570                 return 5;
12571             }
12572         }
12573         return 0;
12574     }
12575     ts.getAssignmentDeclarationPropertyAccessKind = getAssignmentDeclarationPropertyAccessKind;
12576     function getInitializerOfBinaryExpression(expr) {
12577         while (ts.isBinaryExpression(expr.right)) {
12578             expr = expr.right;
12579         }
12580         return expr.right;
12581     }
12582     ts.getInitializerOfBinaryExpression = getInitializerOfBinaryExpression;
12583     function isPrototypePropertyAssignment(node) {
12584         return ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 3;
12585     }
12586     ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
12587     function isSpecialPropertyDeclaration(expr) {
12588         return isInJSFile(expr) &&
12589             expr.parent && expr.parent.kind === 237 &&
12590             (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) &&
12591             !!ts.getJSDocTypeTag(expr.parent);
12592     }
12593     ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
12594     function setValueDeclaration(symbol, node) {
12595         var valueDeclaration = symbol.valueDeclaration;
12596         if (!valueDeclaration ||
12597             !(node.flags & 8388608 && !(valueDeclaration.flags & 8388608)) &&
12598                 (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
12599             (valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
12600             symbol.valueDeclaration = node;
12601         }
12602     }
12603     ts.setValueDeclaration = setValueDeclaration;
12604     function isFunctionSymbol(symbol) {
12605         if (!symbol || !symbol.valueDeclaration) {
12606             return false;
12607         }
12608         var decl = symbol.valueDeclaration;
12609         return decl.kind === 255 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
12610     }
12611     ts.isFunctionSymbol = isFunctionSymbol;
12612     function tryGetModuleSpecifierFromDeclaration(node) {
12613         var _a, _b, _c;
12614         switch (node.kind) {
12615             case 253:
12616                 return node.initializer.arguments[0].text;
12617             case 265:
12618                 return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
12619             case 264:
12620                 return (_c = ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike)) === null || _c === void 0 ? void 0 : _c.text;
12621             default:
12622                 ts.Debug.assertNever(node);
12623         }
12624     }
12625     ts.tryGetModuleSpecifierFromDeclaration = tryGetModuleSpecifierFromDeclaration;
12626     function importFromModuleSpecifier(node) {
12627         return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
12628     }
12629     ts.importFromModuleSpecifier = importFromModuleSpecifier;
12630     function tryGetImportFromModuleSpecifier(node) {
12631         switch (node.parent.kind) {
12632             case 265:
12633             case 271:
12634                 return node.parent;
12635             case 276:
12636                 return node.parent.parent;
12637             case 207:
12638                 return isImportCall(node.parent) || isRequireCall(node.parent, false) ? node.parent : undefined;
12639             case 195:
12640                 ts.Debug.assert(ts.isStringLiteral(node));
12641                 return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
12642             default:
12643                 return undefined;
12644         }
12645     }
12646     ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
12647     function getExternalModuleName(node) {
12648         switch (node.kind) {
12649             case 265:
12650             case 271:
12651                 return node.moduleSpecifier;
12652             case 264:
12653                 return node.moduleReference.kind === 276 ? node.moduleReference.expression : undefined;
12654             case 199:
12655                 return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
12656             case 207:
12657                 return node.arguments[0];
12658             case 260:
12659                 return node.name.kind === 10 ? node.name : undefined;
12660             default:
12661                 return ts.Debug.assertNever(node);
12662         }
12663     }
12664     ts.getExternalModuleName = getExternalModuleName;
12665     function getNamespaceDeclarationNode(node) {
12666         switch (node.kind) {
12667             case 265:
12668                 return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
12669             case 264:
12670                 return node;
12671             case 271:
12672                 return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport);
12673             default:
12674                 return ts.Debug.assertNever(node);
12675         }
12676     }
12677     ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
12678     function isDefaultImport(node) {
12679         return node.kind === 265 && !!node.importClause && !!node.importClause.name;
12680     }
12681     ts.isDefaultImport = isDefaultImport;
12682     function forEachImportClauseDeclaration(node, action) {
12683         if (node.name) {
12684             var result = action(node);
12685             if (result)
12686                 return result;
12687         }
12688         if (node.namedBindings) {
12689             var result = ts.isNamespaceImport(node.namedBindings)
12690                 ? action(node.namedBindings)
12691                 : ts.forEach(node.namedBindings.elements, action);
12692             if (result)
12693                 return result;
12694         }
12695     }
12696     ts.forEachImportClauseDeclaration = forEachImportClauseDeclaration;
12697     function hasQuestionToken(node) {
12698         if (node) {
12699             switch (node.kind) {
12700                 case 163:
12701                 case 168:
12702                 case 167:
12703                 case 295:
12704                 case 294:
12705                 case 166:
12706                 case 165:
12707                     return node.questionToken !== undefined;
12708             }
12709         }
12710         return false;
12711     }
12712     ts.hasQuestionToken = hasQuestionToken;
12713     function isJSDocConstructSignature(node) {
12714         var param = ts.isJSDocFunctionType(node) ? ts.firstOrUndefined(node.parameters) : undefined;
12715         var name = ts.tryCast(param && param.name, ts.isIdentifier);
12716         return !!name && name.escapedText === "new";
12717     }
12718     ts.isJSDocConstructSignature = isJSDocConstructSignature;
12719     function isJSDocTypeAlias(node) {
12720         return node.kind === 343 || node.kind === 336 || node.kind === 337;
12721     }
12722     ts.isJSDocTypeAlias = isJSDocTypeAlias;
12723     function isTypeAlias(node) {
12724         return isJSDocTypeAlias(node) || ts.isTypeAliasDeclaration(node);
12725     }
12726     ts.isTypeAlias = isTypeAlias;
12727     function getSourceOfAssignment(node) {
12728         return ts.isExpressionStatement(node) &&
12729             ts.isBinaryExpression(node.expression) &&
12730             node.expression.operatorToken.kind === 63
12731             ? getRightMostAssignedExpression(node.expression)
12732             : undefined;
12733     }
12734     function getSourceOfDefaultedAssignment(node) {
12735         return ts.isExpressionStatement(node) &&
12736             ts.isBinaryExpression(node.expression) &&
12737             getAssignmentDeclarationKind(node.expression) !== 0 &&
12738             ts.isBinaryExpression(node.expression.right) &&
12739             (node.expression.right.operatorToken.kind === 56 || node.expression.right.operatorToken.kind === 60)
12740             ? node.expression.right.right
12741             : undefined;
12742     }
12743     function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
12744         switch (node.kind) {
12745             case 236:
12746                 var v = getSingleVariableOfVariableStatement(node);
12747                 return v && v.initializer;
12748             case 166:
12749                 return node.initializer;
12750             case 294:
12751                 return node.initializer;
12752         }
12753     }
12754     ts.getSingleInitializerOfVariableStatementOrPropertyDeclaration = getSingleInitializerOfVariableStatementOrPropertyDeclaration;
12755     function getSingleVariableOfVariableStatement(node) {
12756         return ts.isVariableStatement(node) ? ts.firstOrUndefined(node.declarationList.declarations) : undefined;
12757     }
12758     ts.getSingleVariableOfVariableStatement = getSingleVariableOfVariableStatement;
12759     function getNestedModuleDeclaration(node) {
12760         return ts.isModuleDeclaration(node) &&
12761             node.body &&
12762             node.body.kind === 260
12763             ? node.body
12764             : undefined;
12765     }
12766     function getJSDocCommentsAndTags(hostNode, noCache) {
12767         var result;
12768         if (isVariableLike(hostNode) && ts.hasInitializer(hostNode) && ts.hasJSDocNodes(hostNode.initializer)) {
12769             result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(hostNode.initializer.jsDoc)));
12770         }
12771         var node = hostNode;
12772         while (node && node.parent) {
12773             if (ts.hasJSDocNodes(node)) {
12774                 result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc)));
12775             }
12776             if (node.kind === 163) {
12777                 result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node));
12778                 break;
12779             }
12780             if (node.kind === 162) {
12781                 result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node));
12782                 break;
12783             }
12784             node = getNextJSDocCommentLocation(node);
12785         }
12786         return result || ts.emptyArray;
12787     }
12788     ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
12789     function filterOwnedJSDocTags(hostNode, jsDoc) {
12790         if (ts.isJSDoc(jsDoc)) {
12791             var ownedTags = ts.filter(jsDoc.tags, function (tag) { return ownsJSDocTag(hostNode, tag); });
12792             return jsDoc.tags === ownedTags ? [jsDoc] : ownedTags;
12793         }
12794         return ownsJSDocTag(hostNode, jsDoc) ? [jsDoc] : undefined;
12795     }
12796     function ownsJSDocTag(hostNode, tag) {
12797         return !ts.isJSDocTypeTag(tag)
12798             || !tag.parent
12799             || !ts.isJSDoc(tag.parent)
12800             || !ts.isParenthesizedExpression(tag.parent.parent)
12801             || tag.parent.parent === hostNode;
12802     }
12803     function getNextJSDocCommentLocation(node) {
12804         var parent = node.parent;
12805         if (parent.kind === 294 ||
12806             parent.kind === 270 ||
12807             parent.kind === 166 ||
12808             parent.kind === 237 && node.kind === 205 ||
12809             parent.kind === 246 ||
12810             getNestedModuleDeclaration(parent) ||
12811             ts.isBinaryExpression(node) && node.operatorToken.kind === 63) {
12812             return parent;
12813         }
12814         else if (parent.parent &&
12815             (getSingleVariableOfVariableStatement(parent.parent) === node ||
12816                 ts.isBinaryExpression(parent) && parent.operatorToken.kind === 63)) {
12817             return parent.parent;
12818         }
12819         else if (parent.parent && parent.parent.parent &&
12820             (getSingleVariableOfVariableStatement(parent.parent.parent) ||
12821                 getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent.parent.parent) === node ||
12822                 getSourceOfDefaultedAssignment(parent.parent.parent))) {
12823             return parent.parent.parent;
12824         }
12825     }
12826     ts.getNextJSDocCommentLocation = getNextJSDocCommentLocation;
12827     function getParameterSymbolFromJSDoc(node) {
12828         if (node.symbol) {
12829             return node.symbol;
12830         }
12831         if (!ts.isIdentifier(node.name)) {
12832             return undefined;
12833         }
12834         var name = node.name.escapedText;
12835         var decl = getHostSignatureFromJSDoc(node);
12836         if (!decl) {
12837             return undefined;
12838         }
12839         var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 79 && p.name.escapedText === name; });
12840         return parameter && parameter.symbol;
12841     }
12842     ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
12843     function getEffectiveContainerForJSDocTemplateTag(node) {
12844         if (ts.isJSDoc(node.parent) && node.parent.tags) {
12845             var typeAlias = ts.find(node.parent.tags, isJSDocTypeAlias);
12846             if (typeAlias) {
12847                 return typeAlias;
12848             }
12849         }
12850         return getHostSignatureFromJSDoc(node);
12851     }
12852     ts.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag;
12853     function getHostSignatureFromJSDoc(node) {
12854         var host = getEffectiveJSDocHost(node);
12855         return host && ts.isFunctionLike(host) ? host : undefined;
12856     }
12857     ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc;
12858     function getEffectiveJSDocHost(node) {
12859         var host = getJSDocHost(node);
12860         if (host) {
12861             return getSourceOfDefaultedAssignment(host)
12862                 || getSourceOfAssignment(host)
12863                 || getSingleInitializerOfVariableStatementOrPropertyDeclaration(host)
12864                 || getSingleVariableOfVariableStatement(host)
12865                 || getNestedModuleDeclaration(host)
12866                 || host;
12867         }
12868     }
12869     ts.getEffectiveJSDocHost = getEffectiveJSDocHost;
12870     function getJSDocHost(node) {
12871         var jsDoc = getJSDocRoot(node);
12872         if (!jsDoc) {
12873             return undefined;
12874         }
12875         var host = jsDoc.parent;
12876         if (host && host.jsDoc && jsDoc === ts.lastOrUndefined(host.jsDoc)) {
12877             return host;
12878         }
12879     }
12880     ts.getJSDocHost = getJSDocHost;
12881     function getJSDocRoot(node) {
12882         return ts.findAncestor(node.parent, ts.isJSDoc);
12883     }
12884     ts.getJSDocRoot = getJSDocRoot;
12885     function getTypeParameterFromJsDoc(node) {
12886         var name = node.name.escapedText;
12887         var typeParameters = node.parent.parent.parent.typeParameters;
12888         return typeParameters && ts.find(typeParameters, function (p) { return p.name.escapedText === name; });
12889     }
12890     ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc;
12891     function hasRestParameter(s) {
12892         var last = ts.lastOrUndefined(s.parameters);
12893         return !!last && isRestParameter(last);
12894     }
12895     ts.hasRestParameter = hasRestParameter;
12896     function isRestParameter(node) {
12897         var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
12898         return node.dotDotDotToken !== undefined || !!type && type.kind === 316;
12899     }
12900     ts.isRestParameter = isRestParameter;
12901     function hasTypeArguments(node) {
12902         return !!node.typeArguments;
12903     }
12904     ts.hasTypeArguments = hasTypeArguments;
12905     function getAssignmentTargetKind(node) {
12906         var parent = node.parent;
12907         while (true) {
12908             switch (parent.kind) {
12909                 case 220:
12910                     var binaryOperator = parent.operatorToken.kind;
12911                     return isAssignmentOperator(binaryOperator) && parent.left === node ?
12912                         binaryOperator === 63 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 :
12913                         0;
12914                 case 218:
12915                 case 219:
12916                     var unaryOperator = parent.operator;
12917                     return unaryOperator === 45 || unaryOperator === 46 ? 2 : 0;
12918                 case 242:
12919                 case 243:
12920                     return parent.initializer === node ? 1 : 0;
12921                 case 211:
12922                 case 203:
12923                 case 224:
12924                 case 229:
12925                     node = parent;
12926                     break;
12927                 case 296:
12928                     node = parent.parent;
12929                     break;
12930                 case 295:
12931                     if (parent.name !== node) {
12932                         return 0;
12933                     }
12934                     node = parent.parent;
12935                     break;
12936                 case 294:
12937                     if (parent.name === node) {
12938                         return 0;
12939                     }
12940                     node = parent.parent;
12941                     break;
12942                 default:
12943                     return 0;
12944             }
12945             parent = node.parent;
12946         }
12947     }
12948     ts.getAssignmentTargetKind = getAssignmentTargetKind;
12949     function isAssignmentTarget(node) {
12950         return getAssignmentTargetKind(node) !== 0;
12951     }
12952     ts.isAssignmentTarget = isAssignmentTarget;
12953     function isNodeWithPossibleHoistedDeclaration(node) {
12954         switch (node.kind) {
12955             case 234:
12956             case 236:
12957             case 247:
12958             case 238:
12959             case 248:
12960             case 262:
12961             case 288:
12962             case 289:
12963             case 249:
12964             case 241:
12965             case 242:
12966             case 243:
12967             case 239:
12968             case 240:
12969             case 251:
12970             case 291:
12971                 return true;
12972         }
12973         return false;
12974     }
12975     ts.isNodeWithPossibleHoistedDeclaration = isNodeWithPossibleHoistedDeclaration;
12976     function isValueSignatureDeclaration(node) {
12977         return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodOrAccessor(node) || ts.isFunctionDeclaration(node) || ts.isConstructorDeclaration(node);
12978     }
12979     ts.isValueSignatureDeclaration = isValueSignatureDeclaration;
12980     function walkUp(node, kind) {
12981         while (node && node.kind === kind) {
12982             node = node.parent;
12983         }
12984         return node;
12985     }
12986     function walkUpParenthesizedTypes(node) {
12987         return walkUp(node, 190);
12988     }
12989     ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
12990     function walkUpParenthesizedExpressions(node) {
12991         return walkUp(node, 211);
12992     }
12993     ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
12994     function walkUpParenthesizedTypesAndGetParentAndChild(node) {
12995         var child;
12996         while (node && node.kind === 190) {
12997             child = node;
12998             node = node.parent;
12999         }
13000         return [child, node];
13001     }
13002     ts.walkUpParenthesizedTypesAndGetParentAndChild = walkUpParenthesizedTypesAndGetParentAndChild;
13003     function skipParentheses(node, excludeJSDocTypeAssertions) {
13004         var flags = excludeJSDocTypeAssertions ?
13005             1 | 16 :
13006             1;
13007         return ts.skipOuterExpressions(node, flags);
13008     }
13009     ts.skipParentheses = skipParentheses;
13010     function isDeleteTarget(node) {
13011         if (node.kind !== 205 && node.kind !== 206) {
13012             return false;
13013         }
13014         node = walkUpParenthesizedExpressions(node.parent);
13015         return node && node.kind === 214;
13016     }
13017     ts.isDeleteTarget = isDeleteTarget;
13018     function isNodeDescendantOf(node, ancestor) {
13019         while (node) {
13020             if (node === ancestor)
13021                 return true;
13022             node = node.parent;
13023         }
13024         return false;
13025     }
13026     ts.isNodeDescendantOf = isNodeDescendantOf;
13027     function isDeclarationName(name) {
13028         return !ts.isSourceFile(name) && !ts.isBindingPattern(name) && ts.isDeclaration(name.parent) && name.parent.name === name;
13029     }
13030     ts.isDeclarationName = isDeclarationName;
13031     function getDeclarationFromName(name) {
13032         var parent = name.parent;
13033         switch (name.kind) {
13034             case 10:
13035             case 14:
13036             case 8:
13037                 if (ts.isComputedPropertyName(parent))
13038                     return parent.parent;
13039             case 79:
13040                 if (ts.isDeclaration(parent)) {
13041                     return parent.name === name ? parent : undefined;
13042                 }
13043                 else if (ts.isQualifiedName(parent)) {
13044                     var tag = parent.parent;
13045                     return ts.isJSDocParameterTag(tag) && tag.name === parent ? tag : undefined;
13046                 }
13047                 else {
13048                     var binExp = parent.parent;
13049                     return ts.isBinaryExpression(binExp) &&
13050                         getAssignmentDeclarationKind(binExp) !== 0 &&
13051                         (binExp.left.symbol || binExp.symbol) &&
13052                         ts.getNameOfDeclaration(binExp) === name
13053                         ? binExp
13054                         : undefined;
13055                 }
13056             case 80:
13057                 return ts.isDeclaration(parent) && parent.name === name ? parent : undefined;
13058             default:
13059                 return undefined;
13060         }
13061     }
13062     ts.getDeclarationFromName = getDeclarationFromName;
13063     function isLiteralComputedPropertyDeclarationName(node) {
13064         return isStringOrNumericLiteralLike(node) &&
13065             node.parent.kind === 161 &&
13066             ts.isDeclaration(node.parent.parent);
13067     }
13068     ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
13069     function isIdentifierName(node) {
13070         var parent = node.parent;
13071         switch (parent.kind) {
13072             case 166:
13073             case 165:
13074             case 168:
13075             case 167:
13076             case 171:
13077             case 172:
13078             case 297:
13079             case 294:
13080             case 205:
13081                 return parent.name === node;
13082             case 160:
13083                 return parent.right === node;
13084             case 202:
13085             case 269:
13086                 return parent.propertyName === node;
13087             case 274:
13088             case 284:
13089                 return true;
13090         }
13091         return false;
13092     }
13093     ts.isIdentifierName = isIdentifierName;
13094     function isAliasSymbolDeclaration(node) {
13095         return node.kind === 264 ||
13096             node.kind === 263 ||
13097             node.kind === 266 && !!node.name ||
13098             node.kind === 267 ||
13099             node.kind === 273 ||
13100             node.kind === 269 ||
13101             node.kind === 274 ||
13102             node.kind === 270 && exportAssignmentIsAlias(node) ||
13103             ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13104             ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableExpression(node.parent.right) ||
13105             node.kind === 295 ||
13106             node.kind === 294 && isAliasableExpression(node.initializer);
13107     }
13108     ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
13109     function getAliasDeclarationFromName(node) {
13110         switch (node.parent.kind) {
13111             case 266:
13112             case 269:
13113             case 267:
13114             case 274:
13115             case 270:
13116             case 264:
13117                 return node.parent;
13118             case 160:
13119                 do {
13120                     node = node.parent;
13121                 } while (node.parent.kind === 160);
13122                 return getAliasDeclarationFromName(node);
13123         }
13124     }
13125     ts.getAliasDeclarationFromName = getAliasDeclarationFromName;
13126     function isAliasableExpression(e) {
13127         return isEntityNameExpression(e) || ts.isClassExpression(e);
13128     }
13129     ts.isAliasableExpression = isAliasableExpression;
13130     function exportAssignmentIsAlias(node) {
13131         var e = getExportAssignmentExpression(node);
13132         return isAliasableExpression(e);
13133     }
13134     ts.exportAssignmentIsAlias = exportAssignmentIsAlias;
13135     function getExportAssignmentExpression(node) {
13136         return ts.isExportAssignment(node) ? node.expression : node.right;
13137     }
13138     ts.getExportAssignmentExpression = getExportAssignmentExpression;
13139     function getPropertyAssignmentAliasLikeExpression(node) {
13140         return node.kind === 295 ? node.name : node.kind === 294 ? node.initializer :
13141             node.parent.right;
13142     }
13143     ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression;
13144     function getEffectiveBaseTypeNode(node) {
13145         var baseType = getClassExtendsHeritageElement(node);
13146         if (baseType && isInJSFile(node)) {
13147             var tag = ts.getJSDocAugmentsTag(node);
13148             if (tag) {
13149                 return tag.class;
13150             }
13151         }
13152         return baseType;
13153     }
13154     ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
13155     function getClassExtendsHeritageElement(node) {
13156         var heritageClause = getHeritageClause(node.heritageClauses, 94);
13157         return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
13158     }
13159     ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
13160     function getEffectiveImplementsTypeNodes(node) {
13161         if (isInJSFile(node)) {
13162             return ts.getJSDocImplementsTags(node).map(function (n) { return n.class; });
13163         }
13164         else {
13165             var heritageClause = getHeritageClause(node.heritageClauses, 117);
13166             return heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.types;
13167         }
13168     }
13169     ts.getEffectiveImplementsTypeNodes = getEffectiveImplementsTypeNodes;
13170     function getAllSuperTypeNodes(node) {
13171         return ts.isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || ts.emptyArray :
13172             ts.isClassLike(node) ? ts.concatenate(ts.singleElementArray(getEffectiveBaseTypeNode(node)), getEffectiveImplementsTypeNodes(node)) || ts.emptyArray :
13173                 ts.emptyArray;
13174     }
13175     ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
13176     function getInterfaceBaseTypeNodes(node) {
13177         var heritageClause = getHeritageClause(node.heritageClauses, 94);
13178         return heritageClause ? heritageClause.types : undefined;
13179     }
13180     ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
13181     function getHeritageClause(clauses, kind) {
13182         if (clauses) {
13183             for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) {
13184                 var clause = clauses_1[_i];
13185                 if (clause.token === kind) {
13186                     return clause;
13187                 }
13188             }
13189         }
13190         return undefined;
13191     }
13192     ts.getHeritageClause = getHeritageClause;
13193     function getAncestor(node, kind) {
13194         while (node) {
13195             if (node.kind === kind) {
13196                 return node;
13197             }
13198             node = node.parent;
13199         }
13200         return undefined;
13201     }
13202     ts.getAncestor = getAncestor;
13203     function isKeyword(token) {
13204         return 81 <= token && token <= 159;
13205     }
13206     ts.isKeyword = isKeyword;
13207     function isContextualKeyword(token) {
13208         return 126 <= token && token <= 159;
13209     }
13210     ts.isContextualKeyword = isContextualKeyword;
13211     function isNonContextualKeyword(token) {
13212         return isKeyword(token) && !isContextualKeyword(token);
13213     }
13214     ts.isNonContextualKeyword = isNonContextualKeyword;
13215     function isFutureReservedKeyword(token) {
13216         return 117 <= token && token <= 125;
13217     }
13218     ts.isFutureReservedKeyword = isFutureReservedKeyword;
13219     function isStringANonContextualKeyword(name) {
13220         var token = ts.stringToToken(name);
13221         return token !== undefined && isNonContextualKeyword(token);
13222     }
13223     ts.isStringANonContextualKeyword = isStringANonContextualKeyword;
13224     function isStringAKeyword(name) {
13225         var token = ts.stringToToken(name);
13226         return token !== undefined && isKeyword(token);
13227     }
13228     ts.isStringAKeyword = isStringAKeyword;
13229     function isIdentifierANonContextualKeyword(_a) {
13230         var originalKeywordKind = _a.originalKeywordKind;
13231         return !!originalKeywordKind && !isContextualKeyword(originalKeywordKind);
13232     }
13233     ts.isIdentifierANonContextualKeyword = isIdentifierANonContextualKeyword;
13234     function isTrivia(token) {
13235         return 2 <= token && token <= 7;
13236     }
13237     ts.isTrivia = isTrivia;
13238     function getFunctionFlags(node) {
13239         if (!node) {
13240             return 4;
13241         }
13242         var flags = 0;
13243         switch (node.kind) {
13244             case 255:
13245             case 212:
13246             case 168:
13247                 if (node.asteriskToken) {
13248                     flags |= 1;
13249                 }
13250             case 213:
13251                 if (hasSyntacticModifier(node, 256)) {
13252                     flags |= 2;
13253                 }
13254                 break;
13255         }
13256         if (!node.body) {
13257             flags |= 4;
13258         }
13259         return flags;
13260     }
13261     ts.getFunctionFlags = getFunctionFlags;
13262     function isAsyncFunction(node) {
13263         switch (node.kind) {
13264             case 255:
13265             case 212:
13266             case 213:
13267             case 168:
13268                 return node.body !== undefined
13269                     && node.asteriskToken === undefined
13270                     && hasSyntacticModifier(node, 256);
13271         }
13272         return false;
13273     }
13274     ts.isAsyncFunction = isAsyncFunction;
13275     function isStringOrNumericLiteralLike(node) {
13276         return ts.isStringLiteralLike(node) || ts.isNumericLiteral(node);
13277     }
13278     ts.isStringOrNumericLiteralLike = isStringOrNumericLiteralLike;
13279     function isSignedNumericLiteral(node) {
13280         return ts.isPrefixUnaryExpression(node) && (node.operator === 39 || node.operator === 40) && ts.isNumericLiteral(node.operand);
13281     }
13282     ts.isSignedNumericLiteral = isSignedNumericLiteral;
13283     function hasDynamicName(declaration) {
13284         var name = ts.getNameOfDeclaration(declaration);
13285         return !!name && isDynamicName(name);
13286     }
13287     ts.hasDynamicName = hasDynamicName;
13288     function isDynamicName(name) {
13289         if (!(name.kind === 161 || name.kind === 206)) {
13290             return false;
13291         }
13292         var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
13293         return !isStringOrNumericLiteralLike(expr) &&
13294             !isSignedNumericLiteral(expr);
13295     }
13296     ts.isDynamicName = isDynamicName;
13297     function getPropertyNameForPropertyNameNode(name) {
13298         switch (name.kind) {
13299             case 79:
13300             case 80:
13301                 return name.escapedText;
13302             case 10:
13303             case 8:
13304                 return ts.escapeLeadingUnderscores(name.text);
13305             case 161:
13306                 var nameExpression = name.expression;
13307                 if (isStringOrNumericLiteralLike(nameExpression)) {
13308                     return ts.escapeLeadingUnderscores(nameExpression.text);
13309                 }
13310                 else if (isSignedNumericLiteral(nameExpression)) {
13311                     if (nameExpression.operator === 40) {
13312                         return ts.tokenToString(nameExpression.operator) + nameExpression.operand.text;
13313                     }
13314                     return nameExpression.operand.text;
13315                 }
13316                 return undefined;
13317             default:
13318                 return ts.Debug.assertNever(name);
13319         }
13320     }
13321     ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
13322     function isPropertyNameLiteral(node) {
13323         switch (node.kind) {
13324             case 79:
13325             case 10:
13326             case 14:
13327             case 8:
13328                 return true;
13329             default:
13330                 return false;
13331         }
13332     }
13333     ts.isPropertyNameLiteral = isPropertyNameLiteral;
13334     function getTextOfIdentifierOrLiteral(node) {
13335         return ts.isMemberName(node) ? ts.idText(node) : node.text;
13336     }
13337     ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
13338     function getEscapedTextOfIdentifierOrLiteral(node) {
13339         return ts.isMemberName(node) ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
13340     }
13341     ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
13342     function getPropertyNameForUniqueESSymbol(symbol) {
13343         return "__@".concat(ts.getSymbolId(symbol), "@").concat(symbol.escapedName);
13344     }
13345     ts.getPropertyNameForUniqueESSymbol = getPropertyNameForUniqueESSymbol;
13346     function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) {
13347         return "__#".concat(ts.getSymbolId(containingClassSymbol), "@").concat(description);
13348     }
13349     ts.getSymbolNameForPrivateIdentifier = getSymbolNameForPrivateIdentifier;
13350     function isKnownSymbol(symbol) {
13351         return ts.startsWith(symbol.escapedName, "__@");
13352     }
13353     ts.isKnownSymbol = isKnownSymbol;
13354     function isPrivateIdentifierSymbol(symbol) {
13355         return ts.startsWith(symbol.escapedName, "__#");
13356     }
13357     ts.isPrivateIdentifierSymbol = isPrivateIdentifierSymbol;
13358     function isESSymbolIdentifier(node) {
13359         return node.kind === 79 && node.escapedText === "Symbol";
13360     }
13361     ts.isESSymbolIdentifier = isESSymbolIdentifier;
13362     function isPushOrUnshiftIdentifier(node) {
13363         return node.escapedText === "push" || node.escapedText === "unshift";
13364     }
13365     ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
13366     function isParameterDeclaration(node) {
13367         var root = getRootDeclaration(node);
13368         return root.kind === 163;
13369     }
13370     ts.isParameterDeclaration = isParameterDeclaration;
13371     function getRootDeclaration(node) {
13372         while (node.kind === 202) {
13373             node = node.parent.parent;
13374         }
13375         return node;
13376     }
13377     ts.getRootDeclaration = getRootDeclaration;
13378     function nodeStartsNewLexicalEnvironment(node) {
13379         var kind = node.kind;
13380         return kind === 170
13381             || kind === 212
13382             || kind === 255
13383             || kind === 213
13384             || kind === 168
13385             || kind === 171
13386             || kind === 172
13387             || kind === 260
13388             || kind === 303;
13389     }
13390     ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
13391     function nodeIsSynthesized(range) {
13392         return positionIsSynthesized(range.pos)
13393             || positionIsSynthesized(range.end);
13394     }
13395     ts.nodeIsSynthesized = nodeIsSynthesized;
13396     function getOriginalSourceFile(sourceFile) {
13397         return ts.getParseTreeNode(sourceFile, ts.isSourceFile) || sourceFile;
13398     }
13399     ts.getOriginalSourceFile = getOriginalSourceFile;
13400     function getExpressionAssociativity(expression) {
13401         var operator = getOperator(expression);
13402         var hasArguments = expression.kind === 208 && expression.arguments !== undefined;
13403         return getOperatorAssociativity(expression.kind, operator, hasArguments);
13404     }
13405     ts.getExpressionAssociativity = getExpressionAssociativity;
13406     function getOperatorAssociativity(kind, operator, hasArguments) {
13407         switch (kind) {
13408             case 208:
13409                 return hasArguments ? 0 : 1;
13410             case 218:
13411             case 215:
13412             case 216:
13413             case 214:
13414             case 217:
13415             case 221:
13416             case 223:
13417                 return 1;
13418             case 220:
13419                 switch (operator) {
13420                     case 42:
13421                     case 63:
13422                     case 64:
13423                     case 65:
13424                     case 67:
13425                     case 66:
13426                     case 68:
13427                     case 69:
13428                     case 70:
13429                     case 71:
13430                     case 72:
13431                     case 73:
13432                     case 78:
13433                     case 74:
13434                     case 75:
13435                     case 76:
13436                     case 77:
13437                         return 1;
13438                 }
13439         }
13440         return 0;
13441     }
13442     ts.getOperatorAssociativity = getOperatorAssociativity;
13443     function getExpressionPrecedence(expression) {
13444         var operator = getOperator(expression);
13445         var hasArguments = expression.kind === 208 && expression.arguments !== undefined;
13446         return getOperatorPrecedence(expression.kind, operator, hasArguments);
13447     }
13448     ts.getExpressionPrecedence = getExpressionPrecedence;
13449     function getOperator(expression) {
13450         if (expression.kind === 220) {
13451             return expression.operatorToken.kind;
13452         }
13453         else if (expression.kind === 218 || expression.kind === 219) {
13454             return expression.operator;
13455         }
13456         else {
13457             return expression.kind;
13458         }
13459     }
13460     ts.getOperator = getOperator;
13461     function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
13462         switch (nodeKind) {
13463             case 349:
13464                 return 0;
13465             case 224:
13466                 return 1;
13467             case 223:
13468                 return 2;
13469             case 221:
13470                 return 4;
13471             case 220:
13472                 switch (operatorKind) {
13473                     case 27:
13474                         return 0;
13475                     case 63:
13476                     case 64:
13477                     case 65:
13478                     case 67:
13479                     case 66:
13480                     case 68:
13481                     case 69:
13482                     case 70:
13483                     case 71:
13484                     case 72:
13485                     case 73:
13486                     case 78:
13487                     case 74:
13488                     case 75:
13489                     case 76:
13490                     case 77:
13491                         return 3;
13492                     default:
13493                         return getBinaryOperatorPrecedence(operatorKind);
13494                 }
13495             case 210:
13496             case 229:
13497             case 218:
13498             case 215:
13499             case 216:
13500             case 214:
13501             case 217:
13502                 return 16;
13503             case 219:
13504                 return 17;
13505             case 207:
13506                 return 18;
13507             case 208:
13508                 return hasArguments ? 19 : 18;
13509             case 209:
13510             case 205:
13511             case 206:
13512             case 230:
13513                 return 19;
13514             case 228:
13515                 return 11;
13516             case 108:
13517             case 106:
13518             case 79:
13519             case 80:
13520             case 104:
13521             case 110:
13522             case 95:
13523             case 8:
13524             case 9:
13525             case 10:
13526             case 203:
13527             case 204:
13528             case 212:
13529             case 213:
13530             case 225:
13531             case 13:
13532             case 14:
13533             case 222:
13534             case 211:
13535             case 226:
13536             case 277:
13537             case 278:
13538             case 281:
13539                 return 20;
13540             default:
13541                 return -1;
13542         }
13543     }
13544     ts.getOperatorPrecedence = getOperatorPrecedence;
13545     function getBinaryOperatorPrecedence(kind) {
13546         switch (kind) {
13547             case 60:
13548                 return 4;
13549             case 56:
13550                 return 5;
13551             case 55:
13552                 return 6;
13553             case 51:
13554                 return 7;
13555             case 52:
13556                 return 8;
13557             case 50:
13558                 return 9;
13559             case 34:
13560             case 35:
13561             case 36:
13562             case 37:
13563                 return 10;
13564             case 29:
13565             case 31:
13566             case 32:
13567             case 33:
13568             case 102:
13569             case 101:
13570             case 127:
13571                 return 11;
13572             case 47:
13573             case 48:
13574             case 49:
13575                 return 12;
13576             case 39:
13577             case 40:
13578                 return 13;
13579             case 41:
13580             case 43:
13581             case 44:
13582                 return 14;
13583             case 42:
13584                 return 15;
13585         }
13586         return -1;
13587     }
13588     ts.getBinaryOperatorPrecedence = getBinaryOperatorPrecedence;
13589     function getSemanticJsxChildren(children) {
13590         return ts.filter(children, function (i) {
13591             switch (i.kind) {
13592                 case 287:
13593                     return !!i.expression;
13594                 case 11:
13595                     return !i.containsOnlyTriviaWhiteSpaces;
13596                 default:
13597                     return true;
13598             }
13599         });
13600     }
13601     ts.getSemanticJsxChildren = getSemanticJsxChildren;
13602     function createDiagnosticCollection() {
13603         var nonFileDiagnostics = [];
13604         var filesWithDiagnostics = [];
13605         var fileDiagnostics = new ts.Map();
13606         var hasReadNonFileDiagnostics = false;
13607         return {
13608             add: add,
13609             lookup: lookup,
13610             getGlobalDiagnostics: getGlobalDiagnostics,
13611             getDiagnostics: getDiagnostics,
13612         };
13613         function lookup(diagnostic) {
13614             var diagnostics;
13615             if (diagnostic.file) {
13616                 diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
13617             }
13618             else {
13619                 diagnostics = nonFileDiagnostics;
13620             }
13621             if (!diagnostics) {
13622                 return undefined;
13623             }
13624             var result = ts.binarySearch(diagnostics, diagnostic, ts.identity, compareDiagnosticsSkipRelatedInformation);
13625             if (result >= 0) {
13626                 return diagnostics[result];
13627             }
13628             return undefined;
13629         }
13630         function add(diagnostic) {
13631             var diagnostics;
13632             if (diagnostic.file) {
13633                 diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
13634                 if (!diagnostics) {
13635                     diagnostics = [];
13636                     fileDiagnostics.set(diagnostic.file.fileName, diagnostics);
13637                     ts.insertSorted(filesWithDiagnostics, diagnostic.file.fileName, ts.compareStringsCaseSensitive);
13638                 }
13639             }
13640             else {
13641                 if (hasReadNonFileDiagnostics) {
13642                     hasReadNonFileDiagnostics = false;
13643                     nonFileDiagnostics = nonFileDiagnostics.slice();
13644                 }
13645                 diagnostics = nonFileDiagnostics;
13646             }
13647             ts.insertSorted(diagnostics, diagnostic, compareDiagnostics);
13648         }
13649         function getGlobalDiagnostics() {
13650             hasReadNonFileDiagnostics = true;
13651             return nonFileDiagnostics;
13652         }
13653         function getDiagnostics(fileName) {
13654             if (fileName) {
13655                 return fileDiagnostics.get(fileName) || [];
13656             }
13657             var fileDiags = ts.flatMapToMutable(filesWithDiagnostics, function (f) { return fileDiagnostics.get(f); });
13658             if (!nonFileDiagnostics.length) {
13659                 return fileDiags;
13660             }
13661             fileDiags.unshift.apply(fileDiags, nonFileDiagnostics);
13662             return fileDiags;
13663         }
13664     }
13665     ts.createDiagnosticCollection = createDiagnosticCollection;
13666     var templateSubstitutionRegExp = /\$\{/g;
13667     function escapeTemplateSubstitution(str) {
13668         return str.replace(templateSubstitutionRegExp, "\\${");
13669     }
13670     function hasInvalidEscape(template) {
13671         return template && !!(ts.isNoSubstitutionTemplateLiteral(template)
13672             ? template.templateFlags
13673             : (template.head.templateFlags || ts.some(template.templateSpans, function (span) { return !!span.literal.templateFlags; })));
13674     }
13675     ts.hasInvalidEscape = hasInvalidEscape;
13676     var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
13677     var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
13678     var backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
13679     var escapedCharsMap = new ts.Map(ts.getEntries({
13680         "\t": "\\t",
13681         "\v": "\\v",
13682         "\f": "\\f",
13683         "\b": "\\b",
13684         "\r": "\\r",
13685         "\n": "\\n",
13686         "\\": "\\\\",
13687         "\"": "\\\"",
13688         "\'": "\\\'",
13689         "\`": "\\\`",
13690         "\u2028": "\\u2028",
13691         "\u2029": "\\u2029",
13692         "\u0085": "\\u0085",
13693         "\r\n": "\\r\\n",
13694     }));
13695     function encodeUtf16EscapeSequence(charCode) {
13696         var hexCharCode = charCode.toString(16).toUpperCase();
13697         var paddedHexCode = ("0000" + hexCharCode).slice(-4);
13698         return "\\u" + paddedHexCode;
13699     }
13700     function getReplacement(c, offset, input) {
13701         if (c.charCodeAt(0) === 0) {
13702             var lookAhead = input.charCodeAt(offset + c.length);
13703             if (lookAhead >= 48 && lookAhead <= 57) {
13704                 return "\\x00";
13705             }
13706             return "\\0";
13707         }
13708         return escapedCharsMap.get(c) || encodeUtf16EscapeSequence(c.charCodeAt(0));
13709     }
13710     function escapeString(s, quoteChar) {
13711         var escapedCharsRegExp = quoteChar === 96 ? backtickQuoteEscapedCharsRegExp :
13712             quoteChar === 39 ? singleQuoteEscapedCharsRegExp :
13713                 doubleQuoteEscapedCharsRegExp;
13714         return s.replace(escapedCharsRegExp, getReplacement);
13715     }
13716     ts.escapeString = escapeString;
13717     var nonAsciiCharacters = /[^\u0000-\u007F]/g;
13718     function escapeNonAsciiString(s, quoteChar) {
13719         s = escapeString(s, quoteChar);
13720         return nonAsciiCharacters.test(s) ?
13721             s.replace(nonAsciiCharacters, function (c) { return encodeUtf16EscapeSequence(c.charCodeAt(0)); }) :
13722             s;
13723     }
13724     ts.escapeNonAsciiString = escapeNonAsciiString;
13725     var jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g;
13726     var jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g;
13727     var jsxEscapedCharsMap = new ts.Map(ts.getEntries({
13728         "\"": "&quot;",
13729         "\'": "&apos;"
13730     }));
13731     function encodeJsxCharacterEntity(charCode) {
13732         var hexCharCode = charCode.toString(16).toUpperCase();
13733         return "&#x" + hexCharCode + ";";
13734     }
13735     function getJsxAttributeStringReplacement(c) {
13736         if (c.charCodeAt(0) === 0) {
13737             return "&#0;";
13738         }
13739         return jsxEscapedCharsMap.get(c) || encodeJsxCharacterEntity(c.charCodeAt(0));
13740     }
13741     function escapeJsxAttributeString(s, quoteChar) {
13742         var escapedCharsRegExp = quoteChar === 39 ? jsxSingleQuoteEscapedCharsRegExp :
13743             jsxDoubleQuoteEscapedCharsRegExp;
13744         return s.replace(escapedCharsRegExp, getJsxAttributeStringReplacement);
13745     }
13746     ts.escapeJsxAttributeString = escapeJsxAttributeString;
13747     function stripQuotes(name) {
13748         var length = name.length;
13749         if (length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && isQuoteOrBacktick(name.charCodeAt(0))) {
13750             return name.substring(1, length - 1);
13751         }
13752         return name;
13753     }
13754     ts.stripQuotes = stripQuotes;
13755     function isQuoteOrBacktick(charCode) {
13756         return charCode === 39 ||
13757             charCode === 34 ||
13758             charCode === 96;
13759     }
13760     function isIntrinsicJsxName(name) {
13761         var ch = name.charCodeAt(0);
13762         return (ch >= 97 && ch <= 122) || ts.stringContains(name, "-") || ts.stringContains(name, ":");
13763     }
13764     ts.isIntrinsicJsxName = isIntrinsicJsxName;
13765     var indentStrings = ["", "    "];
13766     function getIndentString(level) {
13767         var singleLevel = indentStrings[1];
13768         for (var current = indentStrings.length; current <= level; current++) {
13769             indentStrings.push(indentStrings[current - 1] + singleLevel);
13770         }
13771         return indentStrings[level];
13772     }
13773     ts.getIndentString = getIndentString;
13774     function getIndentSize() {
13775         return indentStrings[1].length;
13776     }
13777     ts.getIndentSize = getIndentSize;
13778     function createTextWriter(newLine) {
13779         var output;
13780         var indent;
13781         var lineStart;
13782         var lineCount;
13783         var linePos;
13784         var hasTrailingComment = false;
13785         function updateLineCountAndPosFor(s) {
13786             var lineStartsOfS = ts.computeLineStarts(s);
13787             if (lineStartsOfS.length > 1) {
13788                 lineCount = lineCount + lineStartsOfS.length - 1;
13789                 linePos = output.length - s.length + ts.last(lineStartsOfS);
13790                 lineStart = (linePos - output.length) === 0;
13791             }
13792             else {
13793                 lineStart = false;
13794             }
13795         }
13796         function writeText(s) {
13797             if (s && s.length) {
13798                 if (lineStart) {
13799                     s = getIndentString(indent) + s;
13800                     lineStart = false;
13801                 }
13802                 output += s;
13803                 updateLineCountAndPosFor(s);
13804             }
13805         }
13806         function write(s) {
13807             if (s)
13808                 hasTrailingComment = false;
13809             writeText(s);
13810         }
13811         function writeComment(s) {
13812             if (s)
13813                 hasTrailingComment = true;
13814             writeText(s);
13815         }
13816         function reset() {
13817             output = "";
13818             indent = 0;
13819             lineStart = true;
13820             lineCount = 0;
13821             linePos = 0;
13822             hasTrailingComment = false;
13823         }
13824         function rawWrite(s) {
13825             if (s !== undefined) {
13826                 output += s;
13827                 updateLineCountAndPosFor(s);
13828                 hasTrailingComment = false;
13829             }
13830         }
13831         function writeLiteral(s) {
13832             if (s && s.length) {
13833                 write(s);
13834             }
13835         }
13836         function writeLine(force) {
13837             if (!lineStart || force) {
13838                 output += newLine;
13839                 lineCount++;
13840                 linePos = output.length;
13841                 lineStart = true;
13842                 hasTrailingComment = false;
13843             }
13844         }
13845         function getTextPosWithWriteLine() {
13846             return lineStart ? output.length : (output.length + newLine.length);
13847         }
13848         reset();
13849         return {
13850             write: write,
13851             rawWrite: rawWrite,
13852             writeLiteral: writeLiteral,
13853             writeLine: writeLine,
13854             increaseIndent: function () { indent++; },
13855             decreaseIndent: function () { indent--; },
13856             getIndent: function () { return indent; },
13857             getTextPos: function () { return output.length; },
13858             getLine: function () { return lineCount; },
13859             getColumn: function () { return lineStart ? indent * getIndentSize() : output.length - linePos; },
13860             getText: function () { return output; },
13861             isAtStartOfLine: function () { return lineStart; },
13862             hasTrailingComment: function () { return hasTrailingComment; },
13863             hasTrailingWhitespace: function () { return !!output.length && ts.isWhiteSpaceLike(output.charCodeAt(output.length - 1)); },
13864             clear: reset,
13865             reportInaccessibleThisError: ts.noop,
13866             reportPrivateInBaseOfClassExpression: ts.noop,
13867             reportInaccessibleUniqueSymbolError: ts.noop,
13868             trackSymbol: function () { return false; },
13869             writeKeyword: write,
13870             writeOperator: write,
13871             writeParameter: write,
13872             writeProperty: write,
13873             writePunctuation: write,
13874             writeSpace: write,
13875             writeStringLiteral: write,
13876             writeSymbol: function (s, _) { return write(s); },
13877             writeTrailingSemicolon: write,
13878             writeComment: writeComment,
13879             getTextPosWithWriteLine: getTextPosWithWriteLine
13880         };
13881     }
13882     ts.createTextWriter = createTextWriter;
13883     function getTrailingSemicolonDeferringWriter(writer) {
13884         var pendingTrailingSemicolon = false;
13885         function commitPendingTrailingSemicolon() {
13886             if (pendingTrailingSemicolon) {
13887                 writer.writeTrailingSemicolon(";");
13888                 pendingTrailingSemicolon = false;
13889             }
13890         }
13891         return __assign(__assign({}, writer), { writeTrailingSemicolon: function () {
13892                 pendingTrailingSemicolon = true;
13893             }, writeLiteral: function (s) {
13894                 commitPendingTrailingSemicolon();
13895                 writer.writeLiteral(s);
13896             }, writeStringLiteral: function (s) {
13897                 commitPendingTrailingSemicolon();
13898                 writer.writeStringLiteral(s);
13899             }, writeSymbol: function (s, sym) {
13900                 commitPendingTrailingSemicolon();
13901                 writer.writeSymbol(s, sym);
13902             }, writePunctuation: function (s) {
13903                 commitPendingTrailingSemicolon();
13904                 writer.writePunctuation(s);
13905             }, writeKeyword: function (s) {
13906                 commitPendingTrailingSemicolon();
13907                 writer.writeKeyword(s);
13908             }, writeOperator: function (s) {
13909                 commitPendingTrailingSemicolon();
13910                 writer.writeOperator(s);
13911             }, writeParameter: function (s) {
13912                 commitPendingTrailingSemicolon();
13913                 writer.writeParameter(s);
13914             }, writeSpace: function (s) {
13915                 commitPendingTrailingSemicolon();
13916                 writer.writeSpace(s);
13917             }, writeProperty: function (s) {
13918                 commitPendingTrailingSemicolon();
13919                 writer.writeProperty(s);
13920             }, writeComment: function (s) {
13921                 commitPendingTrailingSemicolon();
13922                 writer.writeComment(s);
13923             }, writeLine: function () {
13924                 commitPendingTrailingSemicolon();
13925                 writer.writeLine();
13926             }, increaseIndent: function () {
13927                 commitPendingTrailingSemicolon();
13928                 writer.increaseIndent();
13929             }, decreaseIndent: function () {
13930                 commitPendingTrailingSemicolon();
13931                 writer.decreaseIndent();
13932             } });
13933     }
13934     ts.getTrailingSemicolonDeferringWriter = getTrailingSemicolonDeferringWriter;
13935     function hostUsesCaseSensitiveFileNames(host) {
13936         return host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false;
13937     }
13938     ts.hostUsesCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames;
13939     function hostGetCanonicalFileName(host) {
13940         return ts.createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host));
13941     }
13942     ts.hostGetCanonicalFileName = hostGetCanonicalFileName;
13943     function getResolvedExternalModuleName(host, file, referenceFile) {
13944         return file.moduleName || getExternalModuleNameFromPath(host, file.fileName, referenceFile && referenceFile.fileName);
13945     }
13946     ts.getResolvedExternalModuleName = getResolvedExternalModuleName;
13947     function getCanonicalAbsolutePath(host, path) {
13948         return host.getCanonicalFileName(ts.getNormalizedAbsolutePath(path, host.getCurrentDirectory()));
13949     }
13950     function getExternalModuleNameFromDeclaration(host, resolver, declaration) {
13951         var file = resolver.getExternalModuleFileFromDeclaration(declaration);
13952         if (!file || file.isDeclarationFile) {
13953             return undefined;
13954         }
13955         var specifier = getExternalModuleName(declaration);
13956         if (specifier && ts.isStringLiteralLike(specifier) && !ts.pathIsRelative(specifier.text) &&
13957             getCanonicalAbsolutePath(host, file.path).indexOf(getCanonicalAbsolutePath(host, ts.ensureTrailingDirectorySeparator(host.getCommonSourceDirectory()))) === -1) {
13958             return undefined;
13959         }
13960         return getResolvedExternalModuleName(host, file);
13961     }
13962     ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration;
13963     function getExternalModuleNameFromPath(host, fileName, referencePath) {
13964         var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); };
13965         var dir = ts.toPath(referencePath ? ts.getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
13966         var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
13967         var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false);
13968         var extensionless = removeFileExtension(relativePath);
13969         return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
13970     }
13971     ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
13972     function getOwnEmitOutputFilePath(fileName, host, extension) {
13973         var compilerOptions = host.getCompilerOptions();
13974         var emitOutputFilePathWithoutExtension;
13975         if (compilerOptions.outDir) {
13976             emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(fileName, host, compilerOptions.outDir));
13977         }
13978         else {
13979             emitOutputFilePathWithoutExtension = removeFileExtension(fileName);
13980         }
13981         return emitOutputFilePathWithoutExtension + extension;
13982     }
13983     ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath;
13984     function getDeclarationEmitOutputFilePath(fileName, host) {
13985         return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), function (f) { return host.getCanonicalFileName(f); });
13986     }
13987     ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath;
13988     function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
13989         var outputDir = options.declarationDir || options.outDir;
13990         var path = outputDir
13991             ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
13992             : fileName;
13993         var declarationExtension = getDeclarationEmitExtensionForPath(path);
13994         return removeFileExtension(path) + declarationExtension;
13995     }
13996     ts.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker;
13997     function getDeclarationEmitExtensionForPath(path) {
13998         return ts.fileExtensionIsOneOf(path, [".mjs", ".mts"]) ? ".d.mts" :
13999             ts.fileExtensionIsOneOf(path, [".cjs", ".cts"]) ? ".d.cts" :
14000                 ts.fileExtensionIsOneOf(path, [".json"]) ? ".json.d.ts" :
14001                     ".d.ts";
14002     }
14003     ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
14004     function outFile(options) {
14005         return options.outFile || options.out;
14006     }
14007     ts.outFile = outFile;
14008     function getPathsBasePath(options, host) {
14009         var _a, _b;
14010         if (!options.paths)
14011             return undefined;
14012         return (_a = options.baseUrl) !== null && _a !== void 0 ? _a : ts.Debug.checkDefined(options.pathsBasePath || ((_b = host.getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(host)), "Encountered 'paths' without a 'baseUrl', config file, or host 'getCurrentDirectory'.");
14013     }
14014     ts.getPathsBasePath = getPathsBasePath;
14015     function getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit) {
14016         var options = host.getCompilerOptions();
14017         if (outFile(options)) {
14018             var moduleKind = getEmitModuleKind(options);
14019             var moduleEmitEnabled_1 = options.emitDeclarationOnly || moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System;
14020             return ts.filter(host.getSourceFiles(), function (sourceFile) {
14021                 return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) &&
14022                     sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit);
14023             });
14024         }
14025         else {
14026             var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile];
14027             return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit); });
14028         }
14029     }
14030     ts.getSourceFilesToEmit = getSourceFilesToEmit;
14031     function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
14032         var options = host.getCompilerOptions();
14033         return !(options.noEmitForJsFiles && isSourceFileJS(sourceFile)) &&
14034             !sourceFile.isDeclarationFile &&
14035             !host.isSourceFileFromExternalLibrary(sourceFile) &&
14036             (forceDtsEmit || (!(isJsonSourceFile(sourceFile) && host.getResolvedProjectReferenceToRedirect(sourceFile.fileName)) &&
14037                 !host.isSourceOfProjectReferenceRedirect(sourceFile.fileName)));
14038     }
14039     ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted;
14040     function getSourceFilePathInNewDir(fileName, host, newDirPath) {
14041         return getSourceFilePathInNewDirWorker(fileName, newDirPath, host.getCurrentDirectory(), host.getCommonSourceDirectory(), function (f) { return host.getCanonicalFileName(f); });
14042     }
14043     ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir;
14044     function getSourceFilePathInNewDirWorker(fileName, newDirPath, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
14045         var sourceFilePath = ts.getNormalizedAbsolutePath(fileName, currentDirectory);
14046         var isSourceFileInCommonSourceDirectory = getCanonicalFileName(sourceFilePath).indexOf(getCanonicalFileName(commonSourceDirectory)) === 0;
14047         sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
14048         return ts.combinePaths(newDirPath, sourceFilePath);
14049     }
14050     ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
14051     function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
14052         host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
14053             diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
14054         }, sourceFiles);
14055     }
14056     ts.writeFile = writeFile;
14057     function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
14058         if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) {
14059             var parentDirectory = ts.getDirectoryPath(directoryPath);
14060             ensureDirectoriesExist(parentDirectory, createDirectory, directoryExists);
14061             createDirectory(directoryPath);
14062         }
14063     }
14064     function writeFileEnsuringDirectories(path, data, writeByteOrderMark, writeFile, createDirectory, directoryExists) {
14065         try {
14066             writeFile(path, data, writeByteOrderMark);
14067         }
14068         catch (_a) {
14069             ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(path)), createDirectory, directoryExists);
14070             writeFile(path, data, writeByteOrderMark);
14071         }
14072     }
14073     ts.writeFileEnsuringDirectories = writeFileEnsuringDirectories;
14074     function getLineOfLocalPosition(sourceFile, pos) {
14075         var lineStarts = ts.getLineStarts(sourceFile);
14076         return ts.computeLineOfPosition(lineStarts, pos);
14077     }
14078     ts.getLineOfLocalPosition = getLineOfLocalPosition;
14079     function getLineOfLocalPositionFromLineMap(lineMap, pos) {
14080         return ts.computeLineOfPosition(lineMap, pos);
14081     }
14082     ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap;
14083     function getFirstConstructorWithBody(node) {
14084         return ts.find(node.members, function (member) { return ts.isConstructorDeclaration(member) && nodeIsPresent(member.body); });
14085     }
14086     ts.getFirstConstructorWithBody = getFirstConstructorWithBody;
14087     function getSetAccessorValueParameter(accessor) {
14088         if (accessor && accessor.parameters.length > 0) {
14089             var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
14090             return accessor.parameters[hasThis ? 1 : 0];
14091         }
14092     }
14093     ts.getSetAccessorValueParameter = getSetAccessorValueParameter;
14094     function getSetAccessorTypeAnnotationNode(accessor) {
14095         var parameter = getSetAccessorValueParameter(accessor);
14096         return parameter && parameter.type;
14097     }
14098     ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode;
14099     function getThisParameter(signature) {
14100         if (signature.parameters.length && !ts.isJSDocSignature(signature)) {
14101             var thisParameter = signature.parameters[0];
14102             if (parameterIsThisKeyword(thisParameter)) {
14103                 return thisParameter;
14104             }
14105         }
14106     }
14107     ts.getThisParameter = getThisParameter;
14108     function parameterIsThisKeyword(parameter) {
14109         return isThisIdentifier(parameter.name);
14110     }
14111     ts.parameterIsThisKeyword = parameterIsThisKeyword;
14112     function isThisIdentifier(node) {
14113         return !!node && node.kind === 79 && identifierIsThisKeyword(node);
14114     }
14115     ts.isThisIdentifier = isThisIdentifier;
14116     function isThisInTypeQuery(node) {
14117         if (!isThisIdentifier(node)) {
14118             return false;
14119         }
14120         while (ts.isQualifiedName(node.parent) && node.parent.left === node) {
14121             node = node.parent;
14122         }
14123         return node.parent.kind === 180;
14124     }
14125     ts.isThisInTypeQuery = isThisInTypeQuery;
14126     function identifierIsThisKeyword(id) {
14127         return id.originalKeywordKind === 108;
14128     }
14129     ts.identifierIsThisKeyword = identifierIsThisKeyword;
14130     function getAllAccessorDeclarations(declarations, accessor) {
14131         var firstAccessor;
14132         var secondAccessor;
14133         var getAccessor;
14134         var setAccessor;
14135         if (hasDynamicName(accessor)) {
14136             firstAccessor = accessor;
14137             if (accessor.kind === 171) {
14138                 getAccessor = accessor;
14139             }
14140             else if (accessor.kind === 172) {
14141                 setAccessor = accessor;
14142             }
14143             else {
14144                 ts.Debug.fail("Accessor has wrong kind");
14145             }
14146         }
14147         else {
14148             ts.forEach(declarations, function (member) {
14149                 if (ts.isAccessor(member)
14150                     && isStatic(member) === isStatic(accessor)) {
14151                     var memberName = getPropertyNameForPropertyNameNode(member.name);
14152                     var accessorName = getPropertyNameForPropertyNameNode(accessor.name);
14153                     if (memberName === accessorName) {
14154                         if (!firstAccessor) {
14155                             firstAccessor = member;
14156                         }
14157                         else if (!secondAccessor) {
14158                             secondAccessor = member;
14159                         }
14160                         if (member.kind === 171 && !getAccessor) {
14161                             getAccessor = member;
14162                         }
14163                         if (member.kind === 172 && !setAccessor) {
14164                             setAccessor = member;
14165                         }
14166                     }
14167                 }
14168             });
14169         }
14170         return {
14171             firstAccessor: firstAccessor,
14172             secondAccessor: secondAccessor,
14173             getAccessor: getAccessor,
14174             setAccessor: setAccessor
14175         };
14176     }
14177     ts.getAllAccessorDeclarations = getAllAccessorDeclarations;
14178     function getEffectiveTypeAnnotationNode(node) {
14179         if (!isInJSFile(node) && ts.isFunctionDeclaration(node))
14180             return undefined;
14181         var type = node.type;
14182         if (type || !isInJSFile(node))
14183             return type;
14184         return ts.isJSDocPropertyLikeTag(node) ? node.typeExpression && node.typeExpression.type : ts.getJSDocType(node);
14185     }
14186     ts.getEffectiveTypeAnnotationNode = getEffectiveTypeAnnotationNode;
14187     function getTypeAnnotationNode(node) {
14188         return node.type;
14189     }
14190     ts.getTypeAnnotationNode = getTypeAnnotationNode;
14191     function getEffectiveReturnTypeNode(node) {
14192         return ts.isJSDocSignature(node) ?
14193             node.type && node.type.typeExpression && node.type.typeExpression.type :
14194             node.type || (isInJSFile(node) ? ts.getJSDocReturnType(node) : undefined);
14195     }
14196     ts.getEffectiveReturnTypeNode = getEffectiveReturnTypeNode;
14197     function getJSDocTypeParameterDeclarations(node) {
14198         return ts.flatMap(ts.getJSDocTags(node), function (tag) { return isNonTypeAliasTemplate(tag) ? tag.typeParameters : undefined; });
14199     }
14200     ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
14201     function isNonTypeAliasTemplate(tag) {
14202         return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 318 && tag.parent.tags.some(isJSDocTypeAlias));
14203     }
14204     function getEffectiveSetAccessorTypeAnnotationNode(node) {
14205         var parameter = getSetAccessorValueParameter(node);
14206         return parameter && getEffectiveTypeAnnotationNode(parameter);
14207     }
14208     ts.getEffectiveSetAccessorTypeAnnotationNode = getEffectiveSetAccessorTypeAnnotationNode;
14209     function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {
14210         emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);
14211     }
14212     ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments;
14213     function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {
14214         if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos &&
14215             getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {
14216             writer.writeLine();
14217         }
14218     }
14219     ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition;
14220     function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {
14221         if (pos !== commentPos &&
14222             getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {
14223             writer.writeLine();
14224         }
14225     }
14226     ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;
14227     function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {
14228         if (comments && comments.length > 0) {
14229             if (leadingSeparator) {
14230                 writer.writeSpace(" ");
14231             }
14232             var emitInterveningSeparator = false;
14233             for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
14234                 var comment = comments_1[_i];
14235                 if (emitInterveningSeparator) {
14236                     writer.writeSpace(" ");
14237                     emitInterveningSeparator = false;
14238                 }
14239                 writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);
14240                 if (comment.hasTrailingNewLine) {
14241                     writer.writeLine();
14242                 }
14243                 else {
14244                     emitInterveningSeparator = true;
14245                 }
14246             }
14247             if (emitInterveningSeparator && trailingSeparator) {
14248                 writer.writeSpace(" ");
14249             }
14250         }
14251     }
14252     ts.emitComments = emitComments;
14253     function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {
14254         var leadingComments;
14255         var currentDetachedCommentInfo;
14256         if (removeComments) {
14257             if (node.pos === 0) {
14258                 leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal);
14259             }
14260         }
14261         else {
14262             leadingComments = ts.getLeadingCommentRanges(text, node.pos);
14263         }
14264         if (leadingComments) {
14265             var detachedComments = [];
14266             var lastComment = void 0;
14267             for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) {
14268                 var comment = leadingComments_1[_i];
14269                 if (lastComment) {
14270                     var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);
14271                     var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);
14272                     if (commentLine >= lastCommentLine + 2) {
14273                         break;
14274                     }
14275                 }
14276                 detachedComments.push(comment);
14277                 lastComment = comment;
14278             }
14279             if (detachedComments.length) {
14280                 var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.last(detachedComments).end);
14281                 var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos));
14282                 if (nodeLine >= lastCommentLine + 2) {
14283                     emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);
14284                     emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment);
14285                     currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.last(detachedComments).end };
14286                 }
14287             }
14288         }
14289         return currentDetachedCommentInfo;
14290         function isPinnedCommentLocal(comment) {
14291             return isPinnedComment(text, comment.pos);
14292         }
14293     }
14294     ts.emitDetachedComments = emitDetachedComments;
14295     function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {
14296         if (text.charCodeAt(commentPos + 1) === 42) {
14297             var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos);
14298             var lineCount = lineMap.length;
14299             var firstCommentLineIndent = void 0;
14300             for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {
14301                 var nextLineStart = (currentLine + 1) === lineCount
14302                     ? text.length + 1
14303                     : lineMap[currentLine + 1];
14304                 if (pos !== commentPos) {
14305                     if (firstCommentLineIndent === undefined) {
14306                         firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);
14307                     }
14308                     var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
14309                     var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);
14310                     if (spacesToEmit > 0) {
14311                         var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
14312                         var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
14313                         writer.rawWrite(indentSizeSpaceString);
14314                         while (numberOfSingleSpacesToEmit) {
14315                             writer.rawWrite(" ");
14316                             numberOfSingleSpacesToEmit--;
14317                         }
14318                     }
14319                     else {
14320                         writer.rawWrite("");
14321                     }
14322                 }
14323                 writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);
14324                 pos = nextLineStart;
14325             }
14326         }
14327         else {
14328             writer.writeComment(text.substring(commentPos, commentEnd));
14329         }
14330     }
14331     ts.writeCommentRange = writeCommentRange;
14332     function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
14333         var end = Math.min(commentEnd, nextLineStart - 1);
14334         var currentLineText = ts.trimString(text.substring(pos, end));
14335         if (currentLineText) {
14336             writer.writeComment(currentLineText);
14337             if (end !== commentEnd) {
14338                 writer.writeLine();
14339             }
14340         }
14341         else {
14342             writer.rawWrite(newLine);
14343         }
14344     }
14345     function calculateIndent(text, pos, end) {
14346         var currentLineIndent = 0;
14347         for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {
14348             if (text.charCodeAt(pos) === 9) {
14349                 currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize());
14350             }
14351             else {
14352                 currentLineIndent++;
14353             }
14354         }
14355         return currentLineIndent;
14356     }
14357     function hasEffectiveModifiers(node) {
14358         return getEffectiveModifierFlags(node) !== 0;
14359     }
14360     ts.hasEffectiveModifiers = hasEffectiveModifiers;
14361     function hasSyntacticModifiers(node) {
14362         return getSyntacticModifierFlags(node) !== 0;
14363     }
14364     ts.hasSyntacticModifiers = hasSyntacticModifiers;
14365     function hasEffectiveModifier(node, flags) {
14366         return !!getSelectedEffectiveModifierFlags(node, flags);
14367     }
14368     ts.hasEffectiveModifier = hasEffectiveModifier;
14369     function hasSyntacticModifier(node, flags) {
14370         return !!getSelectedSyntacticModifierFlags(node, flags);
14371     }
14372     ts.hasSyntacticModifier = hasSyntacticModifier;
14373     function isStatic(node) {
14374         return ts.isClassElement(node) && hasStaticModifier(node) || ts.isClassStaticBlockDeclaration(node);
14375     }
14376     ts.isStatic = isStatic;
14377     function hasStaticModifier(node) {
14378         return hasSyntacticModifier(node, 32);
14379     }
14380     ts.hasStaticModifier = hasStaticModifier;
14381     function hasOverrideModifier(node) {
14382         return hasEffectiveModifier(node, 16384);
14383     }
14384     ts.hasOverrideModifier = hasOverrideModifier;
14385     function hasAbstractModifier(node) {
14386         return hasSyntacticModifier(node, 128);
14387     }
14388     ts.hasAbstractModifier = hasAbstractModifier;
14389     function hasAmbientModifier(node) {
14390         return hasSyntacticModifier(node, 2);
14391     }
14392     ts.hasAmbientModifier = hasAmbientModifier;
14393     function hasEffectiveReadonlyModifier(node) {
14394         return hasEffectiveModifier(node, 64);
14395     }
14396     ts.hasEffectiveReadonlyModifier = hasEffectiveReadonlyModifier;
14397     function getSelectedEffectiveModifierFlags(node, flags) {
14398         return getEffectiveModifierFlags(node) & flags;
14399     }
14400     ts.getSelectedEffectiveModifierFlags = getSelectedEffectiveModifierFlags;
14401     function getSelectedSyntacticModifierFlags(node, flags) {
14402         return getSyntacticModifierFlags(node) & flags;
14403     }
14404     ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags;
14405     function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) {
14406         if (node.kind >= 0 && node.kind <= 159) {
14407             return 0;
14408         }
14409         if (!(node.modifierFlagsCache & 536870912)) {
14410             node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912;
14411         }
14412         if (includeJSDoc && !(node.modifierFlagsCache & 4096) && (alwaysIncludeJSDoc || isInJSFile(node)) && node.parent) {
14413             node.modifierFlagsCache |= getJSDocModifierFlagsNoCache(node) | 4096;
14414         }
14415         return node.modifierFlagsCache & ~(536870912 | 4096);
14416     }
14417     function getEffectiveModifierFlags(node) {
14418         return getModifierFlagsWorker(node, true);
14419     }
14420     ts.getEffectiveModifierFlags = getEffectiveModifierFlags;
14421     function getEffectiveModifierFlagsAlwaysIncludeJSDoc(node) {
14422         return getModifierFlagsWorker(node, true, true);
14423     }
14424     ts.getEffectiveModifierFlagsAlwaysIncludeJSDoc = getEffectiveModifierFlagsAlwaysIncludeJSDoc;
14425     function getSyntacticModifierFlags(node) {
14426         return getModifierFlagsWorker(node, false);
14427     }
14428     ts.getSyntacticModifierFlags = getSyntacticModifierFlags;
14429     function getJSDocModifierFlagsNoCache(node) {
14430         var flags = 0;
14431         if (!!node.parent && !ts.isParameter(node)) {
14432             if (isInJSFile(node)) {
14433                 if (ts.getJSDocPublicTagNoCache(node))
14434                     flags |= 4;
14435                 if (ts.getJSDocPrivateTagNoCache(node))
14436                     flags |= 8;
14437                 if (ts.getJSDocProtectedTagNoCache(node))
14438                     flags |= 16;
14439                 if (ts.getJSDocReadonlyTagNoCache(node))
14440                     flags |= 64;
14441                 if (ts.getJSDocOverrideTagNoCache(node))
14442                     flags |= 16384;
14443             }
14444             if (ts.getJSDocDeprecatedTagNoCache(node))
14445                 flags |= 8192;
14446         }
14447         return flags;
14448     }
14449     function getEffectiveModifierFlagsNoCache(node) {
14450         return getSyntacticModifierFlagsNoCache(node) | getJSDocModifierFlagsNoCache(node);
14451     }
14452     ts.getEffectiveModifierFlagsNoCache = getEffectiveModifierFlagsNoCache;
14453     function getSyntacticModifierFlagsNoCache(node) {
14454         var flags = modifiersToFlags(node.modifiers);
14455         if (node.flags & 4 || (node.kind === 79 && node.isInJSDocNamespace)) {
14456             flags |= 1;
14457         }
14458         return flags;
14459     }
14460     ts.getSyntacticModifierFlagsNoCache = getSyntacticModifierFlagsNoCache;
14461     function modifiersToFlags(modifiers) {
14462         var flags = 0;
14463         if (modifiers) {
14464             for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
14465                 var modifier = modifiers_1[_i];
14466                 flags |= modifierToFlag(modifier.kind);
14467             }
14468         }
14469         return flags;
14470     }
14471     ts.modifiersToFlags = modifiersToFlags;
14472     function modifierToFlag(token) {
14473         switch (token) {
14474             case 124: return 32;
14475             case 123: return 4;
14476             case 122: return 16;
14477             case 121: return 8;
14478             case 126: return 128;
14479             case 93: return 1;
14480             case 135: return 2;
14481             case 85: return 2048;
14482             case 88: return 512;
14483             case 131: return 256;
14484             case 144: return 64;
14485             case 158: return 16384;
14486         }
14487         return 0;
14488     }
14489     ts.modifierToFlag = modifierToFlag;
14490     function createModifiers(modifierFlags) {
14491         return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
14492     }
14493     ts.createModifiers = createModifiers;
14494     function isLogicalOperator(token) {
14495         return token === 56
14496             || token === 55
14497             || token === 53;
14498     }
14499     ts.isLogicalOperator = isLogicalOperator;
14500     function isLogicalOrCoalescingAssignmentOperator(token) {
14501         return token === 75
14502             || token === 76
14503             || token === 77;
14504     }
14505     ts.isLogicalOrCoalescingAssignmentOperator = isLogicalOrCoalescingAssignmentOperator;
14506     function isLogicalOrCoalescingAssignmentExpression(expr) {
14507         return isLogicalOrCoalescingAssignmentOperator(expr.operatorToken.kind);
14508     }
14509     ts.isLogicalOrCoalescingAssignmentExpression = isLogicalOrCoalescingAssignmentExpression;
14510     function isAssignmentOperator(token) {
14511         return token >= 63 && token <= 78;
14512     }
14513     ts.isAssignmentOperator = isAssignmentOperator;
14514     function tryGetClassExtendingExpressionWithTypeArguments(node) {
14515         var cls = tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node);
14516         return cls && !cls.isImplements ? cls.class : undefined;
14517     }
14518     ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments;
14519     function tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node) {
14520         return ts.isExpressionWithTypeArguments(node)
14521             && ts.isHeritageClause(node.parent)
14522             && ts.isClassLike(node.parent.parent)
14523             ? { class: node.parent.parent, isImplements: node.parent.token === 117 }
14524             : undefined;
14525     }
14526     ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
14527     function isAssignmentExpression(node, excludeCompoundAssignment) {
14528         return ts.isBinaryExpression(node)
14529             && (excludeCompoundAssignment
14530                 ? node.operatorToken.kind === 63
14531                 : isAssignmentOperator(node.operatorToken.kind))
14532             && ts.isLeftHandSideExpression(node.left);
14533     }
14534     ts.isAssignmentExpression = isAssignmentExpression;
14535     function isLeftHandSideOfAssignment(node) {
14536         return isAssignmentExpression(node.parent) && node.parent.left === node;
14537     }
14538     ts.isLeftHandSideOfAssignment = isLeftHandSideOfAssignment;
14539     function isDestructuringAssignment(node) {
14540         if (isAssignmentExpression(node, true)) {
14541             var kind = node.left.kind;
14542             return kind === 204
14543                 || kind === 203;
14544         }
14545         return false;
14546     }
14547     ts.isDestructuringAssignment = isDestructuringAssignment;
14548     function isExpressionWithTypeArgumentsInClassExtendsClause(node) {
14549         return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined;
14550     }
14551     ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
14552     function isEntityNameExpression(node) {
14553         return node.kind === 79 || isPropertyAccessEntityNameExpression(node);
14554     }
14555     ts.isEntityNameExpression = isEntityNameExpression;
14556     function getFirstIdentifier(node) {
14557         switch (node.kind) {
14558             case 79:
14559                 return node;
14560             case 160:
14561                 do {
14562                     node = node.left;
14563                 } while (node.kind !== 79);
14564                 return node;
14565             case 205:
14566                 do {
14567                     node = node.expression;
14568                 } while (node.kind !== 79);
14569                 return node;
14570         }
14571     }
14572     ts.getFirstIdentifier = getFirstIdentifier;
14573     function isDottedName(node) {
14574         return node.kind === 79
14575             || node.kind === 108
14576             || node.kind === 106
14577             || node.kind === 230
14578             || node.kind === 205 && isDottedName(node.expression)
14579             || node.kind === 211 && isDottedName(node.expression);
14580     }
14581     ts.isDottedName = isDottedName;
14582     function isPropertyAccessEntityNameExpression(node) {
14583         return ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && isEntityNameExpression(node.expression);
14584     }
14585     ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
14586     function tryGetPropertyAccessOrIdentifierToString(expr) {
14587         if (ts.isPropertyAccessExpression(expr)) {
14588             var baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression);
14589             if (baseStr !== undefined) {
14590                 return baseStr + "." + entityNameToString(expr.name);
14591             }
14592         }
14593         else if (ts.isElementAccessExpression(expr)) {
14594             var baseStr = tryGetPropertyAccessOrIdentifierToString(expr.expression);
14595             if (baseStr !== undefined && ts.isPropertyName(expr.argumentExpression)) {
14596                 return baseStr + "." + getPropertyNameForPropertyNameNode(expr.argumentExpression);
14597             }
14598         }
14599         else if (ts.isIdentifier(expr)) {
14600             return ts.unescapeLeadingUnderscores(expr.escapedText);
14601         }
14602         return undefined;
14603     }
14604     ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
14605     function isPrototypeAccess(node) {
14606         return isBindableStaticAccessExpression(node) && getElementOrPropertyAccessName(node) === "prototype";
14607     }
14608     ts.isPrototypeAccess = isPrototypeAccess;
14609     function isRightSideOfQualifiedNameOrPropertyAccess(node) {
14610         return (node.parent.kind === 160 && node.parent.right === node) ||
14611             (node.parent.kind === 205 && node.parent.name === node);
14612     }
14613     ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
14614     function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
14615         return ts.isQualifiedName(node.parent) && node.parent.right === node
14616             || ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
14617             || ts.isJSDocMemberName(node.parent) && node.parent.right === node;
14618     }
14619     ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName;
14620     function isEmptyObjectLiteral(expression) {
14621         return expression.kind === 204 &&
14622             expression.properties.length === 0;
14623     }
14624     ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
14625     function isEmptyArrayLiteral(expression) {
14626         return expression.kind === 203 &&
14627             expression.elements.length === 0;
14628     }
14629     ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
14630     function getLocalSymbolForExportDefault(symbol) {
14631         if (!isExportDefaultSymbol(symbol) || !symbol.declarations)
14632             return undefined;
14633         for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
14634             var decl = _a[_i];
14635             if (decl.localSymbol)
14636                 return decl.localSymbol;
14637         }
14638         return undefined;
14639     }
14640     ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault;
14641     function isExportDefaultSymbol(symbol) {
14642         return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512);
14643     }
14644     function tryExtractTSExtension(fileName) {
14645         return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
14646     }
14647     ts.tryExtractTSExtension = tryExtractTSExtension;
14648     function getExpandedCharCodes(input) {
14649         var output = [];
14650         var length = input.length;
14651         for (var i = 0; i < length; i++) {
14652             var charCode = input.charCodeAt(i);
14653             if (charCode < 0x80) {
14654                 output.push(charCode);
14655             }
14656             else if (charCode < 0x800) {
14657                 output.push((charCode >> 6) | 192);
14658                 output.push((charCode & 63) | 128);
14659             }
14660             else if (charCode < 0x10000) {
14661                 output.push((charCode >> 12) | 224);
14662                 output.push(((charCode >> 6) & 63) | 128);
14663                 output.push((charCode & 63) | 128);
14664             }
14665             else if (charCode < 0x20000) {
14666                 output.push((charCode >> 18) | 240);
14667                 output.push(((charCode >> 12) & 63) | 128);
14668                 output.push(((charCode >> 6) & 63) | 128);
14669                 output.push((charCode & 63) | 128);
14670             }
14671             else {
14672                 ts.Debug.assert(false, "Unexpected code point");
14673             }
14674         }
14675         return output;
14676     }
14677     var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
14678     function convertToBase64(input) {
14679         var result = "";
14680         var charCodes = getExpandedCharCodes(input);
14681         var i = 0;
14682         var length = charCodes.length;
14683         var byte1, byte2, byte3, byte4;
14684         while (i < length) {
14685             byte1 = charCodes[i] >> 2;
14686             byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
14687             byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
14688             byte4 = charCodes[i + 2] & 63;
14689             if (i + 1 >= length) {
14690                 byte3 = byte4 = 64;
14691             }
14692             else if (i + 2 >= length) {
14693                 byte4 = 64;
14694             }
14695             result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
14696             i += 3;
14697         }
14698         return result;
14699     }
14700     ts.convertToBase64 = convertToBase64;
14701     function getStringFromExpandedCharCodes(codes) {
14702         var output = "";
14703         var i = 0;
14704         var length = codes.length;
14705         while (i < length) {
14706             var charCode = codes[i];
14707             if (charCode < 0x80) {
14708                 output += String.fromCharCode(charCode);
14709                 i++;
14710             }
14711             else if ((charCode & 192) === 192) {
14712                 var value = charCode & 63;
14713                 i++;
14714                 var nextCode = codes[i];
14715                 while ((nextCode & 192) === 128) {
14716                     value = (value << 6) | (nextCode & 63);
14717                     i++;
14718                     nextCode = codes[i];
14719                 }
14720                 output += String.fromCharCode(value);
14721             }
14722             else {
14723                 output += String.fromCharCode(charCode);
14724                 i++;
14725             }
14726         }
14727         return output;
14728     }
14729     function base64encode(host, input) {
14730         if (host && host.base64encode) {
14731             return host.base64encode(input);
14732         }
14733         return convertToBase64(input);
14734     }
14735     ts.base64encode = base64encode;
14736     function base64decode(host, input) {
14737         if (host && host.base64decode) {
14738             return host.base64decode(input);
14739         }
14740         var length = input.length;
14741         var expandedCharCodes = [];
14742         var i = 0;
14743         while (i < length) {
14744             if (input.charCodeAt(i) === base64Digits.charCodeAt(64)) {
14745                 break;
14746             }
14747             var ch1 = base64Digits.indexOf(input[i]);
14748             var ch2 = base64Digits.indexOf(input[i + 1]);
14749             var ch3 = base64Digits.indexOf(input[i + 2]);
14750             var ch4 = base64Digits.indexOf(input[i + 3]);
14751             var code1 = ((ch1 & 63) << 2) | ((ch2 >> 4) & 3);
14752             var code2 = ((ch2 & 15) << 4) | ((ch3 >> 2) & 15);
14753             var code3 = ((ch3 & 3) << 6) | (ch4 & 63);
14754             if (code2 === 0 && ch3 !== 0) {
14755                 expandedCharCodes.push(code1);
14756             }
14757             else if (code3 === 0 && ch4 !== 0) {
14758                 expandedCharCodes.push(code1, code2);
14759             }
14760             else {
14761                 expandedCharCodes.push(code1, code2, code3);
14762             }
14763             i += 4;
14764         }
14765         return getStringFromExpandedCharCodes(expandedCharCodes);
14766     }
14767     ts.base64decode = base64decode;
14768     function readJson(path, host) {
14769         try {
14770             var jsonText = host.readFile(path);
14771             if (!jsonText)
14772                 return {};
14773             var result = ts.parseConfigFileTextToJson(path, jsonText);
14774             if (result.error) {
14775                 return {};
14776             }
14777             return result.config;
14778         }
14779         catch (e) {
14780             return {};
14781         }
14782     }
14783     ts.readJson = readJson;
14784     function directoryProbablyExists(directoryName, host) {
14785         return !host.directoryExists || host.directoryExists(directoryName);
14786     }
14787     ts.directoryProbablyExists = directoryProbablyExists;
14788     var carriageReturnLineFeed = "\r\n";
14789     var lineFeed = "\n";
14790     function getNewLineCharacter(options, getNewLine) {
14791         switch (options.newLine) {
14792             case 0:
14793                 return carriageReturnLineFeed;
14794             case 1:
14795                 return lineFeed;
14796         }
14797         return getNewLine ? getNewLine() : ts.sys ? ts.sys.newLine : carriageReturnLineFeed;
14798     }
14799     ts.getNewLineCharacter = getNewLineCharacter;
14800     function createRange(pos, end) {
14801         if (end === void 0) { end = pos; }
14802         ts.Debug.assert(end >= pos || end === -1);
14803         return { pos: pos, end: end };
14804     }
14805     ts.createRange = createRange;
14806     function moveRangeEnd(range, end) {
14807         return createRange(range.pos, end);
14808     }
14809     ts.moveRangeEnd = moveRangeEnd;
14810     function moveRangePos(range, pos) {
14811         return createRange(pos, range.end);
14812     }
14813     ts.moveRangePos = moveRangePos;
14814     function moveRangePastDecorators(node) {
14815         return node.decorators && node.decorators.length > 0
14816             ? moveRangePos(node, node.decorators.end)
14817             : node;
14818     }
14819     ts.moveRangePastDecorators = moveRangePastDecorators;
14820     function moveRangePastModifiers(node) {
14821         return node.modifiers && node.modifiers.length > 0
14822             ? moveRangePos(node, node.modifiers.end)
14823             : moveRangePastDecorators(node);
14824     }
14825     ts.moveRangePastModifiers = moveRangePastModifiers;
14826     function isCollapsedRange(range) {
14827         return range.pos === range.end;
14828     }
14829     ts.isCollapsedRange = isCollapsedRange;
14830     function createTokenRange(pos, token) {
14831         return createRange(pos, pos + ts.tokenToString(token).length);
14832     }
14833     ts.createTokenRange = createTokenRange;
14834     function rangeIsOnSingleLine(range, sourceFile) {
14835         return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);
14836     }
14837     ts.rangeIsOnSingleLine = rangeIsOnSingleLine;
14838     function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {
14839         return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile, false), getStartPositionOfRange(range2, sourceFile, false), sourceFile);
14840     }
14841     ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine;
14842     function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {
14843         return positionsAreOnSameLine(range1.end, range2.end, sourceFile);
14844     }
14845     ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine;
14846     function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {
14847         return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile, false), range2.end, sourceFile);
14848     }
14849     ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd;
14850     function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {
14851         return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile, false), sourceFile);
14852     }
14853     ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
14854     function getLinesBetweenRangeEndAndRangeStart(range1, range2, sourceFile, includeSecondRangeComments) {
14855         var range2Start = getStartPositionOfRange(range2, sourceFile, includeSecondRangeComments);
14856         return ts.getLinesBetweenPositions(sourceFile, range1.end, range2Start);
14857     }
14858     ts.getLinesBetweenRangeEndAndRangeStart = getLinesBetweenRangeEndAndRangeStart;
14859     function getLinesBetweenRangeEndPositions(range1, range2, sourceFile) {
14860         return ts.getLinesBetweenPositions(sourceFile, range1.end, range2.end);
14861     }
14862     ts.getLinesBetweenRangeEndPositions = getLinesBetweenRangeEndPositions;
14863     function isNodeArrayMultiLine(list, sourceFile) {
14864         return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
14865     }
14866     ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
14867     function positionsAreOnSameLine(pos1, pos2, sourceFile) {
14868         return ts.getLinesBetweenPositions(sourceFile, pos1, pos2) === 0;
14869     }
14870     ts.positionsAreOnSameLine = positionsAreOnSameLine;
14871     function getStartPositionOfRange(range, sourceFile, includeComments) {
14872         return positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos, false, includeComments);
14873     }
14874     ts.getStartPositionOfRange = getStartPositionOfRange;
14875     function getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) {
14876         var startPos = ts.skipTrivia(sourceFile.text, pos, false, includeComments);
14877         var prevPos = getPreviousNonWhitespacePosition(startPos, stopPos, sourceFile);
14878         return ts.getLinesBetweenPositions(sourceFile, prevPos !== null && prevPos !== void 0 ? prevPos : stopPos, startPos);
14879     }
14880     ts.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter = getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter;
14881     function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) {
14882         var nextPos = ts.skipTrivia(sourceFile.text, pos, false, includeComments);
14883         return ts.getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
14884     }
14885     ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter = getLinesBetweenPositionAndNextNonWhitespaceCharacter;
14886     function getPreviousNonWhitespacePosition(pos, stopPos, sourceFile) {
14887         if (stopPos === void 0) { stopPos = 0; }
14888         while (pos-- > stopPos) {
14889             if (!ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
14890                 return pos;
14891             }
14892         }
14893     }
14894     function isDeclarationNameOfEnumOrNamespace(node) {
14895         var parseNode = ts.getParseTreeNode(node);
14896         if (parseNode) {
14897             switch (parseNode.parent.kind) {
14898                 case 259:
14899                 case 260:
14900                     return parseNode === parseNode.parent.name;
14901             }
14902         }
14903         return false;
14904     }
14905     ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace;
14906     function getInitializedVariables(node) {
14907         return ts.filter(node.declarations, isInitializedVariable);
14908     }
14909     ts.getInitializedVariables = getInitializedVariables;
14910     function isInitializedVariable(node) {
14911         return node.initializer !== undefined;
14912     }
14913     function isWatchSet(options) {
14914         return options.watch && options.hasOwnProperty("watch");
14915     }
14916     ts.isWatchSet = isWatchSet;
14917     function closeFileWatcher(watcher) {
14918         watcher.close();
14919     }
14920     ts.closeFileWatcher = closeFileWatcher;
14921     function getCheckFlags(symbol) {
14922         return symbol.flags & 33554432 ? symbol.checkFlags : 0;
14923     }
14924     ts.getCheckFlags = getCheckFlags;
14925     function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
14926         if (isWrite === void 0) { isWrite = false; }
14927         if (s.valueDeclaration) {
14928             var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 172; })) || s.valueDeclaration;
14929             var flags = ts.getCombinedModifierFlags(declaration);
14930             return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
14931         }
14932         if (getCheckFlags(s) & 6) {
14933             var checkFlags = s.checkFlags;
14934             var accessModifier = checkFlags & 1024 ? 8 :
14935                 checkFlags & 256 ? 4 :
14936                     16;
14937             var staticModifier = checkFlags & 2048 ? 32 : 0;
14938             return accessModifier | staticModifier;
14939         }
14940         if (s.flags & 4194304) {
14941             return 4 | 32;
14942         }
14943         return 0;
14944     }
14945     ts.getDeclarationModifierFlagsFromSymbol = getDeclarationModifierFlagsFromSymbol;
14946     function skipAlias(symbol, checker) {
14947         return symbol.flags & 2097152 ? checker.getAliasedSymbol(symbol) : symbol;
14948     }
14949     ts.skipAlias = skipAlias;
14950     function getCombinedLocalAndExportSymbolFlags(symbol) {
14951         return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
14952     }
14953     ts.getCombinedLocalAndExportSymbolFlags = getCombinedLocalAndExportSymbolFlags;
14954     function isWriteOnlyAccess(node) {
14955         return accessKind(node) === 1;
14956     }
14957     ts.isWriteOnlyAccess = isWriteOnlyAccess;
14958     function isWriteAccess(node) {
14959         return accessKind(node) !== 0;
14960     }
14961     ts.isWriteAccess = isWriteAccess;
14962     function accessKind(node) {
14963         var parent = node.parent;
14964         if (!parent)
14965             return 0;
14966         switch (parent.kind) {
14967             case 211:
14968                 return accessKind(parent);
14969             case 219:
14970             case 218:
14971                 var operator = parent.operator;
14972                 return operator === 45 || operator === 46 ? writeOrReadWrite() : 0;
14973             case 220:
14974                 var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
14975                 return left === node && isAssignmentOperator(operatorToken.kind) ?
14976                     operatorToken.kind === 63 ? 1 : writeOrReadWrite()
14977                     : 0;
14978             case 205:
14979                 return parent.name !== node ? 0 : accessKind(parent);
14980             case 294: {
14981                 var parentAccess = accessKind(parent.parent);
14982                 return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
14983             }
14984             case 295:
14985                 return node === parent.objectAssignmentInitializer ? 0 : accessKind(parent.parent);
14986             case 203:
14987                 return accessKind(parent);
14988             default:
14989                 return 0;
14990         }
14991         function writeOrReadWrite() {
14992             return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 237 ? 1 : 2;
14993         }
14994     }
14995     function reverseAccessKind(a) {
14996         switch (a) {
14997             case 0:
14998                 return 1;
14999             case 1:
15000                 return 0;
15001             case 2:
15002                 return 2;
15003             default:
15004                 return ts.Debug.assertNever(a);
15005         }
15006     }
15007     function compareDataObjects(dst, src) {
15008         if (!dst || !src || Object.keys(dst).length !== Object.keys(src).length) {
15009             return false;
15010         }
15011         for (var e in dst) {
15012             if (typeof dst[e] === "object") {
15013                 if (!compareDataObjects(dst[e], src[e])) {
15014                     return false;
15015                 }
15016             }
15017             else if (typeof dst[e] !== "function") {
15018                 if (dst[e] !== src[e]) {
15019                     return false;
15020                 }
15021             }
15022         }
15023         return true;
15024     }
15025     ts.compareDataObjects = compareDataObjects;
15026     function clearMap(map, onDeleteValue) {
15027         map.forEach(onDeleteValue);
15028         map.clear();
15029     }
15030     ts.clearMap = clearMap;
15031     function mutateMapSkippingNewValues(map, newMap, options) {
15032         var onDeleteValue = options.onDeleteValue, onExistingValue = options.onExistingValue;
15033         map.forEach(function (existingValue, key) {
15034             var valueInNewMap = newMap.get(key);
15035             if (valueInNewMap === undefined) {
15036                 map.delete(key);
15037                 onDeleteValue(existingValue, key);
15038             }
15039             else if (onExistingValue) {
15040                 onExistingValue(existingValue, valueInNewMap, key);
15041             }
15042         });
15043     }
15044     ts.mutateMapSkippingNewValues = mutateMapSkippingNewValues;
15045     function mutateMap(map, newMap, options) {
15046         mutateMapSkippingNewValues(map, newMap, options);
15047         var createNewValue = options.createNewValue;
15048         newMap.forEach(function (valueInNewMap, key) {
15049             if (!map.has(key)) {
15050                 map.set(key, createNewValue(key, valueInNewMap));
15051             }
15052         });
15053     }
15054     ts.mutateMap = mutateMap;
15055     function isAbstractConstructorSymbol(symbol) {
15056         if (symbol.flags & 32) {
15057             var declaration = getClassLikeDeclarationOfSymbol(symbol);
15058             return !!declaration && hasSyntacticModifier(declaration, 128);
15059         }
15060         return false;
15061     }
15062     ts.isAbstractConstructorSymbol = isAbstractConstructorSymbol;
15063     function getClassLikeDeclarationOfSymbol(symbol) {
15064         var _a;
15065         return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isClassLike);
15066     }
15067     ts.getClassLikeDeclarationOfSymbol = getClassLikeDeclarationOfSymbol;
15068     function getObjectFlags(type) {
15069         return type.flags & 3899393 ? type.objectFlags : 0;
15070     }
15071     ts.getObjectFlags = getObjectFlags;
15072     function typeHasCallOrConstructSignatures(type, checker) {
15073         return checker.getSignaturesOfType(type, 0).length !== 0 || checker.getSignaturesOfType(type, 1).length !== 0;
15074     }
15075     ts.typeHasCallOrConstructSignatures = typeHasCallOrConstructSignatures;
15076     function forSomeAncestorDirectory(directory, callback) {
15077         return !!ts.forEachAncestorDirectory(directory, function (d) { return callback(d) ? true : undefined; });
15078     }
15079     ts.forSomeAncestorDirectory = forSomeAncestorDirectory;
15080     function isUMDExportSymbol(symbol) {
15081         return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && ts.isNamespaceExportDeclaration(symbol.declarations[0]);
15082     }
15083     ts.isUMDExportSymbol = isUMDExportSymbol;
15084     function showModuleSpecifier(_a) {
15085         var moduleSpecifier = _a.moduleSpecifier;
15086         return ts.isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier);
15087     }
15088     ts.showModuleSpecifier = showModuleSpecifier;
15089     function getLastChild(node) {
15090         var lastChild;
15091         ts.forEachChild(node, function (child) {
15092             if (nodeIsPresent(child))
15093                 lastChild = child;
15094         }, function (children) {
15095             for (var i = children.length - 1; i >= 0; i--) {
15096                 if (nodeIsPresent(children[i])) {
15097                     lastChild = children[i];
15098                     break;
15099                 }
15100             }
15101         });
15102         return lastChild;
15103     }
15104     ts.getLastChild = getLastChild;
15105     function addToSeen(seen, key, value) {
15106         if (value === void 0) { value = true; }
15107         if (seen.has(key)) {
15108             return false;
15109         }
15110         seen.set(key, value);
15111         return true;
15112     }
15113     ts.addToSeen = addToSeen;
15114     function isObjectTypeDeclaration(node) {
15115         return ts.isClassLike(node) || ts.isInterfaceDeclaration(node) || ts.isTypeLiteralNode(node);
15116     }
15117     ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
15118     function isTypeNodeKind(kind) {
15119         return (kind >= 176 && kind <= 199)
15120             || kind === 130
15121             || kind === 154
15122             || kind === 146
15123             || kind === 157
15124             || kind === 147
15125             || kind === 133
15126             || kind === 149
15127             || kind === 150
15128             || kind === 114
15129             || kind === 152
15130             || kind === 143
15131             || kind === 227
15132             || kind === 310
15133             || kind === 311
15134             || kind === 312
15135             || kind === 313
15136             || kind === 314
15137             || kind === 315
15138             || kind === 316;
15139     }
15140     ts.isTypeNodeKind = isTypeNodeKind;
15141     function isAccessExpression(node) {
15142         return node.kind === 205 || node.kind === 206;
15143     }
15144     ts.isAccessExpression = isAccessExpression;
15145     function getNameOfAccessExpression(node) {
15146         if (node.kind === 205) {
15147             return node.name;
15148         }
15149         ts.Debug.assert(node.kind === 206);
15150         return node.argumentExpression;
15151     }
15152     ts.getNameOfAccessExpression = getNameOfAccessExpression;
15153     function isBundleFileTextLike(section) {
15154         switch (section.kind) {
15155             case "text":
15156             case "internal":
15157                 return true;
15158             default:
15159                 return false;
15160         }
15161     }
15162     ts.isBundleFileTextLike = isBundleFileTextLike;
15163     function isNamedImportsOrExports(node) {
15164         return node.kind === 268 || node.kind === 272;
15165     }
15166     ts.isNamedImportsOrExports = isNamedImportsOrExports;
15167     function getLeftmostAccessExpression(expr) {
15168         while (isAccessExpression(expr)) {
15169             expr = expr.expression;
15170         }
15171         return expr;
15172     }
15173     ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
15174     function getLeftmostExpression(node, stopAtCallExpressions) {
15175         while (true) {
15176             switch (node.kind) {
15177                 case 219:
15178                     node = node.operand;
15179                     continue;
15180                 case 220:
15181                     node = node.left;
15182                     continue;
15183                 case 221:
15184                     node = node.condition;
15185                     continue;
15186                 case 209:
15187                     node = node.tag;
15188                     continue;
15189                 case 207:
15190                     if (stopAtCallExpressions) {
15191                         return node;
15192                     }
15193                 case 228:
15194                 case 206:
15195                 case 205:
15196                 case 229:
15197                 case 348:
15198                     node = node.expression;
15199                     continue;
15200             }
15201             return node;
15202         }
15203     }
15204     ts.getLeftmostExpression = getLeftmostExpression;
15205     function Symbol(flags, name) {
15206         this.flags = flags;
15207         this.escapedName = name;
15208         this.declarations = undefined;
15209         this.valueDeclaration = undefined;
15210         this.id = undefined;
15211         this.mergeId = undefined;
15212         this.parent = undefined;
15213     }
15214     function Type(checker, flags) {
15215         this.flags = flags;
15216         if (ts.Debug.isDebugging || ts.tracing) {
15217             this.checker = checker;
15218         }
15219     }
15220     function Signature(checker, flags) {
15221         this.flags = flags;
15222         if (ts.Debug.isDebugging) {
15223             this.checker = checker;
15224         }
15225     }
15226     function Node(kind, pos, end) {
15227         this.pos = pos;
15228         this.end = end;
15229         this.kind = kind;
15230         this.id = 0;
15231         this.flags = 0;
15232         this.modifierFlagsCache = 0;
15233         this.transformFlags = 0;
15234         this.parent = undefined;
15235         this.original = undefined;
15236     }
15237     function Token(kind, pos, end) {
15238         this.pos = pos;
15239         this.end = end;
15240         this.kind = kind;
15241         this.id = 0;
15242         this.flags = 0;
15243         this.transformFlags = 0;
15244         this.parent = undefined;
15245     }
15246     function Identifier(kind, pos, end) {
15247         this.pos = pos;
15248         this.end = end;
15249         this.kind = kind;
15250         this.id = 0;
15251         this.flags = 0;
15252         this.transformFlags = 0;
15253         this.parent = undefined;
15254         this.original = undefined;
15255         this.flowNode = undefined;
15256     }
15257     function SourceMapSource(fileName, text, skipTrivia) {
15258         this.fileName = fileName;
15259         this.text = text;
15260         this.skipTrivia = skipTrivia || (function (pos) { return pos; });
15261     }
15262     ts.objectAllocator = {
15263         getNodeConstructor: function () { return Node; },
15264         getTokenConstructor: function () { return Token; },
15265         getIdentifierConstructor: function () { return Identifier; },
15266         getPrivateIdentifierConstructor: function () { return Node; },
15267         getSourceFileConstructor: function () { return Node; },
15268         getSymbolConstructor: function () { return Symbol; },
15269         getTypeConstructor: function () { return Type; },
15270         getSignatureConstructor: function () { return Signature; },
15271         getSourceMapSourceConstructor: function () { return SourceMapSource; },
15272     };
15273     function setObjectAllocator(alloc) {
15274         ts.objectAllocator = alloc;
15275     }
15276     ts.setObjectAllocator = setObjectAllocator;
15277     function formatStringFromArgs(text, args, baseIndex) {
15278         if (baseIndex === void 0) { baseIndex = 0; }
15279         return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
15280     }
15281     ts.formatStringFromArgs = formatStringFromArgs;
15282     function setLocalizedDiagnosticMessages(messages) {
15283         ts.localizedDiagnosticMessages = messages;
15284     }
15285     ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
15286     function getLocaleSpecificMessage(message) {
15287         return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;
15288     }
15289     ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
15290     function createDetachedDiagnostic(fileName, start, length, message) {
15291         assertDiagnosticLocation(undefined, start, length);
15292         var text = getLocaleSpecificMessage(message);
15293         if (arguments.length > 4) {
15294             text = formatStringFromArgs(text, arguments, 4);
15295         }
15296         return {
15297             file: undefined,
15298             start: start,
15299             length: length,
15300             messageText: text,
15301             category: message.category,
15302             code: message.code,
15303             reportsUnnecessary: message.reportsUnnecessary,
15304             fileName: fileName,
15305         };
15306     }
15307     ts.createDetachedDiagnostic = createDetachedDiagnostic;
15308     function isDiagnosticWithDetachedLocation(diagnostic) {
15309         return diagnostic.file === undefined
15310             && diagnostic.start !== undefined
15311             && diagnostic.length !== undefined
15312             && typeof diagnostic.fileName === "string";
15313     }
15314     function attachFileToDiagnostic(diagnostic, file) {
15315         var fileName = file.fileName || "";
15316         var length = file.text.length;
15317         ts.Debug.assertEqual(diagnostic.fileName, fileName);
15318         ts.Debug.assertLessThanOrEqual(diagnostic.start, length);
15319         ts.Debug.assertLessThanOrEqual(diagnostic.start + diagnostic.length, length);
15320         var diagnosticWithLocation = {
15321             file: file,
15322             start: diagnostic.start,
15323             length: diagnostic.length,
15324             messageText: diagnostic.messageText,
15325             category: diagnostic.category,
15326             code: diagnostic.code,
15327             reportsUnnecessary: diagnostic.reportsUnnecessary
15328         };
15329         if (diagnostic.relatedInformation) {
15330             diagnosticWithLocation.relatedInformation = [];
15331             for (var _i = 0, _a = diagnostic.relatedInformation; _i < _a.length; _i++) {
15332                 var related = _a[_i];
15333                 if (isDiagnosticWithDetachedLocation(related) && related.fileName === fileName) {
15334                     ts.Debug.assertLessThanOrEqual(related.start, length);
15335                     ts.Debug.assertLessThanOrEqual(related.start + related.length, length);
15336                     diagnosticWithLocation.relatedInformation.push(attachFileToDiagnostic(related, file));
15337                 }
15338                 else {
15339                     diagnosticWithLocation.relatedInformation.push(related);
15340                 }
15341             }
15342         }
15343         return diagnosticWithLocation;
15344     }
15345     function attachFileToDiagnostics(diagnostics, file) {
15346         var diagnosticsWithLocation = [];
15347         for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
15348             var diagnostic = diagnostics_1[_i];
15349             diagnosticsWithLocation.push(attachFileToDiagnostic(diagnostic, file));
15350         }
15351         return diagnosticsWithLocation;
15352     }
15353     ts.attachFileToDiagnostics = attachFileToDiagnostics;
15354     function createFileDiagnostic(file, start, length, message) {
15355         assertDiagnosticLocation(file, start, length);
15356         var text = getLocaleSpecificMessage(message);
15357         if (arguments.length > 4) {
15358             text = formatStringFromArgs(text, arguments, 4);
15359         }
15360         return {
15361             file: file,
15362             start: start,
15363             length: length,
15364             messageText: text,
15365             category: message.category,
15366             code: message.code,
15367             reportsUnnecessary: message.reportsUnnecessary,
15368             reportsDeprecated: message.reportsDeprecated
15369         };
15370     }
15371     ts.createFileDiagnostic = createFileDiagnostic;
15372     function formatMessage(_dummy, message) {
15373         var text = getLocaleSpecificMessage(message);
15374         if (arguments.length > 2) {
15375             text = formatStringFromArgs(text, arguments, 2);
15376         }
15377         return text;
15378     }
15379     ts.formatMessage = formatMessage;
15380     function createCompilerDiagnostic(message) {
15381         var text = getLocaleSpecificMessage(message);
15382         if (arguments.length > 1) {
15383             text = formatStringFromArgs(text, arguments, 1);
15384         }
15385         return {
15386             file: undefined,
15387             start: undefined,
15388             length: undefined,
15389             messageText: text,
15390             category: message.category,
15391             code: message.code,
15392             reportsUnnecessary: message.reportsUnnecessary,
15393             reportsDeprecated: message.reportsDeprecated
15394         };
15395     }
15396     ts.createCompilerDiagnostic = createCompilerDiagnostic;
15397     function createCompilerDiagnosticFromMessageChain(chain, relatedInformation) {
15398         return {
15399             file: undefined,
15400             start: undefined,
15401             length: undefined,
15402             code: chain.code,
15403             category: chain.category,
15404             messageText: chain.next ? chain : chain.messageText,
15405             relatedInformation: relatedInformation
15406         };
15407     }
15408     ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain;
15409     function chainDiagnosticMessages(details, message) {
15410         var text = getLocaleSpecificMessage(message);
15411         if (arguments.length > 2) {
15412             text = formatStringFromArgs(text, arguments, 2);
15413         }
15414         return {
15415             messageText: text,
15416             category: message.category,
15417             code: message.code,
15418             next: details === undefined || Array.isArray(details) ? details : [details]
15419         };
15420     }
15421     ts.chainDiagnosticMessages = chainDiagnosticMessages;
15422     function concatenateDiagnosticMessageChains(headChain, tailChain) {
15423         var lastChain = headChain;
15424         while (lastChain.next) {
15425             lastChain = lastChain.next[0];
15426         }
15427         lastChain.next = [tailChain];
15428     }
15429     ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains;
15430     function getDiagnosticFilePath(diagnostic) {
15431         return diagnostic.file ? diagnostic.file.path : undefined;
15432     }
15433     function compareDiagnostics(d1, d2) {
15434         return compareDiagnosticsSkipRelatedInformation(d1, d2) ||
15435             compareRelatedInformation(d1, d2) ||
15436             0;
15437     }
15438     ts.compareDiagnostics = compareDiagnostics;
15439     function compareDiagnosticsSkipRelatedInformation(d1, d2) {
15440         return ts.compareStringsCaseSensitive(getDiagnosticFilePath(d1), getDiagnosticFilePath(d2)) ||
15441             ts.compareValues(d1.start, d2.start) ||
15442             ts.compareValues(d1.length, d2.length) ||
15443             ts.compareValues(d1.code, d2.code) ||
15444             compareMessageText(d1.messageText, d2.messageText) ||
15445             0;
15446     }
15447     ts.compareDiagnosticsSkipRelatedInformation = compareDiagnosticsSkipRelatedInformation;
15448     function compareRelatedInformation(d1, d2) {
15449         if (!d1.relatedInformation && !d2.relatedInformation) {
15450             return 0;
15451         }
15452         if (d1.relatedInformation && d2.relatedInformation) {
15453             return ts.compareValues(d1.relatedInformation.length, d2.relatedInformation.length) || ts.forEach(d1.relatedInformation, function (d1i, index) {
15454                 var d2i = d2.relatedInformation[index];
15455                 return compareDiagnostics(d1i, d2i);
15456             }) || 0;
15457         }
15458         return d1.relatedInformation ? -1 : 1;
15459     }
15460     function compareMessageText(t1, t2) {
15461         if (typeof t1 === "string" && typeof t2 === "string") {
15462             return ts.compareStringsCaseSensitive(t1, t2);
15463         }
15464         else if (typeof t1 === "string") {
15465             return -1;
15466         }
15467         else if (typeof t2 === "string") {
15468             return 1;
15469         }
15470         var res = ts.compareStringsCaseSensitive(t1.messageText, t2.messageText);
15471         if (res) {
15472             return res;
15473         }
15474         if (!t1.next && !t2.next) {
15475             return 0;
15476         }
15477         if (!t1.next) {
15478             return -1;
15479         }
15480         if (!t2.next) {
15481             return 1;
15482         }
15483         var len = Math.min(t1.next.length, t2.next.length);
15484         for (var i = 0; i < len; i++) {
15485             res = compareMessageText(t1.next[i], t2.next[i]);
15486             if (res) {
15487                 return res;
15488             }
15489         }
15490         if (t1.next.length < t2.next.length) {
15491             return -1;
15492         }
15493         else if (t1.next.length > t2.next.length) {
15494             return 1;
15495         }
15496         return 0;
15497     }
15498     function getLanguageVariant(scriptKind) {
15499         return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 || scriptKind === 6 ? 1 : 0;
15500     }
15501     ts.getLanguageVariant = getLanguageVariant;
15502     function getEmitScriptTarget(compilerOptions) {
15503         return compilerOptions.target ||
15504             (compilerOptions.module === ts.ModuleKind.Node12 && 7) ||
15505             (compilerOptions.module === ts.ModuleKind.NodeNext && 99) ||
15506             0;
15507     }
15508     ts.getEmitScriptTarget = getEmitScriptTarget;
15509     function getEmitModuleKind(compilerOptions) {
15510         return typeof compilerOptions.module === "number" ?
15511             compilerOptions.module :
15512             getEmitScriptTarget(compilerOptions) >= 2 ? ts.ModuleKind.ES2015 : ts.ModuleKind.CommonJS;
15513     }
15514     ts.getEmitModuleKind = getEmitModuleKind;
15515     function getEmitModuleResolutionKind(compilerOptions) {
15516         var moduleResolution = compilerOptions.moduleResolution;
15517         if (moduleResolution === undefined) {
15518             switch (getEmitModuleKind(compilerOptions)) {
15519                 case ts.ModuleKind.CommonJS:
15520                     moduleResolution = ts.ModuleResolutionKind.NodeJs;
15521                     break;
15522                 case ts.ModuleKind.Node12:
15523                     moduleResolution = ts.ModuleResolutionKind.Node12;
15524                     break;
15525                 case ts.ModuleKind.NodeNext:
15526                     moduleResolution = ts.ModuleResolutionKind.NodeNext;
15527                     break;
15528                 default:
15529                     moduleResolution = ts.ModuleResolutionKind.Classic;
15530                     break;
15531             }
15532         }
15533         return moduleResolution;
15534     }
15535     ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
15536     function hasJsonModuleEmitEnabled(options) {
15537         switch (getEmitModuleKind(options)) {
15538             case ts.ModuleKind.CommonJS:
15539             case ts.ModuleKind.AMD:
15540             case ts.ModuleKind.ES2015:
15541             case ts.ModuleKind.ES2020:
15542             case ts.ModuleKind.ES2022:
15543             case ts.ModuleKind.ESNext:
15544             case ts.ModuleKind.Node12:
15545             case ts.ModuleKind.NodeNext:
15546                 return true;
15547             default:
15548                 return false;
15549         }
15550     }
15551     ts.hasJsonModuleEmitEnabled = hasJsonModuleEmitEnabled;
15552     function unreachableCodeIsError(options) {
15553         return options.allowUnreachableCode === false;
15554     }
15555     ts.unreachableCodeIsError = unreachableCodeIsError;
15556     function unusedLabelIsError(options) {
15557         return options.allowUnusedLabels === false;
15558     }
15559     ts.unusedLabelIsError = unusedLabelIsError;
15560     function getAreDeclarationMapsEnabled(options) {
15561         return !!(getEmitDeclarations(options) && options.declarationMap);
15562     }
15563     ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled;
15564     function getESModuleInterop(compilerOptions) {
15565         if (compilerOptions.esModuleInterop !== undefined) {
15566             return compilerOptions.esModuleInterop;
15567         }
15568         switch (getEmitModuleKind(compilerOptions)) {
15569             case ts.ModuleKind.Node12:
15570             case ts.ModuleKind.NodeNext:
15571                 return true;
15572         }
15573         return undefined;
15574     }
15575     ts.getESModuleInterop = getESModuleInterop;
15576     function getAllowSyntheticDefaultImports(compilerOptions) {
15577         var moduleKind = getEmitModuleKind(compilerOptions);
15578         return compilerOptions.allowSyntheticDefaultImports !== undefined
15579             ? compilerOptions.allowSyntheticDefaultImports
15580             : getESModuleInterop(compilerOptions) ||
15581                 moduleKind === ts.ModuleKind.System;
15582     }
15583     ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports;
15584     function getEmitDeclarations(compilerOptions) {
15585         return !!(compilerOptions.declaration || compilerOptions.composite);
15586     }
15587     ts.getEmitDeclarations = getEmitDeclarations;
15588     function shouldPreserveConstEnums(compilerOptions) {
15589         return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
15590     }
15591     ts.shouldPreserveConstEnums = shouldPreserveConstEnums;
15592     function isIncrementalCompilation(options) {
15593         return !!(options.incremental || options.composite);
15594     }
15595     ts.isIncrementalCompilation = isIncrementalCompilation;
15596     function getStrictOptionValue(compilerOptions, flag) {
15597         return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag];
15598     }
15599     ts.getStrictOptionValue = getStrictOptionValue;
15600     function getAllowJSCompilerOption(compilerOptions) {
15601         return compilerOptions.allowJs === undefined ? !!compilerOptions.checkJs : compilerOptions.allowJs;
15602     }
15603     ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
15604     function getUseDefineForClassFields(compilerOptions) {
15605         return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 : compilerOptions.useDefineForClassFields;
15606     }
15607     ts.getUseDefineForClassFields = getUseDefineForClassFields;
15608     function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
15609         return optionsHaveChanges(oldOptions, newOptions, ts.semanticDiagnosticsOptionDeclarations);
15610     }
15611     ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
15612     function compilerOptionsAffectEmit(newOptions, oldOptions) {
15613         return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
15614     }
15615     ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
15616     function getCompilerOptionValue(options, option) {
15617         return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
15618     }
15619     ts.getCompilerOptionValue = getCompilerOptionValue;
15620     function getJSXTransformEnabled(options) {
15621         var jsx = options.jsx;
15622         return jsx === 2 || jsx === 4 || jsx === 5;
15623     }
15624     ts.getJSXTransformEnabled = getJSXTransformEnabled;
15625     function getJSXImplicitImportBase(compilerOptions, file) {
15626         var jsxImportSourcePragmas = file === null || file === void 0 ? void 0 : file.pragmas.get("jsximportsource");
15627         var jsxImportSourcePragma = ts.isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[jsxImportSourcePragmas.length - 1] : jsxImportSourcePragmas;
15628         return compilerOptions.jsx === 4 ||
15629             compilerOptions.jsx === 5 ||
15630             compilerOptions.jsxImportSource ||
15631             jsxImportSourcePragma ?
15632             (jsxImportSourcePragma === null || jsxImportSourcePragma === void 0 ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" :
15633             undefined;
15634     }
15635     ts.getJSXImplicitImportBase = getJSXImplicitImportBase;
15636     function getJSXRuntimeImport(base, options) {
15637         return base ? "".concat(base, "/").concat(options.jsx === 5 ? "jsx-dev-runtime" : "jsx-runtime") : undefined;
15638     }
15639     ts.getJSXRuntimeImport = getJSXRuntimeImport;
15640     function hasZeroOrOneAsteriskCharacter(str) {
15641         var seenAsterisk = false;
15642         for (var i = 0; i < str.length; i++) {
15643             if (str.charCodeAt(i) === 42) {
15644                 if (!seenAsterisk) {
15645                     seenAsterisk = true;
15646                 }
15647                 else {
15648                     return false;
15649                 }
15650             }
15651         }
15652         return true;
15653     }
15654     ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter;
15655     function createSymlinkCache(cwd, getCanonicalFileName) {
15656         var symlinkedDirectories;
15657         var symlinkedDirectoriesByRealpath;
15658         var symlinkedFiles;
15659         var hasProcessedResolutions = false;
15660         return {
15661             getSymlinkedFiles: function () { return symlinkedFiles; },
15662             getSymlinkedDirectories: function () { return symlinkedDirectories; },
15663             getSymlinkedDirectoriesByRealpath: function () { return symlinkedDirectoriesByRealpath; },
15664             setSymlinkedFile: function (path, real) { return (symlinkedFiles || (symlinkedFiles = new ts.Map())).set(path, real); },
15665             setSymlinkedDirectory: function (symlink, real) {
15666                 var symlinkPath = ts.toPath(symlink, cwd, getCanonicalFileName);
15667                 if (!containsIgnoredPath(symlinkPath)) {
15668                     symlinkPath = ts.ensureTrailingDirectorySeparator(symlinkPath);
15669                     if (real !== false && !(symlinkedDirectories === null || symlinkedDirectories === void 0 ? void 0 : symlinkedDirectories.has(symlinkPath))) {
15670                         (symlinkedDirectoriesByRealpath || (symlinkedDirectoriesByRealpath = ts.createMultiMap())).add(ts.ensureTrailingDirectorySeparator(real.realPath), symlink);
15671                     }
15672                     (symlinkedDirectories || (symlinkedDirectories = new ts.Map())).set(symlinkPath, real);
15673                 }
15674             },
15675             setSymlinkedDirectoryFromSymlinkedFile: function (symlink, real) {
15676                 this.setSymlinkedFile(ts.toPath(symlink, cwd, getCanonicalFileName), real);
15677                 var _a = guessDirectorySymlink(real, symlink, cwd, getCanonicalFileName) || ts.emptyArray, commonResolved = _a[0], commonOriginal = _a[1];
15678                 if (commonResolved && commonOriginal) {
15679                     this.setSymlinkedDirectory(commonOriginal, {
15680                         real: commonResolved,
15681                         realPath: ts.toPath(commonResolved, cwd, getCanonicalFileName),
15682                     });
15683                 }
15684             },
15685             setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
15686                 var _this = this;
15687                 var _a;
15688                 ts.Debug.assert(!hasProcessedResolutions);
15689                 hasProcessedResolutions = true;
15690                 for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
15691                     var file = files_1[_i];
15692                     (_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
15693                 }
15694                 typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); });
15695             },
15696             hasProcessedResolutions: function () { return hasProcessedResolutions; },
15697         };
15698         function processResolution(cache, resolution) {
15699             if (!resolution || !resolution.originalPath || !resolution.resolvedFileName)
15700                 return;
15701             var resolvedFileName = resolution.resolvedFileName, originalPath = resolution.originalPath;
15702             cache.setSymlinkedFile(ts.toPath(originalPath, cwd, getCanonicalFileName), resolvedFileName);
15703             var _a = guessDirectorySymlink(resolvedFileName, originalPath, cwd, getCanonicalFileName) || ts.emptyArray, commonResolved = _a[0], commonOriginal = _a[1];
15704             if (commonResolved && commonOriginal) {
15705                 cache.setSymlinkedDirectory(commonOriginal, { real: commonResolved, realPath: ts.toPath(commonResolved, cwd, getCanonicalFileName) });
15706             }
15707         }
15708     }
15709     ts.createSymlinkCache = createSymlinkCache;
15710     function guessDirectorySymlink(a, b, cwd, getCanonicalFileName) {
15711         var aParts = ts.getPathComponents(ts.getNormalizedAbsolutePath(a, cwd));
15712         var bParts = ts.getPathComponents(ts.getNormalizedAbsolutePath(b, cwd));
15713         var isDirectory = false;
15714         while (aParts.length >= 2 && bParts.length >= 2 &&
15715             !isNodeModulesOrScopedPackageDirectory(aParts[aParts.length - 2], getCanonicalFileName) &&
15716             !isNodeModulesOrScopedPackageDirectory(bParts[bParts.length - 2], getCanonicalFileName) &&
15717             getCanonicalFileName(aParts[aParts.length - 1]) === getCanonicalFileName(bParts[bParts.length - 1])) {
15718             aParts.pop();
15719             bParts.pop();
15720             isDirectory = true;
15721         }
15722         return isDirectory ? [ts.getPathFromPathComponents(aParts), ts.getPathFromPathComponents(bParts)] : undefined;
15723     }
15724     function isNodeModulesOrScopedPackageDirectory(s, getCanonicalFileName) {
15725         return s !== undefined && (getCanonicalFileName(s) === "node_modules" || ts.startsWith(s, "@"));
15726     }
15727     function stripLeadingDirectorySeparator(s) {
15728         return ts.isAnyDirectorySeparator(s.charCodeAt(0)) ? s.slice(1) : undefined;
15729     }
15730     function tryRemoveDirectoryPrefix(path, dirPath, getCanonicalFileName) {
15731         var withoutPrefix = ts.tryRemovePrefix(path, dirPath, getCanonicalFileName);
15732         return withoutPrefix === undefined ? undefined : stripLeadingDirectorySeparator(withoutPrefix);
15733     }
15734     ts.tryRemoveDirectoryPrefix = tryRemoveDirectoryPrefix;
15735     var reservedCharacterPattern = /[^\w\s\/]/g;
15736     function regExpEscape(text) {
15737         return text.replace(reservedCharacterPattern, escapeRegExpCharacter);
15738     }
15739     ts.regExpEscape = regExpEscape;
15740     function escapeRegExpCharacter(match) {
15741         return "\\" + match;
15742     }
15743     var wildcardCharCodes = [42, 63];
15744     ts.commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"];
15745     var implicitExcludePathRegexPattern = "(?!(".concat(ts.commonPackageFolders.join("|"), ")(/|$))");
15746     var filesMatcher = {
15747         singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*",
15748         doubleAsteriskRegexFragment: "(/".concat(implicitExcludePathRegexPattern, "[^/.][^/]*)*?"),
15749         replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment); }
15750     };
15751     var directoriesMatcher = {
15752         singleAsteriskRegexFragment: "[^/]*",
15753         doubleAsteriskRegexFragment: "(/".concat(implicitExcludePathRegexPattern, "[^/.][^/]*)*?"),
15754         replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment); }
15755     };
15756     var excludeMatcher = {
15757         singleAsteriskRegexFragment: "[^/]*",
15758         doubleAsteriskRegexFragment: "(/.+?)?",
15759         replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment); }
15760     };
15761     var wildcardMatchers = {
15762         files: filesMatcher,
15763         directories: directoriesMatcher,
15764         exclude: excludeMatcher
15765     };
15766     function getRegularExpressionForWildcard(specs, basePath, usage) {
15767         var patterns = getRegularExpressionsForWildcards(specs, basePath, usage);
15768         if (!patterns || !patterns.length) {
15769             return undefined;
15770         }
15771         var pattern = patterns.map(function (pattern) { return "(".concat(pattern, ")"); }).join("|");
15772         var terminator = usage === "exclude" ? "($|/)" : "$";
15773         return "^(".concat(pattern, ")").concat(terminator);
15774     }
15775     ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard;
15776     function getRegularExpressionsForWildcards(specs, basePath, usage) {
15777         if (specs === undefined || specs.length === 0) {
15778             return undefined;
15779         }
15780         return ts.flatMap(specs, function (spec) {
15781             return spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
15782         });
15783     }
15784     ts.getRegularExpressionsForWildcards = getRegularExpressionsForWildcards;
15785     function isImplicitGlob(lastPathComponent) {
15786         return !/[.*?]/.test(lastPathComponent);
15787     }
15788     ts.isImplicitGlob = isImplicitGlob;
15789     function getPatternFromSpec(spec, basePath, usage) {
15790         var pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
15791         return pattern && "^(".concat(pattern, ")").concat(usage === "exclude" ? "($|/)" : "$");
15792     }
15793     ts.getPatternFromSpec = getPatternFromSpec;
15794     function getSubPatternFromSpec(spec, basePath, usage, _a) {
15795         var singleAsteriskRegexFragment = _a.singleAsteriskRegexFragment, doubleAsteriskRegexFragment = _a.doubleAsteriskRegexFragment, replaceWildcardCharacter = _a.replaceWildcardCharacter;
15796         var subpattern = "";
15797         var hasWrittenComponent = false;
15798         var components = ts.getNormalizedPathComponents(spec, basePath);
15799         var lastComponent = ts.last(components);
15800         if (usage !== "exclude" && lastComponent === "**") {
15801             return undefined;
15802         }
15803         components[0] = ts.removeTrailingDirectorySeparator(components[0]);
15804         if (isImplicitGlob(lastComponent)) {
15805             components.push("**", "*");
15806         }
15807         var optionalCount = 0;
15808         for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
15809             var component = components_1[_i];
15810             if (component === "**") {
15811                 subpattern += doubleAsteriskRegexFragment;
15812             }
15813             else {
15814                 if (usage === "directories") {
15815                     subpattern += "(";
15816                     optionalCount++;
15817                 }
15818                 if (hasWrittenComponent) {
15819                     subpattern += ts.directorySeparator;
15820                 }
15821                 if (usage !== "exclude") {
15822                     var componentPattern = "";
15823                     if (component.charCodeAt(0) === 42) {
15824                         componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?";
15825                         component = component.substr(1);
15826                     }
15827                     else if (component.charCodeAt(0) === 63) {
15828                         componentPattern += "[^./]";
15829                         component = component.substr(1);
15830                     }
15831                     componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
15832                     if (componentPattern !== component) {
15833                         subpattern += implicitExcludePathRegexPattern;
15834                     }
15835                     subpattern += componentPattern;
15836                 }
15837                 else {
15838                     subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
15839                 }
15840             }
15841             hasWrittenComponent = true;
15842         }
15843         while (optionalCount > 0) {
15844             subpattern += ")?";
15845             optionalCount--;
15846         }
15847         return subpattern;
15848     }
15849     function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
15850         return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
15851     }
15852     function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
15853         path = ts.normalizePath(path);
15854         currentDirectory = ts.normalizePath(currentDirectory);
15855         var absolutePath = ts.combinePaths(currentDirectory, path);
15856         return {
15857             includeFilePatterns: ts.map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^".concat(pattern, "$"); }),
15858             includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
15859             includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
15860             excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
15861             basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
15862         };
15863     }
15864     ts.getFileMatcherPatterns = getFileMatcherPatterns;
15865     function getRegexFromPattern(pattern, useCaseSensitiveFileNames) {
15866         return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
15867     }
15868     ts.getRegexFromPattern = getRegexFromPattern;
15869     function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
15870         path = ts.normalizePath(path);
15871         currentDirectory = ts.normalizePath(currentDirectory);
15872         var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
15873         var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return getRegexFromPattern(pattern, useCaseSensitiveFileNames); });
15874         var includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames);
15875         var excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames);
15876         var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]];
15877         var visited = new ts.Map();
15878         var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
15879         for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
15880             var basePath = _a[_i];
15881             visitDirectory(basePath, ts.combinePaths(currentDirectory, basePath), depth);
15882         }
15883         return ts.flatten(results);
15884         function visitDirectory(path, absolutePath, depth) {
15885             var canonicalPath = toCanonical(realpath(absolutePath));
15886             if (visited.has(canonicalPath))
15887                 return;
15888             visited.set(canonicalPath, true);
15889             var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
15890             var _loop_1 = function (current) {
15891                 var name = ts.combinePaths(path, current);
15892                 var absoluteName = ts.combinePaths(absolutePath, current);
15893                 if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
15894                     return "continue";
15895                 if (excludeRegex && excludeRegex.test(absoluteName))
15896                     return "continue";
15897                 if (!includeFileRegexes) {
15898                     results[0].push(name);
15899                 }
15900                 else {
15901                     var includeIndex = ts.findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); });
15902                     if (includeIndex !== -1) {
15903                         results[includeIndex].push(name);
15904                     }
15905                 }
15906             };
15907             for (var _i = 0, _b = ts.sort(files, ts.compareStringsCaseSensitive); _i < _b.length; _i++) {
15908                 var current = _b[_i];
15909                 _loop_1(current);
15910             }
15911             if (depth !== undefined) {
15912                 depth--;
15913                 if (depth === 0) {
15914                     return;
15915                 }
15916             }
15917             for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
15918                 var current = _d[_c];
15919                 var name = ts.combinePaths(path, current);
15920                 var absoluteName = ts.combinePaths(absolutePath, current);
15921                 if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
15922                     (!excludeRegex || !excludeRegex.test(absoluteName))) {
15923                     visitDirectory(name, absoluteName, depth);
15924                 }
15925             }
15926         }
15927     }
15928     ts.matchFiles = matchFiles;
15929     function getBasePaths(path, includes, useCaseSensitiveFileNames) {
15930         var basePaths = [path];
15931         if (includes) {
15932             var includeBasePaths = [];
15933             for (var _i = 0, includes_1 = includes; _i < includes_1.length; _i++) {
15934                 var include = includes_1[_i];
15935                 var absolute = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(path, include));
15936                 includeBasePaths.push(getIncludeBasePath(absolute));
15937             }
15938             includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
15939             var _loop_2 = function (includeBasePath) {
15940                 if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) {
15941                     basePaths.push(includeBasePath);
15942                 }
15943             };
15944             for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) {
15945                 var includeBasePath = includeBasePaths_1[_a];
15946                 _loop_2(includeBasePath);
15947             }
15948         }
15949         return basePaths;
15950     }
15951     function getIncludeBasePath(absolute) {
15952         var wildcardOffset = ts.indexOfAnyCharCode(absolute, wildcardCharCodes);
15953         if (wildcardOffset < 0) {
15954             return !ts.hasExtension(absolute)
15955                 ? absolute
15956                 : ts.removeTrailingDirectorySeparator(ts.getDirectoryPath(absolute));
15957         }
15958         return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset));
15959     }
15960     function ensureScriptKind(fileName, scriptKind) {
15961         return scriptKind || getScriptKindFromFileName(fileName) || 3;
15962     }
15963     ts.ensureScriptKind = ensureScriptKind;
15964     function getScriptKindFromFileName(fileName) {
15965         var ext = fileName.substr(fileName.lastIndexOf("."));
15966         switch (ext.toLowerCase()) {
15967             case ".js":
15968             case ".cjs":
15969             case ".mjs":
15970                 return 1;
15971             case ".jsx":
15972                 return 2;
15973             case ".ts":
15974             case ".cts":
15975             case ".mts":
15976                 return 3;
15977             case ".tsx":
15978                 return 4;
15979             case ".json":
15980                 return 6;
15981             default:
15982                 return 0;
15983         }
15984     }
15985     ts.getScriptKindFromFileName = getScriptKindFromFileName;
15986     ts.supportedTSExtensions = [[".ts", ".tsx", ".d.ts"], [".cts", ".d.cts"], [".mts", ".d.mts"]];
15987     ts.supportedTSExtensionsFlat = ts.flatten(ts.supportedTSExtensions);
15988     var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), [[".json"]], false);
15989     var supportedTSExtensionsForExtractExtension = [".d.ts", ".d.cts", ".d.mts", ".cts", ".mts", ".ts", ".tsx", ".cts", ".mts"];
15990     ts.supportedJSExtensions = [[".js", ".jsx"], [".mjs"], [".cjs"]];
15991     ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
15992     var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"]];
15993     var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json"]], false);
15994     function getSupportedExtensions(options, extraFileExtensions) {
15995         var needJsExtensions = options && getAllowJSCompilerOption(options);
15996         if (!extraFileExtensions || extraFileExtensions.length === 0) {
15997             return needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
15998         }
15999         var builtins = needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
16000         var flatBuiltins = ts.flatten(builtins);
16001         var extensions = __spreadArray(__spreadArray([], builtins, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension) === -1 ? [x.extension] : undefined; }), true);
16002         return extensions;
16003     }
16004     ts.getSupportedExtensions = getSupportedExtensions;
16005     function getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) {
16006         if (!options || !options.resolveJsonModule)
16007             return supportedExtensions;
16008         if (supportedExtensions === allSupportedExtensions)
16009             return allSupportedExtensionsWithJson;
16010         if (supportedExtensions === ts.supportedTSExtensions)
16011             return supportedTSExtensionsWithJson;
16012         return __spreadArray(__spreadArray([], supportedExtensions, true), [[".json"]], false);
16013     }
16014     ts.getSupportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule;
16015     function isJSLike(scriptKind) {
16016         return scriptKind === 1 || scriptKind === 2;
16017     }
16018     function hasJSFileExtension(fileName) {
16019         return ts.some(ts.supportedJSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
16020     }
16021     ts.hasJSFileExtension = hasJSFileExtension;
16022     function hasTSFileExtension(fileName) {
16023         return ts.some(ts.supportedTSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
16024     }
16025     ts.hasTSFileExtension = hasTSFileExtension;
16026     function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
16027         if (!fileName)
16028             return false;
16029         var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
16030         for (var _i = 0, _a = ts.flatten(getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)); _i < _a.length; _i++) {
16031             var extension = _a[_i];
16032             if (ts.fileExtensionIs(fileName, extension)) {
16033                 return true;
16034             }
16035         }
16036         return false;
16037     }
16038     ts.isSupportedSourceFileName = isSupportedSourceFileName;
16039     function numberOfDirectorySeparators(str) {
16040         var match = str.match(/\//g);
16041         return match ? match.length : 0;
16042     }
16043     function compareNumberOfDirectorySeparators(path1, path2) {
16044         return ts.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2));
16045     }
16046     ts.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators;
16047     var extensionsToRemove = [".d.ts", ".d.mts", ".d.cts", ".mjs", ".mts", ".cjs", ".cts", ".ts", ".js", ".tsx", ".jsx", ".json"];
16048     function removeFileExtension(path) {
16049         for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
16050             var ext = extensionsToRemove_1[_i];
16051             var extensionless = tryRemoveExtension(path, ext);
16052             if (extensionless !== undefined) {
16053                 return extensionless;
16054             }
16055         }
16056         return path;
16057     }
16058     ts.removeFileExtension = removeFileExtension;
16059     function tryRemoveExtension(path, extension) {
16060         return ts.fileExtensionIs(path, extension) ? removeExtension(path, extension) : undefined;
16061     }
16062     ts.tryRemoveExtension = tryRemoveExtension;
16063     function removeExtension(path, extension) {
16064         return path.substring(0, path.length - extension.length);
16065     }
16066     ts.removeExtension = removeExtension;
16067     function changeExtension(path, newExtension) {
16068         return ts.changeAnyExtension(path, newExtension, extensionsToRemove, false);
16069     }
16070     ts.changeExtension = changeExtension;
16071     function tryParsePattern(pattern) {
16072         var indexOfStar = pattern.indexOf("*");
16073         if (indexOfStar === -1) {
16074             return pattern;
16075         }
16076         return pattern.indexOf("*", indexOfStar + 1) !== -1
16077             ? undefined
16078             : {
16079                 prefix: pattern.substr(0, indexOfStar),
16080                 suffix: pattern.substr(indexOfStar + 1)
16081             };
16082     }
16083     ts.tryParsePattern = tryParsePattern;
16084     function tryParsePatterns(paths) {
16085         return ts.mapDefined(ts.getOwnKeys(paths), function (path) { return tryParsePattern(path); });
16086     }
16087     ts.tryParsePatterns = tryParsePatterns;
16088     function positionIsSynthesized(pos) {
16089         return !(pos >= 0);
16090     }
16091     ts.positionIsSynthesized = positionIsSynthesized;
16092     function extensionIsTS(ext) {
16093         return ext === ".ts" || ext === ".tsx" || ext === ".d.ts" || ext === ".cts" || ext === ".mts" || ext === ".d.mts" || ext === ".d.cts";
16094     }
16095     ts.extensionIsTS = extensionIsTS;
16096     function resolutionExtensionIsTSOrJson(ext) {
16097         return extensionIsTS(ext) || ext === ".json";
16098     }
16099     ts.resolutionExtensionIsTSOrJson = resolutionExtensionIsTSOrJson;
16100     function extensionFromPath(path) {
16101         var ext = tryGetExtensionFromPath(path);
16102         return ext !== undefined ? ext : ts.Debug.fail("File ".concat(path, " has unknown extension."));
16103     }
16104     ts.extensionFromPath = extensionFromPath;
16105     function isAnySupportedFileExtension(path) {
16106         return tryGetExtensionFromPath(path) !== undefined;
16107     }
16108     ts.isAnySupportedFileExtension = isAnySupportedFileExtension;
16109     function tryGetExtensionFromPath(path) {
16110         return ts.find(extensionsToRemove, function (e) { return ts.fileExtensionIs(path, e); });
16111     }
16112     ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
16113     function isCheckJsEnabledForFile(sourceFile, compilerOptions) {
16114         return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs;
16115     }
16116     ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile;
16117     ts.emptyFileSystemEntries = {
16118         files: ts.emptyArray,
16119         directories: ts.emptyArray
16120     };
16121     function matchPatternOrExact(patternOrStrings, candidate) {
16122         var patterns = [];
16123         for (var _i = 0, patternOrStrings_1 = patternOrStrings; _i < patternOrStrings_1.length; _i++) {
16124             var patternOrString = patternOrStrings_1[_i];
16125             if (patternOrString === candidate) {
16126                 return candidate;
16127             }
16128             if (!ts.isString(patternOrString)) {
16129                 patterns.push(patternOrString);
16130             }
16131         }
16132         return ts.findBestPatternMatch(patterns, function (_) { return _; }, candidate);
16133     }
16134     ts.matchPatternOrExact = matchPatternOrExact;
16135     function sliceAfter(arr, value) {
16136         var index = arr.indexOf(value);
16137         ts.Debug.assert(index !== -1);
16138         return arr.slice(index);
16139     }
16140     ts.sliceAfter = sliceAfter;
16141     function addRelatedInfo(diagnostic) {
16142         var _a;
16143         var relatedInformation = [];
16144         for (var _i = 1; _i < arguments.length; _i++) {
16145             relatedInformation[_i - 1] = arguments[_i];
16146         }
16147         if (!relatedInformation.length) {
16148             return diagnostic;
16149         }
16150         if (!diagnostic.relatedInformation) {
16151             diagnostic.relatedInformation = [];
16152         }
16153         ts.Debug.assert(diagnostic.relatedInformation !== ts.emptyArray, "Diagnostic had empty array singleton for related info, but is still being constructed!");
16154         (_a = diagnostic.relatedInformation).push.apply(_a, relatedInformation);
16155         return diagnostic;
16156     }
16157     ts.addRelatedInfo = addRelatedInfo;
16158     function minAndMax(arr, getValue) {
16159         ts.Debug.assert(arr.length !== 0);
16160         var min = getValue(arr[0]);
16161         var max = min;
16162         for (var i = 1; i < arr.length; i++) {
16163             var value = getValue(arr[i]);
16164             if (value < min) {
16165                 min = value;
16166             }
16167             else if (value > max) {
16168                 max = value;
16169             }
16170         }
16171         return { min: min, max: max };
16172     }
16173     ts.minAndMax = minAndMax;
16174     function rangeOfNode(node) {
16175         return { pos: getTokenPosOfNode(node), end: node.end };
16176     }
16177     ts.rangeOfNode = rangeOfNode;
16178     function rangeOfTypeParameters(sourceFile, typeParameters) {
16179         var pos = typeParameters.pos - 1;
16180         var end = ts.skipTrivia(sourceFile.text, typeParameters.end) + 1;
16181         return { pos: pos, end: end };
16182     }
16183     ts.rangeOfTypeParameters = rangeOfTypeParameters;
16184     function skipTypeChecking(sourceFile, options, host) {
16185         return (options.skipLibCheck && sourceFile.isDeclarationFile ||
16186             options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) ||
16187             host.isSourceOfProjectReferenceRedirect(sourceFile.fileName);
16188     }
16189     ts.skipTypeChecking = skipTypeChecking;
16190     function isJsonEqual(a, b) {
16191         return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && ts.equalOwnProperties(a, b, isJsonEqual);
16192     }
16193     ts.isJsonEqual = isJsonEqual;
16194     function parsePseudoBigInt(stringValue) {
16195         var log2Base;
16196         switch (stringValue.charCodeAt(1)) {
16197             case 98:
16198             case 66:
16199                 log2Base = 1;
16200                 break;
16201             case 111:
16202             case 79:
16203                 log2Base = 3;
16204                 break;
16205             case 120:
16206             case 88:
16207                 log2Base = 4;
16208                 break;
16209             default:
16210                 var nIndex = stringValue.length - 1;
16211                 var nonZeroStart = 0;
16212                 while (stringValue.charCodeAt(nonZeroStart) === 48) {
16213                     nonZeroStart++;
16214                 }
16215                 return stringValue.slice(nonZeroStart, nIndex) || "0";
16216         }
16217         var startIndex = 2, endIndex = stringValue.length - 1;
16218         var bitsNeeded = (endIndex - startIndex) * log2Base;
16219         var segments = new Uint16Array((bitsNeeded >>> 4) + (bitsNeeded & 15 ? 1 : 0));
16220         for (var i = endIndex - 1, bitOffset = 0; i >= startIndex; i--, bitOffset += log2Base) {
16221             var segment = bitOffset >>> 4;
16222             var digitChar = stringValue.charCodeAt(i);
16223             var digit = digitChar <= 57
16224                 ? digitChar - 48
16225                 : 10 + digitChar -
16226                     (digitChar <= 70 ? 65 : 97);
16227             var shiftedDigit = digit << (bitOffset & 15);
16228             segments[segment] |= shiftedDigit;
16229             var residual = shiftedDigit >>> 16;
16230             if (residual)
16231                 segments[segment + 1] |= residual;
16232         }
16233         var base10Value = "";
16234         var firstNonzeroSegment = segments.length - 1;
16235         var segmentsRemaining = true;
16236         while (segmentsRemaining) {
16237             var mod10 = 0;
16238             segmentsRemaining = false;
16239             for (var segment = firstNonzeroSegment; segment >= 0; segment--) {
16240                 var newSegment = mod10 << 16 | segments[segment];
16241                 var segmentValue = (newSegment / 10) | 0;
16242                 segments[segment] = segmentValue;
16243                 mod10 = newSegment - segmentValue * 10;
16244                 if (segmentValue && !segmentsRemaining) {
16245                     firstNonzeroSegment = segment;
16246                     segmentsRemaining = true;
16247                 }
16248             }
16249             base10Value = mod10 + base10Value;
16250         }
16251         return base10Value;
16252     }
16253     ts.parsePseudoBigInt = parsePseudoBigInt;
16254     function pseudoBigIntToString(_a) {
16255         var negative = _a.negative, base10Value = _a.base10Value;
16256         return (negative && base10Value !== "0" ? "-" : "") + base10Value;
16257     }
16258     ts.pseudoBigIntToString = pseudoBigIntToString;
16259     function isValidTypeOnlyAliasUseSite(useSite) {
16260         return !!(useSite.flags & 8388608)
16261             || isPartOfTypeQuery(useSite)
16262             || isIdentifierInNonEmittingHeritageClause(useSite)
16263             || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
16264             || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
16265     }
16266     ts.isValidTypeOnlyAliasUseSite = isValidTypeOnlyAliasUseSite;
16267     function isShorthandPropertyNameUseSite(useSite) {
16268         return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite;
16269     }
16270     function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) {
16271         while (node.kind === 79 || node.kind === 205) {
16272             node = node.parent;
16273         }
16274         if (node.kind !== 161) {
16275             return false;
16276         }
16277         if (hasSyntacticModifier(node.parent, 128)) {
16278             return true;
16279         }
16280         var containerKind = node.parent.parent.kind;
16281         return containerKind === 257 || containerKind === 181;
16282     }
16283     function isIdentifierInNonEmittingHeritageClause(node) {
16284         if (node.kind !== 79)
16285             return false;
16286         var heritageClause = ts.findAncestor(node.parent, function (parent) {
16287             switch (parent.kind) {
16288                 case 290:
16289                     return true;
16290                 case 205:
16291                 case 227:
16292                     return false;
16293                 default:
16294                     return "quit";
16295             }
16296         });
16297         return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 257;
16298     }
16299     function isIdentifierTypeReference(node) {
16300         return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName);
16301     }
16302     ts.isIdentifierTypeReference = isIdentifierTypeReference;
16303     function arrayIsHomogeneous(array, comparer) {
16304         if (comparer === void 0) { comparer = ts.equateValues; }
16305         if (array.length < 2)
16306             return true;
16307         var first = array[0];
16308         for (var i = 1, length_1 = array.length; i < length_1; i++) {
16309             var target = array[i];
16310             if (!comparer(first, target))
16311                 return false;
16312         }
16313         return true;
16314     }
16315     ts.arrayIsHomogeneous = arrayIsHomogeneous;
16316     function setTextRangePos(range, pos) {
16317         range.pos = pos;
16318         return range;
16319     }
16320     ts.setTextRangePos = setTextRangePos;
16321     function setTextRangeEnd(range, end) {
16322         range.end = end;
16323         return range;
16324     }
16325     ts.setTextRangeEnd = setTextRangeEnd;
16326     function setTextRangePosEnd(range, pos, end) {
16327         return setTextRangeEnd(setTextRangePos(range, pos), end);
16328     }
16329     ts.setTextRangePosEnd = setTextRangePosEnd;
16330     function setTextRangePosWidth(range, pos, width) {
16331         return setTextRangePosEnd(range, pos, pos + width);
16332     }
16333     ts.setTextRangePosWidth = setTextRangePosWidth;
16334     function setNodeFlags(node, newFlags) {
16335         if (node) {
16336             node.flags = newFlags;
16337         }
16338         return node;
16339     }
16340     ts.setNodeFlags = setNodeFlags;
16341     function setParent(child, parent) {
16342         if (child && parent) {
16343             child.parent = parent;
16344         }
16345         return child;
16346     }
16347     ts.setParent = setParent;
16348     function setEachParent(children, parent) {
16349         if (children) {
16350             for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
16351                 var child = children_1[_i];
16352                 setParent(child, parent);
16353             }
16354         }
16355         return children;
16356     }
16357     ts.setEachParent = setEachParent;
16358     function setParentRecursive(rootNode, incremental) {
16359         if (!rootNode)
16360             return rootNode;
16361         ts.forEachChildRecursively(rootNode, ts.isJSDocNode(rootNode) ? bindParentToChildIgnoringJSDoc : bindParentToChild);
16362         return rootNode;
16363         function bindParentToChildIgnoringJSDoc(child, parent) {
16364             if (incremental && child.parent === parent) {
16365                 return "skip";
16366             }
16367             setParent(child, parent);
16368         }
16369         function bindJSDoc(child) {
16370             if (ts.hasJSDocNodes(child)) {
16371                 for (var _i = 0, _a = child.jsDoc; _i < _a.length; _i++) {
16372                     var doc = _a[_i];
16373                     bindParentToChildIgnoringJSDoc(doc, child);
16374                     ts.forEachChildRecursively(doc, bindParentToChildIgnoringJSDoc);
16375                 }
16376             }
16377         }
16378         function bindParentToChild(child, parent) {
16379             return bindParentToChildIgnoringJSDoc(child, parent) || bindJSDoc(child);
16380         }
16381     }
16382     ts.setParentRecursive = setParentRecursive;
16383     function isPackedElement(node) {
16384         return !ts.isOmittedExpression(node);
16385     }
16386     function isPackedArrayLiteral(node) {
16387         return ts.isArrayLiteralExpression(node) && ts.every(node.elements, isPackedElement);
16388     }
16389     ts.isPackedArrayLiteral = isPackedArrayLiteral;
16390     function expressionResultIsUnused(node) {
16391         ts.Debug.assertIsDefined(node.parent);
16392         while (true) {
16393             var parent = node.parent;
16394             if (ts.isParenthesizedExpression(parent)) {
16395                 node = parent;
16396                 continue;
16397             }
16398             if (ts.isExpressionStatement(parent) ||
16399                 ts.isVoidExpression(parent) ||
16400                 ts.isForStatement(parent) && (parent.initializer === node || parent.incrementor === node)) {
16401                 return true;
16402             }
16403             if (ts.isCommaListExpression(parent)) {
16404                 if (node !== ts.last(parent.elements))
16405                     return true;
16406                 node = parent;
16407                 continue;
16408             }
16409             if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 27) {
16410                 if (node === parent.left)
16411                     return true;
16412                 node = parent;
16413                 continue;
16414             }
16415             return false;
16416         }
16417     }
16418     ts.expressionResultIsUnused = expressionResultIsUnused;
16419     function containsIgnoredPath(path) {
16420         return ts.some(ts.ignoredPaths, function (p) { return ts.stringContains(path, p); });
16421     }
16422     ts.containsIgnoredPath = containsIgnoredPath;
16423     function getContainingNodeArray(node) {
16424         if (!node.parent)
16425             return undefined;
16426         switch (node.kind) {
16427             case 162:
16428                 var parent_1 = node.parent;
16429                 return parent_1.kind === 189 ? undefined : parent_1.typeParameters;
16430             case 163:
16431                 return node.parent.parameters;
16432             case 198:
16433                 return node.parent.templateSpans;
16434             case 232:
16435                 return node.parent.templateSpans;
16436             case 164:
16437                 return node.parent.decorators;
16438             case 290:
16439                 return node.parent.heritageClauses;
16440         }
16441         var parent = node.parent;
16442         if (ts.isJSDocTag(node)) {
16443             return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags;
16444         }
16445         switch (parent.kind) {
16446             case 181:
16447             case 257:
16448                 return ts.isTypeElement(node) ? parent.members : undefined;
16449             case 186:
16450             case 187:
16451                 return parent.types;
16452             case 183:
16453             case 203:
16454             case 349:
16455             case 268:
16456             case 272:
16457                 return parent.elements;
16458             case 204:
16459             case 285:
16460                 return parent.properties;
16461             case 207:
16462             case 208:
16463                 return ts.isTypeNode(node) ? parent.typeArguments :
16464                     parent.expression === node ? undefined :
16465                         parent.arguments;
16466             case 277:
16467             case 281:
16468                 return ts.isJsxChild(node) ? parent.children : undefined;
16469             case 279:
16470             case 278:
16471                 return ts.isTypeNode(node) ? parent.typeArguments : undefined;
16472             case 234:
16473             case 288:
16474             case 289:
16475             case 261:
16476                 return parent.statements;
16477             case 262:
16478                 return parent.clauses;
16479             case 256:
16480             case 225:
16481                 return ts.isClassElement(node) ? parent.members : undefined;
16482             case 259:
16483                 return ts.isEnumMember(node) ? parent.members : undefined;
16484             case 303:
16485                 return parent.statements;
16486         }
16487     }
16488     ts.getContainingNodeArray = getContainingNodeArray;
16489     function hasContextSensitiveParameters(node) {
16490         if (!node.typeParameters) {
16491             if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) {
16492                 return true;
16493             }
16494             if (node.kind !== 213) {
16495                 var parameter = ts.firstOrUndefined(node.parameters);
16496                 if (!(parameter && parameterIsThisKeyword(parameter))) {
16497                     return true;
16498                 }
16499             }
16500         }
16501         return false;
16502     }
16503     ts.hasContextSensitiveParameters = hasContextSensitiveParameters;
16504     function isInfinityOrNaNString(name) {
16505         return name === "Infinity" || name === "-Infinity" || name === "NaN";
16506     }
16507     ts.isInfinityOrNaNString = isInfinityOrNaNString;
16508     function isCatchClauseVariableDeclaration(node) {
16509         return node.kind === 253 && node.parent.kind === 291;
16510     }
16511     ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration;
16512     function isParameterOrCatchClauseVariable(symbol) {
16513         var declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
16514         return !!declaration && (ts.isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
16515     }
16516     ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable;
16517     function isFunctionExpressionOrArrowFunction(node) {
16518         return node.kind === 212 || node.kind === 213;
16519     }
16520     ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
16521     function escapeSnippetText(text) {
16522         return text.replace(/\$/gm, "\\$");
16523     }
16524     ts.escapeSnippetText = escapeSnippetText;
16525 })(ts || (ts = {}));
16526 var ts;
16527 (function (ts) {
16528     function createBaseNodeFactory() {
16529         var NodeConstructor;
16530         var TokenConstructor;
16531         var IdentifierConstructor;
16532         var PrivateIdentifierConstructor;
16533         var SourceFileConstructor;
16534         return {
16535             createBaseSourceFileNode: createBaseSourceFileNode,
16536             createBaseIdentifierNode: createBaseIdentifierNode,
16537             createBasePrivateIdentifierNode: createBasePrivateIdentifierNode,
16538             createBaseTokenNode: createBaseTokenNode,
16539             createBaseNode: createBaseNode
16540         };
16541         function createBaseSourceFileNode(kind) {
16542             return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, -1, -1);
16543         }
16544         function createBaseIdentifierNode(kind) {
16545             return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, -1, -1);
16546         }
16547         function createBasePrivateIdentifierNode(kind) {
16548             return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = ts.objectAllocator.getPrivateIdentifierConstructor()))(kind, -1, -1);
16549         }
16550         function createBaseTokenNode(kind) {
16551             return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, -1, -1);
16552         }
16553         function createBaseNode(kind) {
16554             return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, -1, -1);
16555         }
16556     }
16557     ts.createBaseNodeFactory = createBaseNodeFactory;
16558 })(ts || (ts = {}));
16559 var ts;
16560 (function (ts) {
16561     function createParenthesizerRules(factory) {
16562         var binaryLeftOperandParenthesizerCache;
16563         var binaryRightOperandParenthesizerCache;
16564         return {
16565             getParenthesizeLeftSideOfBinaryForOperator: getParenthesizeLeftSideOfBinaryForOperator,
16566             getParenthesizeRightSideOfBinaryForOperator: getParenthesizeRightSideOfBinaryForOperator,
16567             parenthesizeLeftSideOfBinary: parenthesizeLeftSideOfBinary,
16568             parenthesizeRightSideOfBinary: parenthesizeRightSideOfBinary,
16569             parenthesizeExpressionOfComputedPropertyName: parenthesizeExpressionOfComputedPropertyName,
16570             parenthesizeConditionOfConditionalExpression: parenthesizeConditionOfConditionalExpression,
16571             parenthesizeBranchOfConditionalExpression: parenthesizeBranchOfConditionalExpression,
16572             parenthesizeExpressionOfExportDefault: parenthesizeExpressionOfExportDefault,
16573             parenthesizeExpressionOfNew: parenthesizeExpressionOfNew,
16574             parenthesizeLeftSideOfAccess: parenthesizeLeftSideOfAccess,
16575             parenthesizeOperandOfPostfixUnary: parenthesizeOperandOfPostfixUnary,
16576             parenthesizeOperandOfPrefixUnary: parenthesizeOperandOfPrefixUnary,
16577             parenthesizeExpressionsOfCommaDelimitedList: parenthesizeExpressionsOfCommaDelimitedList,
16578             parenthesizeExpressionForDisallowedComma: parenthesizeExpressionForDisallowedComma,
16579             parenthesizeExpressionOfExpressionStatement: parenthesizeExpressionOfExpressionStatement,
16580             parenthesizeConciseBodyOfArrowFunction: parenthesizeConciseBodyOfArrowFunction,
16581             parenthesizeMemberOfConditionalType: parenthesizeMemberOfConditionalType,
16582             parenthesizeMemberOfElementType: parenthesizeMemberOfElementType,
16583             parenthesizeElementTypeOfArrayType: parenthesizeElementTypeOfArrayType,
16584             parenthesizeConstituentTypesOfUnionOrIntersectionType: parenthesizeConstituentTypesOfUnionOrIntersectionType,
16585             parenthesizeTypeArguments: parenthesizeTypeArguments,
16586         };
16587         function getParenthesizeLeftSideOfBinaryForOperator(operatorKind) {
16588             binaryLeftOperandParenthesizerCache || (binaryLeftOperandParenthesizerCache = new ts.Map());
16589             var parenthesizerRule = binaryLeftOperandParenthesizerCache.get(operatorKind);
16590             if (!parenthesizerRule) {
16591                 parenthesizerRule = function (node) { return parenthesizeLeftSideOfBinary(operatorKind, node); };
16592                 binaryLeftOperandParenthesizerCache.set(operatorKind, parenthesizerRule);
16593             }
16594             return parenthesizerRule;
16595         }
16596         function getParenthesizeRightSideOfBinaryForOperator(operatorKind) {
16597             binaryRightOperandParenthesizerCache || (binaryRightOperandParenthesizerCache = new ts.Map());
16598             var parenthesizerRule = binaryRightOperandParenthesizerCache.get(operatorKind);
16599             if (!parenthesizerRule) {
16600                 parenthesizerRule = function (node) { return parenthesizeRightSideOfBinary(operatorKind, undefined, node); };
16601                 binaryRightOperandParenthesizerCache.set(operatorKind, parenthesizerRule);
16602             }
16603             return parenthesizerRule;
16604         }
16605         function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
16606             var binaryOperatorPrecedence = ts.getOperatorPrecedence(220, binaryOperator);
16607             var binaryOperatorAssociativity = ts.getOperatorAssociativity(220, binaryOperator);
16608             var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
16609             if (!isLeftSideOfBinary && operand.kind === 213 && binaryOperatorPrecedence > 3) {
16610                 return true;
16611             }
16612             var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
16613             switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) {
16614                 case -1:
16615                     if (!isLeftSideOfBinary
16616                         && binaryOperatorAssociativity === 1
16617                         && operand.kind === 223) {
16618                         return false;
16619                     }
16620                     return true;
16621                 case 1:
16622                     return false;
16623                 case 0:
16624                     if (isLeftSideOfBinary) {
16625                         return binaryOperatorAssociativity === 1;
16626                     }
16627                     else {
16628                         if (ts.isBinaryExpression(emittedOperand)
16629                             && emittedOperand.operatorToken.kind === binaryOperator) {
16630                             if (operatorHasAssociativeProperty(binaryOperator)) {
16631                                 return false;
16632                             }
16633                             if (binaryOperator === 39) {
16634                                 var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0;
16635                                 if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) {
16636                                     return false;
16637                                 }
16638                             }
16639                         }
16640                         var operandAssociativity = ts.getExpressionAssociativity(emittedOperand);
16641                         return operandAssociativity === 0;
16642                     }
16643             }
16644         }
16645         function operatorHasAssociativeProperty(binaryOperator) {
16646             return binaryOperator === 41
16647                 || binaryOperator === 51
16648                 || binaryOperator === 50
16649                 || binaryOperator === 52;
16650         }
16651         function getLiteralKindOfBinaryPlusOperand(node) {
16652             node = ts.skipPartiallyEmittedExpressions(node);
16653             if (ts.isLiteralKind(node.kind)) {
16654                 return node.kind;
16655             }
16656             if (node.kind === 220 && node.operatorToken.kind === 39) {
16657                 if (node.cachedLiteralKind !== undefined) {
16658                     return node.cachedLiteralKind;
16659                 }
16660                 var leftKind = getLiteralKindOfBinaryPlusOperand(node.left);
16661                 var literalKind = ts.isLiteralKind(leftKind)
16662                     && leftKind === getLiteralKindOfBinaryPlusOperand(node.right)
16663                     ? leftKind
16664                     : 0;
16665                 node.cachedLiteralKind = literalKind;
16666                 return literalKind;
16667             }
16668             return 0;
16669         }
16670         function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
16671             var skipped = ts.skipPartiallyEmittedExpressions(operand);
16672             if (skipped.kind === 211) {
16673                 return operand;
16674             }
16675             return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
16676                 ? factory.createParenthesizedExpression(operand)
16677                 : operand;
16678         }
16679         function parenthesizeLeftSideOfBinary(binaryOperator, leftSide) {
16680             return parenthesizeBinaryOperand(binaryOperator, leftSide, true);
16681         }
16682         function parenthesizeRightSideOfBinary(binaryOperator, leftSide, rightSide) {
16683             return parenthesizeBinaryOperand(binaryOperator, rightSide, false, leftSide);
16684         }
16685         function parenthesizeExpressionOfComputedPropertyName(expression) {
16686             return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression;
16687         }
16688         function parenthesizeConditionOfConditionalExpression(condition) {
16689             var conditionalPrecedence = ts.getOperatorPrecedence(221, 57);
16690             var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
16691             var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
16692             if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1) {
16693                 return factory.createParenthesizedExpression(condition);
16694             }
16695             return condition;
16696         }
16697         function parenthesizeBranchOfConditionalExpression(branch) {
16698             var emittedExpression = ts.skipPartiallyEmittedExpressions(branch);
16699             return ts.isCommaSequence(emittedExpression)
16700                 ? factory.createParenthesizedExpression(branch)
16701                 : branch;
16702         }
16703         function parenthesizeExpressionOfExportDefault(expression) {
16704             var check = ts.skipPartiallyEmittedExpressions(expression);
16705             var needsParens = ts.isCommaSequence(check);
16706             if (!needsParens) {
16707                 switch (ts.getLeftmostExpression(check, false).kind) {
16708                     case 225:
16709                     case 212:
16710                         needsParens = true;
16711                 }
16712             }
16713             return needsParens ? factory.createParenthesizedExpression(expression) : expression;
16714         }
16715         function parenthesizeExpressionOfNew(expression) {
16716             var leftmostExpr = ts.getLeftmostExpression(expression, true);
16717             switch (leftmostExpr.kind) {
16718                 case 207:
16719                     return factory.createParenthesizedExpression(expression);
16720                 case 208:
16721                     return !leftmostExpr.arguments
16722                         ? factory.createParenthesizedExpression(expression)
16723                         : expression;
16724             }
16725             return parenthesizeLeftSideOfAccess(expression);
16726         }
16727         function parenthesizeLeftSideOfAccess(expression) {
16728             var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
16729             if (ts.isLeftHandSideExpression(emittedExpression)
16730                 && (emittedExpression.kind !== 208 || emittedExpression.arguments)) {
16731                 return expression;
16732             }
16733             return ts.setTextRange(factory.createParenthesizedExpression(expression), expression);
16734         }
16735         function parenthesizeOperandOfPostfixUnary(operand) {
16736             return ts.isLeftHandSideExpression(operand) ? operand : ts.setTextRange(factory.createParenthesizedExpression(operand), operand);
16737         }
16738         function parenthesizeOperandOfPrefixUnary(operand) {
16739             return ts.isUnaryExpression(operand) ? operand : ts.setTextRange(factory.createParenthesizedExpression(operand), operand);
16740         }
16741         function parenthesizeExpressionsOfCommaDelimitedList(elements) {
16742             var result = ts.sameMap(elements, parenthesizeExpressionForDisallowedComma);
16743             return ts.setTextRange(factory.createNodeArray(result, elements.hasTrailingComma), elements);
16744         }
16745         function parenthesizeExpressionForDisallowedComma(expression) {
16746             var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
16747             var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
16748             var commaPrecedence = ts.getOperatorPrecedence(220, 27);
16749             return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression);
16750         }
16751         function parenthesizeExpressionOfExpressionStatement(expression) {
16752             var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
16753             if (ts.isCallExpression(emittedExpression)) {
16754                 var callee = emittedExpression.expression;
16755                 var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
16756                 if (kind === 212 || kind === 213) {
16757                     var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments);
16758                     return factory.restoreOuterExpressions(expression, updated, 8);
16759                 }
16760             }
16761             var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, false).kind;
16762             if (leftmostExpressionKind === 204 || leftmostExpressionKind === 212) {
16763                 return ts.setTextRange(factory.createParenthesizedExpression(expression), expression);
16764             }
16765             return expression;
16766         }
16767         function parenthesizeConciseBodyOfArrowFunction(body) {
16768             if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, false).kind === 204)) {
16769                 return ts.setTextRange(factory.createParenthesizedExpression(body), body);
16770             }
16771             return body;
16772         }
16773         function parenthesizeMemberOfConditionalType(member) {
16774             return member.kind === 188 ? factory.createParenthesizedType(member) : member;
16775         }
16776         function parenthesizeMemberOfElementType(member) {
16777             switch (member.kind) {
16778                 case 186:
16779                 case 187:
16780                 case 178:
16781                 case 179:
16782                     return factory.createParenthesizedType(member);
16783             }
16784             return parenthesizeMemberOfConditionalType(member);
16785         }
16786         function parenthesizeElementTypeOfArrayType(member) {
16787             switch (member.kind) {
16788                 case 180:
16789                 case 192:
16790                 case 189:
16791                     return factory.createParenthesizedType(member);
16792             }
16793             return parenthesizeMemberOfElementType(member);
16794         }
16795         function parenthesizeConstituentTypesOfUnionOrIntersectionType(members) {
16796             return factory.createNodeArray(ts.sameMap(members, parenthesizeMemberOfElementType));
16797         }
16798         function parenthesizeOrdinalTypeArgument(node, i) {
16799             return i === 0 && ts.isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node;
16800         }
16801         function parenthesizeTypeArguments(typeArguments) {
16802             if (ts.some(typeArguments)) {
16803                 return factory.createNodeArray(ts.sameMap(typeArguments, parenthesizeOrdinalTypeArgument));
16804             }
16805         }
16806     }
16807     ts.createParenthesizerRules = createParenthesizerRules;
16808     ts.nullParenthesizerRules = {
16809         getParenthesizeLeftSideOfBinaryForOperator: function (_) { return ts.identity; },
16810         getParenthesizeRightSideOfBinaryForOperator: function (_) { return ts.identity; },
16811         parenthesizeLeftSideOfBinary: function (_binaryOperator, leftSide) { return leftSide; },
16812         parenthesizeRightSideOfBinary: function (_binaryOperator, _leftSide, rightSide) { return rightSide; },
16813         parenthesizeExpressionOfComputedPropertyName: ts.identity,
16814         parenthesizeConditionOfConditionalExpression: ts.identity,
16815         parenthesizeBranchOfConditionalExpression: ts.identity,
16816         parenthesizeExpressionOfExportDefault: ts.identity,
16817         parenthesizeExpressionOfNew: function (expression) { return ts.cast(expression, ts.isLeftHandSideExpression); },
16818         parenthesizeLeftSideOfAccess: function (expression) { return ts.cast(expression, ts.isLeftHandSideExpression); },
16819         parenthesizeOperandOfPostfixUnary: function (operand) { return ts.cast(operand, ts.isLeftHandSideExpression); },
16820         parenthesizeOperandOfPrefixUnary: function (operand) { return ts.cast(operand, ts.isUnaryExpression); },
16821         parenthesizeExpressionsOfCommaDelimitedList: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
16822         parenthesizeExpressionForDisallowedComma: ts.identity,
16823         parenthesizeExpressionOfExpressionStatement: ts.identity,
16824         parenthesizeConciseBodyOfArrowFunction: ts.identity,
16825         parenthesizeMemberOfConditionalType: ts.identity,
16826         parenthesizeMemberOfElementType: ts.identity,
16827         parenthesizeElementTypeOfArrayType: ts.identity,
16828         parenthesizeConstituentTypesOfUnionOrIntersectionType: function (nodes) { return ts.cast(nodes, ts.isNodeArray); },
16829         parenthesizeTypeArguments: function (nodes) { return nodes && ts.cast(nodes, ts.isNodeArray); },
16830     };
16831 })(ts || (ts = {}));
16832 var ts;
16833 (function (ts) {
16834     function createNodeConverters(factory) {
16835         return {
16836             convertToFunctionBlock: convertToFunctionBlock,
16837             convertToFunctionExpression: convertToFunctionExpression,
16838             convertToArrayAssignmentElement: convertToArrayAssignmentElement,
16839             convertToObjectAssignmentElement: convertToObjectAssignmentElement,
16840             convertToAssignmentPattern: convertToAssignmentPattern,
16841             convertToObjectAssignmentPattern: convertToObjectAssignmentPattern,
16842             convertToArrayAssignmentPattern: convertToArrayAssignmentPattern,
16843             convertToAssignmentElementTarget: convertToAssignmentElementTarget,
16844         };
16845         function convertToFunctionBlock(node, multiLine) {
16846             if (ts.isBlock(node))
16847                 return node;
16848             var returnStatement = factory.createReturnStatement(node);
16849             ts.setTextRange(returnStatement, node);
16850             var body = factory.createBlock([returnStatement], multiLine);
16851             ts.setTextRange(body, node);
16852             return body;
16853         }
16854         function convertToFunctionExpression(node) {
16855             if (!node.body)
16856                 return ts.Debug.fail("Cannot convert a FunctionDeclaration without a body");
16857             var updated = factory.createFunctionExpression(node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
16858             ts.setOriginalNode(updated, node);
16859             ts.setTextRange(updated, node);
16860             if (ts.getStartsOnNewLine(node)) {
16861                 ts.setStartsOnNewLine(updated, true);
16862             }
16863             return updated;
16864         }
16865         function convertToArrayAssignmentElement(element) {
16866             if (ts.isBindingElement(element)) {
16867                 if (element.dotDotDotToken) {
16868                     ts.Debug.assertNode(element.name, ts.isIdentifier);
16869                     return ts.setOriginalNode(ts.setTextRange(factory.createSpreadElement(element.name), element), element);
16870                 }
16871                 var expression = convertToAssignmentElementTarget(element.name);
16872                 return element.initializer
16873                     ? ts.setOriginalNode(ts.setTextRange(factory.createAssignment(expression, element.initializer), element), element)
16874                     : expression;
16875             }
16876             return ts.cast(element, ts.isExpression);
16877         }
16878         function convertToObjectAssignmentElement(element) {
16879             if (ts.isBindingElement(element)) {
16880                 if (element.dotDotDotToken) {
16881                     ts.Debug.assertNode(element.name, ts.isIdentifier);
16882                     return ts.setOriginalNode(ts.setTextRange(factory.createSpreadAssignment(element.name), element), element);
16883                 }
16884                 if (element.propertyName) {
16885                     var expression = convertToAssignmentElementTarget(element.name);
16886                     return ts.setOriginalNode(ts.setTextRange(factory.createPropertyAssignment(element.propertyName, element.initializer ? factory.createAssignment(expression, element.initializer) : expression), element), element);
16887                 }
16888                 ts.Debug.assertNode(element.name, ts.isIdentifier);
16889                 return ts.setOriginalNode(ts.setTextRange(factory.createShorthandPropertyAssignment(element.name, element.initializer), element), element);
16890             }
16891             return ts.cast(element, ts.isObjectLiteralElementLike);
16892         }
16893         function convertToAssignmentPattern(node) {
16894             switch (node.kind) {
16895                 case 201:
16896                 case 203:
16897                     return convertToArrayAssignmentPattern(node);
16898                 case 200:
16899                 case 204:
16900                     return convertToObjectAssignmentPattern(node);
16901             }
16902         }
16903         function convertToObjectAssignmentPattern(node) {
16904             if (ts.isObjectBindingPattern(node)) {
16905                 return ts.setOriginalNode(ts.setTextRange(factory.createObjectLiteralExpression(ts.map(node.elements, convertToObjectAssignmentElement)), node), node);
16906             }
16907             return ts.cast(node, ts.isObjectLiteralExpression);
16908         }
16909         function convertToArrayAssignmentPattern(node) {
16910             if (ts.isArrayBindingPattern(node)) {
16911                 return ts.setOriginalNode(ts.setTextRange(factory.createArrayLiteralExpression(ts.map(node.elements, convertToArrayAssignmentElement)), node), node);
16912             }
16913             return ts.cast(node, ts.isArrayLiteralExpression);
16914         }
16915         function convertToAssignmentElementTarget(node) {
16916             if (ts.isBindingPattern(node)) {
16917                 return convertToAssignmentPattern(node);
16918             }
16919             return ts.cast(node, ts.isExpression);
16920         }
16921     }
16922     ts.createNodeConverters = createNodeConverters;
16923     ts.nullNodeConverters = {
16924         convertToFunctionBlock: ts.notImplemented,
16925         convertToFunctionExpression: ts.notImplemented,
16926         convertToArrayAssignmentElement: ts.notImplemented,
16927         convertToObjectAssignmentElement: ts.notImplemented,
16928         convertToAssignmentPattern: ts.notImplemented,
16929         convertToObjectAssignmentPattern: ts.notImplemented,
16930         convertToArrayAssignmentPattern: ts.notImplemented,
16931         convertToAssignmentElementTarget: ts.notImplemented,
16932     };
16933 })(ts || (ts = {}));
16934 var ts;
16935 (function (ts) {
16936     var nextAutoGenerateId = 0;
16937     function createNodeFactory(flags, baseFactory) {
16938         var update = flags & 8 ? updateWithoutOriginal : updateWithOriginal;
16939         var parenthesizerRules = ts.memoize(function () { return flags & 1 ? ts.nullParenthesizerRules : ts.createParenthesizerRules(factory); });
16940         var converters = ts.memoize(function () { return flags & 2 ? ts.nullNodeConverters : ts.createNodeConverters(factory); });
16941         var getBinaryCreateFunction = ts.memoizeOne(function (operator) { return function (left, right) { return createBinaryExpression(left, operator, right); }; });
16942         var getPrefixUnaryCreateFunction = ts.memoizeOne(function (operator) { return function (operand) { return createPrefixUnaryExpression(operator, operand); }; });
16943         var getPostfixUnaryCreateFunction = ts.memoizeOne(function (operator) { return function (operand) { return createPostfixUnaryExpression(operand, operator); }; });
16944         var getJSDocPrimaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function () { return createJSDocPrimaryTypeWorker(kind); }; });
16945         var getJSDocUnaryTypeCreateFunction = ts.memoizeOne(function (kind) { return function (type) { return createJSDocUnaryTypeWorker(kind, type); }; });
16946         var getJSDocUnaryTypeUpdateFunction = ts.memoizeOne(function (kind) { return function (node, type) { return updateJSDocUnaryTypeWorker(kind, node, type); }; });
16947         var getJSDocSimpleTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, comment) { return createJSDocSimpleTagWorker(kind, tagName, comment); }; });
16948         var getJSDocSimpleTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, comment) { return updateJSDocSimpleTagWorker(kind, node, tagName, comment); }; });
16949         var getJSDocTypeLikeTagCreateFunction = ts.memoizeOne(function (kind) { return function (tagName, typeExpression, comment) { return createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment); }; });
16950         var getJSDocTypeLikeTagUpdateFunction = ts.memoizeOne(function (kind) { return function (node, tagName, typeExpression, comment) { return updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment); }; });
16951         var factory = {
16952             get parenthesizer() { return parenthesizerRules(); },
16953             get converters() { return converters(); },
16954             createNodeArray: createNodeArray,
16955             createNumericLiteral: createNumericLiteral,
16956             createBigIntLiteral: createBigIntLiteral,
16957             createStringLiteral: createStringLiteral,
16958             createStringLiteralFromNode: createStringLiteralFromNode,
16959             createRegularExpressionLiteral: createRegularExpressionLiteral,
16960             createLiteralLikeNode: createLiteralLikeNode,
16961             createIdentifier: createIdentifier,
16962             updateIdentifier: updateIdentifier,
16963             createTempVariable: createTempVariable,
16964             createLoopVariable: createLoopVariable,
16965             createUniqueName: createUniqueName,
16966             getGeneratedNameForNode: getGeneratedNameForNode,
16967             createPrivateIdentifier: createPrivateIdentifier,
16968             createToken: createToken,
16969             createSuper: createSuper,
16970             createThis: createThis,
16971             createNull: createNull,
16972             createTrue: createTrue,
16973             createFalse: createFalse,
16974             createModifier: createModifier,
16975             createModifiersFromModifierFlags: createModifiersFromModifierFlags,
16976             createQualifiedName: createQualifiedName,
16977             updateQualifiedName: updateQualifiedName,
16978             createComputedPropertyName: createComputedPropertyName,
16979             updateComputedPropertyName: updateComputedPropertyName,
16980             createTypeParameterDeclaration: createTypeParameterDeclaration,
16981             updateTypeParameterDeclaration: updateTypeParameterDeclaration,
16982             createParameterDeclaration: createParameterDeclaration,
16983             updateParameterDeclaration: updateParameterDeclaration,
16984             createDecorator: createDecorator,
16985             updateDecorator: updateDecorator,
16986             createPropertySignature: createPropertySignature,
16987             updatePropertySignature: updatePropertySignature,
16988             createPropertyDeclaration: createPropertyDeclaration,
16989             updatePropertyDeclaration: updatePropertyDeclaration,
16990             createMethodSignature: createMethodSignature,
16991             updateMethodSignature: updateMethodSignature,
16992             createMethodDeclaration: createMethodDeclaration,
16993             updateMethodDeclaration: updateMethodDeclaration,
16994             createConstructorDeclaration: createConstructorDeclaration,
16995             updateConstructorDeclaration: updateConstructorDeclaration,
16996             createGetAccessorDeclaration: createGetAccessorDeclaration,
16997             updateGetAccessorDeclaration: updateGetAccessorDeclaration,
16998             createSetAccessorDeclaration: createSetAccessorDeclaration,
16999             updateSetAccessorDeclaration: updateSetAccessorDeclaration,
17000             createCallSignature: createCallSignature,
17001             updateCallSignature: updateCallSignature,
17002             createConstructSignature: createConstructSignature,
17003             updateConstructSignature: updateConstructSignature,
17004             createIndexSignature: createIndexSignature,
17005             updateIndexSignature: updateIndexSignature,
17006             createClassStaticBlockDeclaration: createClassStaticBlockDeclaration,
17007             updateClassStaticBlockDeclaration: updateClassStaticBlockDeclaration,
17008             createTemplateLiteralTypeSpan: createTemplateLiteralTypeSpan,
17009             updateTemplateLiteralTypeSpan: updateTemplateLiteralTypeSpan,
17010             createKeywordTypeNode: createKeywordTypeNode,
17011             createTypePredicateNode: createTypePredicateNode,
17012             updateTypePredicateNode: updateTypePredicateNode,
17013             createTypeReferenceNode: createTypeReferenceNode,
17014             updateTypeReferenceNode: updateTypeReferenceNode,
17015             createFunctionTypeNode: createFunctionTypeNode,
17016             updateFunctionTypeNode: updateFunctionTypeNode,
17017             createConstructorTypeNode: createConstructorTypeNode,
17018             updateConstructorTypeNode: updateConstructorTypeNode,
17019             createTypeQueryNode: createTypeQueryNode,
17020             updateTypeQueryNode: updateTypeQueryNode,
17021             createTypeLiteralNode: createTypeLiteralNode,
17022             updateTypeLiteralNode: updateTypeLiteralNode,
17023             createArrayTypeNode: createArrayTypeNode,
17024             updateArrayTypeNode: updateArrayTypeNode,
17025             createTupleTypeNode: createTupleTypeNode,
17026             updateTupleTypeNode: updateTupleTypeNode,
17027             createNamedTupleMember: createNamedTupleMember,
17028             updateNamedTupleMember: updateNamedTupleMember,
17029             createOptionalTypeNode: createOptionalTypeNode,
17030             updateOptionalTypeNode: updateOptionalTypeNode,
17031             createRestTypeNode: createRestTypeNode,
17032             updateRestTypeNode: updateRestTypeNode,
17033             createUnionTypeNode: createUnionTypeNode,
17034             updateUnionTypeNode: updateUnionTypeNode,
17035             createIntersectionTypeNode: createIntersectionTypeNode,
17036             updateIntersectionTypeNode: updateIntersectionTypeNode,
17037             createConditionalTypeNode: createConditionalTypeNode,
17038             updateConditionalTypeNode: updateConditionalTypeNode,
17039             createInferTypeNode: createInferTypeNode,
17040             updateInferTypeNode: updateInferTypeNode,
17041             createImportTypeNode: createImportTypeNode,
17042             updateImportTypeNode: updateImportTypeNode,
17043             createParenthesizedType: createParenthesizedType,
17044             updateParenthesizedType: updateParenthesizedType,
17045             createThisTypeNode: createThisTypeNode,
17046             createTypeOperatorNode: createTypeOperatorNode,
17047             updateTypeOperatorNode: updateTypeOperatorNode,
17048             createIndexedAccessTypeNode: createIndexedAccessTypeNode,
17049             updateIndexedAccessTypeNode: updateIndexedAccessTypeNode,
17050             createMappedTypeNode: createMappedTypeNode,
17051             updateMappedTypeNode: updateMappedTypeNode,
17052             createLiteralTypeNode: createLiteralTypeNode,
17053             updateLiteralTypeNode: updateLiteralTypeNode,
17054             createTemplateLiteralType: createTemplateLiteralType,
17055             updateTemplateLiteralType: updateTemplateLiteralType,
17056             createObjectBindingPattern: createObjectBindingPattern,
17057             updateObjectBindingPattern: updateObjectBindingPattern,
17058             createArrayBindingPattern: createArrayBindingPattern,
17059             updateArrayBindingPattern: updateArrayBindingPattern,
17060             createBindingElement: createBindingElement,
17061             updateBindingElement: updateBindingElement,
17062             createArrayLiteralExpression: createArrayLiteralExpression,
17063             updateArrayLiteralExpression: updateArrayLiteralExpression,
17064             createObjectLiteralExpression: createObjectLiteralExpression,
17065             updateObjectLiteralExpression: updateObjectLiteralExpression,
17066             createPropertyAccessExpression: flags & 4 ?
17067                 function (expression, name) { return ts.setEmitFlags(createPropertyAccessExpression(expression, name), 131072); } :
17068                 createPropertyAccessExpression,
17069             updatePropertyAccessExpression: updatePropertyAccessExpression,
17070             createPropertyAccessChain: flags & 4 ?
17071                 function (expression, questionDotToken, name) { return ts.setEmitFlags(createPropertyAccessChain(expression, questionDotToken, name), 131072); } :
17072                 createPropertyAccessChain,
17073             updatePropertyAccessChain: updatePropertyAccessChain,
17074             createElementAccessExpression: createElementAccessExpression,
17075             updateElementAccessExpression: updateElementAccessExpression,
17076             createElementAccessChain: createElementAccessChain,
17077             updateElementAccessChain: updateElementAccessChain,
17078             createCallExpression: createCallExpression,
17079             updateCallExpression: updateCallExpression,
17080             createCallChain: createCallChain,
17081             updateCallChain: updateCallChain,
17082             createNewExpression: createNewExpression,
17083             updateNewExpression: updateNewExpression,
17084             createTaggedTemplateExpression: createTaggedTemplateExpression,
17085             updateTaggedTemplateExpression: updateTaggedTemplateExpression,
17086             createTypeAssertion: createTypeAssertion,
17087             updateTypeAssertion: updateTypeAssertion,
17088             createParenthesizedExpression: createParenthesizedExpression,
17089             updateParenthesizedExpression: updateParenthesizedExpression,
17090             createFunctionExpression: createFunctionExpression,
17091             updateFunctionExpression: updateFunctionExpression,
17092             createArrowFunction: createArrowFunction,
17093             updateArrowFunction: updateArrowFunction,
17094             createDeleteExpression: createDeleteExpression,
17095             updateDeleteExpression: updateDeleteExpression,
17096             createTypeOfExpression: createTypeOfExpression,
17097             updateTypeOfExpression: updateTypeOfExpression,
17098             createVoidExpression: createVoidExpression,
17099             updateVoidExpression: updateVoidExpression,
17100             createAwaitExpression: createAwaitExpression,
17101             updateAwaitExpression: updateAwaitExpression,
17102             createPrefixUnaryExpression: createPrefixUnaryExpression,
17103             updatePrefixUnaryExpression: updatePrefixUnaryExpression,
17104             createPostfixUnaryExpression: createPostfixUnaryExpression,
17105             updatePostfixUnaryExpression: updatePostfixUnaryExpression,
17106             createBinaryExpression: createBinaryExpression,
17107             updateBinaryExpression: updateBinaryExpression,
17108             createConditionalExpression: createConditionalExpression,
17109             updateConditionalExpression: updateConditionalExpression,
17110             createTemplateExpression: createTemplateExpression,
17111             updateTemplateExpression: updateTemplateExpression,
17112             createTemplateHead: createTemplateHead,
17113             createTemplateMiddle: createTemplateMiddle,
17114             createTemplateTail: createTemplateTail,
17115             createNoSubstitutionTemplateLiteral: createNoSubstitutionTemplateLiteral,
17116             createTemplateLiteralLikeNode: createTemplateLiteralLikeNode,
17117             createYieldExpression: createYieldExpression,
17118             updateYieldExpression: updateYieldExpression,
17119             createSpreadElement: createSpreadElement,
17120             updateSpreadElement: updateSpreadElement,
17121             createClassExpression: createClassExpression,
17122             updateClassExpression: updateClassExpression,
17123             createOmittedExpression: createOmittedExpression,
17124             createExpressionWithTypeArguments: createExpressionWithTypeArguments,
17125             updateExpressionWithTypeArguments: updateExpressionWithTypeArguments,
17126             createAsExpression: createAsExpression,
17127             updateAsExpression: updateAsExpression,
17128             createNonNullExpression: createNonNullExpression,
17129             updateNonNullExpression: updateNonNullExpression,
17130             createNonNullChain: createNonNullChain,
17131             updateNonNullChain: updateNonNullChain,
17132             createMetaProperty: createMetaProperty,
17133             updateMetaProperty: updateMetaProperty,
17134             createTemplateSpan: createTemplateSpan,
17135             updateTemplateSpan: updateTemplateSpan,
17136             createSemicolonClassElement: createSemicolonClassElement,
17137             createBlock: createBlock,
17138             updateBlock: updateBlock,
17139             createVariableStatement: createVariableStatement,
17140             updateVariableStatement: updateVariableStatement,
17141             createEmptyStatement: createEmptyStatement,
17142             createExpressionStatement: createExpressionStatement,
17143             updateExpressionStatement: updateExpressionStatement,
17144             createIfStatement: createIfStatement,
17145             updateIfStatement: updateIfStatement,
17146             createDoStatement: createDoStatement,
17147             updateDoStatement: updateDoStatement,
17148             createWhileStatement: createWhileStatement,
17149             updateWhileStatement: updateWhileStatement,
17150             createForStatement: createForStatement,
17151             updateForStatement: updateForStatement,
17152             createForInStatement: createForInStatement,
17153             updateForInStatement: updateForInStatement,
17154             createForOfStatement: createForOfStatement,
17155             updateForOfStatement: updateForOfStatement,
17156             createContinueStatement: createContinueStatement,
17157             updateContinueStatement: updateContinueStatement,
17158             createBreakStatement: createBreakStatement,
17159             updateBreakStatement: updateBreakStatement,
17160             createReturnStatement: createReturnStatement,
17161             updateReturnStatement: updateReturnStatement,
17162             createWithStatement: createWithStatement,
17163             updateWithStatement: updateWithStatement,
17164             createSwitchStatement: createSwitchStatement,
17165             updateSwitchStatement: updateSwitchStatement,
17166             createLabeledStatement: createLabeledStatement,
17167             updateLabeledStatement: updateLabeledStatement,
17168             createThrowStatement: createThrowStatement,
17169             updateThrowStatement: updateThrowStatement,
17170             createTryStatement: createTryStatement,
17171             updateTryStatement: updateTryStatement,
17172             createDebuggerStatement: createDebuggerStatement,
17173             createVariableDeclaration: createVariableDeclaration,
17174             updateVariableDeclaration: updateVariableDeclaration,
17175             createVariableDeclarationList: createVariableDeclarationList,
17176             updateVariableDeclarationList: updateVariableDeclarationList,
17177             createFunctionDeclaration: createFunctionDeclaration,
17178             updateFunctionDeclaration: updateFunctionDeclaration,
17179             createClassDeclaration: createClassDeclaration,
17180             updateClassDeclaration: updateClassDeclaration,
17181             createInterfaceDeclaration: createInterfaceDeclaration,
17182             updateInterfaceDeclaration: updateInterfaceDeclaration,
17183             createTypeAliasDeclaration: createTypeAliasDeclaration,
17184             updateTypeAliasDeclaration: updateTypeAliasDeclaration,
17185             createEnumDeclaration: createEnumDeclaration,
17186             updateEnumDeclaration: updateEnumDeclaration,
17187             createModuleDeclaration: createModuleDeclaration,
17188             updateModuleDeclaration: updateModuleDeclaration,
17189             createModuleBlock: createModuleBlock,
17190             updateModuleBlock: updateModuleBlock,
17191             createCaseBlock: createCaseBlock,
17192             updateCaseBlock: updateCaseBlock,
17193             createNamespaceExportDeclaration: createNamespaceExportDeclaration,
17194             updateNamespaceExportDeclaration: updateNamespaceExportDeclaration,
17195             createImportEqualsDeclaration: createImportEqualsDeclaration,
17196             updateImportEqualsDeclaration: updateImportEqualsDeclaration,
17197             createImportDeclaration: createImportDeclaration,
17198             updateImportDeclaration: updateImportDeclaration,
17199             createImportClause: createImportClause,
17200             updateImportClause: updateImportClause,
17201             createAssertClause: createAssertClause,
17202             updateAssertClause: updateAssertClause,
17203             createAssertEntry: createAssertEntry,
17204             updateAssertEntry: updateAssertEntry,
17205             createNamespaceImport: createNamespaceImport,
17206             updateNamespaceImport: updateNamespaceImport,
17207             createNamespaceExport: createNamespaceExport,
17208             updateNamespaceExport: updateNamespaceExport,
17209             createNamedImports: createNamedImports,
17210             updateNamedImports: updateNamedImports,
17211             createImportSpecifier: createImportSpecifier,
17212             updateImportSpecifier: updateImportSpecifier,
17213             createExportAssignment: createExportAssignment,
17214             updateExportAssignment: updateExportAssignment,
17215             createExportDeclaration: createExportDeclaration,
17216             updateExportDeclaration: updateExportDeclaration,
17217             createNamedExports: createNamedExports,
17218             updateNamedExports: updateNamedExports,
17219             createExportSpecifier: createExportSpecifier,
17220             updateExportSpecifier: updateExportSpecifier,
17221             createMissingDeclaration: createMissingDeclaration,
17222             createExternalModuleReference: createExternalModuleReference,
17223             updateExternalModuleReference: updateExternalModuleReference,
17224             get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(310); },
17225             get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(311); },
17226             get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(313); },
17227             get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(313); },
17228             get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(312); },
17229             get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(312); },
17230             get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(314); },
17231             get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(314); },
17232             get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(316); },
17233             get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(316); },
17234             get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(317); },
17235             get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(317); },
17236             createJSDocFunctionType: createJSDocFunctionType,
17237             updateJSDocFunctionType: updateJSDocFunctionType,
17238             createJSDocTypeLiteral: createJSDocTypeLiteral,
17239             updateJSDocTypeLiteral: updateJSDocTypeLiteral,
17240             createJSDocTypeExpression: createJSDocTypeExpression,
17241             updateJSDocTypeExpression: updateJSDocTypeExpression,
17242             createJSDocSignature: createJSDocSignature,
17243             updateJSDocSignature: updateJSDocSignature,
17244             createJSDocTemplateTag: createJSDocTemplateTag,
17245             updateJSDocTemplateTag: updateJSDocTemplateTag,
17246             createJSDocTypedefTag: createJSDocTypedefTag,
17247             updateJSDocTypedefTag: updateJSDocTypedefTag,
17248             createJSDocParameterTag: createJSDocParameterTag,
17249             updateJSDocParameterTag: updateJSDocParameterTag,
17250             createJSDocPropertyTag: createJSDocPropertyTag,
17251             updateJSDocPropertyTag: updateJSDocPropertyTag,
17252             createJSDocCallbackTag: createJSDocCallbackTag,
17253             updateJSDocCallbackTag: updateJSDocCallbackTag,
17254             createJSDocAugmentsTag: createJSDocAugmentsTag,
17255             updateJSDocAugmentsTag: updateJSDocAugmentsTag,
17256             createJSDocImplementsTag: createJSDocImplementsTag,
17257             updateJSDocImplementsTag: updateJSDocImplementsTag,
17258             createJSDocSeeTag: createJSDocSeeTag,
17259             updateJSDocSeeTag: updateJSDocSeeTag,
17260             createJSDocNameReference: createJSDocNameReference,
17261             updateJSDocNameReference: updateJSDocNameReference,
17262             createJSDocMemberName: createJSDocMemberName,
17263             updateJSDocMemberName: updateJSDocMemberName,
17264             createJSDocLink: createJSDocLink,
17265             updateJSDocLink: updateJSDocLink,
17266             createJSDocLinkCode: createJSDocLinkCode,
17267             updateJSDocLinkCode: updateJSDocLinkCode,
17268             createJSDocLinkPlain: createJSDocLinkPlain,
17269             updateJSDocLinkPlain: updateJSDocLinkPlain,
17270             get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(341); },
17271             get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(341); },
17272             get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(339); },
17273             get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(339); },
17274             get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(340); },
17275             get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(340); },
17276             get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(337); },
17277             get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(337); },
17278             get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(328); },
17279             get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(328); },
17280             get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(330); },
17281             get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(330); },
17282             get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(331); },
17283             get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(331); },
17284             get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(332); },
17285             get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(332); },
17286             get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(333); },
17287             get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(333); },
17288             get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(334); },
17289             get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(334); },
17290             get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(335); },
17291             get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(335); },
17292             get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(329); },
17293             get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(329); },
17294             createJSDocUnknownTag: createJSDocUnknownTag,
17295             updateJSDocUnknownTag: updateJSDocUnknownTag,
17296             createJSDocText: createJSDocText,
17297             updateJSDocText: updateJSDocText,
17298             createJSDocComment: createJSDocComment,
17299             updateJSDocComment: updateJSDocComment,
17300             createJsxElement: createJsxElement,
17301             updateJsxElement: updateJsxElement,
17302             createJsxSelfClosingElement: createJsxSelfClosingElement,
17303             updateJsxSelfClosingElement: updateJsxSelfClosingElement,
17304             createJsxOpeningElement: createJsxOpeningElement,
17305             updateJsxOpeningElement: updateJsxOpeningElement,
17306             createJsxClosingElement: createJsxClosingElement,
17307             updateJsxClosingElement: updateJsxClosingElement,
17308             createJsxFragment: createJsxFragment,
17309             createJsxText: createJsxText,
17310             updateJsxText: updateJsxText,
17311             createJsxOpeningFragment: createJsxOpeningFragment,
17312             createJsxJsxClosingFragment: createJsxJsxClosingFragment,
17313             updateJsxFragment: updateJsxFragment,
17314             createJsxAttribute: createJsxAttribute,
17315             updateJsxAttribute: updateJsxAttribute,
17316             createJsxAttributes: createJsxAttributes,
17317             updateJsxAttributes: updateJsxAttributes,
17318             createJsxSpreadAttribute: createJsxSpreadAttribute,
17319             updateJsxSpreadAttribute: updateJsxSpreadAttribute,
17320             createJsxExpression: createJsxExpression,
17321             updateJsxExpression: updateJsxExpression,
17322             createCaseClause: createCaseClause,
17323             updateCaseClause: updateCaseClause,
17324             createDefaultClause: createDefaultClause,
17325             updateDefaultClause: updateDefaultClause,
17326             createHeritageClause: createHeritageClause,
17327             updateHeritageClause: updateHeritageClause,
17328             createCatchClause: createCatchClause,
17329             updateCatchClause: updateCatchClause,
17330             createPropertyAssignment: createPropertyAssignment,
17331             updatePropertyAssignment: updatePropertyAssignment,
17332             createShorthandPropertyAssignment: createShorthandPropertyAssignment,
17333             updateShorthandPropertyAssignment: updateShorthandPropertyAssignment,
17334             createSpreadAssignment: createSpreadAssignment,
17335             updateSpreadAssignment: updateSpreadAssignment,
17336             createEnumMember: createEnumMember,
17337             updateEnumMember: updateEnumMember,
17338             createSourceFile: createSourceFile,
17339             updateSourceFile: updateSourceFile,
17340             createBundle: createBundle,
17341             updateBundle: updateBundle,
17342             createUnparsedSource: createUnparsedSource,
17343             createUnparsedPrologue: createUnparsedPrologue,
17344             createUnparsedPrepend: createUnparsedPrepend,
17345             createUnparsedTextLike: createUnparsedTextLike,
17346             createUnparsedSyntheticReference: createUnparsedSyntheticReference,
17347             createInputFiles: createInputFiles,
17348             createSyntheticExpression: createSyntheticExpression,
17349             createSyntaxList: createSyntaxList,
17350             createNotEmittedStatement: createNotEmittedStatement,
17351             createPartiallyEmittedExpression: createPartiallyEmittedExpression,
17352             updatePartiallyEmittedExpression: updatePartiallyEmittedExpression,
17353             createCommaListExpression: createCommaListExpression,
17354             updateCommaListExpression: updateCommaListExpression,
17355             createEndOfDeclarationMarker: createEndOfDeclarationMarker,
17356             createMergeDeclarationMarker: createMergeDeclarationMarker,
17357             createSyntheticReferenceExpression: createSyntheticReferenceExpression,
17358             updateSyntheticReferenceExpression: updateSyntheticReferenceExpression,
17359             cloneNode: cloneNode,
17360             get createComma() { return getBinaryCreateFunction(27); },
17361             get createAssignment() { return getBinaryCreateFunction(63); },
17362             get createLogicalOr() { return getBinaryCreateFunction(56); },
17363             get createLogicalAnd() { return getBinaryCreateFunction(55); },
17364             get createBitwiseOr() { return getBinaryCreateFunction(51); },
17365             get createBitwiseXor() { return getBinaryCreateFunction(52); },
17366             get createBitwiseAnd() { return getBinaryCreateFunction(50); },
17367             get createStrictEquality() { return getBinaryCreateFunction(36); },
17368             get createStrictInequality() { return getBinaryCreateFunction(37); },
17369             get createEquality() { return getBinaryCreateFunction(34); },
17370             get createInequality() { return getBinaryCreateFunction(35); },
17371             get createLessThan() { return getBinaryCreateFunction(29); },
17372             get createLessThanEquals() { return getBinaryCreateFunction(32); },
17373             get createGreaterThan() { return getBinaryCreateFunction(31); },
17374             get createGreaterThanEquals() { return getBinaryCreateFunction(33); },
17375             get createLeftShift() { return getBinaryCreateFunction(47); },
17376             get createRightShift() { return getBinaryCreateFunction(48); },
17377             get createUnsignedRightShift() { return getBinaryCreateFunction(49); },
17378             get createAdd() { return getBinaryCreateFunction(39); },
17379             get createSubtract() { return getBinaryCreateFunction(40); },
17380             get createMultiply() { return getBinaryCreateFunction(41); },
17381             get createDivide() { return getBinaryCreateFunction(43); },
17382             get createModulo() { return getBinaryCreateFunction(44); },
17383             get createExponent() { return getBinaryCreateFunction(42); },
17384             get createPrefixPlus() { return getPrefixUnaryCreateFunction(39); },
17385             get createPrefixMinus() { return getPrefixUnaryCreateFunction(40); },
17386             get createPrefixIncrement() { return getPrefixUnaryCreateFunction(45); },
17387             get createPrefixDecrement() { return getPrefixUnaryCreateFunction(46); },
17388             get createBitwiseNot() { return getPrefixUnaryCreateFunction(54); },
17389             get createLogicalNot() { return getPrefixUnaryCreateFunction(53); },
17390             get createPostfixIncrement() { return getPostfixUnaryCreateFunction(45); },
17391             get createPostfixDecrement() { return getPostfixUnaryCreateFunction(46); },
17392             createImmediatelyInvokedFunctionExpression: createImmediatelyInvokedFunctionExpression,
17393             createImmediatelyInvokedArrowFunction: createImmediatelyInvokedArrowFunction,
17394             createVoidZero: createVoidZero,
17395             createExportDefault: createExportDefault,
17396             createExternalModuleExport: createExternalModuleExport,
17397             createTypeCheck: createTypeCheck,
17398             createMethodCall: createMethodCall,
17399             createGlobalMethodCall: createGlobalMethodCall,
17400             createFunctionBindCall: createFunctionBindCall,
17401             createFunctionCallCall: createFunctionCallCall,
17402             createFunctionApplyCall: createFunctionApplyCall,
17403             createArraySliceCall: createArraySliceCall,
17404             createArrayConcatCall: createArrayConcatCall,
17405             createObjectDefinePropertyCall: createObjectDefinePropertyCall,
17406             createReflectGetCall: createReflectGetCall,
17407             createReflectSetCall: createReflectSetCall,
17408             createPropertyDescriptor: createPropertyDescriptor,
17409             createCallBinding: createCallBinding,
17410             createAssignmentTargetWrapper: createAssignmentTargetWrapper,
17411             inlineExpressions: inlineExpressions,
17412             getInternalName: getInternalName,
17413             getLocalName: getLocalName,
17414             getExportName: getExportName,
17415             getDeclarationName: getDeclarationName,
17416             getNamespaceMemberName: getNamespaceMemberName,
17417             getExternalModuleOrNamespaceExportName: getExternalModuleOrNamespaceExportName,
17418             restoreOuterExpressions: restoreOuterExpressions,
17419             restoreEnclosingLabel: restoreEnclosingLabel,
17420             createUseStrictPrologue: createUseStrictPrologue,
17421             copyPrologue: copyPrologue,
17422             copyStandardPrologue: copyStandardPrologue,
17423             copyCustomPrologue: copyCustomPrologue,
17424             ensureUseStrict: ensureUseStrict,
17425             liftToBlock: liftToBlock,
17426             mergeLexicalEnvironment: mergeLexicalEnvironment,
17427             updateModifiers: updateModifiers,
17428         };
17429         return factory;
17430         function createNodeArray(elements, hasTrailingComma) {
17431             if (elements === undefined || elements === ts.emptyArray) {
17432                 elements = [];
17433             }
17434             else if (ts.isNodeArray(elements)) {
17435                 if (hasTrailingComma === undefined || elements.hasTrailingComma === hasTrailingComma) {
17436                     if (elements.transformFlags === undefined) {
17437                         aggregateChildrenFlags(elements);
17438                     }
17439                     ts.Debug.attachNodeArrayDebugInfo(elements);
17440                     return elements;
17441                 }
17442                 var array_8 = elements.slice();
17443                 array_8.pos = elements.pos;
17444                 array_8.end = elements.end;
17445                 array_8.hasTrailingComma = hasTrailingComma;
17446                 array_8.transformFlags = elements.transformFlags;
17447                 ts.Debug.attachNodeArrayDebugInfo(array_8);
17448                 return array_8;
17449             }
17450             var length = elements.length;
17451             var array = (length >= 1 && length <= 4 ? elements.slice() : elements);
17452             ts.setTextRangePosEnd(array, -1, -1);
17453             array.hasTrailingComma = !!hasTrailingComma;
17454             aggregateChildrenFlags(array);
17455             ts.Debug.attachNodeArrayDebugInfo(array);
17456             return array;
17457         }
17458         function createBaseNode(kind) {
17459             return baseFactory.createBaseNode(kind);
17460         }
17461         function createBaseDeclaration(kind, decorators, modifiers) {
17462             var node = createBaseNode(kind);
17463             node.decorators = asNodeArray(decorators);
17464             node.modifiers = asNodeArray(modifiers);
17465             node.transformFlags |=
17466                 propagateChildrenFlags(node.decorators) |
17467                     propagateChildrenFlags(node.modifiers);
17468             node.symbol = undefined;
17469             node.localSymbol = undefined;
17470             node.locals = undefined;
17471             node.nextContainer = undefined;
17472             return node;
17473         }
17474         function createBaseNamedDeclaration(kind, decorators, modifiers, name) {
17475             var node = createBaseDeclaration(kind, decorators, modifiers);
17476             name = asName(name);
17477             node.name = name;
17478             if (name) {
17479                 switch (node.kind) {
17480                     case 168:
17481                     case 171:
17482                     case 172:
17483                     case 166:
17484                     case 294:
17485                         if (ts.isIdentifier(name)) {
17486                             node.transformFlags |= propagateIdentifierNameFlags(name);
17487                             break;
17488                         }
17489                     default:
17490                         node.transformFlags |= propagateChildFlags(name);
17491                         break;
17492                 }
17493             }
17494             return node;
17495         }
17496         function createBaseGenericNamedDeclaration(kind, decorators, modifiers, name, typeParameters) {
17497             var node = createBaseNamedDeclaration(kind, decorators, modifiers, name);
17498             node.typeParameters = asNodeArray(typeParameters);
17499             node.transformFlags |= propagateChildrenFlags(node.typeParameters);
17500             if (typeParameters)
17501                 node.transformFlags |= 1;
17502             return node;
17503         }
17504         function createBaseSignatureDeclaration(kind, decorators, modifiers, name, typeParameters, parameters, type) {
17505             var node = createBaseGenericNamedDeclaration(kind, decorators, modifiers, name, typeParameters);
17506             node.parameters = createNodeArray(parameters);
17507             node.type = type;
17508             node.transformFlags |=
17509                 propagateChildrenFlags(node.parameters) |
17510                     propagateChildFlags(node.type);
17511             if (type)
17512                 node.transformFlags |= 1;
17513             return node;
17514         }
17515         function updateBaseSignatureDeclaration(updated, original) {
17516             if (original.typeArguments)
17517                 updated.typeArguments = original.typeArguments;
17518             return update(updated, original);
17519         }
17520         function createBaseFunctionLikeDeclaration(kind, decorators, modifiers, name, typeParameters, parameters, type, body) {
17521             var node = createBaseSignatureDeclaration(kind, decorators, modifiers, name, typeParameters, parameters, type);
17522             node.body = body;
17523             node.transformFlags |= propagateChildFlags(node.body) & ~16777216;
17524             if (!body)
17525                 node.transformFlags |= 1;
17526             return node;
17527         }
17528         function updateBaseFunctionLikeDeclaration(updated, original) {
17529             if (original.exclamationToken)
17530                 updated.exclamationToken = original.exclamationToken;
17531             if (original.typeArguments)
17532                 updated.typeArguments = original.typeArguments;
17533             return updateBaseSignatureDeclaration(updated, original);
17534         }
17535         function createBaseInterfaceOrClassLikeDeclaration(kind, decorators, modifiers, name, typeParameters, heritageClauses) {
17536             var node = createBaseGenericNamedDeclaration(kind, decorators, modifiers, name, typeParameters);
17537             node.heritageClauses = asNodeArray(heritageClauses);
17538             node.transformFlags |= propagateChildrenFlags(node.heritageClauses);
17539             return node;
17540         }
17541         function createBaseClassLikeDeclaration(kind, decorators, modifiers, name, typeParameters, heritageClauses, members) {
17542             var node = createBaseInterfaceOrClassLikeDeclaration(kind, decorators, modifiers, name, typeParameters, heritageClauses);
17543             node.members = createNodeArray(members);
17544             node.transformFlags |= propagateChildrenFlags(node.members);
17545             return node;
17546         }
17547         function createBaseBindingLikeDeclaration(kind, decorators, modifiers, name, initializer) {
17548             var node = createBaseNamedDeclaration(kind, decorators, modifiers, name);
17549             node.initializer = initializer;
17550             node.transformFlags |= propagateChildFlags(node.initializer);
17551             return node;
17552         }
17553         function createBaseVariableLikeDeclaration(kind, decorators, modifiers, name, type, initializer) {
17554             var node = createBaseBindingLikeDeclaration(kind, decorators, modifiers, name, initializer);
17555             node.type = type;
17556             node.transformFlags |= propagateChildFlags(type);
17557             if (type)
17558                 node.transformFlags |= 1;
17559             return node;
17560         }
17561         function createBaseLiteral(kind, text) {
17562             var node = createBaseToken(kind);
17563             node.text = text;
17564             return node;
17565         }
17566         function createNumericLiteral(value, numericLiteralFlags) {
17567             if (numericLiteralFlags === void 0) { numericLiteralFlags = 0; }
17568             var node = createBaseLiteral(8, typeof value === "number" ? value + "" : value);
17569             node.numericLiteralFlags = numericLiteralFlags;
17570             if (numericLiteralFlags & 384)
17571                 node.transformFlags |= 512;
17572             return node;
17573         }
17574         function createBigIntLiteral(value) {
17575             var node = createBaseLiteral(9, typeof value === "string" ? value : ts.pseudoBigIntToString(value) + "n");
17576             node.transformFlags |= 4;
17577             return node;
17578         }
17579         function createBaseStringLiteral(text, isSingleQuote) {
17580             var node = createBaseLiteral(10, text);
17581             node.singleQuote = isSingleQuote;
17582             return node;
17583         }
17584         function createStringLiteral(text, isSingleQuote, hasExtendedUnicodeEscape) {
17585             var node = createBaseStringLiteral(text, isSingleQuote);
17586             node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
17587             if (hasExtendedUnicodeEscape)
17588                 node.transformFlags |= 512;
17589             return node;
17590         }
17591         function createStringLiteralFromNode(sourceNode) {
17592             var node = createBaseStringLiteral(ts.getTextOfIdentifierOrLiteral(sourceNode), undefined);
17593             node.textSourceNode = sourceNode;
17594             return node;
17595         }
17596         function createRegularExpressionLiteral(text) {
17597             var node = createBaseLiteral(13, text);
17598             return node;
17599         }
17600         function createLiteralLikeNode(kind, text) {
17601             switch (kind) {
17602                 case 8: return createNumericLiteral(text, 0);
17603                 case 9: return createBigIntLiteral(text);
17604                 case 10: return createStringLiteral(text, undefined);
17605                 case 11: return createJsxText(text, false);
17606                 case 12: return createJsxText(text, true);
17607                 case 13: return createRegularExpressionLiteral(text);
17608                 case 14: return createTemplateLiteralLikeNode(kind, text, undefined, 0);
17609             }
17610         }
17611         function createBaseIdentifier(text, originalKeywordKind) {
17612             if (originalKeywordKind === undefined && text) {
17613                 originalKeywordKind = ts.stringToToken(text);
17614             }
17615             if (originalKeywordKind === 79) {
17616                 originalKeywordKind = undefined;
17617             }
17618             var node = baseFactory.createBaseIdentifierNode(79);
17619             node.originalKeywordKind = originalKeywordKind;
17620             node.escapedText = ts.escapeLeadingUnderscores(text);
17621             return node;
17622         }
17623         function createBaseGeneratedIdentifier(text, autoGenerateFlags) {
17624             var node = createBaseIdentifier(text, undefined);
17625             node.autoGenerateFlags = autoGenerateFlags;
17626             node.autoGenerateId = nextAutoGenerateId;
17627             nextAutoGenerateId++;
17628             return node;
17629         }
17630         function createIdentifier(text, typeArguments, originalKeywordKind) {
17631             var node = createBaseIdentifier(text, originalKeywordKind);
17632             if (typeArguments) {
17633                 node.typeArguments = createNodeArray(typeArguments);
17634             }
17635             if (node.originalKeywordKind === 132) {
17636                 node.transformFlags |= 16777216;
17637             }
17638             return node;
17639         }
17640         function updateIdentifier(node, typeArguments) {
17641             return node.typeArguments !== typeArguments
17642                 ? update(createIdentifier(ts.idText(node), typeArguments), node)
17643                 : node;
17644         }
17645         function createTempVariable(recordTempVariable, reservedInNestedScopes) {
17646             var flags = 1;
17647             if (reservedInNestedScopes)
17648                 flags |= 8;
17649             var name = createBaseGeneratedIdentifier("", flags);
17650             if (recordTempVariable) {
17651                 recordTempVariable(name);
17652             }
17653             return name;
17654         }
17655         function createLoopVariable(reservedInNestedScopes) {
17656             var flags = 2;
17657             if (reservedInNestedScopes)
17658                 flags |= 8;
17659             return createBaseGeneratedIdentifier("", flags);
17660         }
17661         function createUniqueName(text, flags) {
17662             if (flags === void 0) { flags = 0; }
17663             ts.Debug.assert(!(flags & 7), "Argument out of range: flags");
17664             ts.Debug.assert((flags & (16 | 32)) !== 32, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic");
17665             return createBaseGeneratedIdentifier(text, 3 | flags);
17666         }
17667         function getGeneratedNameForNode(node, flags) {
17668             if (flags === void 0) { flags = 0; }
17669             ts.Debug.assert(!(flags & 7), "Argument out of range: flags");
17670             var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 | flags);
17671             name.original = node;
17672             return name;
17673         }
17674         function createPrivateIdentifier(text) {
17675             if (!ts.startsWith(text, "#"))
17676                 ts.Debug.fail("First character of private identifier must be #: " + text);
17677             var node = baseFactory.createBasePrivateIdentifierNode(80);
17678             node.escapedText = ts.escapeLeadingUnderscores(text);
17679             node.transformFlags |= 8388608;
17680             return node;
17681         }
17682         function createBaseToken(kind) {
17683             return baseFactory.createBaseTokenNode(kind);
17684         }
17685         function createToken(token) {
17686             ts.Debug.assert(token >= 0 && token <= 159, "Invalid token");
17687             ts.Debug.assert(token <= 14 || token >= 17, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals.");
17688             ts.Debug.assert(token <= 8 || token >= 14, "Invalid token. Use 'createLiteralLikeNode' to create literals.");
17689             ts.Debug.assert(token !== 79, "Invalid token. Use 'createIdentifier' to create identifiers");
17690             var node = createBaseToken(token);
17691             var transformFlags = 0;
17692             switch (token) {
17693                 case 131:
17694                     transformFlags =
17695                         128 |
17696                             64;
17697                     break;
17698                 case 123:
17699                 case 121:
17700                 case 122:
17701                 case 144:
17702                 case 126:
17703                 case 135:
17704                 case 85:
17705                 case 130:
17706                 case 146:
17707                 case 157:
17708                 case 143:
17709                 case 147:
17710                 case 158:
17711                 case 149:
17712                 case 133:
17713                 case 150:
17714                 case 114:
17715                 case 154:
17716                 case 152:
17717                     transformFlags = 1;
17718                     break;
17719                 case 106:
17720                     transformFlags = 512 | 33554432;
17721                     break;
17722                 case 124:
17723                     transformFlags = 512;
17724                     break;
17725                 case 108:
17726                     transformFlags = 8192;
17727                     break;
17728             }
17729             if (transformFlags) {
17730                 node.transformFlags |= transformFlags;
17731             }
17732             return node;
17733         }
17734         function createSuper() {
17735             return createToken(106);
17736         }
17737         function createThis() {
17738             return createToken(108);
17739         }
17740         function createNull() {
17741             return createToken(104);
17742         }
17743         function createTrue() {
17744             return createToken(110);
17745         }
17746         function createFalse() {
17747             return createToken(95);
17748         }
17749         function createModifier(kind) {
17750             return createToken(kind);
17751         }
17752         function createModifiersFromModifierFlags(flags) {
17753             var result = [];
17754             if (flags & 1)
17755                 result.push(createModifier(93));
17756             if (flags & 2)
17757                 result.push(createModifier(135));
17758             if (flags & 512)
17759                 result.push(createModifier(88));
17760             if (flags & 2048)
17761                 result.push(createModifier(85));
17762             if (flags & 4)
17763                 result.push(createModifier(123));
17764             if (flags & 8)
17765                 result.push(createModifier(121));
17766             if (flags & 16)
17767                 result.push(createModifier(122));
17768             if (flags & 128)
17769                 result.push(createModifier(126));
17770             if (flags & 32)
17771                 result.push(createModifier(124));
17772             if (flags & 16384)
17773                 result.push(createModifier(158));
17774             if (flags & 64)
17775                 result.push(createModifier(144));
17776             if (flags & 256)
17777                 result.push(createModifier(131));
17778             return result;
17779         }
17780         function createQualifiedName(left, right) {
17781             var node = createBaseNode(160);
17782             node.left = left;
17783             node.right = asName(right);
17784             node.transformFlags |=
17785                 propagateChildFlags(node.left) |
17786                     propagateIdentifierNameFlags(node.right);
17787             return node;
17788         }
17789         function updateQualifiedName(node, left, right) {
17790             return node.left !== left
17791                 || node.right !== right
17792                 ? update(createQualifiedName(left, right), node)
17793                 : node;
17794         }
17795         function createComputedPropertyName(expression) {
17796             var node = createBaseNode(161);
17797             node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression);
17798             node.transformFlags |=
17799                 propagateChildFlags(node.expression) |
17800                     512 |
17801                     65536;
17802             return node;
17803         }
17804         function updateComputedPropertyName(node, expression) {
17805             return node.expression !== expression
17806                 ? update(createComputedPropertyName(expression), node)
17807                 : node;
17808         }
17809         function createTypeParameterDeclaration(name, constraint, defaultType) {
17810             var node = createBaseNamedDeclaration(162, undefined, undefined, name);
17811             node.constraint = constraint;
17812             node.default = defaultType;
17813             node.transformFlags = 1;
17814             return node;
17815         }
17816         function updateTypeParameterDeclaration(node, name, constraint, defaultType) {
17817             return node.name !== name
17818                 || node.constraint !== constraint
17819                 || node.default !== defaultType
17820                 ? update(createTypeParameterDeclaration(name, constraint, defaultType), node)
17821                 : node;
17822         }
17823         function createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
17824             var node = createBaseVariableLikeDeclaration(163, decorators, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer));
17825             node.dotDotDotToken = dotDotDotToken;
17826             node.questionToken = questionToken;
17827             if (ts.isThisIdentifier(node.name)) {
17828                 node.transformFlags = 1;
17829             }
17830             else {
17831                 node.transformFlags |=
17832                     propagateChildFlags(node.dotDotDotToken) |
17833                         propagateChildFlags(node.questionToken);
17834                 if (questionToken)
17835                     node.transformFlags |= 1;
17836                 if (ts.modifiersToFlags(node.modifiers) & 16476)
17837                     node.transformFlags |= 4096;
17838                 if (initializer || dotDotDotToken)
17839                     node.transformFlags |= 512;
17840             }
17841             return node;
17842         }
17843         function updateParameterDeclaration(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
17844             return node.decorators !== decorators
17845                 || node.modifiers !== modifiers
17846                 || node.dotDotDotToken !== dotDotDotToken
17847                 || node.name !== name
17848                 || node.questionToken !== questionToken
17849                 || node.type !== type
17850                 || node.initializer !== initializer
17851                 ? update(createParameterDeclaration(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer), node)
17852                 : node;
17853         }
17854         function createDecorator(expression) {
17855             var node = createBaseNode(164);
17856             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
17857             node.transformFlags |=
17858                 propagateChildFlags(node.expression) |
17859                     1 |
17860                     4096;
17861             return node;
17862         }
17863         function updateDecorator(node, expression) {
17864             return node.expression !== expression
17865                 ? update(createDecorator(expression), node)
17866                 : node;
17867         }
17868         function createPropertySignature(modifiers, name, questionToken, type) {
17869             var node = createBaseNamedDeclaration(165, undefined, modifiers, name);
17870             node.type = type;
17871             node.questionToken = questionToken;
17872             node.transformFlags = 1;
17873             return node;
17874         }
17875         function updatePropertySignature(node, modifiers, name, questionToken, type) {
17876             return node.modifiers !== modifiers
17877                 || node.name !== name
17878                 || node.questionToken !== questionToken
17879                 || node.type !== type
17880                 ? update(createPropertySignature(modifiers, name, questionToken, type), node)
17881                 : node;
17882         }
17883         function createPropertyDeclaration(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
17884             var node = createBaseVariableLikeDeclaration(166, decorators, modifiers, name, type, initializer);
17885             node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined;
17886             node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined;
17887             node.transformFlags |=
17888                 propagateChildFlags(node.questionToken) |
17889                     propagateChildFlags(node.exclamationToken) |
17890                     8388608;
17891             if (ts.isComputedPropertyName(node.name) || (ts.hasStaticModifier(node) && node.initializer)) {
17892                 node.transformFlags |= 4096;
17893             }
17894             if (questionOrExclamationToken || ts.modifiersToFlags(node.modifiers) & 2) {
17895                 node.transformFlags |= 1;
17896             }
17897             return node;
17898         }
17899         function updatePropertyDeclaration(node, decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
17900             return node.decorators !== decorators
17901                 || node.modifiers !== modifiers
17902                 || node.name !== name
17903                 || node.questionToken !== (questionOrExclamationToken !== undefined && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined)
17904                 || node.exclamationToken !== (questionOrExclamationToken !== undefined && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined)
17905                 || node.type !== type
17906                 || node.initializer !== initializer
17907                 ? update(createPropertyDeclaration(decorators, modifiers, name, questionOrExclamationToken, type, initializer), node)
17908                 : node;
17909         }
17910         function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) {
17911             var node = createBaseSignatureDeclaration(167, undefined, modifiers, name, typeParameters, parameters, type);
17912             node.questionToken = questionToken;
17913             node.transformFlags = 1;
17914             return node;
17915         }
17916         function updateMethodSignature(node, modifiers, name, questionToken, typeParameters, parameters, type) {
17917             return node.modifiers !== modifiers
17918                 || node.name !== name
17919                 || node.questionToken !== questionToken
17920                 || node.typeParameters !== typeParameters
17921                 || node.parameters !== parameters
17922                 || node.type !== type
17923                 ? updateBaseSignatureDeclaration(createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type), node)
17924                 : node;
17925         }
17926         function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
17927             var node = createBaseFunctionLikeDeclaration(168, decorators, modifiers, name, typeParameters, parameters, type, body);
17928             node.asteriskToken = asteriskToken;
17929             node.questionToken = questionToken;
17930             node.transformFlags |=
17931                 propagateChildFlags(node.asteriskToken) |
17932                     propagateChildFlags(node.questionToken) |
17933                     512;
17934             if (questionToken) {
17935                 node.transformFlags |= 1;
17936             }
17937             if (ts.modifiersToFlags(node.modifiers) & 256) {
17938                 if (asteriskToken) {
17939                     node.transformFlags |= 64;
17940                 }
17941                 else {
17942                     node.transformFlags |= 128;
17943                 }
17944             }
17945             else if (asteriskToken) {
17946                 node.transformFlags |= 1024;
17947             }
17948             return node;
17949         }
17950         function updateMethodDeclaration(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
17951             return node.decorators !== decorators
17952                 || node.modifiers !== modifiers
17953                 || node.asteriskToken !== asteriskToken
17954                 || node.name !== name
17955                 || node.questionToken !== questionToken
17956                 || node.typeParameters !== typeParameters
17957                 || node.parameters !== parameters
17958                 || node.type !== type
17959                 || node.body !== body
17960                 ? updateBaseFunctionLikeDeclaration(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node)
17961                 : node;
17962         }
17963         function createClassStaticBlockDeclaration(decorators, modifiers, body) {
17964             var node = createBaseGenericNamedDeclaration(169, decorators, modifiers, undefined, undefined);
17965             node.body = body;
17966             node.transformFlags = propagateChildFlags(body) | 8388608;
17967             return node;
17968         }
17969         function updateClassStaticBlockDeclaration(node, decorators, modifiers, body) {
17970             return node.decorators !== decorators
17971                 || node.modifier !== modifiers
17972                 || node.body !== body
17973                 ? update(createClassStaticBlockDeclaration(decorators, modifiers, body), node)
17974                 : node;
17975         }
17976         function createConstructorDeclaration(decorators, modifiers, parameters, body) {
17977             var node = createBaseFunctionLikeDeclaration(170, decorators, modifiers, undefined, undefined, parameters, undefined, body);
17978             node.transformFlags |= 512;
17979             return node;
17980         }
17981         function updateConstructorDeclaration(node, decorators, modifiers, parameters, body) {
17982             return node.decorators !== decorators
17983                 || node.modifiers !== modifiers
17984                 || node.parameters !== parameters
17985                 || node.body !== body
17986                 ? updateBaseFunctionLikeDeclaration(createConstructorDeclaration(decorators, modifiers, parameters, body), node)
17987                 : node;
17988         }
17989         function createGetAccessorDeclaration(decorators, modifiers, name, parameters, type, body) {
17990             return createBaseFunctionLikeDeclaration(171, decorators, modifiers, name, undefined, parameters, type, body);
17991         }
17992         function updateGetAccessorDeclaration(node, decorators, modifiers, name, parameters, type, body) {
17993             return node.decorators !== decorators
17994                 || node.modifiers !== modifiers
17995                 || node.name !== name
17996                 || node.parameters !== parameters
17997                 || node.type !== type
17998                 || node.body !== body
17999                 ? updateBaseFunctionLikeDeclaration(createGetAccessorDeclaration(decorators, modifiers, name, parameters, type, body), node)
18000                 : node;
18001         }
18002         function createSetAccessorDeclaration(decorators, modifiers, name, parameters, body) {
18003             return createBaseFunctionLikeDeclaration(172, decorators, modifiers, name, undefined, parameters, undefined, body);
18004         }
18005         function updateSetAccessorDeclaration(node, decorators, modifiers, name, parameters, body) {
18006             return node.decorators !== decorators
18007                 || node.modifiers !== modifiers
18008                 || node.name !== name
18009                 || node.parameters !== parameters
18010                 || node.body !== body
18011                 ? updateBaseFunctionLikeDeclaration(createSetAccessorDeclaration(decorators, modifiers, name, parameters, body), node)
18012                 : node;
18013         }
18014         function createCallSignature(typeParameters, parameters, type) {
18015             var node = createBaseSignatureDeclaration(173, undefined, undefined, undefined, typeParameters, parameters, type);
18016             node.transformFlags = 1;
18017             return node;
18018         }
18019         function updateCallSignature(node, typeParameters, parameters, type) {
18020             return node.typeParameters !== typeParameters
18021                 || node.parameters !== parameters
18022                 || node.type !== type
18023                 ? updateBaseSignatureDeclaration(createCallSignature(typeParameters, parameters, type), node)
18024                 : node;
18025         }
18026         function createConstructSignature(typeParameters, parameters, type) {
18027             var node = createBaseSignatureDeclaration(174, undefined, undefined, undefined, typeParameters, parameters, type);
18028             node.transformFlags = 1;
18029             return node;
18030         }
18031         function updateConstructSignature(node, typeParameters, parameters, type) {
18032             return node.typeParameters !== typeParameters
18033                 || node.parameters !== parameters
18034                 || node.type !== type
18035                 ? updateBaseSignatureDeclaration(createConstructSignature(typeParameters, parameters, type), node)
18036                 : node;
18037         }
18038         function createIndexSignature(decorators, modifiers, parameters, type) {
18039             var node = createBaseSignatureDeclaration(175, decorators, modifiers, undefined, undefined, parameters, type);
18040             node.transformFlags = 1;
18041             return node;
18042         }
18043         function updateIndexSignature(node, decorators, modifiers, parameters, type) {
18044             return node.parameters !== parameters
18045                 || node.type !== type
18046                 || node.decorators !== decorators
18047                 || node.modifiers !== modifiers
18048                 ? updateBaseSignatureDeclaration(createIndexSignature(decorators, modifiers, parameters, type), node)
18049                 : node;
18050         }
18051         function createTemplateLiteralTypeSpan(type, literal) {
18052             var node = createBaseNode(198);
18053             node.type = type;
18054             node.literal = literal;
18055             node.transformFlags = 1;
18056             return node;
18057         }
18058         function updateTemplateLiteralTypeSpan(node, type, literal) {
18059             return node.type !== type
18060                 || node.literal !== literal
18061                 ? update(createTemplateLiteralTypeSpan(type, literal), node)
18062                 : node;
18063         }
18064         function createKeywordTypeNode(kind) {
18065             return createToken(kind);
18066         }
18067         function createTypePredicateNode(assertsModifier, parameterName, type) {
18068             var node = createBaseNode(176);
18069             node.assertsModifier = assertsModifier;
18070             node.parameterName = asName(parameterName);
18071             node.type = type;
18072             node.transformFlags = 1;
18073             return node;
18074         }
18075         function updateTypePredicateNode(node, assertsModifier, parameterName, type) {
18076             return node.assertsModifier !== assertsModifier
18077                 || node.parameterName !== parameterName
18078                 || node.type !== type
18079                 ? update(createTypePredicateNode(assertsModifier, parameterName, type), node)
18080                 : node;
18081         }
18082         function createTypeReferenceNode(typeName, typeArguments) {
18083             var node = createBaseNode(177);
18084             node.typeName = asName(typeName);
18085             node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments));
18086             node.transformFlags = 1;
18087             return node;
18088         }
18089         function updateTypeReferenceNode(node, typeName, typeArguments) {
18090             return node.typeName !== typeName
18091                 || node.typeArguments !== typeArguments
18092                 ? update(createTypeReferenceNode(typeName, typeArguments), node)
18093                 : node;
18094         }
18095         function createFunctionTypeNode(typeParameters, parameters, type) {
18096             var node = createBaseSignatureDeclaration(178, undefined, undefined, undefined, typeParameters, parameters, type);
18097             node.transformFlags = 1;
18098             return node;
18099         }
18100         function updateFunctionTypeNode(node, typeParameters, parameters, type) {
18101             return node.typeParameters !== typeParameters
18102                 || node.parameters !== parameters
18103                 || node.type !== type
18104                 ? updateBaseSignatureDeclaration(createFunctionTypeNode(typeParameters, parameters, type), node)
18105                 : node;
18106         }
18107         function createConstructorTypeNode() {
18108             var args = [];
18109             for (var _i = 0; _i < arguments.length; _i++) {
18110                 args[_i] = arguments[_i];
18111             }
18112             return args.length === 4 ? createConstructorTypeNode1.apply(void 0, args) :
18113                 args.length === 3 ? createConstructorTypeNode2.apply(void 0, args) :
18114                     ts.Debug.fail("Incorrect number of arguments specified.");
18115         }
18116         function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) {
18117             var node = createBaseSignatureDeclaration(179, undefined, modifiers, undefined, typeParameters, parameters, type);
18118             node.transformFlags = 1;
18119             return node;
18120         }
18121         function createConstructorTypeNode2(typeParameters, parameters, type) {
18122             return createConstructorTypeNode1(undefined, typeParameters, parameters, type);
18123         }
18124         function updateConstructorTypeNode() {
18125             var args = [];
18126             for (var _i = 0; _i < arguments.length; _i++) {
18127                 args[_i] = arguments[_i];
18128             }
18129             return args.length === 5 ? updateConstructorTypeNode1.apply(void 0, args) :
18130                 args.length === 4 ? updateConstructorTypeNode2.apply(void 0, args) :
18131                     ts.Debug.fail("Incorrect number of arguments specified.");
18132         }
18133         function updateConstructorTypeNode1(node, modifiers, typeParameters, parameters, type) {
18134             return node.modifiers !== modifiers
18135                 || node.typeParameters !== typeParameters
18136                 || node.parameters !== parameters
18137                 || node.type !== type
18138                 ? updateBaseSignatureDeclaration(createConstructorTypeNode(modifiers, typeParameters, parameters, type), node)
18139                 : node;
18140         }
18141         function updateConstructorTypeNode2(node, typeParameters, parameters, type) {
18142             return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type);
18143         }
18144         function createTypeQueryNode(exprName) {
18145             var node = createBaseNode(180);
18146             node.exprName = exprName;
18147             node.transformFlags = 1;
18148             return node;
18149         }
18150         function updateTypeQueryNode(node, exprName) {
18151             return node.exprName !== exprName
18152                 ? update(createTypeQueryNode(exprName), node)
18153                 : node;
18154         }
18155         function createTypeLiteralNode(members) {
18156             var node = createBaseNode(181);
18157             node.members = createNodeArray(members);
18158             node.transformFlags = 1;
18159             return node;
18160         }
18161         function updateTypeLiteralNode(node, members) {
18162             return node.members !== members
18163                 ? update(createTypeLiteralNode(members), node)
18164                 : node;
18165         }
18166         function createArrayTypeNode(elementType) {
18167             var node = createBaseNode(182);
18168             node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType);
18169             node.transformFlags = 1;
18170             return node;
18171         }
18172         function updateArrayTypeNode(node, elementType) {
18173             return node.elementType !== elementType
18174                 ? update(createArrayTypeNode(elementType), node)
18175                 : node;
18176         }
18177         function createTupleTypeNode(elements) {
18178             var node = createBaseNode(183);
18179             node.elements = createNodeArray(elements);
18180             node.transformFlags = 1;
18181             return node;
18182         }
18183         function updateTupleTypeNode(node, elements) {
18184             return node.elements !== elements
18185                 ? update(createTupleTypeNode(elements), node)
18186                 : node;
18187         }
18188         function createNamedTupleMember(dotDotDotToken, name, questionToken, type) {
18189             var node = createBaseNode(196);
18190             node.dotDotDotToken = dotDotDotToken;
18191             node.name = name;
18192             node.questionToken = questionToken;
18193             node.type = type;
18194             node.transformFlags = 1;
18195             return node;
18196         }
18197         function updateNamedTupleMember(node, dotDotDotToken, name, questionToken, type) {
18198             return node.dotDotDotToken !== dotDotDotToken
18199                 || node.name !== name
18200                 || node.questionToken !== questionToken
18201                 || node.type !== type
18202                 ? update(createNamedTupleMember(dotDotDotToken, name, questionToken, type), node)
18203                 : node;
18204         }
18205         function createOptionalTypeNode(type) {
18206             var node = createBaseNode(184);
18207             node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type);
18208             node.transformFlags = 1;
18209             return node;
18210         }
18211         function updateOptionalTypeNode(node, type) {
18212             return node.type !== type
18213                 ? update(createOptionalTypeNode(type), node)
18214                 : node;
18215         }
18216         function createRestTypeNode(type) {
18217             var node = createBaseNode(185);
18218             node.type = type;
18219             node.transformFlags = 1;
18220             return node;
18221         }
18222         function updateRestTypeNode(node, type) {
18223             return node.type !== type
18224                 ? update(createRestTypeNode(type), node)
18225                 : node;
18226         }
18227         function createUnionOrIntersectionTypeNode(kind, types) {
18228             var node = createBaseNode(kind);
18229             node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types);
18230             node.transformFlags = 1;
18231             return node;
18232         }
18233         function updateUnionOrIntersectionTypeNode(node, types) {
18234             return node.types !== types
18235                 ? update(createUnionOrIntersectionTypeNode(node.kind, types), node)
18236                 : node;
18237         }
18238         function createUnionTypeNode(types) {
18239             return createUnionOrIntersectionTypeNode(186, types);
18240         }
18241         function updateUnionTypeNode(node, types) {
18242             return updateUnionOrIntersectionTypeNode(node, types);
18243         }
18244         function createIntersectionTypeNode(types) {
18245             return createUnionOrIntersectionTypeNode(187, types);
18246         }
18247         function updateIntersectionTypeNode(node, types) {
18248             return updateUnionOrIntersectionTypeNode(node, types);
18249         }
18250         function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
18251             var node = createBaseNode(188);
18252             node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType);
18253             node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType);
18254             node.trueType = trueType;
18255             node.falseType = falseType;
18256             node.transformFlags = 1;
18257             return node;
18258         }
18259         function updateConditionalTypeNode(node, checkType, extendsType, trueType, falseType) {
18260             return node.checkType !== checkType
18261                 || node.extendsType !== extendsType
18262                 || node.trueType !== trueType
18263                 || node.falseType !== falseType
18264                 ? update(createConditionalTypeNode(checkType, extendsType, trueType, falseType), node)
18265                 : node;
18266         }
18267         function createInferTypeNode(typeParameter) {
18268             var node = createBaseNode(189);
18269             node.typeParameter = typeParameter;
18270             node.transformFlags = 1;
18271             return node;
18272         }
18273         function updateInferTypeNode(node, typeParameter) {
18274             return node.typeParameter !== typeParameter
18275                 ? update(createInferTypeNode(typeParameter), node)
18276                 : node;
18277         }
18278         function createTemplateLiteralType(head, templateSpans) {
18279             var node = createBaseNode(197);
18280             node.head = head;
18281             node.templateSpans = createNodeArray(templateSpans);
18282             node.transformFlags = 1;
18283             return node;
18284         }
18285         function updateTemplateLiteralType(node, head, templateSpans) {
18286             return node.head !== head
18287                 || node.templateSpans !== templateSpans
18288                 ? update(createTemplateLiteralType(head, templateSpans), node)
18289                 : node;
18290         }
18291         function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
18292             if (isTypeOf === void 0) { isTypeOf = false; }
18293             var node = createBaseNode(199);
18294             node.argument = argument;
18295             node.qualifier = qualifier;
18296             node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
18297             node.isTypeOf = isTypeOf;
18298             node.transformFlags = 1;
18299             return node;
18300         }
18301         function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) {
18302             if (isTypeOf === void 0) { isTypeOf = node.isTypeOf; }
18303             return node.argument !== argument
18304                 || node.qualifier !== qualifier
18305                 || node.typeArguments !== typeArguments
18306                 || node.isTypeOf !== isTypeOf
18307                 ? update(createImportTypeNode(argument, qualifier, typeArguments, isTypeOf), node)
18308                 : node;
18309         }
18310         function createParenthesizedType(type) {
18311             var node = createBaseNode(190);
18312             node.type = type;
18313             node.transformFlags = 1;
18314             return node;
18315         }
18316         function updateParenthesizedType(node, type) {
18317             return node.type !== type
18318                 ? update(createParenthesizedType(type), node)
18319                 : node;
18320         }
18321         function createThisTypeNode() {
18322             var node = createBaseNode(191);
18323             node.transformFlags = 1;
18324             return node;
18325         }
18326         function createTypeOperatorNode(operator, type) {
18327             var node = createBaseNode(192);
18328             node.operator = operator;
18329             node.type = parenthesizerRules().parenthesizeMemberOfElementType(type);
18330             node.transformFlags = 1;
18331             return node;
18332         }
18333         function updateTypeOperatorNode(node, type) {
18334             return node.type !== type
18335                 ? update(createTypeOperatorNode(node.operator, type), node)
18336                 : node;
18337         }
18338         function createIndexedAccessTypeNode(objectType, indexType) {
18339             var node = createBaseNode(193);
18340             node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType);
18341             node.indexType = indexType;
18342             node.transformFlags = 1;
18343             return node;
18344         }
18345         function updateIndexedAccessTypeNode(node, objectType, indexType) {
18346             return node.objectType !== objectType
18347                 || node.indexType !== indexType
18348                 ? update(createIndexedAccessTypeNode(objectType, indexType), node)
18349                 : node;
18350         }
18351         function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) {
18352             var node = createBaseNode(194);
18353             node.readonlyToken = readonlyToken;
18354             node.typeParameter = typeParameter;
18355             node.nameType = nameType;
18356             node.questionToken = questionToken;
18357             node.type = type;
18358             node.members = members && createNodeArray(members);
18359             node.transformFlags = 1;
18360             return node;
18361         }
18362         function updateMappedTypeNode(node, readonlyToken, typeParameter, nameType, questionToken, type, members) {
18363             return node.readonlyToken !== readonlyToken
18364                 || node.typeParameter !== typeParameter
18365                 || node.nameType !== nameType
18366                 || node.questionToken !== questionToken
18367                 || node.type !== type
18368                 || node.members !== members
18369                 ? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), node)
18370                 : node;
18371         }
18372         function createLiteralTypeNode(literal) {
18373             var node = createBaseNode(195);
18374             node.literal = literal;
18375             node.transformFlags = 1;
18376             return node;
18377         }
18378         function updateLiteralTypeNode(node, literal) {
18379             return node.literal !== literal
18380                 ? update(createLiteralTypeNode(literal), node)
18381                 : node;
18382         }
18383         function createObjectBindingPattern(elements) {
18384             var node = createBaseNode(200);
18385             node.elements = createNodeArray(elements);
18386             node.transformFlags |=
18387                 propagateChildrenFlags(node.elements) |
18388                     512 |
18389                     262144;
18390             if (node.transformFlags & 16384) {
18391                 node.transformFlags |=
18392                     64 |
18393                         32768;
18394             }
18395             return node;
18396         }
18397         function updateObjectBindingPattern(node, elements) {
18398             return node.elements !== elements
18399                 ? update(createObjectBindingPattern(elements), node)
18400                 : node;
18401         }
18402         function createArrayBindingPattern(elements) {
18403             var node = createBaseNode(201);
18404             node.elements = createNodeArray(elements);
18405             node.transformFlags |=
18406                 propagateChildrenFlags(node.elements) |
18407                     512 |
18408                     262144;
18409             return node;
18410         }
18411         function updateArrayBindingPattern(node, elements) {
18412             return node.elements !== elements
18413                 ? update(createArrayBindingPattern(elements), node)
18414                 : node;
18415         }
18416         function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
18417             var node = createBaseBindingLikeDeclaration(202, undefined, undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer));
18418             node.propertyName = asName(propertyName);
18419             node.dotDotDotToken = dotDotDotToken;
18420             node.transformFlags |=
18421                 propagateChildFlags(node.dotDotDotToken) |
18422                     512;
18423             if (node.propertyName) {
18424                 node.transformFlags |= ts.isIdentifier(node.propertyName) ?
18425                     propagateIdentifierNameFlags(node.propertyName) :
18426                     propagateChildFlags(node.propertyName);
18427             }
18428             if (dotDotDotToken)
18429                 node.transformFlags |= 16384;
18430             return node;
18431         }
18432         function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) {
18433             return node.propertyName !== propertyName
18434                 || node.dotDotDotToken !== dotDotDotToken
18435                 || node.name !== name
18436                 || node.initializer !== initializer
18437                 ? update(createBindingElement(dotDotDotToken, propertyName, name, initializer), node)
18438                 : node;
18439         }
18440         function createBaseExpression(kind) {
18441             var node = createBaseNode(kind);
18442             return node;
18443         }
18444         function createArrayLiteralExpression(elements, multiLine) {
18445             var node = createBaseExpression(203);
18446             var lastElement = elements && ts.lastOrUndefined(elements);
18447             var elementsArray = createNodeArray(elements, lastElement && ts.isOmittedExpression(lastElement) ? true : undefined);
18448             node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray);
18449             node.multiLine = multiLine;
18450             node.transformFlags |= propagateChildrenFlags(node.elements);
18451             return node;
18452         }
18453         function updateArrayLiteralExpression(node, elements) {
18454             return node.elements !== elements
18455                 ? update(createArrayLiteralExpression(elements, node.multiLine), node)
18456                 : node;
18457         }
18458         function createObjectLiteralExpression(properties, multiLine) {
18459             var node = createBaseExpression(204);
18460             node.properties = createNodeArray(properties);
18461             node.multiLine = multiLine;
18462             node.transformFlags |= propagateChildrenFlags(node.properties);
18463             return node;
18464         }
18465         function updateObjectLiteralExpression(node, properties) {
18466             return node.properties !== properties
18467                 ? update(createObjectLiteralExpression(properties, node.multiLine), node)
18468                 : node;
18469         }
18470         function createPropertyAccessExpression(expression, name) {
18471             var node = createBaseExpression(205);
18472             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18473             node.name = asName(name);
18474             node.transformFlags =
18475                 propagateChildFlags(node.expression) |
18476                     (ts.isIdentifier(node.name) ?
18477                         propagateIdentifierNameFlags(node.name) :
18478                         propagateChildFlags(node.name));
18479             if (ts.isSuperKeyword(expression)) {
18480                 node.transformFlags |=
18481                     128 |
18482                         64;
18483             }
18484             return node;
18485         }
18486         function updatePropertyAccessExpression(node, expression, name) {
18487             if (ts.isPropertyAccessChain(node)) {
18488                 return updatePropertyAccessChain(node, expression, node.questionDotToken, ts.cast(name, ts.isIdentifier));
18489             }
18490             return node.expression !== expression
18491                 || node.name !== name
18492                 ? update(createPropertyAccessExpression(expression, name), node)
18493                 : node;
18494         }
18495         function createPropertyAccessChain(expression, questionDotToken, name) {
18496             var node = createBaseExpression(205);
18497             node.flags |= 32;
18498             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18499             node.questionDotToken = questionDotToken;
18500             node.name = asName(name);
18501             node.transformFlags |=
18502                 16 |
18503                     propagateChildFlags(node.expression) |
18504                     propagateChildFlags(node.questionDotToken) |
18505                     (ts.isIdentifier(node.name) ?
18506                         propagateIdentifierNameFlags(node.name) :
18507                         propagateChildFlags(node.name));
18508             return node;
18509         }
18510         function updatePropertyAccessChain(node, expression, questionDotToken, name) {
18511             ts.Debug.assert(!!(node.flags & 32), "Cannot update a PropertyAccessExpression using updatePropertyAccessChain. Use updatePropertyAccess instead.");
18512             return node.expression !== expression
18513                 || node.questionDotToken !== questionDotToken
18514                 || node.name !== name
18515                 ? update(createPropertyAccessChain(expression, questionDotToken, name), node)
18516                 : node;
18517         }
18518         function createElementAccessExpression(expression, index) {
18519             var node = createBaseExpression(206);
18520             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18521             node.argumentExpression = asExpression(index);
18522             node.transformFlags |=
18523                 propagateChildFlags(node.expression) |
18524                     propagateChildFlags(node.argumentExpression);
18525             if (ts.isSuperKeyword(expression)) {
18526                 node.transformFlags |=
18527                     128 |
18528                         64;
18529             }
18530             return node;
18531         }
18532         function updateElementAccessExpression(node, expression, argumentExpression) {
18533             if (ts.isElementAccessChain(node)) {
18534                 return updateElementAccessChain(node, expression, node.questionDotToken, argumentExpression);
18535             }
18536             return node.expression !== expression
18537                 || node.argumentExpression !== argumentExpression
18538                 ? update(createElementAccessExpression(expression, argumentExpression), node)
18539                 : node;
18540         }
18541         function createElementAccessChain(expression, questionDotToken, index) {
18542             var node = createBaseExpression(206);
18543             node.flags |= 32;
18544             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18545             node.questionDotToken = questionDotToken;
18546             node.argumentExpression = asExpression(index);
18547             node.transformFlags |=
18548                 propagateChildFlags(node.expression) |
18549                     propagateChildFlags(node.questionDotToken) |
18550                     propagateChildFlags(node.argumentExpression) |
18551                     16;
18552             return node;
18553         }
18554         function updateElementAccessChain(node, expression, questionDotToken, argumentExpression) {
18555             ts.Debug.assert(!!(node.flags & 32), "Cannot update a ElementAccessExpression using updateElementAccessChain. Use updateElementAccess instead.");
18556             return node.expression !== expression
18557                 || node.questionDotToken !== questionDotToken
18558                 || node.argumentExpression !== argumentExpression
18559                 ? update(createElementAccessChain(expression, questionDotToken, argumentExpression), node)
18560                 : node;
18561         }
18562         function createCallExpression(expression, typeArguments, argumentsArray) {
18563             var node = createBaseExpression(207);
18564             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18565             node.typeArguments = asNodeArray(typeArguments);
18566             node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
18567             node.transformFlags |=
18568                 propagateChildFlags(node.expression) |
18569                     propagateChildrenFlags(node.typeArguments) |
18570                     propagateChildrenFlags(node.arguments);
18571             if (node.typeArguments) {
18572                 node.transformFlags |= 1;
18573             }
18574             if (ts.isImportKeyword(node.expression)) {
18575                 node.transformFlags |= 4194304;
18576             }
18577             else if (ts.isSuperProperty(node.expression)) {
18578                 node.transformFlags |= 8192;
18579             }
18580             return node;
18581         }
18582         function updateCallExpression(node, expression, typeArguments, argumentsArray) {
18583             if (ts.isCallChain(node)) {
18584                 return updateCallChain(node, expression, node.questionDotToken, typeArguments, argumentsArray);
18585             }
18586             return node.expression !== expression
18587                 || node.typeArguments !== typeArguments
18588                 || node.arguments !== argumentsArray
18589                 ? update(createCallExpression(expression, typeArguments, argumentsArray), node)
18590                 : node;
18591         }
18592         function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) {
18593             var node = createBaseExpression(207);
18594             node.flags |= 32;
18595             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
18596             node.questionDotToken = questionDotToken;
18597             node.typeArguments = asNodeArray(typeArguments);
18598             node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
18599             node.transformFlags |=
18600                 propagateChildFlags(node.expression) |
18601                     propagateChildFlags(node.questionDotToken) |
18602                     propagateChildrenFlags(node.typeArguments) |
18603                     propagateChildrenFlags(node.arguments) |
18604                     16;
18605             if (node.typeArguments) {
18606                 node.transformFlags |= 1;
18607             }
18608             if (ts.isSuperProperty(node.expression)) {
18609                 node.transformFlags |= 8192;
18610             }
18611             return node;
18612         }
18613         function updateCallChain(node, expression, questionDotToken, typeArguments, argumentsArray) {
18614             ts.Debug.assert(!!(node.flags & 32), "Cannot update a CallExpression using updateCallChain. Use updateCall instead.");
18615             return node.expression !== expression
18616                 || node.questionDotToken !== questionDotToken
18617                 || node.typeArguments !== typeArguments
18618                 || node.arguments !== argumentsArray
18619                 ? update(createCallChain(expression, questionDotToken, typeArguments, argumentsArray), node)
18620                 : node;
18621         }
18622         function createNewExpression(expression, typeArguments, argumentsArray) {
18623             var node = createBaseExpression(208);
18624             node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression);
18625             node.typeArguments = asNodeArray(typeArguments);
18626             node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined;
18627             node.transformFlags |=
18628                 propagateChildFlags(node.expression) |
18629                     propagateChildrenFlags(node.typeArguments) |
18630                     propagateChildrenFlags(node.arguments) |
18631                     16;
18632             if (node.typeArguments) {
18633                 node.transformFlags |= 1;
18634             }
18635             return node;
18636         }
18637         function updateNewExpression(node, expression, typeArguments, argumentsArray) {
18638             return node.expression !== expression
18639                 || node.typeArguments !== typeArguments
18640                 || node.arguments !== argumentsArray
18641                 ? update(createNewExpression(expression, typeArguments, argumentsArray), node)
18642                 : node;
18643         }
18644         function createTaggedTemplateExpression(tag, typeArguments, template) {
18645             var node = createBaseExpression(209);
18646             node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag);
18647             node.typeArguments = asNodeArray(typeArguments);
18648             node.template = template;
18649             node.transformFlags |=
18650                 propagateChildFlags(node.tag) |
18651                     propagateChildrenFlags(node.typeArguments) |
18652                     propagateChildFlags(node.template) |
18653                     512;
18654             if (node.typeArguments) {
18655                 node.transformFlags |= 1;
18656             }
18657             if (ts.hasInvalidEscape(node.template)) {
18658                 node.transformFlags |= 64;
18659             }
18660             return node;
18661         }
18662         function updateTaggedTemplateExpression(node, tag, typeArguments, template) {
18663             return node.tag !== tag
18664                 || node.typeArguments !== typeArguments
18665                 || node.template !== template
18666                 ? update(createTaggedTemplateExpression(tag, typeArguments, template), node)
18667                 : node;
18668         }
18669         function createTypeAssertion(type, expression) {
18670             var node = createBaseExpression(210);
18671             node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
18672             node.type = type;
18673             node.transformFlags |=
18674                 propagateChildFlags(node.expression) |
18675                     propagateChildFlags(node.type) |
18676                     1;
18677             return node;
18678         }
18679         function updateTypeAssertion(node, type, expression) {
18680             return node.type !== type
18681                 || node.expression !== expression
18682                 ? update(createTypeAssertion(type, expression), node)
18683                 : node;
18684         }
18685         function createParenthesizedExpression(expression) {
18686             var node = createBaseExpression(211);
18687             node.expression = expression;
18688             node.transformFlags = propagateChildFlags(node.expression);
18689             return node;
18690         }
18691         function updateParenthesizedExpression(node, expression) {
18692             return node.expression !== expression
18693                 ? update(createParenthesizedExpression(expression), node)
18694                 : node;
18695         }
18696         function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
18697             var node = createBaseFunctionLikeDeclaration(212, undefined, modifiers, name, typeParameters, parameters, type, body);
18698             node.asteriskToken = asteriskToken;
18699             node.transformFlags |= propagateChildFlags(node.asteriskToken);
18700             if (node.typeParameters) {
18701                 node.transformFlags |= 1;
18702             }
18703             if (ts.modifiersToFlags(node.modifiers) & 256) {
18704                 if (node.asteriskToken) {
18705                     node.transformFlags |= 64;
18706                 }
18707                 else {
18708                     node.transformFlags |= 128;
18709                 }
18710             }
18711             else if (node.asteriskToken) {
18712                 node.transformFlags |= 1024;
18713             }
18714             return node;
18715         }
18716         function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
18717             return node.name !== name
18718                 || node.modifiers !== modifiers
18719                 || node.asteriskToken !== asteriskToken
18720                 || node.typeParameters !== typeParameters
18721                 || node.parameters !== parameters
18722                 || node.type !== type
18723                 || node.body !== body
18724                 ? updateBaseFunctionLikeDeclaration(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node)
18725                 : node;
18726         }
18727         function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
18728             var node = createBaseFunctionLikeDeclaration(213, undefined, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body));
18729             node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38);
18730             node.transformFlags |=
18731                 propagateChildFlags(node.equalsGreaterThanToken) |
18732                     512;
18733             if (ts.modifiersToFlags(node.modifiers) & 256) {
18734                 node.transformFlags |= 128 | 8192;
18735             }
18736             return node;
18737         }
18738         function updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
18739             return node.modifiers !== modifiers
18740                 || node.typeParameters !== typeParameters
18741                 || node.parameters !== parameters
18742                 || node.type !== type
18743                 || node.equalsGreaterThanToken !== equalsGreaterThanToken
18744                 || node.body !== body
18745                 ? updateBaseFunctionLikeDeclaration(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node)
18746                 : node;
18747         }
18748         function createDeleteExpression(expression) {
18749             var node = createBaseExpression(214);
18750             node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
18751             node.transformFlags |= propagateChildFlags(node.expression);
18752             return node;
18753         }
18754         function updateDeleteExpression(node, expression) {
18755             return node.expression !== expression
18756                 ? update(createDeleteExpression(expression), node)
18757                 : node;
18758         }
18759         function createTypeOfExpression(expression) {
18760             var node = createBaseExpression(215);
18761             node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
18762             node.transformFlags |= propagateChildFlags(node.expression);
18763             return node;
18764         }
18765         function updateTypeOfExpression(node, expression) {
18766             return node.expression !== expression
18767                 ? update(createTypeOfExpression(expression), node)
18768                 : node;
18769         }
18770         function createVoidExpression(expression) {
18771             var node = createBaseExpression(216);
18772             node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
18773             node.transformFlags |= propagateChildFlags(node.expression);
18774             return node;
18775         }
18776         function updateVoidExpression(node, expression) {
18777             return node.expression !== expression
18778                 ? update(createVoidExpression(expression), node)
18779                 : node;
18780         }
18781         function createAwaitExpression(expression) {
18782             var node = createBaseExpression(217);
18783             node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression);
18784             node.transformFlags |=
18785                 propagateChildFlags(node.expression) |
18786                     128 |
18787                     64 |
18788                     1048576;
18789             return node;
18790         }
18791         function updateAwaitExpression(node, expression) {
18792             return node.expression !== expression
18793                 ? update(createAwaitExpression(expression), node)
18794                 : node;
18795         }
18796         function createPrefixUnaryExpression(operator, operand) {
18797             var node = createBaseExpression(218);
18798             node.operator = operator;
18799             node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand);
18800             node.transformFlags |= propagateChildFlags(node.operand);
18801             if ((operator === 45 || operator === 46) &&
18802                 ts.isIdentifier(node.operand) &&
18803                 !ts.isGeneratedIdentifier(node.operand) &&
18804                 !ts.isLocalName(node.operand)) {
18805                 node.transformFlags |= 67108864;
18806             }
18807             return node;
18808         }
18809         function updatePrefixUnaryExpression(node, operand) {
18810             return node.operand !== operand
18811                 ? update(createPrefixUnaryExpression(node.operator, operand), node)
18812                 : node;
18813         }
18814         function createPostfixUnaryExpression(operand, operator) {
18815             var node = createBaseExpression(219);
18816             node.operator = operator;
18817             node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand);
18818             node.transformFlags |= propagateChildFlags(node.operand);
18819             if (ts.isIdentifier(node.operand) &&
18820                 !ts.isGeneratedIdentifier(node.operand) &&
18821                 !ts.isLocalName(node.operand)) {
18822                 node.transformFlags |= 67108864;
18823             }
18824             return node;
18825         }
18826         function updatePostfixUnaryExpression(node, operand) {
18827             return node.operand !== operand
18828                 ? update(createPostfixUnaryExpression(operand, node.operator), node)
18829                 : node;
18830         }
18831         function createBinaryExpression(left, operator, right) {
18832             var node = createBaseExpression(220);
18833             var operatorToken = asToken(operator);
18834             var operatorKind = operatorToken.kind;
18835             node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left);
18836             node.operatorToken = operatorToken;
18837             node.right = parenthesizerRules().parenthesizeRightSideOfBinary(operatorKind, node.left, right);
18838             node.transformFlags |=
18839                 propagateChildFlags(node.left) |
18840                     propagateChildFlags(node.operatorToken) |
18841                     propagateChildFlags(node.right);
18842             if (operatorKind === 60) {
18843                 node.transformFlags |= 16;
18844             }
18845             else if (operatorKind === 63) {
18846                 if (ts.isObjectLiteralExpression(node.left)) {
18847                     node.transformFlags |=
18848                         512 |
18849                             64 |
18850                             2048 |
18851                             propagateAssignmentPatternFlags(node.left);
18852                 }
18853                 else if (ts.isArrayLiteralExpression(node.left)) {
18854                     node.transformFlags |=
18855                         512 |
18856                             2048 |
18857                             propagateAssignmentPatternFlags(node.left);
18858                 }
18859             }
18860             else if (operatorKind === 42 || operatorKind === 67) {
18861                 node.transformFlags |= 256;
18862             }
18863             else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
18864                 node.transformFlags |= 8;
18865             }
18866             return node;
18867         }
18868         function propagateAssignmentPatternFlags(node) {
18869             if (node.transformFlags & 32768)
18870                 return 32768;
18871             if (node.transformFlags & 64) {
18872                 for (var _i = 0, _a = ts.getElementsOfBindingOrAssignmentPattern(node); _i < _a.length; _i++) {
18873                     var element = _a[_i];
18874                     var target = ts.getTargetOfBindingOrAssignmentElement(element);
18875                     if (target && ts.isAssignmentPattern(target)) {
18876                         if (target.transformFlags & 32768) {
18877                             return 32768;
18878                         }
18879                         if (target.transformFlags & 64) {
18880                             var flags_1 = propagateAssignmentPatternFlags(target);
18881                             if (flags_1)
18882                                 return flags_1;
18883                         }
18884                     }
18885                 }
18886             }
18887             return 0;
18888         }
18889         function updateBinaryExpression(node, left, operator, right) {
18890             return node.left !== left
18891                 || node.operatorToken !== operator
18892                 || node.right !== right
18893                 ? update(createBinaryExpression(left, operator, right), node)
18894                 : node;
18895         }
18896         function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) {
18897             var node = createBaseExpression(221);
18898             node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition);
18899             node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57);
18900             node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue);
18901             node.colonToken = colonToken !== null && colonToken !== void 0 ? colonToken : createToken(58);
18902             node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse);
18903             node.transformFlags |=
18904                 propagateChildFlags(node.condition) |
18905                     propagateChildFlags(node.questionToken) |
18906                     propagateChildFlags(node.whenTrue) |
18907                     propagateChildFlags(node.colonToken) |
18908                     propagateChildFlags(node.whenFalse);
18909             return node;
18910         }
18911         function updateConditionalExpression(node, condition, questionToken, whenTrue, colonToken, whenFalse) {
18912             return node.condition !== condition
18913                 || node.questionToken !== questionToken
18914                 || node.whenTrue !== whenTrue
18915                 || node.colonToken !== colonToken
18916                 || node.whenFalse !== whenFalse
18917                 ? update(createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node)
18918                 : node;
18919         }
18920         function createTemplateExpression(head, templateSpans) {
18921             var node = createBaseExpression(222);
18922             node.head = head;
18923             node.templateSpans = createNodeArray(templateSpans);
18924             node.transformFlags |=
18925                 propagateChildFlags(node.head) |
18926                     propagateChildrenFlags(node.templateSpans) |
18927                     512;
18928             return node;
18929         }
18930         function updateTemplateExpression(node, head, templateSpans) {
18931             return node.head !== head
18932                 || node.templateSpans !== templateSpans
18933                 ? update(createTemplateExpression(head, templateSpans), node)
18934                 : node;
18935         }
18936         function createTemplateLiteralLikeNodeChecked(kind, text, rawText, templateFlags) {
18937             if (templateFlags === void 0) { templateFlags = 0; }
18938             ts.Debug.assert(!(templateFlags & ~2048), "Unsupported template flags.");
18939             var cooked = undefined;
18940             if (rawText !== undefined && rawText !== text) {
18941                 cooked = getCookedText(kind, rawText);
18942                 if (typeof cooked === "object") {
18943                     return ts.Debug.fail("Invalid raw text");
18944                 }
18945             }
18946             if (text === undefined) {
18947                 if (cooked === undefined) {
18948                     return ts.Debug.fail("Arguments 'text' and 'rawText' may not both be undefined.");
18949                 }
18950                 text = cooked;
18951             }
18952             else if (cooked !== undefined) {
18953                 ts.Debug.assert(text === cooked, "Expected argument 'text' to be the normalized (i.e. 'cooked') version of argument 'rawText'.");
18954             }
18955             return createTemplateLiteralLikeNode(kind, text, rawText, templateFlags);
18956         }
18957         function createTemplateLiteralLikeNode(kind, text, rawText, templateFlags) {
18958             var node = createBaseToken(kind);
18959             node.text = text;
18960             node.rawText = rawText;
18961             node.templateFlags = templateFlags & 2048;
18962             node.transformFlags |= 512;
18963             if (node.templateFlags) {
18964                 node.transformFlags |= 64;
18965             }
18966             return node;
18967         }
18968         function createTemplateHead(text, rawText, templateFlags) {
18969             return createTemplateLiteralLikeNodeChecked(15, text, rawText, templateFlags);
18970         }
18971         function createTemplateMiddle(text, rawText, templateFlags) {
18972             return createTemplateLiteralLikeNodeChecked(16, text, rawText, templateFlags);
18973         }
18974         function createTemplateTail(text, rawText, templateFlags) {
18975             return createTemplateLiteralLikeNodeChecked(17, text, rawText, templateFlags);
18976         }
18977         function createNoSubstitutionTemplateLiteral(text, rawText, templateFlags) {
18978             return createTemplateLiteralLikeNodeChecked(14, text, rawText, templateFlags);
18979         }
18980         function createYieldExpression(asteriskToken, expression) {
18981             ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression.");
18982             var node = createBaseExpression(223);
18983             node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
18984             node.asteriskToken = asteriskToken;
18985             node.transformFlags |=
18986                 propagateChildFlags(node.expression) |
18987                     propagateChildFlags(node.asteriskToken) |
18988                     512 |
18989                     64 |
18990                     524288;
18991             return node;
18992         }
18993         function updateYieldExpression(node, asteriskToken, expression) {
18994             return node.expression !== expression
18995                 || node.asteriskToken !== asteriskToken
18996                 ? update(createYieldExpression(asteriskToken, expression), node)
18997                 : node;
18998         }
18999         function createSpreadElement(expression) {
19000             var node = createBaseExpression(224);
19001             node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
19002             node.transformFlags |=
19003                 propagateChildFlags(node.expression) |
19004                     512 |
19005                     16384;
19006             return node;
19007         }
19008         function updateSpreadElement(node, expression) {
19009             return node.expression !== expression
19010                 ? update(createSpreadElement(expression), node)
19011                 : node;
19012         }
19013         function createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members) {
19014             var node = createBaseClassLikeDeclaration(225, decorators, modifiers, name, typeParameters, heritageClauses, members);
19015             node.transformFlags |= 512;
19016             return node;
19017         }
19018         function updateClassExpression(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {
19019             return node.decorators !== decorators
19020                 || node.modifiers !== modifiers
19021                 || node.name !== name
19022                 || node.typeParameters !== typeParameters
19023                 || node.heritageClauses !== heritageClauses
19024                 || node.members !== members
19025                 ? update(createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members), node)
19026                 : node;
19027         }
19028         function createOmittedExpression() {
19029             return createBaseExpression(226);
19030         }
19031         function createExpressionWithTypeArguments(expression, typeArguments) {
19032             var node = createBaseNode(227);
19033             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
19034             node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
19035             node.transformFlags |=
19036                 propagateChildFlags(node.expression) |
19037                     propagateChildrenFlags(node.typeArguments) |
19038                     512;
19039             return node;
19040         }
19041         function updateExpressionWithTypeArguments(node, expression, typeArguments) {
19042             return node.expression !== expression
19043                 || node.typeArguments !== typeArguments
19044                 ? update(createExpressionWithTypeArguments(expression, typeArguments), node)
19045                 : node;
19046         }
19047         function createAsExpression(expression, type) {
19048             var node = createBaseExpression(228);
19049             node.expression = expression;
19050             node.type = type;
19051             node.transformFlags |=
19052                 propagateChildFlags(node.expression) |
19053                     propagateChildFlags(node.type) |
19054                     1;
19055             return node;
19056         }
19057         function updateAsExpression(node, expression, type) {
19058             return node.expression !== expression
19059                 || node.type !== type
19060                 ? update(createAsExpression(expression, type), node)
19061                 : node;
19062         }
19063         function createNonNullExpression(expression) {
19064             var node = createBaseExpression(229);
19065             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
19066             node.transformFlags |=
19067                 propagateChildFlags(node.expression) |
19068                     1;
19069             return node;
19070         }
19071         function updateNonNullExpression(node, expression) {
19072             if (ts.isNonNullChain(node)) {
19073                 return updateNonNullChain(node, expression);
19074             }
19075             return node.expression !== expression
19076                 ? update(createNonNullExpression(expression), node)
19077                 : node;
19078         }
19079         function createNonNullChain(expression) {
19080             var node = createBaseExpression(229);
19081             node.flags |= 32;
19082             node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
19083             node.transformFlags |=
19084                 propagateChildFlags(node.expression) |
19085                     1;
19086             return node;
19087         }
19088         function updateNonNullChain(node, expression) {
19089             ts.Debug.assert(!!(node.flags & 32), "Cannot update a NonNullExpression using updateNonNullChain. Use updateNonNullExpression instead.");
19090             return node.expression !== expression
19091                 ? update(createNonNullChain(expression), node)
19092                 : node;
19093         }
19094         function createMetaProperty(keywordToken, name) {
19095             var node = createBaseExpression(230);
19096             node.keywordToken = keywordToken;
19097             node.name = name;
19098             node.transformFlags |= propagateChildFlags(node.name);
19099             switch (keywordToken) {
19100                 case 103:
19101                     node.transformFlags |= 512;
19102                     break;
19103                 case 100:
19104                     node.transformFlags |= 4;
19105                     break;
19106                 default:
19107                     return ts.Debug.assertNever(keywordToken);
19108             }
19109             return node;
19110         }
19111         function updateMetaProperty(node, name) {
19112             return node.name !== name
19113                 ? update(createMetaProperty(node.keywordToken, name), node)
19114                 : node;
19115         }
19116         function createTemplateSpan(expression, literal) {
19117             var node = createBaseNode(232);
19118             node.expression = expression;
19119             node.literal = literal;
19120             node.transformFlags |=
19121                 propagateChildFlags(node.expression) |
19122                     propagateChildFlags(node.literal) |
19123                     512;
19124             return node;
19125         }
19126         function updateTemplateSpan(node, expression, literal) {
19127             return node.expression !== expression
19128                 || node.literal !== literal
19129                 ? update(createTemplateSpan(expression, literal), node)
19130                 : node;
19131         }
19132         function createSemicolonClassElement() {
19133             var node = createBaseNode(233);
19134             node.transformFlags |= 512;
19135             return node;
19136         }
19137         function createBlock(statements, multiLine) {
19138             var node = createBaseNode(234);
19139             node.statements = createNodeArray(statements);
19140             node.multiLine = multiLine;
19141             node.transformFlags |= propagateChildrenFlags(node.statements);
19142             return node;
19143         }
19144         function updateBlock(node, statements) {
19145             return node.statements !== statements
19146                 ? update(createBlock(statements, node.multiLine), node)
19147                 : node;
19148         }
19149         function createVariableStatement(modifiers, declarationList) {
19150             var node = createBaseDeclaration(236, undefined, modifiers);
19151             node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
19152             node.transformFlags |=
19153                 propagateChildFlags(node.declarationList);
19154             if (ts.modifiersToFlags(node.modifiers) & 2) {
19155                 node.transformFlags = 1;
19156             }
19157             return node;
19158         }
19159         function updateVariableStatement(node, modifiers, declarationList) {
19160             return node.modifiers !== modifiers
19161                 || node.declarationList !== declarationList
19162                 ? update(createVariableStatement(modifiers, declarationList), node)
19163                 : node;
19164         }
19165         function createEmptyStatement() {
19166             return createBaseNode(235);
19167         }
19168         function createExpressionStatement(expression) {
19169             var node = createBaseNode(237);
19170             node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression);
19171             node.transformFlags |= propagateChildFlags(node.expression);
19172             return node;
19173         }
19174         function updateExpressionStatement(node, expression) {
19175             return node.expression !== expression
19176                 ? update(createExpressionStatement(expression), node)
19177                 : node;
19178         }
19179         function createIfStatement(expression, thenStatement, elseStatement) {
19180             var node = createBaseNode(238);
19181             node.expression = expression;
19182             node.thenStatement = asEmbeddedStatement(thenStatement);
19183             node.elseStatement = asEmbeddedStatement(elseStatement);
19184             node.transformFlags |=
19185                 propagateChildFlags(node.expression) |
19186                     propagateChildFlags(node.thenStatement) |
19187                     propagateChildFlags(node.elseStatement);
19188             return node;
19189         }
19190         function updateIfStatement(node, expression, thenStatement, elseStatement) {
19191             return node.expression !== expression
19192                 || node.thenStatement !== thenStatement
19193                 || node.elseStatement !== elseStatement
19194                 ? update(createIfStatement(expression, thenStatement, elseStatement), node)
19195                 : node;
19196         }
19197         function createDoStatement(statement, expression) {
19198             var node = createBaseNode(239);
19199             node.statement = asEmbeddedStatement(statement);
19200             node.expression = expression;
19201             node.transformFlags |=
19202                 propagateChildFlags(node.statement) |
19203                     propagateChildFlags(node.expression);
19204             return node;
19205         }
19206         function updateDoStatement(node, statement, expression) {
19207             return node.statement !== statement
19208                 || node.expression !== expression
19209                 ? update(createDoStatement(statement, expression), node)
19210                 : node;
19211         }
19212         function createWhileStatement(expression, statement) {
19213             var node = createBaseNode(240);
19214             node.expression = expression;
19215             node.statement = asEmbeddedStatement(statement);
19216             node.transformFlags |=
19217                 propagateChildFlags(node.expression) |
19218                     propagateChildFlags(node.statement);
19219             return node;
19220         }
19221         function updateWhileStatement(node, expression, statement) {
19222             return node.expression !== expression
19223                 || node.statement !== statement
19224                 ? update(createWhileStatement(expression, statement), node)
19225                 : node;
19226         }
19227         function createForStatement(initializer, condition, incrementor, statement) {
19228             var node = createBaseNode(241);
19229             node.initializer = initializer;
19230             node.condition = condition;
19231             node.incrementor = incrementor;
19232             node.statement = asEmbeddedStatement(statement);
19233             node.transformFlags |=
19234                 propagateChildFlags(node.initializer) |
19235                     propagateChildFlags(node.condition) |
19236                     propagateChildFlags(node.incrementor) |
19237                     propagateChildFlags(node.statement);
19238             return node;
19239         }
19240         function updateForStatement(node, initializer, condition, incrementor, statement) {
19241             return node.initializer !== initializer
19242                 || node.condition !== condition
19243                 || node.incrementor !== incrementor
19244                 || node.statement !== statement
19245                 ? update(createForStatement(initializer, condition, incrementor, statement), node)
19246                 : node;
19247         }
19248         function createForInStatement(initializer, expression, statement) {
19249             var node = createBaseNode(242);
19250             node.initializer = initializer;
19251             node.expression = expression;
19252             node.statement = asEmbeddedStatement(statement);
19253             node.transformFlags |=
19254                 propagateChildFlags(node.initializer) |
19255                     propagateChildFlags(node.expression) |
19256                     propagateChildFlags(node.statement);
19257             return node;
19258         }
19259         function updateForInStatement(node, initializer, expression, statement) {
19260             return node.initializer !== initializer
19261                 || node.expression !== expression
19262                 || node.statement !== statement
19263                 ? update(createForInStatement(initializer, expression, statement), node)
19264                 : node;
19265         }
19266         function createForOfStatement(awaitModifier, initializer, expression, statement) {
19267             var node = createBaseNode(243);
19268             node.awaitModifier = awaitModifier;
19269             node.initializer = initializer;
19270             node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
19271             node.statement = asEmbeddedStatement(statement);
19272             node.transformFlags |=
19273                 propagateChildFlags(node.awaitModifier) |
19274                     propagateChildFlags(node.initializer) |
19275                     propagateChildFlags(node.expression) |
19276                     propagateChildFlags(node.statement) |
19277                     512;
19278             if (awaitModifier)
19279                 node.transformFlags |= 64;
19280             return node;
19281         }
19282         function updateForOfStatement(node, awaitModifier, initializer, expression, statement) {
19283             return node.awaitModifier !== awaitModifier
19284                 || node.initializer !== initializer
19285                 || node.expression !== expression
19286                 || node.statement !== statement
19287                 ? update(createForOfStatement(awaitModifier, initializer, expression, statement), node)
19288                 : node;
19289         }
19290         function createContinueStatement(label) {
19291             var node = createBaseNode(244);
19292             node.label = asName(label);
19293             node.transformFlags |=
19294                 propagateChildFlags(node.label) |
19295                     2097152;
19296             return node;
19297         }
19298         function updateContinueStatement(node, label) {
19299             return node.label !== label
19300                 ? update(createContinueStatement(label), node)
19301                 : node;
19302         }
19303         function createBreakStatement(label) {
19304             var node = createBaseNode(245);
19305             node.label = asName(label);
19306             node.transformFlags |=
19307                 propagateChildFlags(node.label) |
19308                     2097152;
19309             return node;
19310         }
19311         function updateBreakStatement(node, label) {
19312             return node.label !== label
19313                 ? update(createBreakStatement(label), node)
19314                 : node;
19315         }
19316         function createReturnStatement(expression) {
19317             var node = createBaseNode(246);
19318             node.expression = expression;
19319             node.transformFlags |=
19320                 propagateChildFlags(node.expression) |
19321                     64 |
19322                     2097152;
19323             return node;
19324         }
19325         function updateReturnStatement(node, expression) {
19326             return node.expression !== expression
19327                 ? update(createReturnStatement(expression), node)
19328                 : node;
19329         }
19330         function createWithStatement(expression, statement) {
19331             var node = createBaseNode(247);
19332             node.expression = expression;
19333             node.statement = asEmbeddedStatement(statement);
19334             node.transformFlags |=
19335                 propagateChildFlags(node.expression) |
19336                     propagateChildFlags(node.statement);
19337             return node;
19338         }
19339         function updateWithStatement(node, expression, statement) {
19340             return node.expression !== expression
19341                 || node.statement !== statement
19342                 ? update(createWithStatement(expression, statement), node)
19343                 : node;
19344         }
19345         function createSwitchStatement(expression, caseBlock) {
19346             var node = createBaseNode(248);
19347             node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
19348             node.caseBlock = caseBlock;
19349             node.transformFlags |=
19350                 propagateChildFlags(node.expression) |
19351                     propagateChildFlags(node.caseBlock);
19352             return node;
19353         }
19354         function updateSwitchStatement(node, expression, caseBlock) {
19355             return node.expression !== expression
19356                 || node.caseBlock !== caseBlock
19357                 ? update(createSwitchStatement(expression, caseBlock), node)
19358                 : node;
19359         }
19360         function createLabeledStatement(label, statement) {
19361             var node = createBaseNode(249);
19362             node.label = asName(label);
19363             node.statement = asEmbeddedStatement(statement);
19364             node.transformFlags |=
19365                 propagateChildFlags(node.label) |
19366                     propagateChildFlags(node.statement);
19367             return node;
19368         }
19369         function updateLabeledStatement(node, label, statement) {
19370             return node.label !== label
19371                 || node.statement !== statement
19372                 ? update(createLabeledStatement(label, statement), node)
19373                 : node;
19374         }
19375         function createThrowStatement(expression) {
19376             var node = createBaseNode(250);
19377             node.expression = expression;
19378             node.transformFlags |= propagateChildFlags(node.expression);
19379             return node;
19380         }
19381         function updateThrowStatement(node, expression) {
19382             return node.expression !== expression
19383                 ? update(createThrowStatement(expression), node)
19384                 : node;
19385         }
19386         function createTryStatement(tryBlock, catchClause, finallyBlock) {
19387             var node = createBaseNode(251);
19388             node.tryBlock = tryBlock;
19389             node.catchClause = catchClause;
19390             node.finallyBlock = finallyBlock;
19391             node.transformFlags |=
19392                 propagateChildFlags(node.tryBlock) |
19393                     propagateChildFlags(node.catchClause) |
19394                     propagateChildFlags(node.finallyBlock);
19395             return node;
19396         }
19397         function updateTryStatement(node, tryBlock, catchClause, finallyBlock) {
19398             return node.tryBlock !== tryBlock
19399                 || node.catchClause !== catchClause
19400                 || node.finallyBlock !== finallyBlock
19401                 ? update(createTryStatement(tryBlock, catchClause, finallyBlock), node)
19402                 : node;
19403         }
19404         function createDebuggerStatement() {
19405             return createBaseNode(252);
19406         }
19407         function createVariableDeclaration(name, exclamationToken, type, initializer) {
19408             var node = createBaseVariableLikeDeclaration(253, undefined, undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer));
19409             node.exclamationToken = exclamationToken;
19410             node.transformFlags |= propagateChildFlags(node.exclamationToken);
19411             if (exclamationToken) {
19412                 node.transformFlags |= 1;
19413             }
19414             return node;
19415         }
19416         function updateVariableDeclaration(node, name, exclamationToken, type, initializer) {
19417             return node.name !== name
19418                 || node.type !== type
19419                 || node.exclamationToken !== exclamationToken
19420                 || node.initializer !== initializer
19421                 ? update(createVariableDeclaration(name, exclamationToken, type, initializer), node)
19422                 : node;
19423         }
19424         function createVariableDeclarationList(declarations, flags) {
19425             if (flags === void 0) { flags = 0; }
19426             var node = createBaseNode(254);
19427             node.flags |= flags & 3;
19428             node.declarations = createNodeArray(declarations);
19429             node.transformFlags |=
19430                 propagateChildrenFlags(node.declarations) |
19431                     2097152;
19432             if (flags & 3) {
19433                 node.transformFlags |=
19434                     512 |
19435                         131072;
19436             }
19437             return node;
19438         }
19439         function updateVariableDeclarationList(node, declarations) {
19440             return node.declarations !== declarations
19441                 ? update(createVariableDeclarationList(declarations, node.flags), node)
19442                 : node;
19443         }
19444         function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
19445             var node = createBaseFunctionLikeDeclaration(255, decorators, modifiers, name, typeParameters, parameters, type, body);
19446             node.asteriskToken = asteriskToken;
19447             if (!node.body || ts.modifiersToFlags(node.modifiers) & 2) {
19448                 node.transformFlags = 1;
19449             }
19450             else {
19451                 node.transformFlags |=
19452                     propagateChildFlags(node.asteriskToken) |
19453                         2097152;
19454                 if (ts.modifiersToFlags(node.modifiers) & 256) {
19455                     if (node.asteriskToken) {
19456                         node.transformFlags |= 64;
19457                     }
19458                     else {
19459                         node.transformFlags |= 128;
19460                     }
19461                 }
19462                 else if (node.asteriskToken) {
19463                     node.transformFlags |= 1024;
19464                 }
19465             }
19466             return node;
19467         }
19468         function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
19469             return node.decorators !== decorators
19470                 || node.modifiers !== modifiers
19471                 || node.asteriskToken !== asteriskToken
19472                 || node.name !== name
19473                 || node.typeParameters !== typeParameters
19474                 || node.parameters !== parameters
19475                 || node.type !== type
19476                 || node.body !== body
19477                 ? updateBaseFunctionLikeDeclaration(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node)
19478                 : node;
19479         }
19480         function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
19481             var node = createBaseClassLikeDeclaration(256, decorators, modifiers, name, typeParameters, heritageClauses, members);
19482             if (ts.modifiersToFlags(node.modifiers) & 2) {
19483                 node.transformFlags = 1;
19484             }
19485             else {
19486                 node.transformFlags |= 512;
19487                 if (node.transformFlags & 4096) {
19488                     node.transformFlags |= 1;
19489                 }
19490             }
19491             return node;
19492         }
19493         function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {
19494             return node.decorators !== decorators
19495                 || node.modifiers !== modifiers
19496                 || node.name !== name
19497                 || node.typeParameters !== typeParameters
19498                 || node.heritageClauses !== heritageClauses
19499                 || node.members !== members
19500                 ? update(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node)
19501                 : node;
19502         }
19503         function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
19504             var node = createBaseInterfaceOrClassLikeDeclaration(257, decorators, modifiers, name, typeParameters, heritageClauses);
19505             node.members = createNodeArray(members);
19506             node.transformFlags = 1;
19507             return node;
19508         }
19509         function updateInterfaceDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) {
19510             return node.decorators !== decorators
19511                 || node.modifiers !== modifiers
19512                 || node.name !== name
19513                 || node.typeParameters !== typeParameters
19514                 || node.heritageClauses !== heritageClauses
19515                 || node.members !== members
19516                 ? update(createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node)
19517                 : node;
19518         }
19519         function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
19520             var node = createBaseGenericNamedDeclaration(258, decorators, modifiers, name, typeParameters);
19521             node.type = type;
19522             node.transformFlags = 1;
19523             return node;
19524         }
19525         function updateTypeAliasDeclaration(node, decorators, modifiers, name, typeParameters, type) {
19526             return node.decorators !== decorators
19527                 || node.modifiers !== modifiers
19528                 || node.name !== name
19529                 || node.typeParameters !== typeParameters
19530                 || node.type !== type
19531                 ? update(createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type), node)
19532                 : node;
19533         }
19534         function createEnumDeclaration(decorators, modifiers, name, members) {
19535             var node = createBaseNamedDeclaration(259, decorators, modifiers, name);
19536             node.members = createNodeArray(members);
19537             node.transformFlags |=
19538                 propagateChildrenFlags(node.members) |
19539                     1;
19540             node.transformFlags &= ~16777216;
19541             return node;
19542         }
19543         function updateEnumDeclaration(node, decorators, modifiers, name, members) {
19544             return node.decorators !== decorators
19545                 || node.modifiers !== modifiers
19546                 || node.name !== name
19547                 || node.members !== members
19548                 ? update(createEnumDeclaration(decorators, modifiers, name, members), node)
19549                 : node;
19550         }
19551         function createModuleDeclaration(decorators, modifiers, name, body, flags) {
19552             if (flags === void 0) { flags = 0; }
19553             var node = createBaseDeclaration(260, decorators, modifiers);
19554             node.flags |= flags & (16 | 4 | 1024);
19555             node.name = name;
19556             node.body = body;
19557             if (ts.modifiersToFlags(node.modifiers) & 2) {
19558                 node.transformFlags = 1;
19559             }
19560             else {
19561                 node.transformFlags |=
19562                     propagateChildFlags(node.name) |
19563                         propagateChildFlags(node.body) |
19564                         1;
19565             }
19566             node.transformFlags &= ~16777216;
19567             return node;
19568         }
19569         function updateModuleDeclaration(node, decorators, modifiers, name, body) {
19570             return node.decorators !== decorators
19571                 || node.modifiers !== modifiers
19572                 || node.name !== name
19573                 || node.body !== body
19574                 ? update(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node)
19575                 : node;
19576         }
19577         function createModuleBlock(statements) {
19578             var node = createBaseNode(261);
19579             node.statements = createNodeArray(statements);
19580             node.transformFlags |= propagateChildrenFlags(node.statements);
19581             return node;
19582         }
19583         function updateModuleBlock(node, statements) {
19584             return node.statements !== statements
19585                 ? update(createModuleBlock(statements), node)
19586                 : node;
19587         }
19588         function createCaseBlock(clauses) {
19589             var node = createBaseNode(262);
19590             node.clauses = createNodeArray(clauses);
19591             node.transformFlags |= propagateChildrenFlags(node.clauses);
19592             return node;
19593         }
19594         function updateCaseBlock(node, clauses) {
19595             return node.clauses !== clauses
19596                 ? update(createCaseBlock(clauses), node)
19597                 : node;
19598         }
19599         function createNamespaceExportDeclaration(name) {
19600             var node = createBaseNamedDeclaration(263, undefined, undefined, name);
19601             node.transformFlags = 1;
19602             return node;
19603         }
19604         function updateNamespaceExportDeclaration(node, name) {
19605             return node.name !== name
19606                 ? update(createNamespaceExportDeclaration(name), node)
19607                 : node;
19608         }
19609         function createImportEqualsDeclaration(decorators, modifiers, isTypeOnly, name, moduleReference) {
19610             var node = createBaseNamedDeclaration(264, decorators, modifiers, name);
19611             node.isTypeOnly = isTypeOnly;
19612             node.moduleReference = moduleReference;
19613             node.transformFlags |= propagateChildFlags(node.moduleReference);
19614             if (!ts.isExternalModuleReference(node.moduleReference))
19615                 node.transformFlags |= 1;
19616             node.transformFlags &= ~16777216;
19617             return node;
19618         }
19619         function updateImportEqualsDeclaration(node, decorators, modifiers, isTypeOnly, name, moduleReference) {
19620             return node.decorators !== decorators
19621                 || node.modifiers !== modifiers
19622                 || node.isTypeOnly !== isTypeOnly
19623                 || node.name !== name
19624                 || node.moduleReference !== moduleReference
19625                 ? update(createImportEqualsDeclaration(decorators, modifiers, isTypeOnly, name, moduleReference), node)
19626                 : node;
19627         }
19628         function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause) {
19629             var node = createBaseDeclaration(265, decorators, modifiers);
19630             node.importClause = importClause;
19631             node.moduleSpecifier = moduleSpecifier;
19632             node.assertClause = assertClause;
19633             node.transformFlags |=
19634                 propagateChildFlags(node.importClause) |
19635                     propagateChildFlags(node.moduleSpecifier);
19636             node.transformFlags &= ~16777216;
19637             return node;
19638         }
19639         function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier, assertClause) {
19640             return node.decorators !== decorators
19641                 || node.modifiers !== modifiers
19642                 || node.importClause !== importClause
19643                 || node.moduleSpecifier !== moduleSpecifier
19644                 || node.assertClause !== assertClause
19645                 ? update(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause), node)
19646                 : node;
19647         }
19648         function createImportClause(isTypeOnly, name, namedBindings) {
19649             var node = createBaseNode(266);
19650             node.isTypeOnly = isTypeOnly;
19651             node.name = name;
19652             node.namedBindings = namedBindings;
19653             node.transformFlags |=
19654                 propagateChildFlags(node.name) |
19655                     propagateChildFlags(node.namedBindings);
19656             if (isTypeOnly) {
19657                 node.transformFlags |= 1;
19658             }
19659             node.transformFlags &= ~16777216;
19660             return node;
19661         }
19662         function updateImportClause(node, isTypeOnly, name, namedBindings) {
19663             return node.isTypeOnly !== isTypeOnly
19664                 || node.name !== name
19665                 || node.namedBindings !== namedBindings
19666                 ? update(createImportClause(isTypeOnly, name, namedBindings), node)
19667                 : node;
19668         }
19669         function createAssertClause(elements, multiLine) {
19670             var node = createBaseNode(292);
19671             node.elements = elements;
19672             node.multiLine = multiLine;
19673             node.transformFlags |= 4;
19674             return node;
19675         }
19676         function updateAssertClause(node, elements, multiLine) {
19677             return node.elements !== elements
19678                 || node.multiLine !== multiLine
19679                 ? update(createAssertClause(elements, multiLine), node)
19680                 : node;
19681         }
19682         function createAssertEntry(name, value) {
19683             var node = createBaseNode(293);
19684             node.name = name;
19685             node.value = value;
19686             node.transformFlags |= 4;
19687             return node;
19688         }
19689         function updateAssertEntry(node, name, value) {
19690             return node.name !== name
19691                 || node.value !== value
19692                 ? update(createAssertEntry(name, value), node)
19693                 : node;
19694         }
19695         function createNamespaceImport(name) {
19696             var node = createBaseNode(267);
19697             node.name = name;
19698             node.transformFlags |= propagateChildFlags(node.name);
19699             node.transformFlags &= ~16777216;
19700             return node;
19701         }
19702         function updateNamespaceImport(node, name) {
19703             return node.name !== name
19704                 ? update(createNamespaceImport(name), node)
19705                 : node;
19706         }
19707         function createNamespaceExport(name) {
19708             var node = createBaseNode(273);
19709             node.name = name;
19710             node.transformFlags |=
19711                 propagateChildFlags(node.name) |
19712                     4;
19713             node.transformFlags &= ~16777216;
19714             return node;
19715         }
19716         function updateNamespaceExport(node, name) {
19717             return node.name !== name
19718                 ? update(createNamespaceExport(name), node)
19719                 : node;
19720         }
19721         function createNamedImports(elements) {
19722             var node = createBaseNode(268);
19723             node.elements = createNodeArray(elements);
19724             node.transformFlags |= propagateChildrenFlags(node.elements);
19725             node.transformFlags &= ~16777216;
19726             return node;
19727         }
19728         function updateNamedImports(node, elements) {
19729             return node.elements !== elements
19730                 ? update(createNamedImports(elements), node)
19731                 : node;
19732         }
19733         function createImportSpecifier(isTypeOnly, propertyName, name) {
19734             var node = createBaseNode(269);
19735             node.isTypeOnly = isTypeOnly;
19736             node.propertyName = propertyName;
19737             node.name = name;
19738             node.transformFlags |=
19739                 propagateChildFlags(node.propertyName) |
19740                     propagateChildFlags(node.name);
19741             node.transformFlags &= ~16777216;
19742             return node;
19743         }
19744         function updateImportSpecifier(node, isTypeOnly, propertyName, name) {
19745             return node.isTypeOnly !== isTypeOnly
19746                 || node.propertyName !== propertyName
19747                 || node.name !== name
19748                 ? update(createImportSpecifier(isTypeOnly, propertyName, name), node)
19749                 : node;
19750         }
19751         function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
19752             var node = createBaseDeclaration(270, decorators, modifiers);
19753             node.isExportEquals = isExportEquals;
19754             node.expression = isExportEquals
19755                 ? parenthesizerRules().parenthesizeRightSideOfBinary(63, undefined, expression)
19756                 : parenthesizerRules().parenthesizeExpressionOfExportDefault(expression);
19757             node.transformFlags |= propagateChildFlags(node.expression);
19758             node.transformFlags &= ~16777216;
19759             return node;
19760         }
19761         function updateExportAssignment(node, decorators, modifiers, expression) {
19762             return node.decorators !== decorators
19763                 || node.modifiers !== modifiers
19764                 || node.expression !== expression
19765                 ? update(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node)
19766                 : node;
19767         }
19768         function createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) {
19769             var node = createBaseDeclaration(271, decorators, modifiers);
19770             node.isTypeOnly = isTypeOnly;
19771             node.exportClause = exportClause;
19772             node.moduleSpecifier = moduleSpecifier;
19773             node.assertClause = assertClause;
19774             node.transformFlags |=
19775                 propagateChildFlags(node.exportClause) |
19776                     propagateChildFlags(node.moduleSpecifier);
19777             node.transformFlags &= ~16777216;
19778             return node;
19779         }
19780         function updateExportDeclaration(node, decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) {
19781             return node.decorators !== decorators
19782                 || node.modifiers !== modifiers
19783                 || node.isTypeOnly !== isTypeOnly
19784                 || node.exportClause !== exportClause
19785                 || node.moduleSpecifier !== moduleSpecifier
19786                 || node.assertClause !== assertClause
19787                 ? update(createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause), node)
19788                 : node;
19789         }
19790         function createNamedExports(elements) {
19791             var node = createBaseNode(272);
19792             node.elements = createNodeArray(elements);
19793             node.transformFlags |= propagateChildrenFlags(node.elements);
19794             node.transformFlags &= ~16777216;
19795             return node;
19796         }
19797         function updateNamedExports(node, elements) {
19798             return node.elements !== elements
19799                 ? update(createNamedExports(elements), node)
19800                 : node;
19801         }
19802         function createExportSpecifier(isTypeOnly, propertyName, name) {
19803             var node = createBaseNode(274);
19804             node.isTypeOnly = isTypeOnly;
19805             node.propertyName = asName(propertyName);
19806             node.name = asName(name);
19807             node.transformFlags |=
19808                 propagateChildFlags(node.propertyName) |
19809                     propagateChildFlags(node.name);
19810             node.transformFlags &= ~16777216;
19811             return node;
19812         }
19813         function updateExportSpecifier(node, isTypeOnly, propertyName, name) {
19814             return node.isTypeOnly !== isTypeOnly
19815                 || node.propertyName !== propertyName
19816                 || node.name !== name
19817                 ? update(createExportSpecifier(isTypeOnly, propertyName, name), node)
19818                 : node;
19819         }
19820         function createMissingDeclaration() {
19821             var node = createBaseDeclaration(275, undefined, undefined);
19822             return node;
19823         }
19824         function createExternalModuleReference(expression) {
19825             var node = createBaseNode(276);
19826             node.expression = expression;
19827             node.transformFlags |= propagateChildFlags(node.expression);
19828             node.transformFlags &= ~16777216;
19829             return node;
19830         }
19831         function updateExternalModuleReference(node, expression) {
19832             return node.expression !== expression
19833                 ? update(createExternalModuleReference(expression), node)
19834                 : node;
19835         }
19836         function createJSDocPrimaryTypeWorker(kind) {
19837             return createBaseNode(kind);
19838         }
19839         function createJSDocUnaryTypeWorker(kind, type) {
19840             var node = createBaseNode(kind);
19841             node.type = type;
19842             return node;
19843         }
19844         function updateJSDocUnaryTypeWorker(kind, node, type) {
19845             return node.type !== type
19846                 ? update(createJSDocUnaryTypeWorker(kind, type), node)
19847                 : node;
19848         }
19849         function createJSDocFunctionType(parameters, type) {
19850             var node = createBaseSignatureDeclaration(315, undefined, undefined, undefined, undefined, parameters, type);
19851             return node;
19852         }
19853         function updateJSDocFunctionType(node, parameters, type) {
19854             return node.parameters !== parameters
19855                 || node.type !== type
19856                 ? update(createJSDocFunctionType(parameters, type), node)
19857                 : node;
19858         }
19859         function createJSDocTypeLiteral(propertyTags, isArrayType) {
19860             if (isArrayType === void 0) { isArrayType = false; }
19861             var node = createBaseNode(320);
19862             node.jsDocPropertyTags = asNodeArray(propertyTags);
19863             node.isArrayType = isArrayType;
19864             return node;
19865         }
19866         function updateJSDocTypeLiteral(node, propertyTags, isArrayType) {
19867             return node.jsDocPropertyTags !== propertyTags
19868                 || node.isArrayType !== isArrayType
19869                 ? update(createJSDocTypeLiteral(propertyTags, isArrayType), node)
19870                 : node;
19871         }
19872         function createJSDocTypeExpression(type) {
19873             var node = createBaseNode(307);
19874             node.type = type;
19875             return node;
19876         }
19877         function updateJSDocTypeExpression(node, type) {
19878             return node.type !== type
19879                 ? update(createJSDocTypeExpression(type), node)
19880                 : node;
19881         }
19882         function createJSDocSignature(typeParameters, parameters, type) {
19883             var node = createBaseNode(321);
19884             node.typeParameters = asNodeArray(typeParameters);
19885             node.parameters = createNodeArray(parameters);
19886             node.type = type;
19887             return node;
19888         }
19889         function updateJSDocSignature(node, typeParameters, parameters, type) {
19890             return node.typeParameters !== typeParameters
19891                 || node.parameters !== parameters
19892                 || node.type !== type
19893                 ? update(createJSDocSignature(typeParameters, parameters, type), node)
19894                 : node;
19895         }
19896         function getDefaultTagName(node) {
19897             var defaultTagName = getDefaultTagNameForKind(node.kind);
19898             return node.tagName.escapedText === ts.escapeLeadingUnderscores(defaultTagName)
19899                 ? node.tagName
19900                 : createIdentifier(defaultTagName);
19901         }
19902         function createBaseJSDocTag(kind, tagName, comment) {
19903             var node = createBaseNode(kind);
19904             node.tagName = tagName;
19905             node.comment = comment;
19906             return node;
19907         }
19908         function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) {
19909             var node = createBaseJSDocTag(342, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment);
19910             node.constraint = constraint;
19911             node.typeParameters = createNodeArray(typeParameters);
19912             return node;
19913         }
19914         function updateJSDocTemplateTag(node, tagName, constraint, typeParameters, comment) {
19915             if (tagName === void 0) { tagName = getDefaultTagName(node); }
19916             return node.tagName !== tagName
19917                 || node.constraint !== constraint
19918                 || node.typeParameters !== typeParameters
19919                 || node.comment !== comment
19920                 ? update(createJSDocTemplateTag(tagName, constraint, typeParameters, comment), node)
19921                 : node;
19922         }
19923         function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) {
19924             var node = createBaseJSDocTag(343, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment);
19925             node.typeExpression = typeExpression;
19926             node.fullName = fullName;
19927             node.name = ts.getJSDocTypeAliasName(fullName);
19928             return node;
19929         }
19930         function updateJSDocTypedefTag(node, tagName, typeExpression, fullName, comment) {
19931             if (tagName === void 0) { tagName = getDefaultTagName(node); }
19932             return node.tagName !== tagName
19933                 || node.typeExpression !== typeExpression
19934                 || node.fullName !== fullName
19935                 || node.comment !== comment
19936                 ? update(createJSDocTypedefTag(tagName, typeExpression, fullName, comment), node)
19937                 : node;
19938         }
19939         function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) {
19940             var node = createBaseJSDocTag(338, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment);
19941             node.typeExpression = typeExpression;
19942             node.name = name;
19943             node.isNameFirst = !!isNameFirst;
19944             node.isBracketed = isBracketed;
19945             return node;
19946         }
19947         function updateJSDocParameterTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) {
19948             if (tagName === void 0) { tagName = getDefaultTagName(node); }
19949             return node.tagName !== tagName
19950                 || node.name !== name
19951                 || node.isBracketed !== isBracketed
19952                 || node.typeExpression !== typeExpression
19953                 || node.isNameFirst !== isNameFirst
19954                 || node.comment !== comment
19955                 ? update(createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node)
19956                 : node;
19957         }
19958         function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) {
19959             var node = createBaseJSDocTag(345, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment);
19960             node.typeExpression = typeExpression;
19961             node.name = name;
19962             node.isNameFirst = !!isNameFirst;
19963             node.isBracketed = isBracketed;
19964             return node;
19965         }
19966         function updateJSDocPropertyTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) {
19967             if (tagName === void 0) { tagName = getDefaultTagName(node); }
19968             return node.tagName !== tagName
19969                 || node.name !== name
19970                 || node.isBracketed !== isBracketed
19971                 || node.typeExpression !== typeExpression
19972                 || node.isNameFirst !== isNameFirst
19973                 || node.comment !== comment
19974                 ? update(createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node)
19975                 : node;
19976         }
19977         function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) {
19978             var node = createBaseJSDocTag(336, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment);
19979             node.typeExpression = typeExpression;
19980             node.fullName = fullName;
19981             node.name = ts.getJSDocTypeAliasName(fullName);
19982             return node;
19983         }
19984         function updateJSDocCallbackTag(node, tagName, typeExpression, fullName, comment) {
19985             if (tagName === void 0) { tagName = getDefaultTagName(node); }
19986             return node.tagName !== tagName
19987                 || node.typeExpression !== typeExpression
19988                 || node.fullName !== fullName
19989                 || node.comment !== comment
19990                 ? update(createJSDocCallbackTag(tagName, typeExpression, fullName, comment), node)
19991                 : node;
19992         }
19993         function createJSDocAugmentsTag(tagName, className, comment) {
19994             var node = createBaseJSDocTag(326, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment);
19995             node.class = className;
19996             return node;
19997         }
19998         function updateJSDocAugmentsTag(node, tagName, className, comment) {
19999             if (tagName === void 0) { tagName = getDefaultTagName(node); }
20000             return node.tagName !== tagName
20001                 || node.class !== className
20002                 || node.comment !== comment
20003                 ? update(createJSDocAugmentsTag(tagName, className, comment), node)
20004                 : node;
20005         }
20006         function createJSDocImplementsTag(tagName, className, comment) {
20007             var node = createBaseJSDocTag(327, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment);
20008             node.class = className;
20009             return node;
20010         }
20011         function createJSDocSeeTag(tagName, name, comment) {
20012             var node = createBaseJSDocTag(344, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment);
20013             node.name = name;
20014             return node;
20015         }
20016         function updateJSDocSeeTag(node, tagName, name, comment) {
20017             return node.tagName !== tagName
20018                 || node.name !== name
20019                 || node.comment !== comment
20020                 ? update(createJSDocSeeTag(tagName, name, comment), node)
20021                 : node;
20022         }
20023         function createJSDocNameReference(name) {
20024             var node = createBaseNode(308);
20025             node.name = name;
20026             return node;
20027         }
20028         function updateJSDocNameReference(node, name) {
20029             return node.name !== name
20030                 ? update(createJSDocNameReference(name), node)
20031                 : node;
20032         }
20033         function createJSDocMemberName(left, right) {
20034             var node = createBaseNode(309);
20035             node.left = left;
20036             node.right = right;
20037             node.transformFlags |=
20038                 propagateChildFlags(node.left) |
20039                     propagateChildFlags(node.right);
20040             return node;
20041         }
20042         function updateJSDocMemberName(node, left, right) {
20043             return node.left !== left
20044                 || node.right !== right
20045                 ? update(createJSDocMemberName(left, right), node)
20046                 : node;
20047         }
20048         function createJSDocLink(name, text) {
20049             var node = createBaseNode(322);
20050             node.name = name;
20051             node.text = text;
20052             return node;
20053         }
20054         function updateJSDocLink(node, name, text) {
20055             return node.name !== name
20056                 ? update(createJSDocLink(name, text), node)
20057                 : node;
20058         }
20059         function createJSDocLinkCode(name, text) {
20060             var node = createBaseNode(323);
20061             node.name = name;
20062             node.text = text;
20063             return node;
20064         }
20065         function updateJSDocLinkCode(node, name, text) {
20066             return node.name !== name
20067                 ? update(createJSDocLinkCode(name, text), node)
20068                 : node;
20069         }
20070         function createJSDocLinkPlain(name, text) {
20071             var node = createBaseNode(324);
20072             node.name = name;
20073             node.text = text;
20074             return node;
20075         }
20076         function updateJSDocLinkPlain(node, name, text) {
20077             return node.name !== name
20078                 ? update(createJSDocLinkPlain(name, text), node)
20079                 : node;
20080         }
20081         function updateJSDocImplementsTag(node, tagName, className, comment) {
20082             if (tagName === void 0) { tagName = getDefaultTagName(node); }
20083             return node.tagName !== tagName
20084                 || node.class !== className
20085                 || node.comment !== comment
20086                 ? update(createJSDocImplementsTag(tagName, className, comment), node)
20087                 : node;
20088         }
20089         function createJSDocSimpleTagWorker(kind, tagName, comment) {
20090             var node = createBaseJSDocTag(kind, tagName !== null && tagName !== void 0 ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment);
20091             return node;
20092         }
20093         function updateJSDocSimpleTagWorker(kind, node, tagName, comment) {
20094             if (tagName === void 0) { tagName = getDefaultTagName(node); }
20095             return node.tagName !== tagName
20096                 || node.comment !== comment
20097                 ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) :
20098                 node;
20099         }
20100         function createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment) {
20101             var node = createBaseJSDocTag(kind, tagName !== null && tagName !== void 0 ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment);
20102             node.typeExpression = typeExpression;
20103             return node;
20104         }
20105         function updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment) {
20106             if (tagName === void 0) { tagName = getDefaultTagName(node); }
20107             return node.tagName !== tagName
20108                 || node.typeExpression !== typeExpression
20109                 || node.comment !== comment
20110                 ? update(createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment), node)
20111                 : node;
20112         }
20113         function createJSDocUnknownTag(tagName, comment) {
20114             var node = createBaseJSDocTag(325, tagName, comment);
20115             return node;
20116         }
20117         function updateJSDocUnknownTag(node, tagName, comment) {
20118             return node.tagName !== tagName
20119                 || node.comment !== comment
20120                 ? update(createJSDocUnknownTag(tagName, comment), node)
20121                 : node;
20122         }
20123         function createJSDocText(text) {
20124             var node = createBaseNode(319);
20125             node.text = text;
20126             return node;
20127         }
20128         function updateJSDocText(node, text) {
20129             return node.text !== text
20130                 ? update(createJSDocText(text), node)
20131                 : node;
20132         }
20133         function createJSDocComment(comment, tags) {
20134             var node = createBaseNode(318);
20135             node.comment = comment;
20136             node.tags = asNodeArray(tags);
20137             return node;
20138         }
20139         function updateJSDocComment(node, comment, tags) {
20140             return node.comment !== comment
20141                 || node.tags !== tags
20142                 ? update(createJSDocComment(comment, tags), node)
20143                 : node;
20144         }
20145         function createJsxElement(openingElement, children, closingElement) {
20146             var node = createBaseNode(277);
20147             node.openingElement = openingElement;
20148             node.children = createNodeArray(children);
20149             node.closingElement = closingElement;
20150             node.transformFlags |=
20151                 propagateChildFlags(node.openingElement) |
20152                     propagateChildrenFlags(node.children) |
20153                     propagateChildFlags(node.closingElement) |
20154                     2;
20155             return node;
20156         }
20157         function updateJsxElement(node, openingElement, children, closingElement) {
20158             return node.openingElement !== openingElement
20159                 || node.children !== children
20160                 || node.closingElement !== closingElement
20161                 ? update(createJsxElement(openingElement, children, closingElement), node)
20162                 : node;
20163         }
20164         function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
20165             var node = createBaseNode(278);
20166             node.tagName = tagName;
20167             node.typeArguments = asNodeArray(typeArguments);
20168             node.attributes = attributes;
20169             node.transformFlags |=
20170                 propagateChildFlags(node.tagName) |
20171                     propagateChildrenFlags(node.typeArguments) |
20172                     propagateChildFlags(node.attributes) |
20173                     2;
20174             if (node.typeArguments) {
20175                 node.transformFlags |= 1;
20176             }
20177             return node;
20178         }
20179         function updateJsxSelfClosingElement(node, tagName, typeArguments, attributes) {
20180             return node.tagName !== tagName
20181                 || node.typeArguments !== typeArguments
20182                 || node.attributes !== attributes
20183                 ? update(createJsxSelfClosingElement(tagName, typeArguments, attributes), node)
20184                 : node;
20185         }
20186         function createJsxOpeningElement(tagName, typeArguments, attributes) {
20187             var node = createBaseNode(279);
20188             node.tagName = tagName;
20189             node.typeArguments = asNodeArray(typeArguments);
20190             node.attributes = attributes;
20191             node.transformFlags |=
20192                 propagateChildFlags(node.tagName) |
20193                     propagateChildrenFlags(node.typeArguments) |
20194                     propagateChildFlags(node.attributes) |
20195                     2;
20196             if (typeArguments) {
20197                 node.transformFlags |= 1;
20198             }
20199             return node;
20200         }
20201         function updateJsxOpeningElement(node, tagName, typeArguments, attributes) {
20202             return node.tagName !== tagName
20203                 || node.typeArguments !== typeArguments
20204                 || node.attributes !== attributes
20205                 ? update(createJsxOpeningElement(tagName, typeArguments, attributes), node)
20206                 : node;
20207         }
20208         function createJsxClosingElement(tagName) {
20209             var node = createBaseNode(280);
20210             node.tagName = tagName;
20211             node.transformFlags |=
20212                 propagateChildFlags(node.tagName) |
20213                     2;
20214             return node;
20215         }
20216         function updateJsxClosingElement(node, tagName) {
20217             return node.tagName !== tagName
20218                 ? update(createJsxClosingElement(tagName), node)
20219                 : node;
20220         }
20221         function createJsxFragment(openingFragment, children, closingFragment) {
20222             var node = createBaseNode(281);
20223             node.openingFragment = openingFragment;
20224             node.children = createNodeArray(children);
20225             node.closingFragment = closingFragment;
20226             node.transformFlags |=
20227                 propagateChildFlags(node.openingFragment) |
20228                     propagateChildrenFlags(node.children) |
20229                     propagateChildFlags(node.closingFragment) |
20230                     2;
20231             return node;
20232         }
20233         function updateJsxFragment(node, openingFragment, children, closingFragment) {
20234             return node.openingFragment !== openingFragment
20235                 || node.children !== children
20236                 || node.closingFragment !== closingFragment
20237                 ? update(createJsxFragment(openingFragment, children, closingFragment), node)
20238                 : node;
20239         }
20240         function createJsxText(text, containsOnlyTriviaWhiteSpaces) {
20241             var node = createBaseNode(11);
20242             node.text = text;
20243             node.containsOnlyTriviaWhiteSpaces = !!containsOnlyTriviaWhiteSpaces;
20244             node.transformFlags |= 2;
20245             return node;
20246         }
20247         function updateJsxText(node, text, containsOnlyTriviaWhiteSpaces) {
20248             return node.text !== text
20249                 || node.containsOnlyTriviaWhiteSpaces !== containsOnlyTriviaWhiteSpaces
20250                 ? update(createJsxText(text, containsOnlyTriviaWhiteSpaces), node)
20251                 : node;
20252         }
20253         function createJsxOpeningFragment() {
20254             var node = createBaseNode(282);
20255             node.transformFlags |= 2;
20256             return node;
20257         }
20258         function createJsxJsxClosingFragment() {
20259             var node = createBaseNode(283);
20260             node.transformFlags |= 2;
20261             return node;
20262         }
20263         function createJsxAttribute(name, initializer) {
20264             var node = createBaseNode(284);
20265             node.name = name;
20266             node.initializer = initializer;
20267             node.transformFlags |=
20268                 propagateChildFlags(node.name) |
20269                     propagateChildFlags(node.initializer) |
20270                     2;
20271             return node;
20272         }
20273         function updateJsxAttribute(node, name, initializer) {
20274             return node.name !== name
20275                 || node.initializer !== initializer
20276                 ? update(createJsxAttribute(name, initializer), node)
20277                 : node;
20278         }
20279         function createJsxAttributes(properties) {
20280             var node = createBaseNode(285);
20281             node.properties = createNodeArray(properties);
20282             node.transformFlags |=
20283                 propagateChildrenFlags(node.properties) |
20284                     2;
20285             return node;
20286         }
20287         function updateJsxAttributes(node, properties) {
20288             return node.properties !== properties
20289                 ? update(createJsxAttributes(properties), node)
20290                 : node;
20291         }
20292         function createJsxSpreadAttribute(expression) {
20293             var node = createBaseNode(286);
20294             node.expression = expression;
20295             node.transformFlags |=
20296                 propagateChildFlags(node.expression) |
20297                     2;
20298             return node;
20299         }
20300         function updateJsxSpreadAttribute(node, expression) {
20301             return node.expression !== expression
20302                 ? update(createJsxSpreadAttribute(expression), node)
20303                 : node;
20304         }
20305         function createJsxExpression(dotDotDotToken, expression) {
20306             var node = createBaseNode(287);
20307             node.dotDotDotToken = dotDotDotToken;
20308             node.expression = expression;
20309             node.transformFlags |=
20310                 propagateChildFlags(node.dotDotDotToken) |
20311                     propagateChildFlags(node.expression) |
20312                     2;
20313             return node;
20314         }
20315         function updateJsxExpression(node, expression) {
20316             return node.expression !== expression
20317                 ? update(createJsxExpression(node.dotDotDotToken, expression), node)
20318                 : node;
20319         }
20320         function createCaseClause(expression, statements) {
20321             var node = createBaseNode(288);
20322             node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
20323             node.statements = createNodeArray(statements);
20324             node.transformFlags |=
20325                 propagateChildFlags(node.expression) |
20326                     propagateChildrenFlags(node.statements);
20327             return node;
20328         }
20329         function updateCaseClause(node, expression, statements) {
20330             return node.expression !== expression
20331                 || node.statements !== statements
20332                 ? update(createCaseClause(expression, statements), node)
20333                 : node;
20334         }
20335         function createDefaultClause(statements) {
20336             var node = createBaseNode(289);
20337             node.statements = createNodeArray(statements);
20338             node.transformFlags = propagateChildrenFlags(node.statements);
20339             return node;
20340         }
20341         function updateDefaultClause(node, statements) {
20342             return node.statements !== statements
20343                 ? update(createDefaultClause(statements), node)
20344                 : node;
20345         }
20346         function createHeritageClause(token, types) {
20347             var node = createBaseNode(290);
20348             node.token = token;
20349             node.types = createNodeArray(types);
20350             node.transformFlags |= propagateChildrenFlags(node.types);
20351             switch (token) {
20352                 case 94:
20353                     node.transformFlags |= 512;
20354                     break;
20355                 case 117:
20356                     node.transformFlags |= 1;
20357                     break;
20358                 default:
20359                     return ts.Debug.assertNever(token);
20360             }
20361             return node;
20362         }
20363         function updateHeritageClause(node, types) {
20364             return node.types !== types
20365                 ? update(createHeritageClause(node.token, types), node)
20366                 : node;
20367         }
20368         function createCatchClause(variableDeclaration, block) {
20369             var node = createBaseNode(291);
20370             if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) {
20371                 variableDeclaration = createVariableDeclaration(variableDeclaration, undefined, undefined, undefined);
20372             }
20373             node.variableDeclaration = variableDeclaration;
20374             node.block = block;
20375             node.transformFlags |=
20376                 propagateChildFlags(node.variableDeclaration) |
20377                     propagateChildFlags(node.block);
20378             if (!variableDeclaration)
20379                 node.transformFlags |= 32;
20380             return node;
20381         }
20382         function updateCatchClause(node, variableDeclaration, block) {
20383             return node.variableDeclaration !== variableDeclaration
20384                 || node.block !== block
20385                 ? update(createCatchClause(variableDeclaration, block), node)
20386                 : node;
20387         }
20388         function createPropertyAssignment(name, initializer) {
20389             var node = createBaseNamedDeclaration(294, undefined, undefined, name);
20390             node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer);
20391             node.transformFlags |=
20392                 propagateChildFlags(node.name) |
20393                     propagateChildFlags(node.initializer);
20394             return node;
20395         }
20396         function finishUpdatePropertyAssignment(updated, original) {
20397             if (original.decorators)
20398                 updated.decorators = original.decorators;
20399             if (original.modifiers)
20400                 updated.modifiers = original.modifiers;
20401             if (original.questionToken)
20402                 updated.questionToken = original.questionToken;
20403             if (original.exclamationToken)
20404                 updated.exclamationToken = original.exclamationToken;
20405             return update(updated, original);
20406         }
20407         function updatePropertyAssignment(node, name, initializer) {
20408             return node.name !== name
20409                 || node.initializer !== initializer
20410                 ? finishUpdatePropertyAssignment(createPropertyAssignment(name, initializer), node)
20411                 : node;
20412         }
20413         function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
20414             var node = createBaseNamedDeclaration(295, undefined, undefined, name);
20415             node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer);
20416             node.transformFlags |=
20417                 propagateChildFlags(node.objectAssignmentInitializer) |
20418                     512;
20419             return node;
20420         }
20421         function finishUpdateShorthandPropertyAssignment(updated, original) {
20422             if (original.decorators)
20423                 updated.decorators = original.decorators;
20424             if (original.modifiers)
20425                 updated.modifiers = original.modifiers;
20426             if (original.equalsToken)
20427                 updated.equalsToken = original.equalsToken;
20428             if (original.questionToken)
20429                 updated.questionToken = original.questionToken;
20430             if (original.exclamationToken)
20431                 updated.exclamationToken = original.exclamationToken;
20432             return update(updated, original);
20433         }
20434         function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) {
20435             return node.name !== name
20436                 || node.objectAssignmentInitializer !== objectAssignmentInitializer
20437                 ? finishUpdateShorthandPropertyAssignment(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node)
20438                 : node;
20439         }
20440         function createSpreadAssignment(expression) {
20441             var node = createBaseNode(296);
20442             node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression);
20443             node.transformFlags |=
20444                 propagateChildFlags(node.expression) |
20445                     64 |
20446                     32768;
20447             return node;
20448         }
20449         function updateSpreadAssignment(node, expression) {
20450             return node.expression !== expression
20451                 ? update(createSpreadAssignment(expression), node)
20452                 : node;
20453         }
20454         function createEnumMember(name, initializer) {
20455             var node = createBaseNode(297);
20456             node.name = asName(name);
20457             node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer);
20458             node.transformFlags |=
20459                 propagateChildFlags(node.name) |
20460                     propagateChildFlags(node.initializer) |
20461                     1;
20462             return node;
20463         }
20464         function updateEnumMember(node, name, initializer) {
20465             return node.name !== name
20466                 || node.initializer !== initializer
20467                 ? update(createEnumMember(name, initializer), node)
20468                 : node;
20469         }
20470         function createSourceFile(statements, endOfFileToken, flags) {
20471             var node = baseFactory.createBaseSourceFileNode(303);
20472             node.statements = createNodeArray(statements);
20473             node.endOfFileToken = endOfFileToken;
20474             node.flags |= flags;
20475             node.fileName = "";
20476             node.text = "";
20477             node.languageVersion = 0;
20478             node.languageVariant = 0;
20479             node.scriptKind = 0;
20480             node.isDeclarationFile = false;
20481             node.hasNoDefaultLib = false;
20482             node.transformFlags |=
20483                 propagateChildrenFlags(node.statements) |
20484                     propagateChildFlags(node.endOfFileToken);
20485             return node;
20486         }
20487         function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
20488             var node = baseFactory.createBaseSourceFileNode(303);
20489             for (var p in source) {
20490                 if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
20491                     continue;
20492                 node[p] = source[p];
20493             }
20494             node.flags |= source.flags;
20495             node.statements = createNodeArray(statements);
20496             node.endOfFileToken = source.endOfFileToken;
20497             node.isDeclarationFile = isDeclarationFile;
20498             node.referencedFiles = referencedFiles;
20499             node.typeReferenceDirectives = typeReferences;
20500             node.hasNoDefaultLib = hasNoDefaultLib;
20501             node.libReferenceDirectives = libReferences;
20502             node.transformFlags =
20503                 propagateChildrenFlags(node.statements) |
20504                     propagateChildFlags(node.endOfFileToken);
20505             node.impliedNodeFormat = source.impliedNodeFormat;
20506             return node;
20507         }
20508         function updateSourceFile(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives) {
20509             if (isDeclarationFile === void 0) { isDeclarationFile = node.isDeclarationFile; }
20510             if (referencedFiles === void 0) { referencedFiles = node.referencedFiles; }
20511             if (typeReferenceDirectives === void 0) { typeReferenceDirectives = node.typeReferenceDirectives; }
20512             if (hasNoDefaultLib === void 0) { hasNoDefaultLib = node.hasNoDefaultLib; }
20513             if (libReferenceDirectives === void 0) { libReferenceDirectives = node.libReferenceDirectives; }
20514             return node.statements !== statements
20515                 || node.isDeclarationFile !== isDeclarationFile
20516                 || node.referencedFiles !== referencedFiles
20517                 || node.typeReferenceDirectives !== typeReferenceDirectives
20518                 || node.hasNoDefaultLib !== hasNoDefaultLib
20519                 || node.libReferenceDirectives !== libReferenceDirectives
20520                 ? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives), node)
20521                 : node;
20522         }
20523         function createBundle(sourceFiles, prepends) {
20524             if (prepends === void 0) { prepends = ts.emptyArray; }
20525             var node = createBaseNode(304);
20526             node.prepends = prepends;
20527             node.sourceFiles = sourceFiles;
20528             return node;
20529         }
20530         function updateBundle(node, sourceFiles, prepends) {
20531             if (prepends === void 0) { prepends = ts.emptyArray; }
20532             return node.sourceFiles !== sourceFiles
20533                 || node.prepends !== prepends
20534                 ? update(createBundle(sourceFiles, prepends), node)
20535                 : node;
20536         }
20537         function createUnparsedSource(prologues, syntheticReferences, texts) {
20538             var node = createBaseNode(305);
20539             node.prologues = prologues;
20540             node.syntheticReferences = syntheticReferences;
20541             node.texts = texts;
20542             node.fileName = "";
20543             node.text = "";
20544             node.referencedFiles = ts.emptyArray;
20545             node.libReferenceDirectives = ts.emptyArray;
20546             node.getLineAndCharacterOfPosition = function (pos) { return ts.getLineAndCharacterOfPosition(node, pos); };
20547             return node;
20548         }
20549         function createBaseUnparsedNode(kind, data) {
20550             var node = createBaseNode(kind);
20551             node.data = data;
20552             return node;
20553         }
20554         function createUnparsedPrologue(data) {
20555             return createBaseUnparsedNode(298, data);
20556         }
20557         function createUnparsedPrepend(data, texts) {
20558             var node = createBaseUnparsedNode(299, data);
20559             node.texts = texts;
20560             return node;
20561         }
20562         function createUnparsedTextLike(data, internal) {
20563             return createBaseUnparsedNode(internal ? 301 : 300, data);
20564         }
20565         function createUnparsedSyntheticReference(section) {
20566             var node = createBaseNode(302);
20567             node.data = section.data;
20568             node.section = section;
20569             return node;
20570         }
20571         function createInputFiles() {
20572             var node = createBaseNode(306);
20573             node.javascriptText = "";
20574             node.declarationText = "";
20575             return node;
20576         }
20577         function createSyntheticExpression(type, isSpread, tupleNameSource) {
20578             if (isSpread === void 0) { isSpread = false; }
20579             var node = createBaseNode(231);
20580             node.type = type;
20581             node.isSpread = isSpread;
20582             node.tupleNameSource = tupleNameSource;
20583             return node;
20584         }
20585         function createSyntaxList(children) {
20586             var node = createBaseNode(346);
20587             node._children = children;
20588             return node;
20589         }
20590         function createNotEmittedStatement(original) {
20591             var node = createBaseNode(347);
20592             node.original = original;
20593             ts.setTextRange(node, original);
20594             return node;
20595         }
20596         function createPartiallyEmittedExpression(expression, original) {
20597             var node = createBaseNode(348);
20598             node.expression = expression;
20599             node.original = original;
20600             node.transformFlags |=
20601                 propagateChildFlags(node.expression) |
20602                     1;
20603             ts.setTextRange(node, original);
20604             return node;
20605         }
20606         function updatePartiallyEmittedExpression(node, expression) {
20607             return node.expression !== expression
20608                 ? update(createPartiallyEmittedExpression(expression, node.original), node)
20609                 : node;
20610         }
20611         function flattenCommaElements(node) {
20612             if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
20613                 if (ts.isCommaListExpression(node)) {
20614                     return node.elements;
20615                 }
20616                 if (ts.isBinaryExpression(node) && ts.isCommaToken(node.operatorToken)) {
20617                     return [node.left, node.right];
20618                 }
20619             }
20620             return node;
20621         }
20622         function createCommaListExpression(elements) {
20623             var node = createBaseNode(349);
20624             node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
20625             node.transformFlags |= propagateChildrenFlags(node.elements);
20626             return node;
20627         }
20628         function updateCommaListExpression(node, elements) {
20629             return node.elements !== elements
20630                 ? update(createCommaListExpression(elements), node)
20631                 : node;
20632         }
20633         function createEndOfDeclarationMarker(original) {
20634             var node = createBaseNode(351);
20635             node.emitNode = {};
20636             node.original = original;
20637             return node;
20638         }
20639         function createMergeDeclarationMarker(original) {
20640             var node = createBaseNode(350);
20641             node.emitNode = {};
20642             node.original = original;
20643             return node;
20644         }
20645         function createSyntheticReferenceExpression(expression, thisArg) {
20646             var node = createBaseNode(352);
20647             node.expression = expression;
20648             node.thisArg = thisArg;
20649             node.transformFlags |=
20650                 propagateChildFlags(node.expression) |
20651                     propagateChildFlags(node.thisArg);
20652             return node;
20653         }
20654         function updateSyntheticReferenceExpression(node, expression, thisArg) {
20655             return node.expression !== expression
20656                 || node.thisArg !== thisArg
20657                 ? update(createSyntheticReferenceExpression(expression, thisArg), node)
20658                 : node;
20659         }
20660         function cloneNode(node) {
20661             if (node === undefined) {
20662                 return node;
20663             }
20664             var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(303) :
20665                 ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79) :
20666                     ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80) :
20667                         !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) :
20668                             baseFactory.createBaseNode(node.kind);
20669             clone.flags |= (node.flags & ~8);
20670             clone.transformFlags = node.transformFlags;
20671             setOriginalNode(clone, node);
20672             for (var key in node) {
20673                 if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
20674                     continue;
20675                 }
20676                 clone[key] = node[key];
20677             }
20678             return clone;
20679         }
20680         function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) {
20681             return createCallExpression(createFunctionExpression(undefined, undefined, undefined, undefined, param ? [param] : [], undefined, createBlock(statements, true)), undefined, paramValue ? [paramValue] : []);
20682         }
20683         function createImmediatelyInvokedArrowFunction(statements, param, paramValue) {
20684             return createCallExpression(createArrowFunction(undefined, undefined, param ? [param] : [], undefined, undefined, createBlock(statements, true)), undefined, paramValue ? [paramValue] : []);
20685         }
20686         function createVoidZero() {
20687             return createVoidExpression(createNumericLiteral("0"));
20688         }
20689         function createExportDefault(expression) {
20690             return createExportAssignment(undefined, undefined, false, expression);
20691         }
20692         function createExternalModuleExport(exportName) {
20693             return createExportDeclaration(undefined, undefined, false, createNamedExports([
20694                 createExportSpecifier(false, undefined, exportName)
20695             ]));
20696         }
20697         function createTypeCheck(value, tag) {
20698             return tag === "undefined"
20699                 ? factory.createStrictEquality(value, createVoidZero())
20700                 : factory.createStrictEquality(createTypeOfExpression(value), createStringLiteral(tag));
20701         }
20702         function createMethodCall(object, methodName, argumentsList) {
20703             if (ts.isCallChain(object)) {
20704                 return createCallChain(createPropertyAccessChain(object, undefined, methodName), undefined, undefined, argumentsList);
20705             }
20706             return createCallExpression(createPropertyAccessExpression(object, methodName), undefined, argumentsList);
20707         }
20708         function createFunctionBindCall(target, thisArg, argumentsList) {
20709             return createMethodCall(target, "bind", __spreadArray([thisArg], argumentsList, true));
20710         }
20711         function createFunctionCallCall(target, thisArg, argumentsList) {
20712             return createMethodCall(target, "call", __spreadArray([thisArg], argumentsList, true));
20713         }
20714         function createFunctionApplyCall(target, thisArg, argumentsExpression) {
20715             return createMethodCall(target, "apply", [thisArg, argumentsExpression]);
20716         }
20717         function createGlobalMethodCall(globalObjectName, methodName, argumentsList) {
20718             return createMethodCall(createIdentifier(globalObjectName), methodName, argumentsList);
20719         }
20720         function createArraySliceCall(array, start) {
20721             return createMethodCall(array, "slice", start === undefined ? [] : [asExpression(start)]);
20722         }
20723         function createArrayConcatCall(array, argumentsList) {
20724             return createMethodCall(array, "concat", argumentsList);
20725         }
20726         function createObjectDefinePropertyCall(target, propertyName, attributes) {
20727             return createGlobalMethodCall("Object", "defineProperty", [target, asExpression(propertyName), attributes]);
20728         }
20729         function createReflectGetCall(target, propertyKey, receiver) {
20730             return createGlobalMethodCall("Reflect", "get", receiver ? [target, propertyKey, receiver] : [target, propertyKey]);
20731         }
20732         function createReflectSetCall(target, propertyKey, value, receiver) {
20733             return createGlobalMethodCall("Reflect", "set", receiver ? [target, propertyKey, value, receiver] : [target, propertyKey, value]);
20734         }
20735         function tryAddPropertyAssignment(properties, propertyName, expression) {
20736             if (expression) {
20737                 properties.push(createPropertyAssignment(propertyName, expression));
20738                 return true;
20739             }
20740             return false;
20741         }
20742         function createPropertyDescriptor(attributes, singleLine) {
20743             var properties = [];
20744             tryAddPropertyAssignment(properties, "enumerable", asExpression(attributes.enumerable));
20745             tryAddPropertyAssignment(properties, "configurable", asExpression(attributes.configurable));
20746             var isData = tryAddPropertyAssignment(properties, "writable", asExpression(attributes.writable));
20747             isData = tryAddPropertyAssignment(properties, "value", attributes.value) || isData;
20748             var isAccessor = tryAddPropertyAssignment(properties, "get", attributes.get);
20749             isAccessor = tryAddPropertyAssignment(properties, "set", attributes.set) || isAccessor;
20750             ts.Debug.assert(!(isData && isAccessor), "A PropertyDescriptor may not be both an accessor descriptor and a data descriptor.");
20751             return createObjectLiteralExpression(properties, !singleLine);
20752         }
20753         function updateOuterExpression(outerExpression, expression) {
20754             switch (outerExpression.kind) {
20755                 case 211: return updateParenthesizedExpression(outerExpression, expression);
20756                 case 210: return updateTypeAssertion(outerExpression, outerExpression.type, expression);
20757                 case 228: return updateAsExpression(outerExpression, expression, outerExpression.type);
20758                 case 229: return updateNonNullExpression(outerExpression, expression);
20759                 case 348: return updatePartiallyEmittedExpression(outerExpression, expression);
20760             }
20761         }
20762         function isIgnorableParen(node) {
20763             return ts.isParenthesizedExpression(node)
20764                 && ts.nodeIsSynthesized(node)
20765                 && ts.nodeIsSynthesized(ts.getSourceMapRange(node))
20766                 && ts.nodeIsSynthesized(ts.getCommentRange(node))
20767                 && !ts.some(ts.getSyntheticLeadingComments(node))
20768                 && !ts.some(ts.getSyntheticTrailingComments(node));
20769         }
20770         function restoreOuterExpressions(outerExpression, innerExpression, kinds) {
20771             if (kinds === void 0) { kinds = 15; }
20772             if (outerExpression && ts.isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) {
20773                 return updateOuterExpression(outerExpression, restoreOuterExpressions(outerExpression.expression, innerExpression));
20774             }
20775             return innerExpression;
20776         }
20777         function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) {
20778             if (!outermostLabeledStatement) {
20779                 return node;
20780             }
20781             var updated = updateLabeledStatement(outermostLabeledStatement, outermostLabeledStatement.label, ts.isLabeledStatement(outermostLabeledStatement.statement)
20782                 ? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
20783                 : node);
20784             if (afterRestoreLabelCallback) {
20785                 afterRestoreLabelCallback(outermostLabeledStatement);
20786             }
20787             return updated;
20788         }
20789         function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
20790             var target = ts.skipParentheses(node);
20791             switch (target.kind) {
20792                 case 79:
20793                     return cacheIdentifiers;
20794                 case 108:
20795                 case 8:
20796                 case 9:
20797                 case 10:
20798                     return false;
20799                 case 203:
20800                     var elements = target.elements;
20801                     if (elements.length === 0) {
20802                         return false;
20803                     }
20804                     return true;
20805                 case 204:
20806                     return target.properties.length > 0;
20807                 default:
20808                     return true;
20809             }
20810         }
20811         function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {
20812             if (cacheIdentifiers === void 0) { cacheIdentifiers = false; }
20813             var callee = ts.skipOuterExpressions(expression, 15);
20814             var thisArg;
20815             var target;
20816             if (ts.isSuperProperty(callee)) {
20817                 thisArg = createThis();
20818                 target = callee;
20819             }
20820             else if (ts.isSuperKeyword(callee)) {
20821                 thisArg = createThis();
20822                 target = languageVersion !== undefined && languageVersion < 2
20823                     ? ts.setTextRange(createIdentifier("_super"), callee)
20824                     : callee;
20825             }
20826             else if (ts.getEmitFlags(callee) & 4096) {
20827                 thisArg = createVoidZero();
20828                 target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
20829             }
20830             else if (ts.isPropertyAccessExpression(callee)) {
20831                 if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
20832                     thisArg = createTempVariable(recordTempVariable);
20833                     target = createPropertyAccessExpression(ts.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.name);
20834                     ts.setTextRange(target, callee);
20835                 }
20836                 else {
20837                     thisArg = callee.expression;
20838                     target = callee;
20839                 }
20840             }
20841             else if (ts.isElementAccessExpression(callee)) {
20842                 if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
20843                     thisArg = createTempVariable(recordTempVariable);
20844                     target = createElementAccessExpression(ts.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression);
20845                     ts.setTextRange(target, callee);
20846                 }
20847                 else {
20848                     thisArg = callee.expression;
20849                     target = callee;
20850                 }
20851             }
20852             else {
20853                 thisArg = createVoidZero();
20854                 target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
20855             }
20856             return { target: target, thisArg: thisArg };
20857         }
20858         function createAssignmentTargetWrapper(paramName, expression) {
20859             return createPropertyAccessExpression(createParenthesizedExpression(createObjectLiteralExpression([
20860                 createSetAccessorDeclaration(undefined, undefined, "value", [createParameterDeclaration(undefined, undefined, undefined, paramName, undefined, undefined, undefined)], createBlock([
20861                     createExpressionStatement(expression)
20862                 ]))
20863             ])), "value");
20864         }
20865         function inlineExpressions(expressions) {
20866             return expressions.length > 10
20867                 ? createCommaListExpression(expressions)
20868                 : ts.reduceLeft(expressions, factory.createComma);
20869         }
20870         function getName(node, allowComments, allowSourceMaps, emitFlags) {
20871             if (emitFlags === void 0) { emitFlags = 0; }
20872             var nodeName = ts.getNameOfDeclaration(node);
20873             if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) {
20874                 var name = ts.setParent(ts.setTextRange(cloneNode(nodeName), nodeName), nodeName.parent);
20875                 emitFlags |= ts.getEmitFlags(nodeName);
20876                 if (!allowSourceMaps)
20877                     emitFlags |= 48;
20878                 if (!allowComments)
20879                     emitFlags |= 1536;
20880                 if (emitFlags)
20881                     ts.setEmitFlags(name, emitFlags);
20882                 return name;
20883             }
20884             return getGeneratedNameForNode(node);
20885         }
20886         function getInternalName(node, allowComments, allowSourceMaps) {
20887             return getName(node, allowComments, allowSourceMaps, 16384 | 32768);
20888         }
20889         function getLocalName(node, allowComments, allowSourceMaps) {
20890             return getName(node, allowComments, allowSourceMaps, 16384);
20891         }
20892         function getExportName(node, allowComments, allowSourceMaps) {
20893             return getName(node, allowComments, allowSourceMaps, 8192);
20894         }
20895         function getDeclarationName(node, allowComments, allowSourceMaps) {
20896             return getName(node, allowComments, allowSourceMaps);
20897         }
20898         function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) {
20899             var qualifiedName = createPropertyAccessExpression(ns, ts.nodeIsSynthesized(name) ? name : cloneNode(name));
20900             ts.setTextRange(qualifiedName, name);
20901             var emitFlags = 0;
20902             if (!allowSourceMaps)
20903                 emitFlags |= 48;
20904             if (!allowComments)
20905                 emitFlags |= 1536;
20906             if (emitFlags)
20907                 ts.setEmitFlags(qualifiedName, emitFlags);
20908             return qualifiedName;
20909         }
20910         function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) {
20911             if (ns && ts.hasSyntacticModifier(node, 1)) {
20912                 return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps);
20913             }
20914             return getExportName(node, allowComments, allowSourceMaps);
20915         }
20916         function copyPrologue(source, target, ensureUseStrict, visitor) {
20917             var offset = copyStandardPrologue(source, target, ensureUseStrict);
20918             return copyCustomPrologue(source, target, offset, visitor);
20919         }
20920         function isUseStrictPrologue(node) {
20921             return ts.isStringLiteral(node.expression) && node.expression.text === "use strict";
20922         }
20923         function createUseStrictPrologue() {
20924             return ts.startOnNewLine(createExpressionStatement(createStringLiteral("use strict")));
20925         }
20926         function copyStandardPrologue(source, target, ensureUseStrict) {
20927             ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
20928             var foundUseStrict = false;
20929             var statementOffset = 0;
20930             var numStatements = source.length;
20931             while (statementOffset < numStatements) {
20932                 var statement = source[statementOffset];
20933                 if (ts.isPrologueDirective(statement)) {
20934                     if (isUseStrictPrologue(statement)) {
20935                         foundUseStrict = true;
20936                     }
20937                     target.push(statement);
20938                 }
20939                 else {
20940                     break;
20941                 }
20942                 statementOffset++;
20943             }
20944             if (ensureUseStrict && !foundUseStrict) {
20945                 target.push(createUseStrictPrologue());
20946             }
20947             return statementOffset;
20948         }
20949         function copyCustomPrologue(source, target, statementOffset, visitor, filter) {
20950             if (filter === void 0) { filter = ts.returnTrue; }
20951             var numStatements = source.length;
20952             while (statementOffset !== undefined && statementOffset < numStatements) {
20953                 var statement = source[statementOffset];
20954                 if (ts.getEmitFlags(statement) & 1048576 && filter(statement)) {
20955                     ts.append(target, visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement);
20956                 }
20957                 else {
20958                     break;
20959                 }
20960                 statementOffset++;
20961             }
20962             return statementOffset;
20963         }
20964         function ensureUseStrict(statements) {
20965             var foundUseStrict = ts.findUseStrictPrologue(statements);
20966             if (!foundUseStrict) {
20967                 return ts.setTextRange(createNodeArray(__spreadArray([createUseStrictPrologue()], statements, true)), statements);
20968             }
20969             return statements;
20970         }
20971         function liftToBlock(nodes) {
20972             ts.Debug.assert(ts.every(nodes, ts.isStatementOrBlock), "Cannot lift nodes to a Block.");
20973             return ts.singleOrUndefined(nodes) || createBlock(nodes);
20974         }
20975         function findSpanEnd(array, test, start) {
20976             var i = start;
20977             while (i < array.length && test(array[i])) {
20978                 i++;
20979             }
20980             return i;
20981         }
20982         function mergeLexicalEnvironment(statements, declarations) {
20983             if (!ts.some(declarations)) {
20984                 return statements;
20985             }
20986             var leftStandardPrologueEnd = findSpanEnd(statements, ts.isPrologueDirective, 0);
20987             var leftHoistedFunctionsEnd = findSpanEnd(statements, ts.isHoistedFunction, leftStandardPrologueEnd);
20988             var leftHoistedVariablesEnd = findSpanEnd(statements, ts.isHoistedVariableStatement, leftHoistedFunctionsEnd);
20989             var rightStandardPrologueEnd = findSpanEnd(declarations, ts.isPrologueDirective, 0);
20990             var rightHoistedFunctionsEnd = findSpanEnd(declarations, ts.isHoistedFunction, rightStandardPrologueEnd);
20991             var rightHoistedVariablesEnd = findSpanEnd(declarations, ts.isHoistedVariableStatement, rightHoistedFunctionsEnd);
20992             var rightCustomPrologueEnd = findSpanEnd(declarations, ts.isCustomPrologue, rightHoistedVariablesEnd);
20993             ts.Debug.assert(rightCustomPrologueEnd === declarations.length, "Expected declarations to be valid standard or custom prologues");
20994             var left = ts.isNodeArray(statements) ? statements.slice() : statements;
20995             if (rightCustomPrologueEnd > rightHoistedVariablesEnd) {
20996                 left.splice.apply(left, __spreadArray([leftHoistedVariablesEnd, 0], declarations.slice(rightHoistedVariablesEnd, rightCustomPrologueEnd), false));
20997             }
20998             if (rightHoistedVariablesEnd > rightHoistedFunctionsEnd) {
20999                 left.splice.apply(left, __spreadArray([leftHoistedFunctionsEnd, 0], declarations.slice(rightHoistedFunctionsEnd, rightHoistedVariablesEnd), false));
21000             }
21001             if (rightHoistedFunctionsEnd > rightStandardPrologueEnd) {
21002                 left.splice.apply(left, __spreadArray([leftStandardPrologueEnd, 0], declarations.slice(rightStandardPrologueEnd, rightHoistedFunctionsEnd), false));
21003             }
21004             if (rightStandardPrologueEnd > 0) {
21005                 if (leftStandardPrologueEnd === 0) {
21006                     left.splice.apply(left, __spreadArray([0, 0], declarations.slice(0, rightStandardPrologueEnd), false));
21007                 }
21008                 else {
21009                     var leftPrologues = new ts.Map();
21010                     for (var i = 0; i < leftStandardPrologueEnd; i++) {
21011                         var leftPrologue = statements[i];
21012                         leftPrologues.set(leftPrologue.expression.text, true);
21013                     }
21014                     for (var i = rightStandardPrologueEnd - 1; i >= 0; i--) {
21015                         var rightPrologue = declarations[i];
21016                         if (!leftPrologues.has(rightPrologue.expression.text)) {
21017                             left.unshift(rightPrologue);
21018                         }
21019                     }
21020                 }
21021             }
21022             if (ts.isNodeArray(statements)) {
21023                 return ts.setTextRange(createNodeArray(left, statements.hasTrailingComma), statements);
21024             }
21025             return statements;
21026         }
21027         function updateModifiers(node, modifiers) {
21028             var _a;
21029             if (typeof modifiers === "number") {
21030                 modifiers = createModifiersFromModifierFlags(modifiers);
21031             }
21032             return ts.isParameter(node) ? updateParameterDeclaration(node, node.decorators, modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) :
21033                 ts.isPropertySignature(node) ? updatePropertySignature(node, modifiers, node.name, node.questionToken, node.type) :
21034                     ts.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, node.decorators, modifiers, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) :
21035                         ts.isMethodSignature(node) ? updateMethodSignature(node, modifiers, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) :
21036                             ts.isMethodDeclaration(node) ? updateMethodDeclaration(node, node.decorators, modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) :
21037                                 ts.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, node.decorators, modifiers, node.parameters, node.body) :
21038                                     ts.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, node.decorators, modifiers, node.name, node.parameters, node.type, node.body) :
21039                                         ts.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, node.decorators, modifiers, node.name, node.parameters, node.body) :
21040                                             ts.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, node.decorators, modifiers, node.parameters, node.type) :
21041                                                 ts.isFunctionExpression(node) ? updateFunctionExpression(node, modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21042                                                     ts.isArrowFunction(node) ? updateArrowFunction(node, modifiers, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) :
21043                                                         ts.isClassExpression(node) ? updateClassExpression(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21044                                                             ts.isVariableStatement(node) ? updateVariableStatement(node, modifiers, node.declarationList) :
21045                                                                 ts.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, node.decorators, modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
21046                                                                     ts.isClassDeclaration(node) ? updateClassDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21047                                                                         ts.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.heritageClauses, node.members) :
21048                                                                             ts.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, node.decorators, modifiers, node.name, node.typeParameters, node.type) :
21049                                                                                 ts.isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifiers, node.name, node.members) :
21050                                                                                     ts.isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifiers, node.name, node.body) :
21051                                                                                         ts.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.name, node.moduleReference) :
21052                                                                                             ts.isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifiers, node.importClause, node.moduleSpecifier, node.assertClause) :
21053                                                                                                 ts.isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifiers, node.expression) :
21054                                                                                                     ts.isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
21055                                                                                                         ts.Debug.assertNever(node);
21056         }
21057         function asNodeArray(array) {
21058             return array ? createNodeArray(array) : undefined;
21059         }
21060         function asName(name) {
21061             return typeof name === "string" ? createIdentifier(name) :
21062                 name;
21063         }
21064         function asExpression(value) {
21065             return typeof value === "string" ? createStringLiteral(value) :
21066                 typeof value === "number" ? createNumericLiteral(value) :
21067                     typeof value === "boolean" ? value ? createTrue() : createFalse() :
21068                         value;
21069         }
21070         function asToken(value) {
21071             return typeof value === "number" ? createToken(value) : value;
21072         }
21073         function asEmbeddedStatement(statement) {
21074             return statement && ts.isNotEmittedStatement(statement) ? ts.setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
21075         }
21076     }
21077     ts.createNodeFactory = createNodeFactory;
21078     function updateWithoutOriginal(updated, original) {
21079         if (updated !== original) {
21080             ts.setTextRange(updated, original);
21081         }
21082         return updated;
21083     }
21084     function updateWithOriginal(updated, original) {
21085         if (updated !== original) {
21086             setOriginalNode(updated, original);
21087             ts.setTextRange(updated, original);
21088         }
21089         return updated;
21090     }
21091     function getDefaultTagNameForKind(kind) {
21092         switch (kind) {
21093             case 341: return "type";
21094             case 339: return "returns";
21095             case 340: return "this";
21096             case 337: return "enum";
21097             case 328: return "author";
21098             case 330: return "class";
21099             case 331: return "public";
21100             case 332: return "private";
21101             case 333: return "protected";
21102             case 334: return "readonly";
21103             case 335: return "override";
21104             case 342: return "template";
21105             case 343: return "typedef";
21106             case 338: return "param";
21107             case 345: return "prop";
21108             case 336: return "callback";
21109             case 326: return "augments";
21110             case 327: return "implements";
21111             default:
21112                 return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind)));
21113         }
21114     }
21115     var rawTextScanner;
21116     var invalidValueSentinel = {};
21117     function getCookedText(kind, rawText) {
21118         if (!rawTextScanner) {
21119             rawTextScanner = ts.createScanner(99, false, 0);
21120         }
21121         switch (kind) {
21122             case 14:
21123                 rawTextScanner.setText("`" + rawText + "`");
21124                 break;
21125             case 15:
21126                 rawTextScanner.setText("`" + rawText + "${");
21127                 break;
21128             case 16:
21129                 rawTextScanner.setText("}" + rawText + "${");
21130                 break;
21131             case 17:
21132                 rawTextScanner.setText("}" + rawText + "`");
21133                 break;
21134         }
21135         var token = rawTextScanner.scan();
21136         if (token === 19) {
21137             token = rawTextScanner.reScanTemplateToken(false);
21138         }
21139         if (rawTextScanner.isUnterminated()) {
21140             rawTextScanner.setText(undefined);
21141             return invalidValueSentinel;
21142         }
21143         var tokenValue;
21144         switch (token) {
21145             case 14:
21146             case 15:
21147             case 16:
21148             case 17:
21149                 tokenValue = rawTextScanner.getTokenValue();
21150                 break;
21151         }
21152         if (tokenValue === undefined || rawTextScanner.scan() !== 1) {
21153             rawTextScanner.setText(undefined);
21154             return invalidValueSentinel;
21155         }
21156         rawTextScanner.setText(undefined);
21157         return tokenValue;
21158     }
21159     function propagateIdentifierNameFlags(node) {
21160         return propagateChildFlags(node) & ~16777216;
21161     }
21162     function propagatePropertyNameFlagsOfChild(node, transformFlags) {
21163         return transformFlags | (node.transformFlags & 33562624);
21164     }
21165     function propagateChildFlags(child) {
21166         if (!child)
21167             return 0;
21168         var childFlags = child.transformFlags & ~getTransformFlagsSubtreeExclusions(child.kind);
21169         return ts.isNamedDeclaration(child) && ts.isPropertyName(child.name) ? propagatePropertyNameFlagsOfChild(child.name, childFlags) : childFlags;
21170     }
21171     function propagateChildrenFlags(children) {
21172         return children ? children.transformFlags : 0;
21173     }
21174     function aggregateChildrenFlags(children) {
21175         var subtreeFlags = 0;
21176         for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
21177             var child = children_2[_i];
21178             subtreeFlags |= propagateChildFlags(child);
21179         }
21180         children.transformFlags = subtreeFlags;
21181     }
21182     function getTransformFlagsSubtreeExclusions(kind) {
21183         if (kind >= 176 && kind <= 199) {
21184             return -2;
21185         }
21186         switch (kind) {
21187             case 207:
21188             case 208:
21189             case 203:
21190                 return 536887296;
21191             case 260:
21192                 return 589443072;
21193             case 163:
21194                 return 536870912;
21195             case 213:
21196                 return 557748224;
21197             case 212:
21198             case 255:
21199                 return 591310848;
21200             case 254:
21201                 return 537165824;
21202             case 256:
21203             case 225:
21204                 return 536940544;
21205             case 170:
21206                 return 591306752;
21207             case 166:
21208                 return 570433536;
21209             case 168:
21210             case 171:
21211             case 172:
21212                 return 574529536;
21213             case 130:
21214             case 146:
21215             case 157:
21216             case 143:
21217             case 149:
21218             case 147:
21219             case 133:
21220             case 150:
21221             case 114:
21222             case 162:
21223             case 165:
21224             case 167:
21225             case 173:
21226             case 174:
21227             case 175:
21228             case 257:
21229             case 258:
21230                 return -2;
21231             case 204:
21232                 return 536973312;
21233             case 291:
21234                 return 536903680;
21235             case 200:
21236             case 201:
21237                 return 536887296;
21238             case 210:
21239             case 228:
21240             case 348:
21241             case 211:
21242             case 106:
21243                 return 536870912;
21244             case 205:
21245             case 206:
21246                 return 536870912;
21247             default:
21248                 return 536870912;
21249         }
21250     }
21251     ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
21252     var baseFactory = ts.createBaseNodeFactory();
21253     function makeSynthetic(node) {
21254         node.flags |= 8;
21255         return node;
21256     }
21257     var syntheticFactory = {
21258         createBaseSourceFileNode: function (kind) { return makeSynthetic(baseFactory.createBaseSourceFileNode(kind)); },
21259         createBaseIdentifierNode: function (kind) { return makeSynthetic(baseFactory.createBaseIdentifierNode(kind)); },
21260         createBasePrivateIdentifierNode: function (kind) { return makeSynthetic(baseFactory.createBasePrivateIdentifierNode(kind)); },
21261         createBaseTokenNode: function (kind) { return makeSynthetic(baseFactory.createBaseTokenNode(kind)); },
21262         createBaseNode: function (kind) { return makeSynthetic(baseFactory.createBaseNode(kind)); },
21263     };
21264     ts.factory = createNodeFactory(4, syntheticFactory);
21265     function createUnparsedSourceFile(textOrInputFiles, mapPathOrType, mapTextOrStripInternal) {
21266         var stripInternal;
21267         var bundleFileInfo;
21268         var fileName;
21269         var text;
21270         var length;
21271         var sourceMapPath;
21272         var sourceMapText;
21273         var getText;
21274         var getSourceMapText;
21275         var oldFileOfCurrentEmit;
21276         if (!ts.isString(textOrInputFiles)) {
21277             ts.Debug.assert(mapPathOrType === "js" || mapPathOrType === "dts");
21278             fileName = (mapPathOrType === "js" ? textOrInputFiles.javascriptPath : textOrInputFiles.declarationPath) || "";
21279             sourceMapPath = mapPathOrType === "js" ? textOrInputFiles.javascriptMapPath : textOrInputFiles.declarationMapPath;
21280             getText = function () { return mapPathOrType === "js" ? textOrInputFiles.javascriptText : textOrInputFiles.declarationText; };
21281             getSourceMapText = function () { return mapPathOrType === "js" ? textOrInputFiles.javascriptMapText : textOrInputFiles.declarationMapText; };
21282             length = function () { return getText().length; };
21283             if (textOrInputFiles.buildInfo && textOrInputFiles.buildInfo.bundle) {
21284                 ts.Debug.assert(mapTextOrStripInternal === undefined || typeof mapTextOrStripInternal === "boolean");
21285                 stripInternal = mapTextOrStripInternal;
21286                 bundleFileInfo = mapPathOrType === "js" ? textOrInputFiles.buildInfo.bundle.js : textOrInputFiles.buildInfo.bundle.dts;
21287                 oldFileOfCurrentEmit = textOrInputFiles.oldFileOfCurrentEmit;
21288             }
21289         }
21290         else {
21291             fileName = "";
21292             text = textOrInputFiles;
21293             length = textOrInputFiles.length;
21294             sourceMapPath = mapPathOrType;
21295             sourceMapText = mapTextOrStripInternal;
21296         }
21297         var node = oldFileOfCurrentEmit ?
21298             parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
21299             parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
21300         node.fileName = fileName;
21301         node.sourceMapPath = sourceMapPath;
21302         node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
21303         if (getText && getSourceMapText) {
21304             Object.defineProperty(node, "text", { get: getText });
21305             Object.defineProperty(node, "sourceMapText", { get: getSourceMapText });
21306         }
21307         else {
21308             ts.Debug.assert(!oldFileOfCurrentEmit);
21309             node.text = text !== null && text !== void 0 ? text : "";
21310             node.sourceMapText = sourceMapText;
21311         }
21312         return node;
21313     }
21314     ts.createUnparsedSourceFile = createUnparsedSourceFile;
21315     function parseUnparsedSourceFile(bundleFileInfo, stripInternal, length) {
21316         var prologues;
21317         var helpers;
21318         var referencedFiles;
21319         var typeReferenceDirectives;
21320         var libReferenceDirectives;
21321         var prependChildren;
21322         var texts;
21323         var hasNoDefaultLib;
21324         for (var _i = 0, _a = bundleFileInfo ? bundleFileInfo.sections : ts.emptyArray; _i < _a.length; _i++) {
21325             var section = _a[_i];
21326             switch (section.kind) {
21327                 case "prologue":
21328                     prologues = ts.append(prologues, ts.setTextRange(ts.factory.createUnparsedPrologue(section.data), section));
21329                     break;
21330                 case "emitHelpers":
21331                     helpers = ts.append(helpers, ts.getAllUnscopedEmitHelpers().get(section.data));
21332                     break;
21333                 case "no-default-lib":
21334                     hasNoDefaultLib = true;
21335                     break;
21336                 case "reference":
21337                     referencedFiles = ts.append(referencedFiles, { pos: -1, end: -1, fileName: section.data });
21338                     break;
21339                 case "type":
21340                     typeReferenceDirectives = ts.append(typeReferenceDirectives, section.data);
21341                     break;
21342                 case "lib":
21343                     libReferenceDirectives = ts.append(libReferenceDirectives, { pos: -1, end: -1, fileName: section.data });
21344                     break;
21345                 case "prepend":
21346                     var prependTexts = void 0;
21347                     for (var _b = 0, _c = section.texts; _b < _c.length; _b++) {
21348                         var text = _c[_b];
21349                         if (!stripInternal || text.kind !== "internal") {
21350                             prependTexts = ts.append(prependTexts, ts.setTextRange(ts.factory.createUnparsedTextLike(text.data, text.kind === "internal"), text));
21351                         }
21352                     }
21353                     prependChildren = ts.addRange(prependChildren, prependTexts);
21354                     texts = ts.append(texts, ts.factory.createUnparsedPrepend(section.data, prependTexts !== null && prependTexts !== void 0 ? prependTexts : ts.emptyArray));
21355                     break;
21356                 case "internal":
21357                     if (stripInternal) {
21358                         if (!texts)
21359                             texts = [];
21360                         break;
21361                     }
21362                 case "text":
21363                     texts = ts.append(texts, ts.setTextRange(ts.factory.createUnparsedTextLike(section.data, section.kind === "internal"), section));
21364                     break;
21365                 default:
21366                     ts.Debug.assertNever(section);
21367             }
21368         }
21369         if (!texts) {
21370             var textNode = ts.factory.createUnparsedTextLike(undefined, false);
21371             ts.setTextRangePosWidth(textNode, 0, typeof length === "function" ? length() : length);
21372             texts = [textNode];
21373         }
21374         var node = ts.parseNodeFactory.createUnparsedSource(prologues !== null && prologues !== void 0 ? prologues : ts.emptyArray, undefined, texts);
21375         ts.setEachParent(prologues, node);
21376         ts.setEachParent(texts, node);
21377         ts.setEachParent(prependChildren, node);
21378         node.hasNoDefaultLib = hasNoDefaultLib;
21379         node.helpers = helpers;
21380         node.referencedFiles = referencedFiles || ts.emptyArray;
21381         node.typeReferenceDirectives = typeReferenceDirectives;
21382         node.libReferenceDirectives = libReferenceDirectives || ts.emptyArray;
21383         return node;
21384     }
21385     function parseOldFileOfCurrentEmit(bundleFileInfo) {
21386         var texts;
21387         var syntheticReferences;
21388         for (var _i = 0, _a = bundleFileInfo.sections; _i < _a.length; _i++) {
21389             var section = _a[_i];
21390             switch (section.kind) {
21391                 case "internal":
21392                 case "text":
21393                     texts = ts.append(texts, ts.setTextRange(ts.factory.createUnparsedTextLike(section.data, section.kind === "internal"), section));
21394                     break;
21395                 case "no-default-lib":
21396                 case "reference":
21397                 case "type":
21398                 case "lib":
21399                     syntheticReferences = ts.append(syntheticReferences, ts.setTextRange(ts.factory.createUnparsedSyntheticReference(section), section));
21400                     break;
21401                 case "prologue":
21402                 case "emitHelpers":
21403                 case "prepend":
21404                     break;
21405                 default:
21406                     ts.Debug.assertNever(section);
21407             }
21408         }
21409         var node = ts.factory.createUnparsedSource(ts.emptyArray, syntheticReferences, texts !== null && texts !== void 0 ? texts : ts.emptyArray);
21410         ts.setEachParent(syntheticReferences, node);
21411         ts.setEachParent(texts, node);
21412         node.helpers = ts.map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, function (name) { return ts.getAllUnscopedEmitHelpers().get(name); });
21413         return node;
21414     }
21415     function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
21416         var node = ts.parseNodeFactory.createInputFiles();
21417         if (!ts.isString(javascriptTextOrReadFileText)) {
21418             var cache_1 = new ts.Map();
21419             var textGetter_1 = function (path) {
21420                 if (path === undefined)
21421                     return undefined;
21422                 var value = cache_1.get(path);
21423                 if (value === undefined) {
21424                     value = javascriptTextOrReadFileText(path);
21425                     cache_1.set(path, value !== undefined ? value : false);
21426                 }
21427                 return value !== false ? value : undefined;
21428             };
21429             var definedTextGetter_1 = function (path) {
21430                 var result = textGetter_1(path);
21431                 return result !== undefined ? result : "/* Input file ".concat(path, " was missing */\r\n");
21432             };
21433             var buildInfo_1;
21434             var getAndCacheBuildInfo_1 = function (getText) {
21435                 if (buildInfo_1 === undefined) {
21436                     var result = getText();
21437                     buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
21438                 }
21439                 return buildInfo_1 || undefined;
21440             };
21441             node.javascriptPath = declarationTextOrJavascriptPath;
21442             node.javascriptMapPath = javascriptMapPath;
21443             node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
21444             node.declarationMapPath = declarationMapPath;
21445             node.buildInfoPath = declarationMapTextOrBuildInfoPath;
21446             Object.defineProperties(node, {
21447                 javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
21448                 javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
21449                 declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
21450                 declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
21451                 buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
21452             });
21453         }
21454         else {
21455             node.javascriptText = javascriptTextOrReadFileText;
21456             node.javascriptMapPath = javascriptMapPath;
21457             node.javascriptMapText = javascriptMapTextOrDeclarationPath;
21458             node.declarationText = declarationTextOrJavascriptPath;
21459             node.declarationMapPath = declarationMapPath;
21460             node.declarationMapText = declarationMapTextOrBuildInfoPath;
21461             node.javascriptPath = javascriptPath;
21462             node.declarationPath = declarationPath;
21463             node.buildInfoPath = buildInfoPath;
21464             node.buildInfo = buildInfo;
21465             node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
21466         }
21467         return node;
21468     }
21469     ts.createInputFiles = createInputFiles;
21470     var SourceMapSource;
21471     function createSourceMapSource(fileName, text, skipTrivia) {
21472         return new (SourceMapSource || (SourceMapSource = ts.objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia);
21473     }
21474     ts.createSourceMapSource = createSourceMapSource;
21475     function setOriginalNode(node, original) {
21476         node.original = original;
21477         if (original) {
21478             var emitNode = original.emitNode;
21479             if (emitNode)
21480                 node.emitNode = mergeEmitNode(emitNode, node.emitNode);
21481         }
21482         return node;
21483     }
21484     ts.setOriginalNode = setOriginalNode;
21485     function mergeEmitNode(sourceEmitNode, destEmitNode) {
21486         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, startsOnNewLine = sourceEmitNode.startsOnNewLine;
21487         if (!destEmitNode)
21488             destEmitNode = {};
21489         if (leadingComments)
21490             destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments);
21491         if (trailingComments)
21492             destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments);
21493         if (flags)
21494             destEmitNode.flags = flags & ~268435456;
21495         if (commentRange)
21496             destEmitNode.commentRange = commentRange;
21497         if (sourceMapRange)
21498             destEmitNode.sourceMapRange = sourceMapRange;
21499         if (tokenSourceMapRanges)
21500             destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges);
21501         if (constantValue !== undefined)
21502             destEmitNode.constantValue = constantValue;
21503         if (helpers) {
21504             for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) {
21505                 var helper = helpers_1[_i];
21506                 destEmitNode.helpers = ts.appendIfUnique(destEmitNode.helpers, helper);
21507             }
21508         }
21509         if (startsOnNewLine !== undefined)
21510             destEmitNode.startsOnNewLine = startsOnNewLine;
21511         return destEmitNode;
21512     }
21513     function mergeTokenSourceMapRanges(sourceRanges, destRanges) {
21514         if (!destRanges)
21515             destRanges = [];
21516         for (var key in sourceRanges) {
21517             destRanges[key] = sourceRanges[key];
21518         }
21519         return destRanges;
21520     }
21521 })(ts || (ts = {}));
21522 var ts;
21523 (function (ts) {
21524     function getOrCreateEmitNode(node) {
21525         var _a;
21526         if (!node.emitNode) {
21527             if (ts.isParseTreeNode(node)) {
21528                 if (node.kind === 303) {
21529                     return node.emitNode = { annotatedNodes: [node] };
21530                 }
21531                 var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file.");
21532                 getOrCreateEmitNode(sourceFile).annotatedNodes.push(node);
21533             }
21534             node.emitNode = {};
21535         }
21536         else {
21537             ts.Debug.assert(!(node.emitNode.flags & 268435456), "Invalid attempt to mutate an immutable node.");
21538         }
21539         return node.emitNode;
21540     }
21541     ts.getOrCreateEmitNode = getOrCreateEmitNode;
21542     function disposeEmitNodes(sourceFile) {
21543         var _a, _b;
21544         var annotatedNodes = (_b = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile))) === null || _a === void 0 ? void 0 : _a.emitNode) === null || _b === void 0 ? void 0 : _b.annotatedNodes;
21545         if (annotatedNodes) {
21546             for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) {
21547                 var node = annotatedNodes_1[_i];
21548                 node.emitNode = undefined;
21549             }
21550         }
21551     }
21552     ts.disposeEmitNodes = disposeEmitNodes;
21553     function removeAllComments(node) {
21554         var emitNode = getOrCreateEmitNode(node);
21555         emitNode.flags |= 1536;
21556         emitNode.leadingComments = undefined;
21557         emitNode.trailingComments = undefined;
21558         return node;
21559     }
21560     ts.removeAllComments = removeAllComments;
21561     function setEmitFlags(node, emitFlags) {
21562         getOrCreateEmitNode(node).flags = emitFlags;
21563         return node;
21564     }
21565     ts.setEmitFlags = setEmitFlags;
21566     function addEmitFlags(node, emitFlags) {
21567         var emitNode = getOrCreateEmitNode(node);
21568         emitNode.flags = emitNode.flags | emitFlags;
21569         return node;
21570     }
21571     ts.addEmitFlags = addEmitFlags;
21572     function getSourceMapRange(node) {
21573         var _a, _b;
21574         return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.sourceMapRange) !== null && _b !== void 0 ? _b : node;
21575     }
21576     ts.getSourceMapRange = getSourceMapRange;
21577     function setSourceMapRange(node, range) {
21578         getOrCreateEmitNode(node).sourceMapRange = range;
21579         return node;
21580     }
21581     ts.setSourceMapRange = setSourceMapRange;
21582     function getTokenSourceMapRange(node, token) {
21583         var _a, _b;
21584         return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.tokenSourceMapRanges) === null || _b === void 0 ? void 0 : _b[token];
21585     }
21586     ts.getTokenSourceMapRange = getTokenSourceMapRange;
21587     function setTokenSourceMapRange(node, token, range) {
21588         var _a;
21589         var emitNode = getOrCreateEmitNode(node);
21590         var tokenSourceMapRanges = (_a = emitNode.tokenSourceMapRanges) !== null && _a !== void 0 ? _a : (emitNode.tokenSourceMapRanges = []);
21591         tokenSourceMapRanges[token] = range;
21592         return node;
21593     }
21594     ts.setTokenSourceMapRange = setTokenSourceMapRange;
21595     function getStartsOnNewLine(node) {
21596         var _a;
21597         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.startsOnNewLine;
21598     }
21599     ts.getStartsOnNewLine = getStartsOnNewLine;
21600     function setStartsOnNewLine(node, newLine) {
21601         getOrCreateEmitNode(node).startsOnNewLine = newLine;
21602         return node;
21603     }
21604     ts.setStartsOnNewLine = setStartsOnNewLine;
21605     function getCommentRange(node) {
21606         var _a, _b;
21607         return (_b = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.commentRange) !== null && _b !== void 0 ? _b : node;
21608     }
21609     ts.getCommentRange = getCommentRange;
21610     function setCommentRange(node, range) {
21611         getOrCreateEmitNode(node).commentRange = range;
21612         return node;
21613     }
21614     ts.setCommentRange = setCommentRange;
21615     function getSyntheticLeadingComments(node) {
21616         var _a;
21617         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.leadingComments;
21618     }
21619     ts.getSyntheticLeadingComments = getSyntheticLeadingComments;
21620     function setSyntheticLeadingComments(node, comments) {
21621         getOrCreateEmitNode(node).leadingComments = comments;
21622         return node;
21623     }
21624     ts.setSyntheticLeadingComments = setSyntheticLeadingComments;
21625     function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) {
21626         return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
21627     }
21628     ts.addSyntheticLeadingComment = addSyntheticLeadingComment;
21629     function getSyntheticTrailingComments(node) {
21630         var _a;
21631         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.trailingComments;
21632     }
21633     ts.getSyntheticTrailingComments = getSyntheticTrailingComments;
21634     function setSyntheticTrailingComments(node, comments) {
21635         getOrCreateEmitNode(node).trailingComments = comments;
21636         return node;
21637     }
21638     ts.setSyntheticTrailingComments = setSyntheticTrailingComments;
21639     function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) {
21640         return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text }));
21641     }
21642     ts.addSyntheticTrailingComment = addSyntheticTrailingComment;
21643     function moveSyntheticComments(node, original) {
21644         setSyntheticLeadingComments(node, getSyntheticLeadingComments(original));
21645         setSyntheticTrailingComments(node, getSyntheticTrailingComments(original));
21646         var emit = getOrCreateEmitNode(original);
21647         emit.leadingComments = undefined;
21648         emit.trailingComments = undefined;
21649         return node;
21650     }
21651     ts.moveSyntheticComments = moveSyntheticComments;
21652     function getConstantValue(node) {
21653         var _a;
21654         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.constantValue;
21655     }
21656     ts.getConstantValue = getConstantValue;
21657     function setConstantValue(node, value) {
21658         var emitNode = getOrCreateEmitNode(node);
21659         emitNode.constantValue = value;
21660         return node;
21661     }
21662     ts.setConstantValue = setConstantValue;
21663     function addEmitHelper(node, helper) {
21664         var emitNode = getOrCreateEmitNode(node);
21665         emitNode.helpers = ts.append(emitNode.helpers, helper);
21666         return node;
21667     }
21668     ts.addEmitHelper = addEmitHelper;
21669     function addEmitHelpers(node, helpers) {
21670         if (ts.some(helpers)) {
21671             var emitNode = getOrCreateEmitNode(node);
21672             for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) {
21673                 var helper = helpers_2[_i];
21674                 emitNode.helpers = ts.appendIfUnique(emitNode.helpers, helper);
21675             }
21676         }
21677         return node;
21678     }
21679     ts.addEmitHelpers = addEmitHelpers;
21680     function removeEmitHelper(node, helper) {
21681         var _a;
21682         var helpers = (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.helpers;
21683         if (helpers) {
21684             return ts.orderedRemoveItem(helpers, helper);
21685         }
21686         return false;
21687     }
21688     ts.removeEmitHelper = removeEmitHelper;
21689     function getEmitHelpers(node) {
21690         var _a;
21691         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.helpers;
21692     }
21693     ts.getEmitHelpers = getEmitHelpers;
21694     function moveEmitHelpers(source, target, predicate) {
21695         var sourceEmitNode = source.emitNode;
21696         var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers;
21697         if (!ts.some(sourceEmitHelpers))
21698             return;
21699         var targetEmitNode = getOrCreateEmitNode(target);
21700         var helpersRemoved = 0;
21701         for (var i = 0; i < sourceEmitHelpers.length; i++) {
21702             var helper = sourceEmitHelpers[i];
21703             if (predicate(helper)) {
21704                 helpersRemoved++;
21705                 targetEmitNode.helpers = ts.appendIfUnique(targetEmitNode.helpers, helper);
21706             }
21707             else if (helpersRemoved > 0) {
21708                 sourceEmitHelpers[i - helpersRemoved] = helper;
21709             }
21710         }
21711         if (helpersRemoved > 0) {
21712             sourceEmitHelpers.length -= helpersRemoved;
21713         }
21714     }
21715     ts.moveEmitHelpers = moveEmitHelpers;
21716     function getSnippetElement(node) {
21717         var _a;
21718         return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
21719     }
21720     ts.getSnippetElement = getSnippetElement;
21721     function setSnippetElement(node, snippet) {
21722         var emitNode = getOrCreateEmitNode(node);
21723         emitNode.snippetElement = snippet;
21724         return node;
21725     }
21726     ts.setSnippetElement = setSnippetElement;
21727     function ignoreSourceNewlines(node) {
21728         getOrCreateEmitNode(node).flags |= 134217728;
21729         return node;
21730     }
21731     ts.ignoreSourceNewlines = ignoreSourceNewlines;
21732 })(ts || (ts = {}));
21733 var ts;
21734 (function (ts) {
21735     function createEmitHelperFactory(context) {
21736         var factory = context.factory;
21737         var immutableTrue = ts.memoize(function () { return ts.setEmitFlags(factory.createTrue(), 268435456); });
21738         var immutableFalse = ts.memoize(function () { return ts.setEmitFlags(factory.createFalse(), 268435456); });
21739         return {
21740             getUnscopedHelperName: getUnscopedHelperName,
21741             createDecorateHelper: createDecorateHelper,
21742             createMetadataHelper: createMetadataHelper,
21743             createParamHelper: createParamHelper,
21744             createAssignHelper: createAssignHelper,
21745             createAwaitHelper: createAwaitHelper,
21746             createAsyncGeneratorHelper: createAsyncGeneratorHelper,
21747             createAsyncDelegatorHelper: createAsyncDelegatorHelper,
21748             createAsyncValuesHelper: createAsyncValuesHelper,
21749             createRestHelper: createRestHelper,
21750             createAwaiterHelper: createAwaiterHelper,
21751             createExtendsHelper: createExtendsHelper,
21752             createTemplateObjectHelper: createTemplateObjectHelper,
21753             createSpreadArrayHelper: createSpreadArrayHelper,
21754             createValuesHelper: createValuesHelper,
21755             createReadHelper: createReadHelper,
21756             createGeneratorHelper: createGeneratorHelper,
21757             createCreateBindingHelper: createCreateBindingHelper,
21758             createImportStarHelper: createImportStarHelper,
21759             createImportStarCallbackHelper: createImportStarCallbackHelper,
21760             createImportDefaultHelper: createImportDefaultHelper,
21761             createExportStarHelper: createExportStarHelper,
21762             createClassPrivateFieldGetHelper: createClassPrivateFieldGetHelper,
21763             createClassPrivateFieldSetHelper: createClassPrivateFieldSetHelper,
21764             createClassPrivateFieldInHelper: createClassPrivateFieldInHelper
21765         };
21766         function getUnscopedHelperName(name) {
21767             return ts.setEmitFlags(factory.createIdentifier(name), 4096 | 2);
21768         }
21769         function createDecorateHelper(decoratorExpressions, target, memberName, descriptor) {
21770             context.requestEmitHelper(ts.decorateHelper);
21771             var argumentsArray = [];
21772             argumentsArray.push(factory.createArrayLiteralExpression(decoratorExpressions, true));
21773             argumentsArray.push(target);
21774             if (memberName) {
21775                 argumentsArray.push(memberName);
21776                 if (descriptor) {
21777                     argumentsArray.push(descriptor);
21778                 }
21779             }
21780             return factory.createCallExpression(getUnscopedHelperName("__decorate"), undefined, argumentsArray);
21781         }
21782         function createMetadataHelper(metadataKey, metadataValue) {
21783             context.requestEmitHelper(ts.metadataHelper);
21784             return factory.createCallExpression(getUnscopedHelperName("__metadata"), undefined, [
21785                 factory.createStringLiteral(metadataKey),
21786                 metadataValue
21787             ]);
21788         }
21789         function createParamHelper(expression, parameterOffset, location) {
21790             context.requestEmitHelper(ts.paramHelper);
21791             return ts.setTextRange(factory.createCallExpression(getUnscopedHelperName("__param"), undefined, [
21792                 factory.createNumericLiteral(parameterOffset + ""),
21793                 expression
21794             ]), location);
21795         }
21796         function createAssignHelper(attributesSegments) {
21797             if (ts.getEmitScriptTarget(context.getCompilerOptions()) >= 2) {
21798                 return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"), undefined, attributesSegments);
21799             }
21800             context.requestEmitHelper(ts.assignHelper);
21801             return factory.createCallExpression(getUnscopedHelperName("__assign"), undefined, attributesSegments);
21802         }
21803         function createAwaitHelper(expression) {
21804             context.requestEmitHelper(ts.awaitHelper);
21805             return factory.createCallExpression(getUnscopedHelperName("__await"), undefined, [expression]);
21806         }
21807         function createAsyncGeneratorHelper(generatorFunc, hasLexicalThis) {
21808             context.requestEmitHelper(ts.awaitHelper);
21809             context.requestEmitHelper(ts.asyncGeneratorHelper);
21810             (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288;
21811             return factory.createCallExpression(getUnscopedHelperName("__asyncGenerator"), undefined, [
21812                 hasLexicalThis ? factory.createThis() : factory.createVoidZero(),
21813                 factory.createIdentifier("arguments"),
21814                 generatorFunc
21815             ]);
21816         }
21817         function createAsyncDelegatorHelper(expression) {
21818             context.requestEmitHelper(ts.awaitHelper);
21819             context.requestEmitHelper(ts.asyncDelegator);
21820             return factory.createCallExpression(getUnscopedHelperName("__asyncDelegator"), undefined, [expression]);
21821         }
21822         function createAsyncValuesHelper(expression) {
21823             context.requestEmitHelper(ts.asyncValues);
21824             return factory.createCallExpression(getUnscopedHelperName("__asyncValues"), undefined, [expression]);
21825         }
21826         function createRestHelper(value, elements, computedTempVariables, location) {
21827             context.requestEmitHelper(ts.restHelper);
21828             var propertyNames = [];
21829             var computedTempVariableOffset = 0;
21830             for (var i = 0; i < elements.length - 1; i++) {
21831                 var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(elements[i]);
21832                 if (propertyName) {
21833                     if (ts.isComputedPropertyName(propertyName)) {
21834                         ts.Debug.assertIsDefined(computedTempVariables, "Encountered computed property name but 'computedTempVariables' argument was not provided.");
21835                         var temp = computedTempVariables[computedTempVariableOffset];
21836                         computedTempVariableOffset++;
21837                         propertyNames.push(factory.createConditionalExpression(factory.createTypeCheck(temp, "symbol"), undefined, temp, undefined, factory.createAdd(temp, factory.createStringLiteral(""))));
21838                     }
21839                     else {
21840                         propertyNames.push(factory.createStringLiteralFromNode(propertyName));
21841                     }
21842                 }
21843             }
21844             return factory.createCallExpression(getUnscopedHelperName("__rest"), undefined, [
21845                 value,
21846                 ts.setTextRange(factory.createArrayLiteralExpression(propertyNames), location)
21847             ]);
21848         }
21849         function createAwaiterHelper(hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
21850             context.requestEmitHelper(ts.awaiterHelper);
21851             var generatorFunc = factory.createFunctionExpression(undefined, factory.createToken(41), undefined, undefined, [], undefined, body);
21852             (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 262144 | 524288;
21853             return factory.createCallExpression(getUnscopedHelperName("__awaiter"), undefined, [
21854                 hasLexicalThis ? factory.createThis() : factory.createVoidZero(),
21855                 hasLexicalArguments ? factory.createIdentifier("arguments") : factory.createVoidZero(),
21856                 promiseConstructor ? ts.createExpressionFromEntityName(factory, promiseConstructor) : factory.createVoidZero(),
21857                 generatorFunc
21858             ]);
21859         }
21860         function createExtendsHelper(name) {
21861             context.requestEmitHelper(ts.extendsHelper);
21862             return factory.createCallExpression(getUnscopedHelperName("__extends"), undefined, [name, factory.createUniqueName("_super", 16 | 32)]);
21863         }
21864         function createTemplateObjectHelper(cooked, raw) {
21865             context.requestEmitHelper(ts.templateObjectHelper);
21866             return factory.createCallExpression(getUnscopedHelperName("__makeTemplateObject"), undefined, [cooked, raw]);
21867         }
21868         function createSpreadArrayHelper(to, from, packFrom) {
21869             context.requestEmitHelper(ts.spreadArrayHelper);
21870             return factory.createCallExpression(getUnscopedHelperName("__spreadArray"), undefined, [to, from, packFrom ? immutableTrue() : immutableFalse()]);
21871         }
21872         function createValuesHelper(expression) {
21873             context.requestEmitHelper(ts.valuesHelper);
21874             return factory.createCallExpression(getUnscopedHelperName("__values"), undefined, [expression]);
21875         }
21876         function createReadHelper(iteratorRecord, count) {
21877             context.requestEmitHelper(ts.readHelper);
21878             return factory.createCallExpression(getUnscopedHelperName("__read"), undefined, count !== undefined
21879                 ? [iteratorRecord, factory.createNumericLiteral(count + "")]
21880                 : [iteratorRecord]);
21881         }
21882         function createGeneratorHelper(body) {
21883             context.requestEmitHelper(ts.generatorHelper);
21884             return factory.createCallExpression(getUnscopedHelperName("__generator"), undefined, [factory.createThis(), body]);
21885         }
21886         function createCreateBindingHelper(module, inputName, outputName) {
21887             context.requestEmitHelper(ts.createBindingHelper);
21888             return factory.createCallExpression(getUnscopedHelperName("__createBinding"), undefined, __spreadArray([factory.createIdentifier("exports"), module, inputName], (outputName ? [outputName] : []), true));
21889         }
21890         function createImportStarHelper(expression) {
21891             context.requestEmitHelper(ts.importStarHelper);
21892             return factory.createCallExpression(getUnscopedHelperName("__importStar"), undefined, [expression]);
21893         }
21894         function createImportStarCallbackHelper() {
21895             context.requestEmitHelper(ts.importStarHelper);
21896             return getUnscopedHelperName("__importStar");
21897         }
21898         function createImportDefaultHelper(expression) {
21899             context.requestEmitHelper(ts.importDefaultHelper);
21900             return factory.createCallExpression(getUnscopedHelperName("__importDefault"), undefined, [expression]);
21901         }
21902         function createExportStarHelper(moduleExpression, exportsExpression) {
21903             if (exportsExpression === void 0) { exportsExpression = factory.createIdentifier("exports"); }
21904             context.requestEmitHelper(ts.exportStarHelper);
21905             context.requestEmitHelper(ts.createBindingHelper);
21906             return factory.createCallExpression(getUnscopedHelperName("__exportStar"), undefined, [moduleExpression, exportsExpression]);
21907         }
21908         function createClassPrivateFieldGetHelper(receiver, state, kind, f) {
21909             context.requestEmitHelper(ts.classPrivateFieldGetHelper);
21910             var args;
21911             if (!f) {
21912                 args = [receiver, state, factory.createStringLiteral(kind)];
21913             }
21914             else {
21915                 args = [receiver, state, factory.createStringLiteral(kind), f];
21916             }
21917             return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldGet"), undefined, args);
21918         }
21919         function createClassPrivateFieldSetHelper(receiver, state, value, kind, f) {
21920             context.requestEmitHelper(ts.classPrivateFieldSetHelper);
21921             var args;
21922             if (!f) {
21923                 args = [receiver, state, value, factory.createStringLiteral(kind)];
21924             }
21925             else {
21926                 args = [receiver, state, value, factory.createStringLiteral(kind), f];
21927             }
21928             return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldSet"), undefined, args);
21929         }
21930         function createClassPrivateFieldInHelper(state, receiver) {
21931             context.requestEmitHelper(ts.classPrivateFieldInHelper);
21932             return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldIn"), undefined, [state, receiver]);
21933         }
21934     }
21935     ts.createEmitHelperFactory = createEmitHelperFactory;
21936     function compareEmitHelpers(x, y) {
21937         if (x === y)
21938             return 0;
21939         if (x.priority === y.priority)
21940             return 0;
21941         if (x.priority === undefined)
21942             return 1;
21943         if (y.priority === undefined)
21944             return -1;
21945         return ts.compareValues(x.priority, y.priority);
21946     }
21947     ts.compareEmitHelpers = compareEmitHelpers;
21948     function helperString(input) {
21949         var args = [];
21950         for (var _i = 1; _i < arguments.length; _i++) {
21951             args[_i - 1] = arguments[_i];
21952         }
21953         return function (uniqueName) {
21954             var result = "";
21955             for (var i = 0; i < args.length; i++) {
21956                 result += input[i];
21957                 result += uniqueName(args[i]);
21958             }
21959             result += input[input.length - 1];
21960             return result;
21961         };
21962     }
21963     ts.helperString = helperString;
21964     ts.decorateHelper = {
21965         name: "typescript:decorate",
21966         importName: "__decorate",
21967         scoped: false,
21968         priority: 2,
21969         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            };"
21970     };
21971     ts.metadataHelper = {
21972         name: "typescript:metadata",
21973         importName: "__metadata",
21974         scoped: false,
21975         priority: 3,
21976         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            };"
21977     };
21978     ts.paramHelper = {
21979         name: "typescript:param",
21980         importName: "__param",
21981         scoped: false,
21982         priority: 4,
21983         text: "\n            var __param = (this && this.__param) || function (paramIndex, decorator) {\n                return function (target, key) { decorator(target, key, paramIndex); }\n            };"
21984     };
21985     ts.assignHelper = {
21986         name: "typescript:assign",
21987         importName: "__assign",
21988         scoped: false,
21989         priority: 1,
21990         text: "\n            var __assign = (this && this.__assign) || function () {\n                __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                };\n                return __assign.apply(this, arguments);\n            };"
21991     };
21992     ts.awaitHelper = {
21993         name: "typescript:await",
21994         importName: "__await",
21995         scoped: false,
21996         text: "\n            var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }"
21997     };
21998     ts.asyncGeneratorHelper = {
21999         name: "typescript:asyncGenerator",
22000         importName: "__asyncGenerator",
22001         scoped: false,
22002         dependencies: [ts.awaitHelper],
22003         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 || []), i, q = [];\n                return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n                function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n                function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n                function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n                function fulfill(value) { resume(\"next\", value); }\n                function reject(value) { resume(\"throw\", value); }\n                function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n            };"
22004     };
22005     ts.asyncDelegator = {
22006         name: "typescript:asyncDelegator",
22007         importName: "__asyncDelegator",
22008         scoped: false,
22009         dependencies: [ts.awaitHelper],
22010         text: "\n            var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n                var i, p;\n                return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n                function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n            };"
22011     };
22012     ts.asyncValues = {
22013         name: "typescript:asyncValues",
22014         importName: "__asyncValues",
22015         scoped: false,
22016         text: "\n            var __asyncValues = (this && this.__asyncValues) || function (o) {\n                if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n                var m = o[Symbol.asyncIterator], i;\n                return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n                function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n                function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n            };"
22017     };
22018     ts.restHelper = {
22019         name: "typescript:rest",
22020         importName: "__rest",
22021         scoped: false,
22022         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++) {\n                        if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n                            t[p[i]] = s[p[i]];\n                    }\n                return t;\n            };"
22023     };
22024     ts.awaiterHelper = {
22025         name: "typescript:awaiter",
22026         importName: "__awaiter",
22027         scoped: false,
22028         priority: 5,
22029         text: "\n            var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n                function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\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) : adopt(result.value).then(fulfilled, rejected); }\n                    step((generator = generator.apply(thisArg, _arguments || [])).next());\n                });\n            };"
22030     };
22031     ts.extendsHelper = {
22032         name: "typescript:extends",
22033         importName: "__extends",
22034         scoped: false,
22035         priority: 0,
22036         text: "\n            var __extends = (this && this.__extends) || (function () {\n                var extendStatics = function (d, b) {\n                    extendStatics = Object.setPrototypeOf ||\n                        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n                        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n                    return extendStatics(d, b);\n                };\n\n                return function (d, b) {\n                    if (typeof b !== \"function\" && b !== null)\n                        throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n                    extendStatics(d, b);\n                    function __() { this.constructor = d; }\n                    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n                };\n            })();"
22037     };
22038     ts.templateObjectHelper = {
22039         name: "typescript:makeTemplateObject",
22040         importName: "__makeTemplateObject",
22041         scoped: false,
22042         priority: 0,
22043         text: "\n            var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {\n                if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n                return cooked;\n            };"
22044     };
22045     ts.readHelper = {
22046         name: "typescript:read",
22047         importName: "__read",
22048         scoped: false,
22049         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            };"
22050     };
22051     ts.spreadArrayHelper = {
22052         name: "typescript:spreadArray",
22053         importName: "__spreadArray",
22054         scoped: false,
22055         text: "\n            var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n                if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n                    if (ar || !(i in from)) {\n                        if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n                        ar[i] = from[i];\n                    }\n                }\n                return to.concat(ar || Array.prototype.slice.call(from));\n            };"
22056     };
22057     ts.valuesHelper = {
22058         name: "typescript:values",
22059         importName: "__values",
22060         scoped: false,
22061         text: "\n            var __values = (this && this.__values) || function(o) {\n                var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n                if (m) return m.call(o);\n                if (o && typeof o.length === \"number\") return {\n                    next: function () {\n                        if (o && i >= o.length) o = void 0;\n                        return { value: o && o[i++], done: !o };\n                    }\n                };\n                throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n            };"
22062     };
22063     ts.generatorHelper = {
22064         name: "typescript:generator",
22065         importName: "__generator",
22066         scoped: false,
22067         priority: 6,
22068         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 = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n                        if (y = 0, t) op = [op[0] & 2, 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            };"
22069     };
22070     ts.createBindingHelper = {
22071         name: "typescript:commonjscreatebinding",
22072         importName: "__createBinding",
22073         scoped: false,
22074         priority: 1,
22075         text: "\n            var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n                if (k2 === undefined) k2 = k;\n                Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n            }) : (function(o, m, k, k2) {\n                if (k2 === undefined) k2 = k;\n                o[k2] = m[k];\n            }));"
22076     };
22077     ts.setModuleDefaultHelper = {
22078         name: "typescript:commonjscreatevalue",
22079         importName: "__setModuleDefault",
22080         scoped: false,
22081         priority: 1,
22082         text: "\n            var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n                Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n            }) : function(o, v) {\n                o[\"default\"] = v;\n            });"
22083     };
22084     ts.importStarHelper = {
22085         name: "typescript:commonjsimportstar",
22086         importName: "__importStar",
22087         scoped: false,
22088         dependencies: [ts.createBindingHelper, ts.setModuleDefaultHelper],
22089         priority: 2,
22090         text: "\n            var __importStar = (this && this.__importStar) || function (mod) {\n                if (mod && mod.__esModule) return mod;\n                var result = {};\n                if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n                __setModuleDefault(result, mod);\n                return result;\n            };"
22091     };
22092     ts.importDefaultHelper = {
22093         name: "typescript:commonjsimportdefault",
22094         importName: "__importDefault",
22095         scoped: false,
22096         text: "\n            var __importDefault = (this && this.__importDefault) || function (mod) {\n                return (mod && mod.__esModule) ? mod : { \"default\": mod };\n            };"
22097     };
22098     ts.exportStarHelper = {
22099         name: "typescript:export-star",
22100         importName: "__exportStar",
22101         scoped: false,
22102         dependencies: [ts.createBindingHelper],
22103         priority: 2,
22104         text: "\n            var __exportStar = (this && this.__exportStar) || function(m, exports) {\n                for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n            };"
22105     };
22106     ts.classPrivateFieldGetHelper = {
22107         name: "typescript:classPrivateFieldGet",
22108         importName: "__classPrivateFieldGet",
22109         scoped: false,
22110         text: "\n            var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n                if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n                if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n                return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n            };"
22111     };
22112     ts.classPrivateFieldSetHelper = {
22113         name: "typescript:classPrivateFieldSet",
22114         importName: "__classPrivateFieldSet",
22115         scoped: false,
22116         text: "\n            var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n                if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n                if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n                if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n                return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n            };"
22117     };
22118     ts.classPrivateFieldInHelper = {
22119         name: "typescript:classPrivateFieldIn",
22120         importName: "__classPrivateFieldIn",
22121         scoped: false,
22122         text: "\n            var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) {\n                if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n                return typeof state === \"function\" ? receiver === state : state.has(receiver);\n            };"
22123     };
22124     var allUnscopedEmitHelpers;
22125     function getAllUnscopedEmitHelpers() {
22126         return allUnscopedEmitHelpers || (allUnscopedEmitHelpers = ts.arrayToMap([
22127             ts.decorateHelper,
22128             ts.metadataHelper,
22129             ts.paramHelper,
22130             ts.assignHelper,
22131             ts.awaitHelper,
22132             ts.asyncGeneratorHelper,
22133             ts.asyncDelegator,
22134             ts.asyncValues,
22135             ts.restHelper,
22136             ts.awaiterHelper,
22137             ts.extendsHelper,
22138             ts.templateObjectHelper,
22139             ts.spreadArrayHelper,
22140             ts.valuesHelper,
22141             ts.readHelper,
22142             ts.generatorHelper,
22143             ts.importStarHelper,
22144             ts.importDefaultHelper,
22145             ts.exportStarHelper,
22146             ts.classPrivateFieldGetHelper,
22147             ts.classPrivateFieldSetHelper,
22148             ts.classPrivateFieldInHelper,
22149             ts.createBindingHelper,
22150             ts.setModuleDefaultHelper
22151         ], function (helper) { return helper.name; }));
22152     }
22153     ts.getAllUnscopedEmitHelpers = getAllUnscopedEmitHelpers;
22154     ts.asyncSuperHelper = {
22155         name: "typescript:async-super",
22156         scoped: true,
22157         text: helperString(__makeTemplateObject(["\n            const ", " = name => super[name];"], ["\n            const ", " = name => super[name];"]), "_superIndex")
22158     };
22159     ts.advancedAsyncSuperHelper = {
22160         name: "typescript:advanced-async-super",
22161         scoped: true,
22162         text: helperString(__makeTemplateObject(["\n            const ", " = (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            const ", " = (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);"]), "_superIndex")
22163     };
22164     function isCallToHelper(firstSegment, helperName) {
22165         return ts.isCallExpression(firstSegment)
22166             && ts.isIdentifier(firstSegment.expression)
22167             && (ts.getEmitFlags(firstSegment.expression) & 4096) !== 0
22168             && firstSegment.expression.escapedText === helperName;
22169     }
22170     ts.isCallToHelper = isCallToHelper;
22171 })(ts || (ts = {}));
22172 var ts;
22173 (function (ts) {
22174     function isNumericLiteral(node) {
22175         return node.kind === 8;
22176     }
22177     ts.isNumericLiteral = isNumericLiteral;
22178     function isBigIntLiteral(node) {
22179         return node.kind === 9;
22180     }
22181     ts.isBigIntLiteral = isBigIntLiteral;
22182     function isStringLiteral(node) {
22183         return node.kind === 10;
22184     }
22185     ts.isStringLiteral = isStringLiteral;
22186     function isJsxText(node) {
22187         return node.kind === 11;
22188     }
22189     ts.isJsxText = isJsxText;
22190     function isRegularExpressionLiteral(node) {
22191         return node.kind === 13;
22192     }
22193     ts.isRegularExpressionLiteral = isRegularExpressionLiteral;
22194     function isNoSubstitutionTemplateLiteral(node) {
22195         return node.kind === 14;
22196     }
22197     ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral;
22198     function isTemplateHead(node) {
22199         return node.kind === 15;
22200     }
22201     ts.isTemplateHead = isTemplateHead;
22202     function isTemplateMiddle(node) {
22203         return node.kind === 16;
22204     }
22205     ts.isTemplateMiddle = isTemplateMiddle;
22206     function isTemplateTail(node) {
22207         return node.kind === 17;
22208     }
22209     ts.isTemplateTail = isTemplateTail;
22210     function isDotDotDotToken(node) {
22211         return node.kind === 25;
22212     }
22213     ts.isDotDotDotToken = isDotDotDotToken;
22214     function isCommaToken(node) {
22215         return node.kind === 27;
22216     }
22217     ts.isCommaToken = isCommaToken;
22218     function isPlusToken(node) {
22219         return node.kind === 39;
22220     }
22221     ts.isPlusToken = isPlusToken;
22222     function isMinusToken(node) {
22223         return node.kind === 40;
22224     }
22225     ts.isMinusToken = isMinusToken;
22226     function isAsteriskToken(node) {
22227         return node.kind === 41;
22228     }
22229     ts.isAsteriskToken = isAsteriskToken;
22230     function isExclamationToken(node) {
22231         return node.kind === 53;
22232     }
22233     ts.isExclamationToken = isExclamationToken;
22234     function isQuestionToken(node) {
22235         return node.kind === 57;
22236     }
22237     ts.isQuestionToken = isQuestionToken;
22238     function isColonToken(node) {
22239         return node.kind === 58;
22240     }
22241     ts.isColonToken = isColonToken;
22242     function isQuestionDotToken(node) {
22243         return node.kind === 28;
22244     }
22245     ts.isQuestionDotToken = isQuestionDotToken;
22246     function isEqualsGreaterThanToken(node) {
22247         return node.kind === 38;
22248     }
22249     ts.isEqualsGreaterThanToken = isEqualsGreaterThanToken;
22250     function isIdentifier(node) {
22251         return node.kind === 79;
22252     }
22253     ts.isIdentifier = isIdentifier;
22254     function isPrivateIdentifier(node) {
22255         return node.kind === 80;
22256     }
22257     ts.isPrivateIdentifier = isPrivateIdentifier;
22258     function isExportModifier(node) {
22259         return node.kind === 93;
22260     }
22261     ts.isExportModifier = isExportModifier;
22262     function isAsyncModifier(node) {
22263         return node.kind === 131;
22264     }
22265     ts.isAsyncModifier = isAsyncModifier;
22266     function isAssertsKeyword(node) {
22267         return node.kind === 128;
22268     }
22269     ts.isAssertsKeyword = isAssertsKeyword;
22270     function isAwaitKeyword(node) {
22271         return node.kind === 132;
22272     }
22273     ts.isAwaitKeyword = isAwaitKeyword;
22274     function isReadonlyKeyword(node) {
22275         return node.kind === 144;
22276     }
22277     ts.isReadonlyKeyword = isReadonlyKeyword;
22278     function isStaticModifier(node) {
22279         return node.kind === 124;
22280     }
22281     ts.isStaticModifier = isStaticModifier;
22282     function isAbstractModifier(node) {
22283         return node.kind === 126;
22284     }
22285     ts.isAbstractModifier = isAbstractModifier;
22286     function isSuperKeyword(node) {
22287         return node.kind === 106;
22288     }
22289     ts.isSuperKeyword = isSuperKeyword;
22290     function isImportKeyword(node) {
22291         return node.kind === 100;
22292     }
22293     ts.isImportKeyword = isImportKeyword;
22294     function isQualifiedName(node) {
22295         return node.kind === 160;
22296     }
22297     ts.isQualifiedName = isQualifiedName;
22298     function isComputedPropertyName(node) {
22299         return node.kind === 161;
22300     }
22301     ts.isComputedPropertyName = isComputedPropertyName;
22302     function isTypeParameterDeclaration(node) {
22303         return node.kind === 162;
22304     }
22305     ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
22306     function isParameter(node) {
22307         return node.kind === 163;
22308     }
22309     ts.isParameter = isParameter;
22310     function isDecorator(node) {
22311         return node.kind === 164;
22312     }
22313     ts.isDecorator = isDecorator;
22314     function isPropertySignature(node) {
22315         return node.kind === 165;
22316     }
22317     ts.isPropertySignature = isPropertySignature;
22318     function isPropertyDeclaration(node) {
22319         return node.kind === 166;
22320     }
22321     ts.isPropertyDeclaration = isPropertyDeclaration;
22322     function isMethodSignature(node) {
22323         return node.kind === 167;
22324     }
22325     ts.isMethodSignature = isMethodSignature;
22326     function isMethodDeclaration(node) {
22327         return node.kind === 168;
22328     }
22329     ts.isMethodDeclaration = isMethodDeclaration;
22330     function isClassStaticBlockDeclaration(node) {
22331         return node.kind === 169;
22332     }
22333     ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration;
22334     function isConstructorDeclaration(node) {
22335         return node.kind === 170;
22336     }
22337     ts.isConstructorDeclaration = isConstructorDeclaration;
22338     function isGetAccessorDeclaration(node) {
22339         return node.kind === 171;
22340     }
22341     ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
22342     function isSetAccessorDeclaration(node) {
22343         return node.kind === 172;
22344     }
22345     ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
22346     function isCallSignatureDeclaration(node) {
22347         return node.kind === 173;
22348     }
22349     ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
22350     function isConstructSignatureDeclaration(node) {
22351         return node.kind === 174;
22352     }
22353     ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
22354     function isIndexSignatureDeclaration(node) {
22355         return node.kind === 175;
22356     }
22357     ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
22358     function isTypePredicateNode(node) {
22359         return node.kind === 176;
22360     }
22361     ts.isTypePredicateNode = isTypePredicateNode;
22362     function isTypeReferenceNode(node) {
22363         return node.kind === 177;
22364     }
22365     ts.isTypeReferenceNode = isTypeReferenceNode;
22366     function isFunctionTypeNode(node) {
22367         return node.kind === 178;
22368     }
22369     ts.isFunctionTypeNode = isFunctionTypeNode;
22370     function isConstructorTypeNode(node) {
22371         return node.kind === 179;
22372     }
22373     ts.isConstructorTypeNode = isConstructorTypeNode;
22374     function isTypeQueryNode(node) {
22375         return node.kind === 180;
22376     }
22377     ts.isTypeQueryNode = isTypeQueryNode;
22378     function isTypeLiteralNode(node) {
22379         return node.kind === 181;
22380     }
22381     ts.isTypeLiteralNode = isTypeLiteralNode;
22382     function isArrayTypeNode(node) {
22383         return node.kind === 182;
22384     }
22385     ts.isArrayTypeNode = isArrayTypeNode;
22386     function isTupleTypeNode(node) {
22387         return node.kind === 183;
22388     }
22389     ts.isTupleTypeNode = isTupleTypeNode;
22390     function isNamedTupleMember(node) {
22391         return node.kind === 196;
22392     }
22393     ts.isNamedTupleMember = isNamedTupleMember;
22394     function isOptionalTypeNode(node) {
22395         return node.kind === 184;
22396     }
22397     ts.isOptionalTypeNode = isOptionalTypeNode;
22398     function isRestTypeNode(node) {
22399         return node.kind === 185;
22400     }
22401     ts.isRestTypeNode = isRestTypeNode;
22402     function isUnionTypeNode(node) {
22403         return node.kind === 186;
22404     }
22405     ts.isUnionTypeNode = isUnionTypeNode;
22406     function isIntersectionTypeNode(node) {
22407         return node.kind === 187;
22408     }
22409     ts.isIntersectionTypeNode = isIntersectionTypeNode;
22410     function isConditionalTypeNode(node) {
22411         return node.kind === 188;
22412     }
22413     ts.isConditionalTypeNode = isConditionalTypeNode;
22414     function isInferTypeNode(node) {
22415         return node.kind === 189;
22416     }
22417     ts.isInferTypeNode = isInferTypeNode;
22418     function isParenthesizedTypeNode(node) {
22419         return node.kind === 190;
22420     }
22421     ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
22422     function isThisTypeNode(node) {
22423         return node.kind === 191;
22424     }
22425     ts.isThisTypeNode = isThisTypeNode;
22426     function isTypeOperatorNode(node) {
22427         return node.kind === 192;
22428     }
22429     ts.isTypeOperatorNode = isTypeOperatorNode;
22430     function isIndexedAccessTypeNode(node) {
22431         return node.kind === 193;
22432     }
22433     ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
22434     function isMappedTypeNode(node) {
22435         return node.kind === 194;
22436     }
22437     ts.isMappedTypeNode = isMappedTypeNode;
22438     function isLiteralTypeNode(node) {
22439         return node.kind === 195;
22440     }
22441     ts.isLiteralTypeNode = isLiteralTypeNode;
22442     function isImportTypeNode(node) {
22443         return node.kind === 199;
22444     }
22445     ts.isImportTypeNode = isImportTypeNode;
22446     function isTemplateLiteralTypeSpan(node) {
22447         return node.kind === 198;
22448     }
22449     ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan;
22450     function isTemplateLiteralTypeNode(node) {
22451         return node.kind === 197;
22452     }
22453     ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode;
22454     function isObjectBindingPattern(node) {
22455         return node.kind === 200;
22456     }
22457     ts.isObjectBindingPattern = isObjectBindingPattern;
22458     function isArrayBindingPattern(node) {
22459         return node.kind === 201;
22460     }
22461     ts.isArrayBindingPattern = isArrayBindingPattern;
22462     function isBindingElement(node) {
22463         return node.kind === 202;
22464     }
22465     ts.isBindingElement = isBindingElement;
22466     function isArrayLiteralExpression(node) {
22467         return node.kind === 203;
22468     }
22469     ts.isArrayLiteralExpression = isArrayLiteralExpression;
22470     function isObjectLiteralExpression(node) {
22471         return node.kind === 204;
22472     }
22473     ts.isObjectLiteralExpression = isObjectLiteralExpression;
22474     function isPropertyAccessExpression(node) {
22475         return node.kind === 205;
22476     }
22477     ts.isPropertyAccessExpression = isPropertyAccessExpression;
22478     function isElementAccessExpression(node) {
22479         return node.kind === 206;
22480     }
22481     ts.isElementAccessExpression = isElementAccessExpression;
22482     function isCallExpression(node) {
22483         return node.kind === 207;
22484     }
22485     ts.isCallExpression = isCallExpression;
22486     function isNewExpression(node) {
22487         return node.kind === 208;
22488     }
22489     ts.isNewExpression = isNewExpression;
22490     function isTaggedTemplateExpression(node) {
22491         return node.kind === 209;
22492     }
22493     ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
22494     function isTypeAssertionExpression(node) {
22495         return node.kind === 210;
22496     }
22497     ts.isTypeAssertionExpression = isTypeAssertionExpression;
22498     function isParenthesizedExpression(node) {
22499         return node.kind === 211;
22500     }
22501     ts.isParenthesizedExpression = isParenthesizedExpression;
22502     function isFunctionExpression(node) {
22503         return node.kind === 212;
22504     }
22505     ts.isFunctionExpression = isFunctionExpression;
22506     function isArrowFunction(node) {
22507         return node.kind === 213;
22508     }
22509     ts.isArrowFunction = isArrowFunction;
22510     function isDeleteExpression(node) {
22511         return node.kind === 214;
22512     }
22513     ts.isDeleteExpression = isDeleteExpression;
22514     function isTypeOfExpression(node) {
22515         return node.kind === 215;
22516     }
22517     ts.isTypeOfExpression = isTypeOfExpression;
22518     function isVoidExpression(node) {
22519         return node.kind === 216;
22520     }
22521     ts.isVoidExpression = isVoidExpression;
22522     function isAwaitExpression(node) {
22523         return node.kind === 217;
22524     }
22525     ts.isAwaitExpression = isAwaitExpression;
22526     function isPrefixUnaryExpression(node) {
22527         return node.kind === 218;
22528     }
22529     ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
22530     function isPostfixUnaryExpression(node) {
22531         return node.kind === 219;
22532     }
22533     ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
22534     function isBinaryExpression(node) {
22535         return node.kind === 220;
22536     }
22537     ts.isBinaryExpression = isBinaryExpression;
22538     function isConditionalExpression(node) {
22539         return node.kind === 221;
22540     }
22541     ts.isConditionalExpression = isConditionalExpression;
22542     function isTemplateExpression(node) {
22543         return node.kind === 222;
22544     }
22545     ts.isTemplateExpression = isTemplateExpression;
22546     function isYieldExpression(node) {
22547         return node.kind === 223;
22548     }
22549     ts.isYieldExpression = isYieldExpression;
22550     function isSpreadElement(node) {
22551         return node.kind === 224;
22552     }
22553     ts.isSpreadElement = isSpreadElement;
22554     function isClassExpression(node) {
22555         return node.kind === 225;
22556     }
22557     ts.isClassExpression = isClassExpression;
22558     function isOmittedExpression(node) {
22559         return node.kind === 226;
22560     }
22561     ts.isOmittedExpression = isOmittedExpression;
22562     function isExpressionWithTypeArguments(node) {
22563         return node.kind === 227;
22564     }
22565     ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
22566     function isAsExpression(node) {
22567         return node.kind === 228;
22568     }
22569     ts.isAsExpression = isAsExpression;
22570     function isNonNullExpression(node) {
22571         return node.kind === 229;
22572     }
22573     ts.isNonNullExpression = isNonNullExpression;
22574     function isMetaProperty(node) {
22575         return node.kind === 230;
22576     }
22577     ts.isMetaProperty = isMetaProperty;
22578     function isSyntheticExpression(node) {
22579         return node.kind === 231;
22580     }
22581     ts.isSyntheticExpression = isSyntheticExpression;
22582     function isPartiallyEmittedExpression(node) {
22583         return node.kind === 348;
22584     }
22585     ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
22586     function isCommaListExpression(node) {
22587         return node.kind === 349;
22588     }
22589     ts.isCommaListExpression = isCommaListExpression;
22590     function isTemplateSpan(node) {
22591         return node.kind === 232;
22592     }
22593     ts.isTemplateSpan = isTemplateSpan;
22594     function isSemicolonClassElement(node) {
22595         return node.kind === 233;
22596     }
22597     ts.isSemicolonClassElement = isSemicolonClassElement;
22598     function isBlock(node) {
22599         return node.kind === 234;
22600     }
22601     ts.isBlock = isBlock;
22602     function isVariableStatement(node) {
22603         return node.kind === 236;
22604     }
22605     ts.isVariableStatement = isVariableStatement;
22606     function isEmptyStatement(node) {
22607         return node.kind === 235;
22608     }
22609     ts.isEmptyStatement = isEmptyStatement;
22610     function isExpressionStatement(node) {
22611         return node.kind === 237;
22612     }
22613     ts.isExpressionStatement = isExpressionStatement;
22614     function isIfStatement(node) {
22615         return node.kind === 238;
22616     }
22617     ts.isIfStatement = isIfStatement;
22618     function isDoStatement(node) {
22619         return node.kind === 239;
22620     }
22621     ts.isDoStatement = isDoStatement;
22622     function isWhileStatement(node) {
22623         return node.kind === 240;
22624     }
22625     ts.isWhileStatement = isWhileStatement;
22626     function isForStatement(node) {
22627         return node.kind === 241;
22628     }
22629     ts.isForStatement = isForStatement;
22630     function isForInStatement(node) {
22631         return node.kind === 242;
22632     }
22633     ts.isForInStatement = isForInStatement;
22634     function isForOfStatement(node) {
22635         return node.kind === 243;
22636     }
22637     ts.isForOfStatement = isForOfStatement;
22638     function isContinueStatement(node) {
22639         return node.kind === 244;
22640     }
22641     ts.isContinueStatement = isContinueStatement;
22642     function isBreakStatement(node) {
22643         return node.kind === 245;
22644     }
22645     ts.isBreakStatement = isBreakStatement;
22646     function isReturnStatement(node) {
22647         return node.kind === 246;
22648     }
22649     ts.isReturnStatement = isReturnStatement;
22650     function isWithStatement(node) {
22651         return node.kind === 247;
22652     }
22653     ts.isWithStatement = isWithStatement;
22654     function isSwitchStatement(node) {
22655         return node.kind === 248;
22656     }
22657     ts.isSwitchStatement = isSwitchStatement;
22658     function isLabeledStatement(node) {
22659         return node.kind === 249;
22660     }
22661     ts.isLabeledStatement = isLabeledStatement;
22662     function isThrowStatement(node) {
22663         return node.kind === 250;
22664     }
22665     ts.isThrowStatement = isThrowStatement;
22666     function isTryStatement(node) {
22667         return node.kind === 251;
22668     }
22669     ts.isTryStatement = isTryStatement;
22670     function isDebuggerStatement(node) {
22671         return node.kind === 252;
22672     }
22673     ts.isDebuggerStatement = isDebuggerStatement;
22674     function isVariableDeclaration(node) {
22675         return node.kind === 253;
22676     }
22677     ts.isVariableDeclaration = isVariableDeclaration;
22678     function isVariableDeclarationList(node) {
22679         return node.kind === 254;
22680     }
22681     ts.isVariableDeclarationList = isVariableDeclarationList;
22682     function isFunctionDeclaration(node) {
22683         return node.kind === 255;
22684     }
22685     ts.isFunctionDeclaration = isFunctionDeclaration;
22686     function isClassDeclaration(node) {
22687         return node.kind === 256;
22688     }
22689     ts.isClassDeclaration = isClassDeclaration;
22690     function isInterfaceDeclaration(node) {
22691         return node.kind === 257;
22692     }
22693     ts.isInterfaceDeclaration = isInterfaceDeclaration;
22694     function isTypeAliasDeclaration(node) {
22695         return node.kind === 258;
22696     }
22697     ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
22698     function isEnumDeclaration(node) {
22699         return node.kind === 259;
22700     }
22701     ts.isEnumDeclaration = isEnumDeclaration;
22702     function isModuleDeclaration(node) {
22703         return node.kind === 260;
22704     }
22705     ts.isModuleDeclaration = isModuleDeclaration;
22706     function isModuleBlock(node) {
22707         return node.kind === 261;
22708     }
22709     ts.isModuleBlock = isModuleBlock;
22710     function isCaseBlock(node) {
22711         return node.kind === 262;
22712     }
22713     ts.isCaseBlock = isCaseBlock;
22714     function isNamespaceExportDeclaration(node) {
22715         return node.kind === 263;
22716     }
22717     ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
22718     function isImportEqualsDeclaration(node) {
22719         return node.kind === 264;
22720     }
22721     ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
22722     function isImportDeclaration(node) {
22723         return node.kind === 265;
22724     }
22725     ts.isImportDeclaration = isImportDeclaration;
22726     function isImportClause(node) {
22727         return node.kind === 266;
22728     }
22729     ts.isImportClause = isImportClause;
22730     function isAssertClause(node) {
22731         return node.kind === 292;
22732     }
22733     ts.isAssertClause = isAssertClause;
22734     function isAssertEntry(node) {
22735         return node.kind === 293;
22736     }
22737     ts.isAssertEntry = isAssertEntry;
22738     function isNamespaceImport(node) {
22739         return node.kind === 267;
22740     }
22741     ts.isNamespaceImport = isNamespaceImport;
22742     function isNamespaceExport(node) {
22743         return node.kind === 273;
22744     }
22745     ts.isNamespaceExport = isNamespaceExport;
22746     function isNamedImports(node) {
22747         return node.kind === 268;
22748     }
22749     ts.isNamedImports = isNamedImports;
22750     function isImportSpecifier(node) {
22751         return node.kind === 269;
22752     }
22753     ts.isImportSpecifier = isImportSpecifier;
22754     function isExportAssignment(node) {
22755         return node.kind === 270;
22756     }
22757     ts.isExportAssignment = isExportAssignment;
22758     function isExportDeclaration(node) {
22759         return node.kind === 271;
22760     }
22761     ts.isExportDeclaration = isExportDeclaration;
22762     function isNamedExports(node) {
22763         return node.kind === 272;
22764     }
22765     ts.isNamedExports = isNamedExports;
22766     function isExportSpecifier(node) {
22767         return node.kind === 274;
22768     }
22769     ts.isExportSpecifier = isExportSpecifier;
22770     function isMissingDeclaration(node) {
22771         return node.kind === 275;
22772     }
22773     ts.isMissingDeclaration = isMissingDeclaration;
22774     function isNotEmittedStatement(node) {
22775         return node.kind === 347;
22776     }
22777     ts.isNotEmittedStatement = isNotEmittedStatement;
22778     function isSyntheticReference(node) {
22779         return node.kind === 352;
22780     }
22781     ts.isSyntheticReference = isSyntheticReference;
22782     function isMergeDeclarationMarker(node) {
22783         return node.kind === 350;
22784     }
22785     ts.isMergeDeclarationMarker = isMergeDeclarationMarker;
22786     function isEndOfDeclarationMarker(node) {
22787         return node.kind === 351;
22788     }
22789     ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker;
22790     function isExternalModuleReference(node) {
22791         return node.kind === 276;
22792     }
22793     ts.isExternalModuleReference = isExternalModuleReference;
22794     function isJsxElement(node) {
22795         return node.kind === 277;
22796     }
22797     ts.isJsxElement = isJsxElement;
22798     function isJsxSelfClosingElement(node) {
22799         return node.kind === 278;
22800     }
22801     ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
22802     function isJsxOpeningElement(node) {
22803         return node.kind === 279;
22804     }
22805     ts.isJsxOpeningElement = isJsxOpeningElement;
22806     function isJsxClosingElement(node) {
22807         return node.kind === 280;
22808     }
22809     ts.isJsxClosingElement = isJsxClosingElement;
22810     function isJsxFragment(node) {
22811         return node.kind === 281;
22812     }
22813     ts.isJsxFragment = isJsxFragment;
22814     function isJsxOpeningFragment(node) {
22815         return node.kind === 282;
22816     }
22817     ts.isJsxOpeningFragment = isJsxOpeningFragment;
22818     function isJsxClosingFragment(node) {
22819         return node.kind === 283;
22820     }
22821     ts.isJsxClosingFragment = isJsxClosingFragment;
22822     function isJsxAttribute(node) {
22823         return node.kind === 284;
22824     }
22825     ts.isJsxAttribute = isJsxAttribute;
22826     function isJsxAttributes(node) {
22827         return node.kind === 285;
22828     }
22829     ts.isJsxAttributes = isJsxAttributes;
22830     function isJsxSpreadAttribute(node) {
22831         return node.kind === 286;
22832     }
22833     ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
22834     function isJsxExpression(node) {
22835         return node.kind === 287;
22836     }
22837     ts.isJsxExpression = isJsxExpression;
22838     function isCaseClause(node) {
22839         return node.kind === 288;
22840     }
22841     ts.isCaseClause = isCaseClause;
22842     function isDefaultClause(node) {
22843         return node.kind === 289;
22844     }
22845     ts.isDefaultClause = isDefaultClause;
22846     function isHeritageClause(node) {
22847         return node.kind === 290;
22848     }
22849     ts.isHeritageClause = isHeritageClause;
22850     function isCatchClause(node) {
22851         return node.kind === 291;
22852     }
22853     ts.isCatchClause = isCatchClause;
22854     function isPropertyAssignment(node) {
22855         return node.kind === 294;
22856     }
22857     ts.isPropertyAssignment = isPropertyAssignment;
22858     function isShorthandPropertyAssignment(node) {
22859         return node.kind === 295;
22860     }
22861     ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
22862     function isSpreadAssignment(node) {
22863         return node.kind === 296;
22864     }
22865     ts.isSpreadAssignment = isSpreadAssignment;
22866     function isEnumMember(node) {
22867         return node.kind === 297;
22868     }
22869     ts.isEnumMember = isEnumMember;
22870     function isUnparsedPrepend(node) {
22871         return node.kind === 299;
22872     }
22873     ts.isUnparsedPrepend = isUnparsedPrepend;
22874     function isSourceFile(node) {
22875         return node.kind === 303;
22876     }
22877     ts.isSourceFile = isSourceFile;
22878     function isBundle(node) {
22879         return node.kind === 304;
22880     }
22881     ts.isBundle = isBundle;
22882     function isUnparsedSource(node) {
22883         return node.kind === 305;
22884     }
22885     ts.isUnparsedSource = isUnparsedSource;
22886     function isJSDocTypeExpression(node) {
22887         return node.kind === 307;
22888     }
22889     ts.isJSDocTypeExpression = isJSDocTypeExpression;
22890     function isJSDocNameReference(node) {
22891         return node.kind === 308;
22892     }
22893     ts.isJSDocNameReference = isJSDocNameReference;
22894     function isJSDocMemberName(node) {
22895         return node.kind === 309;
22896     }
22897     ts.isJSDocMemberName = isJSDocMemberName;
22898     function isJSDocLink(node) {
22899         return node.kind === 322;
22900     }
22901     ts.isJSDocLink = isJSDocLink;
22902     function isJSDocLinkCode(node) {
22903         return node.kind === 323;
22904     }
22905     ts.isJSDocLinkCode = isJSDocLinkCode;
22906     function isJSDocLinkPlain(node) {
22907         return node.kind === 324;
22908     }
22909     ts.isJSDocLinkPlain = isJSDocLinkPlain;
22910     function isJSDocAllType(node) {
22911         return node.kind === 310;
22912     }
22913     ts.isJSDocAllType = isJSDocAllType;
22914     function isJSDocUnknownType(node) {
22915         return node.kind === 311;
22916     }
22917     ts.isJSDocUnknownType = isJSDocUnknownType;
22918     function isJSDocNullableType(node) {
22919         return node.kind === 312;
22920     }
22921     ts.isJSDocNullableType = isJSDocNullableType;
22922     function isJSDocNonNullableType(node) {
22923         return node.kind === 313;
22924     }
22925     ts.isJSDocNonNullableType = isJSDocNonNullableType;
22926     function isJSDocOptionalType(node) {
22927         return node.kind === 314;
22928     }
22929     ts.isJSDocOptionalType = isJSDocOptionalType;
22930     function isJSDocFunctionType(node) {
22931         return node.kind === 315;
22932     }
22933     ts.isJSDocFunctionType = isJSDocFunctionType;
22934     function isJSDocVariadicType(node) {
22935         return node.kind === 316;
22936     }
22937     ts.isJSDocVariadicType = isJSDocVariadicType;
22938     function isJSDocNamepathType(node) {
22939         return node.kind === 317;
22940     }
22941     ts.isJSDocNamepathType = isJSDocNamepathType;
22942     function isJSDoc(node) {
22943         return node.kind === 318;
22944     }
22945     ts.isJSDoc = isJSDoc;
22946     function isJSDocTypeLiteral(node) {
22947         return node.kind === 320;
22948     }
22949     ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
22950     function isJSDocSignature(node) {
22951         return node.kind === 321;
22952     }
22953     ts.isJSDocSignature = isJSDocSignature;
22954     function isJSDocAugmentsTag(node) {
22955         return node.kind === 326;
22956     }
22957     ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
22958     function isJSDocAuthorTag(node) {
22959         return node.kind === 328;
22960     }
22961     ts.isJSDocAuthorTag = isJSDocAuthorTag;
22962     function isJSDocClassTag(node) {
22963         return node.kind === 330;
22964     }
22965     ts.isJSDocClassTag = isJSDocClassTag;
22966     function isJSDocCallbackTag(node) {
22967         return node.kind === 336;
22968     }
22969     ts.isJSDocCallbackTag = isJSDocCallbackTag;
22970     function isJSDocPublicTag(node) {
22971         return node.kind === 331;
22972     }
22973     ts.isJSDocPublicTag = isJSDocPublicTag;
22974     function isJSDocPrivateTag(node) {
22975         return node.kind === 332;
22976     }
22977     ts.isJSDocPrivateTag = isJSDocPrivateTag;
22978     function isJSDocProtectedTag(node) {
22979         return node.kind === 333;
22980     }
22981     ts.isJSDocProtectedTag = isJSDocProtectedTag;
22982     function isJSDocReadonlyTag(node) {
22983         return node.kind === 334;
22984     }
22985     ts.isJSDocReadonlyTag = isJSDocReadonlyTag;
22986     function isJSDocOverrideTag(node) {
22987         return node.kind === 335;
22988     }
22989     ts.isJSDocOverrideTag = isJSDocOverrideTag;
22990     function isJSDocDeprecatedTag(node) {
22991         return node.kind === 329;
22992     }
22993     ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag;
22994     function isJSDocSeeTag(node) {
22995         return node.kind === 344;
22996     }
22997     ts.isJSDocSeeTag = isJSDocSeeTag;
22998     function isJSDocEnumTag(node) {
22999         return node.kind === 337;
23000     }
23001     ts.isJSDocEnumTag = isJSDocEnumTag;
23002     function isJSDocParameterTag(node) {
23003         return node.kind === 338;
23004     }
23005     ts.isJSDocParameterTag = isJSDocParameterTag;
23006     function isJSDocReturnTag(node) {
23007         return node.kind === 339;
23008     }
23009     ts.isJSDocReturnTag = isJSDocReturnTag;
23010     function isJSDocThisTag(node) {
23011         return node.kind === 340;
23012     }
23013     ts.isJSDocThisTag = isJSDocThisTag;
23014     function isJSDocTypeTag(node) {
23015         return node.kind === 341;
23016     }
23017     ts.isJSDocTypeTag = isJSDocTypeTag;
23018     function isJSDocTemplateTag(node) {
23019         return node.kind === 342;
23020     }
23021     ts.isJSDocTemplateTag = isJSDocTemplateTag;
23022     function isJSDocTypedefTag(node) {
23023         return node.kind === 343;
23024     }
23025     ts.isJSDocTypedefTag = isJSDocTypedefTag;
23026     function isJSDocUnknownTag(node) {
23027         return node.kind === 325;
23028     }
23029     ts.isJSDocUnknownTag = isJSDocUnknownTag;
23030     function isJSDocPropertyTag(node) {
23031         return node.kind === 345;
23032     }
23033     ts.isJSDocPropertyTag = isJSDocPropertyTag;
23034     function isJSDocImplementsTag(node) {
23035         return node.kind === 327;
23036     }
23037     ts.isJSDocImplementsTag = isJSDocImplementsTag;
23038     function isSyntaxList(n) {
23039         return n.kind === 346;
23040     }
23041     ts.isSyntaxList = isSyntaxList;
23042 })(ts || (ts = {}));
23043 var ts;
23044 (function (ts) {
23045     function createEmptyExports(factory) {
23046         return factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports([]), undefined);
23047     }
23048     ts.createEmptyExports = createEmptyExports;
23049     function createMemberAccessForPropertyName(factory, target, memberName, location) {
23050         if (ts.isComputedPropertyName(memberName)) {
23051             return ts.setTextRange(factory.createElementAccessExpression(target, memberName.expression), location);
23052         }
23053         else {
23054             var expression = ts.setTextRange(ts.isMemberName(memberName)
23055                 ? factory.createPropertyAccessExpression(target, memberName)
23056                 : factory.createElementAccessExpression(target, memberName), memberName);
23057             ts.getOrCreateEmitNode(expression).flags |= 64;
23058             return expression;
23059         }
23060     }
23061     ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName;
23062     function createReactNamespace(reactNamespace, parent) {
23063         var react = ts.parseNodeFactory.createIdentifier(reactNamespace || "React");
23064         ts.setParent(react, ts.getParseTreeNode(parent));
23065         return react;
23066     }
23067     function createJsxFactoryExpressionFromEntityName(factory, jsxFactory, parent) {
23068         if (ts.isQualifiedName(jsxFactory)) {
23069             var left = createJsxFactoryExpressionFromEntityName(factory, jsxFactory.left, parent);
23070             var right = factory.createIdentifier(ts.idText(jsxFactory.right));
23071             right.escapedText = jsxFactory.right.escapedText;
23072             return factory.createPropertyAccessExpression(left, right);
23073         }
23074         else {
23075             return createReactNamespace(ts.idText(jsxFactory), parent);
23076         }
23077     }
23078     function createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parent) {
23079         return jsxFactoryEntity ?
23080             createJsxFactoryExpressionFromEntityName(factory, jsxFactoryEntity, parent) :
23081             factory.createPropertyAccessExpression(createReactNamespace(reactNamespace, parent), "createElement");
23082     }
23083     ts.createJsxFactoryExpression = createJsxFactoryExpression;
23084     function createJsxFragmentFactoryExpression(factory, jsxFragmentFactoryEntity, reactNamespace, parent) {
23085         return jsxFragmentFactoryEntity ?
23086             createJsxFactoryExpressionFromEntityName(factory, jsxFragmentFactoryEntity, parent) :
23087             factory.createPropertyAccessExpression(createReactNamespace(reactNamespace, parent), "Fragment");
23088     }
23089     function createExpressionForJsxElement(factory, callee, tagName, props, children, location) {
23090         var argumentsList = [tagName];
23091         if (props) {
23092             argumentsList.push(props);
23093         }
23094         if (children && children.length > 0) {
23095             if (!props) {
23096                 argumentsList.push(factory.createNull());
23097             }
23098             if (children.length > 1) {
23099                 for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
23100                     var child = children_3[_i];
23101                     startOnNewLine(child);
23102                     argumentsList.push(child);
23103                 }
23104             }
23105             else {
23106                 argumentsList.push(children[0]);
23107             }
23108         }
23109         return ts.setTextRange(factory.createCallExpression(callee, undefined, argumentsList), location);
23110     }
23111     ts.createExpressionForJsxElement = createExpressionForJsxElement;
23112     function createExpressionForJsxFragment(factory, jsxFactoryEntity, jsxFragmentFactoryEntity, reactNamespace, children, parentElement, location) {
23113         var tagName = createJsxFragmentFactoryExpression(factory, jsxFragmentFactoryEntity, reactNamespace, parentElement);
23114         var argumentsList = [tagName, factory.createNull()];
23115         if (children && children.length > 0) {
23116             if (children.length > 1) {
23117                 for (var _i = 0, children_4 = children; _i < children_4.length; _i++) {
23118                     var child = children_4[_i];
23119                     startOnNewLine(child);
23120                     argumentsList.push(child);
23121                 }
23122             }
23123             else {
23124                 argumentsList.push(children[0]);
23125             }
23126         }
23127         return ts.setTextRange(factory.createCallExpression(createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location);
23128     }
23129     ts.createExpressionForJsxFragment = createExpressionForJsxFragment;
23130     function createForOfBindingStatement(factory, node, boundValue) {
23131         if (ts.isVariableDeclarationList(node)) {
23132             var firstDeclaration = ts.first(node.declarations);
23133             var updatedDeclaration = factory.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, undefined, boundValue);
23134             return ts.setTextRange(factory.createVariableStatement(undefined, factory.updateVariableDeclarationList(node, [updatedDeclaration])), node);
23135         }
23136         else {
23137             var updatedExpression = ts.setTextRange(factory.createAssignment(node, boundValue), node);
23138             return ts.setTextRange(factory.createExpressionStatement(updatedExpression), node);
23139         }
23140     }
23141     ts.createForOfBindingStatement = createForOfBindingStatement;
23142     function insertLeadingStatement(factory, dest, source) {
23143         if (ts.isBlock(dest)) {
23144             return factory.updateBlock(dest, ts.setTextRange(factory.createNodeArray(__spreadArray([source], dest.statements, true)), dest.statements));
23145         }
23146         else {
23147             return factory.createBlock(factory.createNodeArray([dest, source]), true);
23148         }
23149     }
23150     ts.insertLeadingStatement = insertLeadingStatement;
23151     function createExpressionFromEntityName(factory, node) {
23152         if (ts.isQualifiedName(node)) {
23153             var left = createExpressionFromEntityName(factory, node.left);
23154             var right = ts.setParent(ts.setTextRange(factory.cloneNode(node.right), node.right), node.right.parent);
23155             return ts.setTextRange(factory.createPropertyAccessExpression(left, right), node);
23156         }
23157         else {
23158             return ts.setParent(ts.setTextRange(factory.cloneNode(node), node), node.parent);
23159         }
23160     }
23161     ts.createExpressionFromEntityName = createExpressionFromEntityName;
23162     function createExpressionForPropertyName(factory, memberName) {
23163         if (ts.isIdentifier(memberName)) {
23164             return factory.createStringLiteralFromNode(memberName);
23165         }
23166         else if (ts.isComputedPropertyName(memberName)) {
23167             return ts.setParent(ts.setTextRange(factory.cloneNode(memberName.expression), memberName.expression), memberName.expression.parent);
23168         }
23169         else {
23170             return ts.setParent(ts.setTextRange(factory.cloneNode(memberName), memberName), memberName.parent);
23171         }
23172     }
23173     ts.createExpressionForPropertyName = createExpressionForPropertyName;
23174     function createExpressionForAccessorDeclaration(factory, properties, property, receiver, multiLine) {
23175         var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
23176         if (property === firstAccessor) {
23177             return ts.setTextRange(factory.createObjectDefinePropertyCall(receiver, createExpressionForPropertyName(factory, property.name), factory.createPropertyDescriptor({
23178                 enumerable: factory.createFalse(),
23179                 configurable: true,
23180                 get: getAccessor && ts.setTextRange(ts.setOriginalNode(factory.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body), getAccessor), getAccessor),
23181                 set: setAccessor && ts.setTextRange(ts.setOriginalNode(factory.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body), setAccessor), setAccessor)
23182             }, !multiLine)), firstAccessor);
23183         }
23184         return undefined;
23185     }
23186     function createExpressionForPropertyAssignment(factory, property, receiver) {
23187         return ts.setOriginalNode(ts.setTextRange(factory.createAssignment(createMemberAccessForPropertyName(factory, receiver, property.name, property.name), property.initializer), property), property);
23188     }
23189     function createExpressionForShorthandPropertyAssignment(factory, property, receiver) {
23190         return ts.setOriginalNode(ts.setTextRange(factory.createAssignment(createMemberAccessForPropertyName(factory, receiver, property.name, property.name), factory.cloneNode(property.name)), property), property);
23191     }
23192     function createExpressionForMethodDeclaration(factory, method, receiver) {
23193         return ts.setOriginalNode(ts.setTextRange(factory.createAssignment(createMemberAccessForPropertyName(factory, receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(factory.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method);
23194     }
23195     function createExpressionForObjectLiteralElementLike(factory, node, property, receiver) {
23196         if (property.name && ts.isPrivateIdentifier(property.name)) {
23197             ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals.");
23198         }
23199         switch (property.kind) {
23200             case 171:
23201             case 172:
23202                 return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine);
23203             case 294:
23204                 return createExpressionForPropertyAssignment(factory, property, receiver);
23205             case 295:
23206                 return createExpressionForShorthandPropertyAssignment(factory, property, receiver);
23207             case 168:
23208                 return createExpressionForMethodDeclaration(factory, property, receiver);
23209         }
23210     }
23211     ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike;
23212     function expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, recordTempVariable, resultVariable) {
23213         var operator = node.operator;
23214         ts.Debug.assert(operator === 45 || operator === 46, "Expected 'node' to be a pre- or post-increment or pre- or post-decrement expression");
23215         var temp = factory.createTempVariable(recordTempVariable);
23216         expression = factory.createAssignment(temp, expression);
23217         ts.setTextRange(expression, node.operand);
23218         var operation = ts.isPrefixUnaryExpression(node) ?
23219             factory.createPrefixUnaryExpression(operator, temp) :
23220             factory.createPostfixUnaryExpression(temp, operator);
23221         ts.setTextRange(operation, node);
23222         if (resultVariable) {
23223             operation = factory.createAssignment(resultVariable, operation);
23224             ts.setTextRange(operation, node);
23225         }
23226         expression = factory.createComma(expression, operation);
23227         ts.setTextRange(expression, node);
23228         if (ts.isPostfixUnaryExpression(node)) {
23229             expression = factory.createComma(expression, temp);
23230             ts.setTextRange(expression, node);
23231         }
23232         return expression;
23233     }
23234     ts.expandPreOrPostfixIncrementOrDecrementExpression = expandPreOrPostfixIncrementOrDecrementExpression;
23235     function isInternalName(node) {
23236         return (ts.getEmitFlags(node) & 32768) !== 0;
23237     }
23238     ts.isInternalName = isInternalName;
23239     function isLocalName(node) {
23240         return (ts.getEmitFlags(node) & 16384) !== 0;
23241     }
23242     ts.isLocalName = isLocalName;
23243     function isExportName(node) {
23244         return (ts.getEmitFlags(node) & 8192) !== 0;
23245     }
23246     ts.isExportName = isExportName;
23247     function isUseStrictPrologue(node) {
23248         return ts.isStringLiteral(node.expression) && node.expression.text === "use strict";
23249     }
23250     function findUseStrictPrologue(statements) {
23251         for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) {
23252             var statement = statements_1[_i];
23253             if (ts.isPrologueDirective(statement)) {
23254                 if (isUseStrictPrologue(statement)) {
23255                     return statement;
23256                 }
23257             }
23258             else {
23259                 break;
23260             }
23261         }
23262         return undefined;
23263     }
23264     ts.findUseStrictPrologue = findUseStrictPrologue;
23265     function startsWithUseStrict(statements) {
23266         var firstStatement = ts.firstOrUndefined(statements);
23267         return firstStatement !== undefined
23268             && ts.isPrologueDirective(firstStatement)
23269             && isUseStrictPrologue(firstStatement);
23270     }
23271     ts.startsWithUseStrict = startsWithUseStrict;
23272     function isCommaSequence(node) {
23273         return node.kind === 220 && node.operatorToken.kind === 27 ||
23274             node.kind === 349;
23275     }
23276     ts.isCommaSequence = isCommaSequence;
23277     function isJSDocTypeAssertion(node) {
23278         return ts.isParenthesizedExpression(node)
23279             && ts.isInJSFile(node)
23280             && !!ts.getJSDocTypeTag(node);
23281     }
23282     ts.isJSDocTypeAssertion = isJSDocTypeAssertion;
23283     function getJSDocTypeAssertionType(node) {
23284         var type = ts.getJSDocType(node);
23285         ts.Debug.assertIsDefined(type);
23286         return type;
23287     }
23288     ts.getJSDocTypeAssertionType = getJSDocTypeAssertionType;
23289     function isOuterExpression(node, kinds) {
23290         if (kinds === void 0) { kinds = 15; }
23291         switch (node.kind) {
23292             case 211:
23293                 if (kinds & 16 && isJSDocTypeAssertion(node)) {
23294                     return false;
23295                 }
23296                 return (kinds & 1) !== 0;
23297             case 210:
23298             case 228:
23299                 return (kinds & 2) !== 0;
23300             case 229:
23301                 return (kinds & 4) !== 0;
23302             case 348:
23303                 return (kinds & 8) !== 0;
23304         }
23305         return false;
23306     }
23307     ts.isOuterExpression = isOuterExpression;
23308     function skipOuterExpressions(node, kinds) {
23309         if (kinds === void 0) { kinds = 15; }
23310         while (isOuterExpression(node, kinds)) {
23311             node = node.expression;
23312         }
23313         return node;
23314     }
23315     ts.skipOuterExpressions = skipOuterExpressions;
23316     function skipAssertions(node) {
23317         return skipOuterExpressions(node, 6);
23318     }
23319     ts.skipAssertions = skipAssertions;
23320     function startOnNewLine(node) {
23321         return ts.setStartsOnNewLine(node, true);
23322     }
23323     ts.startOnNewLine = startOnNewLine;
23324     function getExternalHelpersModuleName(node) {
23325         var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
23326         var emitNode = parseNode && parseNode.emitNode;
23327         return emitNode && emitNode.externalHelpersModuleName;
23328     }
23329     ts.getExternalHelpersModuleName = getExternalHelpersModuleName;
23330     function hasRecordedExternalHelpers(sourceFile) {
23331         var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
23332         var emitNode = parseNode && parseNode.emitNode;
23333         return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
23334     }
23335     ts.hasRecordedExternalHelpers = hasRecordedExternalHelpers;
23336     function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
23337         if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
23338             var namedBindings = void 0;
23339             var moduleKind = ts.getEmitModuleKind(compilerOptions);
23340             if ((moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) || sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
23341                 var helpers = ts.getEmitHelpers(sourceFile);
23342                 if (helpers) {
23343                     var helperNames = [];
23344                     for (var _i = 0, helpers_3 = helpers; _i < helpers_3.length; _i++) {
23345                         var helper = helpers_3[_i];
23346                         if (!helper.scoped) {
23347                             var importName = helper.importName;
23348                             if (importName) {
23349                                 ts.pushIfUnique(helperNames, importName);
23350                             }
23351                         }
23352                     }
23353                     if (ts.some(helperNames)) {
23354                         helperNames.sort(ts.compareStringsCaseSensitive);
23355                         namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
23356                             ? nodeFactory.createImportSpecifier(false, undefined, nodeFactory.createIdentifier(name))
23357                             : nodeFactory.createImportSpecifier(false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); }));
23358                         var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
23359                         var emitNode = ts.getOrCreateEmitNode(parseNode);
23360                         emitNode.externalHelpers = true;
23361                     }
23362                 }
23363             }
23364             else {
23365                 var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
23366                 if (externalHelpersModuleName) {
23367                     namedBindings = nodeFactory.createNamespaceImport(externalHelpersModuleName);
23368                 }
23369             }
23370             if (namedBindings) {
23371                 var externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(undefined, undefined, nodeFactory.createImportClause(false, undefined, namedBindings), nodeFactory.createStringLiteral(ts.externalHelpersModuleNameText), undefined);
23372                 ts.addEmitFlags(externalHelpersImportDeclaration, 67108864);
23373                 return externalHelpersImportDeclaration;
23374             }
23375         }
23376     }
23377     ts.createExternalHelpersImportDeclarationIfNeeded = createExternalHelpersImportDeclarationIfNeeded;
23378     function getOrCreateExternalHelpersModuleNameIfNeeded(factory, node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
23379         if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) {
23380             var externalHelpersModuleName = getExternalHelpersModuleName(node);
23381             if (externalHelpersModuleName) {
23382                 return externalHelpersModuleName;
23383             }
23384             var moduleKind = ts.getEmitModuleKind(compilerOptions);
23385             var create = (hasExportStarsToExportValues || (ts.getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault))
23386                 && moduleKind !== ts.ModuleKind.System
23387                 && (moduleKind < ts.ModuleKind.ES2015 || node.impliedNodeFormat === ts.ModuleKind.CommonJS);
23388             if (!create) {
23389                 var helpers = ts.getEmitHelpers(node);
23390                 if (helpers) {
23391                     for (var _i = 0, helpers_4 = helpers; _i < helpers_4.length; _i++) {
23392                         var helper = helpers_4[_i];
23393                         if (!helper.scoped) {
23394                             create = true;
23395                             break;
23396                         }
23397                     }
23398                 }
23399             }
23400             if (create) {
23401                 var parseNode = ts.getOriginalNode(node, ts.isSourceFile);
23402                 var emitNode = ts.getOrCreateEmitNode(parseNode);
23403                 return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory.createUniqueName(ts.externalHelpersModuleNameText));
23404             }
23405         }
23406     }
23407     ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded;
23408     function getLocalNameForExternalImport(factory, node, sourceFile) {
23409         var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
23410         if (namespaceDeclaration && !ts.isDefaultImport(node) && !ts.isExportNamespaceAsDefaultDeclaration(node)) {
23411             var name = namespaceDeclaration.name;
23412             return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
23413         }
23414         if (node.kind === 265 && node.importClause) {
23415             return factory.getGeneratedNameForNode(node);
23416         }
23417         if (node.kind === 271 && node.moduleSpecifier) {
23418             return factory.getGeneratedNameForNode(node);
23419         }
23420         return undefined;
23421     }
23422     ts.getLocalNameForExternalImport = getLocalNameForExternalImport;
23423     function getExternalModuleNameLiteral(factory, importNode, sourceFile, host, resolver, compilerOptions) {
23424         var moduleName = ts.getExternalModuleName(importNode);
23425         if (moduleName && ts.isStringLiteral(moduleName)) {
23426             return tryGetModuleNameFromDeclaration(importNode, host, factory, resolver, compilerOptions)
23427                 || tryRenameExternalModule(factory, moduleName, sourceFile)
23428                 || factory.cloneNode(moduleName);
23429         }
23430         return undefined;
23431     }
23432     ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral;
23433     function tryRenameExternalModule(factory, moduleName, sourceFile) {
23434         var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
23435         return rename ? factory.createStringLiteral(rename) : undefined;
23436     }
23437     function tryGetModuleNameFromFile(factory, file, host, options) {
23438         if (!file) {
23439             return undefined;
23440         }
23441         if (file.moduleName) {
23442             return factory.createStringLiteral(file.moduleName);
23443         }
23444         if (!file.isDeclarationFile && ts.outFile(options)) {
23445             return factory.createStringLiteral(ts.getExternalModuleNameFromPath(host, file.fileName));
23446         }
23447         return undefined;
23448     }
23449     ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile;
23450     function tryGetModuleNameFromDeclaration(declaration, host, factory, resolver, compilerOptions) {
23451         return tryGetModuleNameFromFile(factory, resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
23452     }
23453     function getInitializerOfBindingOrAssignmentElement(bindingElement) {
23454         if (ts.isDeclarationBindingElement(bindingElement)) {
23455             return bindingElement.initializer;
23456         }
23457         if (ts.isPropertyAssignment(bindingElement)) {
23458             var initializer = bindingElement.initializer;
23459             return ts.isAssignmentExpression(initializer, true)
23460                 ? initializer.right
23461                 : undefined;
23462         }
23463         if (ts.isShorthandPropertyAssignment(bindingElement)) {
23464             return bindingElement.objectAssignmentInitializer;
23465         }
23466         if (ts.isAssignmentExpression(bindingElement, true)) {
23467             return bindingElement.right;
23468         }
23469         if (ts.isSpreadElement(bindingElement)) {
23470             return getInitializerOfBindingOrAssignmentElement(bindingElement.expression);
23471         }
23472     }
23473     ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement;
23474     function getTargetOfBindingOrAssignmentElement(bindingElement) {
23475         if (ts.isDeclarationBindingElement(bindingElement)) {
23476             return bindingElement.name;
23477         }
23478         if (ts.isObjectLiteralElementLike(bindingElement)) {
23479             switch (bindingElement.kind) {
23480                 case 294:
23481                     return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
23482                 case 295:
23483                     return bindingElement.name;
23484                 case 296:
23485                     return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
23486             }
23487             return undefined;
23488         }
23489         if (ts.isAssignmentExpression(bindingElement, true)) {
23490             return getTargetOfBindingOrAssignmentElement(bindingElement.left);
23491         }
23492         if (ts.isSpreadElement(bindingElement)) {
23493             return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
23494         }
23495         return bindingElement;
23496     }
23497     ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
23498     function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
23499         switch (bindingElement.kind) {
23500             case 163:
23501             case 202:
23502                 return bindingElement.dotDotDotToken;
23503             case 224:
23504             case 296:
23505                 return bindingElement;
23506         }
23507         return undefined;
23508     }
23509     ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
23510     function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
23511         var propertyName = tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement);
23512         ts.Debug.assert(!!propertyName || ts.isSpreadAssignment(bindingElement), "Invalid property name for binding element.");
23513         return propertyName;
23514     }
23515     ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement;
23516     function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) {
23517         switch (bindingElement.kind) {
23518             case 202:
23519                 if (bindingElement.propertyName) {
23520                     var propertyName = bindingElement.propertyName;
23521                     if (ts.isPrivateIdentifier(propertyName)) {
23522                         return ts.Debug.failBadSyntaxKind(propertyName);
23523                     }
23524                     return ts.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
23525                         ? propertyName.expression
23526                         : propertyName;
23527                 }
23528                 break;
23529             case 294:
23530                 if (bindingElement.name) {
23531                     var propertyName = bindingElement.name;
23532                     if (ts.isPrivateIdentifier(propertyName)) {
23533                         return ts.Debug.failBadSyntaxKind(propertyName);
23534                     }
23535                     return ts.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
23536                         ? propertyName.expression
23537                         : propertyName;
23538                 }
23539                 break;
23540             case 296:
23541                 if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) {
23542                     return ts.Debug.failBadSyntaxKind(bindingElement.name);
23543                 }
23544                 return bindingElement.name;
23545         }
23546         var target = getTargetOfBindingOrAssignmentElement(bindingElement);
23547         if (target && ts.isPropertyName(target)) {
23548             return target;
23549         }
23550     }
23551     ts.tryGetPropertyNameOfBindingOrAssignmentElement = tryGetPropertyNameOfBindingOrAssignmentElement;
23552     function isStringOrNumericLiteral(node) {
23553         var kind = node.kind;
23554         return kind === 10
23555             || kind === 8;
23556     }
23557     function getElementsOfBindingOrAssignmentPattern(name) {
23558         switch (name.kind) {
23559             case 200:
23560             case 201:
23561             case 203:
23562                 return name.elements;
23563             case 204:
23564                 return name.properties;
23565         }
23566     }
23567     ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern;
23568     function getJSDocTypeAliasName(fullName) {
23569         if (fullName) {
23570             var rightNode = fullName;
23571             while (true) {
23572                 if (ts.isIdentifier(rightNode) || !rightNode.body) {
23573                     return ts.isIdentifier(rightNode) ? rightNode : rightNode.name;
23574                 }
23575                 rightNode = rightNode.body;
23576             }
23577         }
23578     }
23579     ts.getJSDocTypeAliasName = getJSDocTypeAliasName;
23580     function canHaveModifiers(node) {
23581         var kind = node.kind;
23582         return kind === 163
23583             || kind === 165
23584             || kind === 166
23585             || kind === 167
23586             || kind === 168
23587             || kind === 170
23588             || kind === 171
23589             || kind === 172
23590             || kind === 175
23591             || kind === 212
23592             || kind === 213
23593             || kind === 225
23594             || kind === 236
23595             || kind === 255
23596             || kind === 256
23597             || kind === 257
23598             || kind === 258
23599             || kind === 259
23600             || kind === 260
23601             || kind === 264
23602             || kind === 265
23603             || kind === 270
23604             || kind === 271;
23605     }
23606     ts.canHaveModifiers = canHaveModifiers;
23607     ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration);
23608     ts.isQuestionOrExclamationToken = ts.or(ts.isQuestionToken, ts.isExclamationToken);
23609     ts.isIdentifierOrThisTypeNode = ts.or(ts.isIdentifier, ts.isThisTypeNode);
23610     ts.isReadonlyKeywordOrPlusOrMinusToken = ts.or(ts.isReadonlyKeyword, ts.isPlusToken, ts.isMinusToken);
23611     ts.isQuestionOrPlusOrMinusToken = ts.or(ts.isQuestionToken, ts.isPlusToken, ts.isMinusToken);
23612     ts.isModuleName = ts.or(ts.isIdentifier, ts.isStringLiteral);
23613     function isLiteralTypeLikeExpression(node) {
23614         var kind = node.kind;
23615         return kind === 104
23616             || kind === 110
23617             || kind === 95
23618             || ts.isLiteralExpression(node)
23619             || ts.isPrefixUnaryExpression(node);
23620     }
23621     ts.isLiteralTypeLikeExpression = isLiteralTypeLikeExpression;
23622     function isExponentiationOperator(kind) {
23623         return kind === 42;
23624     }
23625     function isMultiplicativeOperator(kind) {
23626         return kind === 41
23627             || kind === 43
23628             || kind === 44;
23629     }
23630     function isMultiplicativeOperatorOrHigher(kind) {
23631         return isExponentiationOperator(kind)
23632             || isMultiplicativeOperator(kind);
23633     }
23634     function isAdditiveOperator(kind) {
23635         return kind === 39
23636             || kind === 40;
23637     }
23638     function isAdditiveOperatorOrHigher(kind) {
23639         return isAdditiveOperator(kind)
23640             || isMultiplicativeOperatorOrHigher(kind);
23641     }
23642     function isShiftOperator(kind) {
23643         return kind === 47
23644             || kind === 48
23645             || kind === 49;
23646     }
23647     function isShiftOperatorOrHigher(kind) {
23648         return isShiftOperator(kind)
23649             || isAdditiveOperatorOrHigher(kind);
23650     }
23651     function isRelationalOperator(kind) {
23652         return kind === 29
23653             || kind === 32
23654             || kind === 31
23655             || kind === 33
23656             || kind === 102
23657             || kind === 101;
23658     }
23659     function isRelationalOperatorOrHigher(kind) {
23660         return isRelationalOperator(kind)
23661             || isShiftOperatorOrHigher(kind);
23662     }
23663     function isEqualityOperator(kind) {
23664         return kind === 34
23665             || kind === 36
23666             || kind === 35
23667             || kind === 37;
23668     }
23669     function isEqualityOperatorOrHigher(kind) {
23670         return isEqualityOperator(kind)
23671             || isRelationalOperatorOrHigher(kind);
23672     }
23673     function isBitwiseOperator(kind) {
23674         return kind === 50
23675             || kind === 51
23676             || kind === 52;
23677     }
23678     function isBitwiseOperatorOrHigher(kind) {
23679         return isBitwiseOperator(kind)
23680             || isEqualityOperatorOrHigher(kind);
23681     }
23682     function isLogicalOperator(kind) {
23683         return kind === 55
23684             || kind === 56;
23685     }
23686     function isLogicalOperatorOrHigher(kind) {
23687         return isLogicalOperator(kind)
23688             || isBitwiseOperatorOrHigher(kind);
23689     }
23690     function isAssignmentOperatorOrHigher(kind) {
23691         return kind === 60
23692             || isLogicalOperatorOrHigher(kind)
23693             || ts.isAssignmentOperator(kind);
23694     }
23695     function isBinaryOperator(kind) {
23696         return isAssignmentOperatorOrHigher(kind)
23697             || kind === 27;
23698     }
23699     function isBinaryOperatorToken(node) {
23700         return isBinaryOperator(node.kind);
23701     }
23702     ts.isBinaryOperatorToken = isBinaryOperatorToken;
23703     var BinaryExpressionState;
23704     (function (BinaryExpressionState) {
23705         function enter(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, outerState) {
23706             var prevUserState = stackIndex > 0 ? userStateStack[stackIndex - 1] : undefined;
23707             ts.Debug.assertEqual(stateStack[stackIndex], enter);
23708             userStateStack[stackIndex] = machine.onEnter(nodeStack[stackIndex], prevUserState, outerState);
23709             stateStack[stackIndex] = nextState(machine, enter);
23710             return stackIndex;
23711         }
23712         BinaryExpressionState.enter = enter;
23713         function left(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) {
23714             ts.Debug.assertEqual(stateStack[stackIndex], left);
23715             ts.Debug.assertIsDefined(machine.onLeft);
23716             stateStack[stackIndex] = nextState(machine, left);
23717             var nextNode = machine.onLeft(nodeStack[stackIndex].left, userStateStack[stackIndex], nodeStack[stackIndex]);
23718             if (nextNode) {
23719                 checkCircularity(stackIndex, nodeStack, nextNode);
23720                 return pushStack(stackIndex, stateStack, nodeStack, userStateStack, nextNode);
23721             }
23722             return stackIndex;
23723         }
23724         BinaryExpressionState.left = left;
23725         function operator(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) {
23726             ts.Debug.assertEqual(stateStack[stackIndex], operator);
23727             ts.Debug.assertIsDefined(machine.onOperator);
23728             stateStack[stackIndex] = nextState(machine, operator);
23729             machine.onOperator(nodeStack[stackIndex].operatorToken, userStateStack[stackIndex], nodeStack[stackIndex]);
23730             return stackIndex;
23731         }
23732         BinaryExpressionState.operator = operator;
23733         function right(machine, stackIndex, stateStack, nodeStack, userStateStack, _resultHolder, _outerState) {
23734             ts.Debug.assertEqual(stateStack[stackIndex], right);
23735             ts.Debug.assertIsDefined(machine.onRight);
23736             stateStack[stackIndex] = nextState(machine, right);
23737             var nextNode = machine.onRight(nodeStack[stackIndex].right, userStateStack[stackIndex], nodeStack[stackIndex]);
23738             if (nextNode) {
23739                 checkCircularity(stackIndex, nodeStack, nextNode);
23740                 return pushStack(stackIndex, stateStack, nodeStack, userStateStack, nextNode);
23741             }
23742             return stackIndex;
23743         }
23744         BinaryExpressionState.right = right;
23745         function exit(machine, stackIndex, stateStack, nodeStack, userStateStack, resultHolder, _outerState) {
23746             ts.Debug.assertEqual(stateStack[stackIndex], exit);
23747             stateStack[stackIndex] = nextState(machine, exit);
23748             var result = machine.onExit(nodeStack[stackIndex], userStateStack[stackIndex]);
23749             if (stackIndex > 0) {
23750                 stackIndex--;
23751                 if (machine.foldState) {
23752                     var side = stateStack[stackIndex] === exit ? "right" : "left";
23753                     userStateStack[stackIndex] = machine.foldState(userStateStack[stackIndex], result, side);
23754                 }
23755             }
23756             else {
23757                 resultHolder.value = result;
23758             }
23759             return stackIndex;
23760         }
23761         BinaryExpressionState.exit = exit;
23762         function done(_machine, stackIndex, stateStack, _nodeStack, _userStateStack, _resultHolder, _outerState) {
23763             ts.Debug.assertEqual(stateStack[stackIndex], done);
23764             return stackIndex;
23765         }
23766         BinaryExpressionState.done = done;
23767         function nextState(machine, currentState) {
23768             switch (currentState) {
23769                 case enter:
23770                     if (machine.onLeft)
23771                         return left;
23772                 case left:
23773                     if (machine.onOperator)
23774                         return operator;
23775                 case operator:
23776                     if (machine.onRight)
23777                         return right;
23778                 case right: return exit;
23779                 case exit: return done;
23780                 case done: return done;
23781                 default: ts.Debug.fail("Invalid state");
23782             }
23783         }
23784         BinaryExpressionState.nextState = nextState;
23785         function pushStack(stackIndex, stateStack, nodeStack, userStateStack, node) {
23786             stackIndex++;
23787             stateStack[stackIndex] = enter;
23788             nodeStack[stackIndex] = node;
23789             userStateStack[stackIndex] = undefined;
23790             return stackIndex;
23791         }
23792         function checkCircularity(stackIndex, nodeStack, node) {
23793             if (ts.Debug.shouldAssert(2)) {
23794                 while (stackIndex >= 0) {
23795                     ts.Debug.assert(nodeStack[stackIndex] !== node, "Circular traversal detected.");
23796                     stackIndex--;
23797                 }
23798             }
23799         }
23800     })(BinaryExpressionState || (BinaryExpressionState = {}));
23801     var BinaryExpressionStateMachine = (function () {
23802         function BinaryExpressionStateMachine(onEnter, onLeft, onOperator, onRight, onExit, foldState) {
23803             this.onEnter = onEnter;
23804             this.onLeft = onLeft;
23805             this.onOperator = onOperator;
23806             this.onRight = onRight;
23807             this.onExit = onExit;
23808             this.foldState = foldState;
23809         }
23810         return BinaryExpressionStateMachine;
23811     }());
23812     function createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState) {
23813         var machine = new BinaryExpressionStateMachine(onEnter, onLeft, onOperator, onRight, onExit, foldState);
23814         return trampoline;
23815         function trampoline(node, outerState) {
23816             var resultHolder = { value: undefined };
23817             var stateStack = [BinaryExpressionState.enter];
23818             var nodeStack = [node];
23819             var userStateStack = [undefined];
23820             var stackIndex = 0;
23821             while (stateStack[stackIndex] !== BinaryExpressionState.done) {
23822                 stackIndex = stateStack[stackIndex](machine, stackIndex, stateStack, nodeStack, userStateStack, resultHolder, outerState);
23823             }
23824             ts.Debug.assertEqual(stackIndex, 0);
23825             return resultHolder.value;
23826         }
23827     }
23828     ts.createBinaryExpressionTrampoline = createBinaryExpressionTrampoline;
23829 })(ts || (ts = {}));
23830 var ts;
23831 (function (ts) {
23832     function setTextRange(range, location) {
23833         return location ? ts.setTextRangePosEnd(range, location.pos, location.end) : range;
23834     }
23835     ts.setTextRange = setTextRange;
23836 })(ts || (ts = {}));
23837 var ts;
23838 (function (ts) {
23839     var NodeConstructor;
23840     var TokenConstructor;
23841     var IdentifierConstructor;
23842     var PrivateIdentifierConstructor;
23843     var SourceFileConstructor;
23844     ts.parseBaseNodeFactory = {
23845         createBaseSourceFileNode: function (kind) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, -1, -1); },
23846         createBaseIdentifierNode: function (kind) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, -1, -1); },
23847         createBasePrivateIdentifierNode: function (kind) { return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = ts.objectAllocator.getPrivateIdentifierConstructor()))(kind, -1, -1); },
23848         createBaseTokenNode: function (kind) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, -1, -1); },
23849         createBaseNode: function (kind) { return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, -1, -1); },
23850     };
23851     ts.parseNodeFactory = ts.createNodeFactory(1, ts.parseBaseNodeFactory);
23852     function visitNode(cbNode, node) {
23853         return node && cbNode(node);
23854     }
23855     function visitNodes(cbNode, cbNodes, nodes) {
23856         if (nodes) {
23857             if (cbNodes) {
23858                 return cbNodes(nodes);
23859             }
23860             for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
23861                 var node = nodes_1[_i];
23862                 var result = cbNode(node);
23863                 if (result) {
23864                     return result;
23865                 }
23866             }
23867         }
23868     }
23869     function isJSDocLikeText(text, start) {
23870         return text.charCodeAt(start + 1) === 42 &&
23871             text.charCodeAt(start + 2) === 42 &&
23872             text.charCodeAt(start + 3) !== 47;
23873     }
23874     ts.isJSDocLikeText = isJSDocLikeText;
23875     function forEachChild(node, cbNode, cbNodes) {
23876         if (!node || node.kind <= 159) {
23877             return;
23878         }
23879         switch (node.kind) {
23880             case 160:
23881                 return visitNode(cbNode, node.left) ||
23882                     visitNode(cbNode, node.right);
23883             case 162:
23884                 return visitNode(cbNode, node.name) ||
23885                     visitNode(cbNode, node.constraint) ||
23886                     visitNode(cbNode, node.default) ||
23887                     visitNode(cbNode, node.expression);
23888             case 295:
23889                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23890                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23891                     visitNode(cbNode, node.name) ||
23892                     visitNode(cbNode, node.questionToken) ||
23893                     visitNode(cbNode, node.exclamationToken) ||
23894                     visitNode(cbNode, node.equalsToken) ||
23895                     visitNode(cbNode, node.objectAssignmentInitializer);
23896             case 296:
23897                 return visitNode(cbNode, node.expression);
23898             case 163:
23899                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23900                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23901                     visitNode(cbNode, node.dotDotDotToken) ||
23902                     visitNode(cbNode, node.name) ||
23903                     visitNode(cbNode, node.questionToken) ||
23904                     visitNode(cbNode, node.type) ||
23905                     visitNode(cbNode, node.initializer);
23906             case 166:
23907                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23908                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23909                     visitNode(cbNode, node.name) ||
23910                     visitNode(cbNode, node.questionToken) ||
23911                     visitNode(cbNode, node.exclamationToken) ||
23912                     visitNode(cbNode, node.type) ||
23913                     visitNode(cbNode, node.initializer);
23914             case 165:
23915                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23916                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23917                     visitNode(cbNode, node.name) ||
23918                     visitNode(cbNode, node.questionToken) ||
23919                     visitNode(cbNode, node.type) ||
23920                     visitNode(cbNode, node.initializer);
23921             case 294:
23922                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23923                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23924                     visitNode(cbNode, node.name) ||
23925                     visitNode(cbNode, node.questionToken) ||
23926                     visitNode(cbNode, node.initializer);
23927             case 253:
23928                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23929                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23930                     visitNode(cbNode, node.name) ||
23931                     visitNode(cbNode, node.exclamationToken) ||
23932                     visitNode(cbNode, node.type) ||
23933                     visitNode(cbNode, node.initializer);
23934             case 202:
23935                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23936                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23937                     visitNode(cbNode, node.dotDotDotToken) ||
23938                     visitNode(cbNode, node.propertyName) ||
23939                     visitNode(cbNode, node.name) ||
23940                     visitNode(cbNode, node.initializer);
23941             case 178:
23942             case 179:
23943             case 173:
23944             case 174:
23945             case 175:
23946                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23947                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23948                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
23949                     visitNodes(cbNode, cbNodes, node.parameters) ||
23950                     visitNode(cbNode, node.type);
23951             case 168:
23952             case 167:
23953             case 170:
23954             case 171:
23955             case 172:
23956             case 212:
23957             case 255:
23958             case 213:
23959                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23960                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23961                     visitNode(cbNode, node.asteriskToken) ||
23962                     visitNode(cbNode, node.name) ||
23963                     visitNode(cbNode, node.questionToken) ||
23964                     visitNode(cbNode, node.exclamationToken) ||
23965                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
23966                     visitNodes(cbNode, cbNodes, node.parameters) ||
23967                     visitNode(cbNode, node.type) ||
23968                     visitNode(cbNode, node.equalsGreaterThanToken) ||
23969                     visitNode(cbNode, node.body);
23970             case 169:
23971                 return visitNodes(cbNode, cbNodes, node.decorators) ||
23972                     visitNodes(cbNode, cbNodes, node.modifiers) ||
23973                     visitNode(cbNode, node.body);
23974             case 177:
23975                 return visitNode(cbNode, node.typeName) ||
23976                     visitNodes(cbNode, cbNodes, node.typeArguments);
23977             case 176:
23978                 return visitNode(cbNode, node.assertsModifier) ||
23979                     visitNode(cbNode, node.parameterName) ||
23980                     visitNode(cbNode, node.type);
23981             case 180:
23982                 return visitNode(cbNode, node.exprName);
23983             case 181:
23984                 return visitNodes(cbNode, cbNodes, node.members);
23985             case 182:
23986                 return visitNode(cbNode, node.elementType);
23987             case 183:
23988                 return visitNodes(cbNode, cbNodes, node.elements);
23989             case 186:
23990             case 187:
23991                 return visitNodes(cbNode, cbNodes, node.types);
23992             case 188:
23993                 return visitNode(cbNode, node.checkType) ||
23994                     visitNode(cbNode, node.extendsType) ||
23995                     visitNode(cbNode, node.trueType) ||
23996                     visitNode(cbNode, node.falseType);
23997             case 189:
23998                 return visitNode(cbNode, node.typeParameter);
23999             case 199:
24000                 return visitNode(cbNode, node.argument) ||
24001                     visitNode(cbNode, node.qualifier) ||
24002                     visitNodes(cbNode, cbNodes, node.typeArguments);
24003             case 190:
24004             case 192:
24005                 return visitNode(cbNode, node.type);
24006             case 193:
24007                 return visitNode(cbNode, node.objectType) ||
24008                     visitNode(cbNode, node.indexType);
24009             case 194:
24010                 return visitNode(cbNode, node.readonlyToken) ||
24011                     visitNode(cbNode, node.typeParameter) ||
24012                     visitNode(cbNode, node.nameType) ||
24013                     visitNode(cbNode, node.questionToken) ||
24014                     visitNode(cbNode, node.type) ||
24015                     visitNodes(cbNode, cbNodes, node.members);
24016             case 195:
24017                 return visitNode(cbNode, node.literal);
24018             case 196:
24019                 return visitNode(cbNode, node.dotDotDotToken) ||
24020                     visitNode(cbNode, node.name) ||
24021                     visitNode(cbNode, node.questionToken) ||
24022                     visitNode(cbNode, node.type);
24023             case 200:
24024             case 201:
24025                 return visitNodes(cbNode, cbNodes, node.elements);
24026             case 203:
24027                 return visitNodes(cbNode, cbNodes, node.elements);
24028             case 204:
24029                 return visitNodes(cbNode, cbNodes, node.properties);
24030             case 205:
24031                 return visitNode(cbNode, node.expression) ||
24032                     visitNode(cbNode, node.questionDotToken) ||
24033                     visitNode(cbNode, node.name);
24034             case 206:
24035                 return visitNode(cbNode, node.expression) ||
24036                     visitNode(cbNode, node.questionDotToken) ||
24037                     visitNode(cbNode, node.argumentExpression);
24038             case 207:
24039             case 208:
24040                 return visitNode(cbNode, node.expression) ||
24041                     visitNode(cbNode, node.questionDotToken) ||
24042                     visitNodes(cbNode, cbNodes, node.typeArguments) ||
24043                     visitNodes(cbNode, cbNodes, node.arguments);
24044             case 209:
24045                 return visitNode(cbNode, node.tag) ||
24046                     visitNode(cbNode, node.questionDotToken) ||
24047                     visitNodes(cbNode, cbNodes, node.typeArguments) ||
24048                     visitNode(cbNode, node.template);
24049             case 210:
24050                 return visitNode(cbNode, node.type) ||
24051                     visitNode(cbNode, node.expression);
24052             case 211:
24053                 return visitNode(cbNode, node.expression);
24054             case 214:
24055                 return visitNode(cbNode, node.expression);
24056             case 215:
24057                 return visitNode(cbNode, node.expression);
24058             case 216:
24059                 return visitNode(cbNode, node.expression);
24060             case 218:
24061                 return visitNode(cbNode, node.operand);
24062             case 223:
24063                 return visitNode(cbNode, node.asteriskToken) ||
24064                     visitNode(cbNode, node.expression);
24065             case 217:
24066                 return visitNode(cbNode, node.expression);
24067             case 219:
24068                 return visitNode(cbNode, node.operand);
24069             case 220:
24070                 return visitNode(cbNode, node.left) ||
24071                     visitNode(cbNode, node.operatorToken) ||
24072                     visitNode(cbNode, node.right);
24073             case 228:
24074                 return visitNode(cbNode, node.expression) ||
24075                     visitNode(cbNode, node.type);
24076             case 229:
24077                 return visitNode(cbNode, node.expression);
24078             case 230:
24079                 return visitNode(cbNode, node.name);
24080             case 221:
24081                 return visitNode(cbNode, node.condition) ||
24082                     visitNode(cbNode, node.questionToken) ||
24083                     visitNode(cbNode, node.whenTrue) ||
24084                     visitNode(cbNode, node.colonToken) ||
24085                     visitNode(cbNode, node.whenFalse);
24086             case 224:
24087                 return visitNode(cbNode, node.expression);
24088             case 234:
24089             case 261:
24090                 return visitNodes(cbNode, cbNodes, node.statements);
24091             case 303:
24092                 return visitNodes(cbNode, cbNodes, node.statements) ||
24093                     visitNode(cbNode, node.endOfFileToken);
24094             case 236:
24095                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24096                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24097                     visitNode(cbNode, node.declarationList);
24098             case 254:
24099                 return visitNodes(cbNode, cbNodes, node.declarations);
24100             case 237:
24101                 return visitNode(cbNode, node.expression);
24102             case 238:
24103                 return visitNode(cbNode, node.expression) ||
24104                     visitNode(cbNode, node.thenStatement) ||
24105                     visitNode(cbNode, node.elseStatement);
24106             case 239:
24107                 return visitNode(cbNode, node.statement) ||
24108                     visitNode(cbNode, node.expression);
24109             case 240:
24110                 return visitNode(cbNode, node.expression) ||
24111                     visitNode(cbNode, node.statement);
24112             case 241:
24113                 return visitNode(cbNode, node.initializer) ||
24114                     visitNode(cbNode, node.condition) ||
24115                     visitNode(cbNode, node.incrementor) ||
24116                     visitNode(cbNode, node.statement);
24117             case 242:
24118                 return visitNode(cbNode, node.initializer) ||
24119                     visitNode(cbNode, node.expression) ||
24120                     visitNode(cbNode, node.statement);
24121             case 243:
24122                 return visitNode(cbNode, node.awaitModifier) ||
24123                     visitNode(cbNode, node.initializer) ||
24124                     visitNode(cbNode, node.expression) ||
24125                     visitNode(cbNode, node.statement);
24126             case 244:
24127             case 245:
24128                 return visitNode(cbNode, node.label);
24129             case 246:
24130                 return visitNode(cbNode, node.expression);
24131             case 247:
24132                 return visitNode(cbNode, node.expression) ||
24133                     visitNode(cbNode, node.statement);
24134             case 248:
24135                 return visitNode(cbNode, node.expression) ||
24136                     visitNode(cbNode, node.caseBlock);
24137             case 262:
24138                 return visitNodes(cbNode, cbNodes, node.clauses);
24139             case 288:
24140                 return visitNode(cbNode, node.expression) ||
24141                     visitNodes(cbNode, cbNodes, node.statements);
24142             case 289:
24143                 return visitNodes(cbNode, cbNodes, node.statements);
24144             case 249:
24145                 return visitNode(cbNode, node.label) ||
24146                     visitNode(cbNode, node.statement);
24147             case 250:
24148                 return visitNode(cbNode, node.expression);
24149             case 251:
24150                 return visitNode(cbNode, node.tryBlock) ||
24151                     visitNode(cbNode, node.catchClause) ||
24152                     visitNode(cbNode, node.finallyBlock);
24153             case 291:
24154                 return visitNode(cbNode, node.variableDeclaration) ||
24155                     visitNode(cbNode, node.block);
24156             case 164:
24157                 return visitNode(cbNode, node.expression);
24158             case 256:
24159             case 225:
24160                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24161                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24162                     visitNode(cbNode, node.name) ||
24163                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
24164                     visitNodes(cbNode, cbNodes, node.heritageClauses) ||
24165                     visitNodes(cbNode, cbNodes, node.members);
24166             case 257:
24167                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24168                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24169                     visitNode(cbNode, node.name) ||
24170                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
24171                     visitNodes(cbNode, cbNodes, node.heritageClauses) ||
24172                     visitNodes(cbNode, cbNodes, node.members);
24173             case 258:
24174                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24175                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24176                     visitNode(cbNode, node.name) ||
24177                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
24178                     visitNode(cbNode, node.type);
24179             case 259:
24180                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24181                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24182                     visitNode(cbNode, node.name) ||
24183                     visitNodes(cbNode, cbNodes, node.members);
24184             case 297:
24185                 return visitNode(cbNode, node.name) ||
24186                     visitNode(cbNode, node.initializer);
24187             case 260:
24188                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24189                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24190                     visitNode(cbNode, node.name) ||
24191                     visitNode(cbNode, node.body);
24192             case 264:
24193                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24194                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24195                     visitNode(cbNode, node.name) ||
24196                     visitNode(cbNode, node.moduleReference);
24197             case 265:
24198                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24199                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24200                     visitNode(cbNode, node.importClause) ||
24201                     visitNode(cbNode, node.moduleSpecifier) ||
24202                     visitNode(cbNode, node.assertClause);
24203             case 266:
24204                 return visitNode(cbNode, node.name) ||
24205                     visitNode(cbNode, node.namedBindings);
24206             case 292:
24207                 return visitNodes(cbNode, cbNodes, node.elements);
24208             case 293:
24209                 return visitNode(cbNode, node.name) ||
24210                     visitNode(cbNode, node.value);
24211             case 263:
24212                 return visitNode(cbNode, node.name);
24213             case 267:
24214                 return visitNode(cbNode, node.name);
24215             case 273:
24216                 return visitNode(cbNode, node.name);
24217             case 268:
24218             case 272:
24219                 return visitNodes(cbNode, cbNodes, node.elements);
24220             case 271:
24221                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24222                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24223                     visitNode(cbNode, node.exportClause) ||
24224                     visitNode(cbNode, node.moduleSpecifier) ||
24225                     visitNode(cbNode, node.assertClause);
24226             case 269:
24227             case 274:
24228                 return visitNode(cbNode, node.propertyName) ||
24229                     visitNode(cbNode, node.name);
24230             case 270:
24231                 return visitNodes(cbNode, cbNodes, node.decorators) ||
24232                     visitNodes(cbNode, cbNodes, node.modifiers) ||
24233                     visitNode(cbNode, node.expression);
24234             case 222:
24235                 return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
24236             case 232:
24237                 return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
24238             case 197:
24239                 return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
24240             case 198:
24241                 return visitNode(cbNode, node.type) || visitNode(cbNode, node.literal);
24242             case 161:
24243                 return visitNode(cbNode, node.expression);
24244             case 290:
24245                 return visitNodes(cbNode, cbNodes, node.types);
24246             case 227:
24247                 return visitNode(cbNode, node.expression) ||
24248                     visitNodes(cbNode, cbNodes, node.typeArguments);
24249             case 276:
24250                 return visitNode(cbNode, node.expression);
24251             case 275:
24252                 return visitNodes(cbNode, cbNodes, node.decorators);
24253             case 349:
24254                 return visitNodes(cbNode, cbNodes, node.elements);
24255             case 277:
24256                 return visitNode(cbNode, node.openingElement) ||
24257                     visitNodes(cbNode, cbNodes, node.children) ||
24258                     visitNode(cbNode, node.closingElement);
24259             case 281:
24260                 return visitNode(cbNode, node.openingFragment) ||
24261                     visitNodes(cbNode, cbNodes, node.children) ||
24262                     visitNode(cbNode, node.closingFragment);
24263             case 278:
24264             case 279:
24265                 return visitNode(cbNode, node.tagName) ||
24266                     visitNodes(cbNode, cbNodes, node.typeArguments) ||
24267                     visitNode(cbNode, node.attributes);
24268             case 285:
24269                 return visitNodes(cbNode, cbNodes, node.properties);
24270             case 284:
24271                 return visitNode(cbNode, node.name) ||
24272                     visitNode(cbNode, node.initializer);
24273             case 286:
24274                 return visitNode(cbNode, node.expression);
24275             case 287:
24276                 return visitNode(cbNode, node.dotDotDotToken) ||
24277                     visitNode(cbNode, node.expression);
24278             case 280:
24279                 return visitNode(cbNode, node.tagName);
24280             case 184:
24281             case 185:
24282             case 307:
24283             case 313:
24284             case 312:
24285             case 314:
24286             case 316:
24287                 return visitNode(cbNode, node.type);
24288             case 315:
24289                 return visitNodes(cbNode, cbNodes, node.parameters) ||
24290                     visitNode(cbNode, node.type);
24291             case 318:
24292                 return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
24293                     || visitNodes(cbNode, cbNodes, node.tags);
24294             case 344:
24295                 return visitNode(cbNode, node.tagName) ||
24296                     visitNode(cbNode, node.name) ||
24297                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24298             case 308:
24299                 return visitNode(cbNode, node.name);
24300             case 309:
24301                 return visitNode(cbNode, node.left) ||
24302                     visitNode(cbNode, node.right);
24303             case 338:
24304             case 345:
24305                 return visitNode(cbNode, node.tagName) ||
24306                     (node.isNameFirst
24307                         ? visitNode(cbNode, node.name) ||
24308                             visitNode(cbNode, node.typeExpression) ||
24309                             (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
24310                         : visitNode(cbNode, node.typeExpression) ||
24311                             visitNode(cbNode, node.name) ||
24312                             (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
24313             case 328:
24314                 return visitNode(cbNode, node.tagName) ||
24315                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24316             case 327:
24317                 return visitNode(cbNode, node.tagName) ||
24318                     visitNode(cbNode, node.class) ||
24319                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24320             case 326:
24321                 return visitNode(cbNode, node.tagName) ||
24322                     visitNode(cbNode, node.class) ||
24323                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24324             case 342:
24325                 return visitNode(cbNode, node.tagName) ||
24326                     visitNode(cbNode, node.constraint) ||
24327                     visitNodes(cbNode, cbNodes, node.typeParameters) ||
24328                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24329             case 343:
24330                 return visitNode(cbNode, node.tagName) ||
24331                     (node.typeExpression &&
24332                         node.typeExpression.kind === 307
24333                         ? visitNode(cbNode, node.typeExpression) ||
24334                             visitNode(cbNode, node.fullName) ||
24335                             (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
24336                         : visitNode(cbNode, node.fullName) ||
24337                             visitNode(cbNode, node.typeExpression) ||
24338                             (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)));
24339             case 336:
24340                 return visitNode(cbNode, node.tagName) ||
24341                     visitNode(cbNode, node.fullName) ||
24342                     visitNode(cbNode, node.typeExpression) ||
24343                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24344             case 339:
24345             case 341:
24346             case 340:
24347             case 337:
24348                 return visitNode(cbNode, node.tagName) ||
24349                     visitNode(cbNode, node.typeExpression) ||
24350                     (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24351             case 321:
24352                 return ts.forEach(node.typeParameters, cbNode) ||
24353                     ts.forEach(node.parameters, cbNode) ||
24354                     visitNode(cbNode, node.type);
24355             case 322:
24356             case 323:
24357             case 324:
24358                 return visitNode(cbNode, node.name);
24359             case 320:
24360                 return ts.forEach(node.jsDocPropertyTags, cbNode);
24361             case 325:
24362             case 330:
24363             case 331:
24364             case 332:
24365             case 333:
24366             case 334:
24367             case 329:
24368                 return visitNode(cbNode, node.tagName)
24369                     || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment));
24370             case 348:
24371                 return visitNode(cbNode, node.expression);
24372         }
24373     }
24374     ts.forEachChild = forEachChild;
24375     function forEachChildRecursively(rootNode, cbNode, cbNodes) {
24376         var queue = gatherPossibleChildren(rootNode);
24377         var parents = [];
24378         while (parents.length < queue.length) {
24379             parents.push(rootNode);
24380         }
24381         while (queue.length !== 0) {
24382             var current = queue.pop();
24383             var parent = parents.pop();
24384             if (ts.isArray(current)) {
24385                 if (cbNodes) {
24386                     var res = cbNodes(current, parent);
24387                     if (res) {
24388                         if (res === "skip")
24389                             continue;
24390                         return res;
24391                     }
24392                 }
24393                 for (var i = current.length - 1; i >= 0; --i) {
24394                     queue.push(current[i]);
24395                     parents.push(parent);
24396                 }
24397             }
24398             else {
24399                 var res = cbNode(current, parent);
24400                 if (res) {
24401                     if (res === "skip")
24402                         continue;
24403                     return res;
24404                 }
24405                 if (current.kind >= 160) {
24406                     for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) {
24407                         var child = _a[_i];
24408                         queue.push(child);
24409                         parents.push(current);
24410                     }
24411                 }
24412             }
24413         }
24414     }
24415     ts.forEachChildRecursively = forEachChildRecursively;
24416     function gatherPossibleChildren(node) {
24417         var children = [];
24418         forEachChild(node, addWorkItem, addWorkItem);
24419         return children;
24420         function addWorkItem(n) {
24421             children.unshift(n);
24422         }
24423     }
24424     function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) {
24425         if (setParentNodes === void 0) { setParentNodes = false; }
24426         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse", "createSourceFile", { path: fileName }, true);
24427         ts.performance.mark("beforeParse");
24428         var result;
24429         ts.perfLogger.logStartParseSourceFile(fileName);
24430         if (languageVersion === 100) {
24431             result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, 6);
24432         }
24433         else {
24434             result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes, scriptKind);
24435         }
24436         ts.perfLogger.logStopParseSourceFile();
24437         ts.performance.mark("afterParse");
24438         ts.performance.measure("Parse", "beforeParse", "afterParse");
24439         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
24440         return result;
24441     }
24442     ts.createSourceFile = createSourceFile;
24443     function parseIsolatedEntityName(text, languageVersion) {
24444         return Parser.parseIsolatedEntityName(text, languageVersion);
24445     }
24446     ts.parseIsolatedEntityName = parseIsolatedEntityName;
24447     function parseJsonText(fileName, sourceText) {
24448         return Parser.parseJsonText(fileName, sourceText);
24449     }
24450     ts.parseJsonText = parseJsonText;
24451     function isExternalModule(file) {
24452         return file.externalModuleIndicator !== undefined;
24453     }
24454     ts.isExternalModule = isExternalModule;
24455     function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
24456         if (aggressiveChecks === void 0) { aggressiveChecks = false; }
24457         var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks);
24458         newSourceFile.flags |= (sourceFile.flags & 3145728);
24459         return newSourceFile;
24460     }
24461     ts.updateSourceFile = updateSourceFile;
24462     function parseIsolatedJSDocComment(content, start, length) {
24463         var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length);
24464         if (result && result.jsDoc) {
24465             Parser.fixupParentReferences(result.jsDoc);
24466         }
24467         return result;
24468     }
24469     ts.parseIsolatedJSDocComment = parseIsolatedJSDocComment;
24470     function parseJSDocTypeExpressionForTests(content, start, length) {
24471         return Parser.JSDocParser.parseJSDocTypeExpressionForTests(content, start, length);
24472     }
24473     ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
24474     var Parser;
24475     (function (Parser) {
24476         var scanner = ts.createScanner(99, true);
24477         var disallowInAndDecoratorContext = 4096 | 16384;
24478         var NodeConstructor;
24479         var TokenConstructor;
24480         var IdentifierConstructor;
24481         var PrivateIdentifierConstructor;
24482         var SourceFileConstructor;
24483         function countNode(node) {
24484             nodeCount++;
24485             return node;
24486         }
24487         var baseNodeFactory = {
24488             createBaseSourceFileNode: function (kind) { return countNode(new SourceFileConstructor(kind, 0, 0)); },
24489             createBaseIdentifierNode: function (kind) { return countNode(new IdentifierConstructor(kind, 0, 0)); },
24490             createBasePrivateIdentifierNode: function (kind) { return countNode(new PrivateIdentifierConstructor(kind, 0, 0)); },
24491             createBaseTokenNode: function (kind) { return countNode(new TokenConstructor(kind, 0, 0)); },
24492             createBaseNode: function (kind) { return countNode(new NodeConstructor(kind, 0, 0)); }
24493         };
24494         var factory = ts.createNodeFactory(1 | 2 | 8, baseNodeFactory);
24495         var fileName;
24496         var sourceFlags;
24497         var sourceText;
24498         var languageVersion;
24499         var scriptKind;
24500         var languageVariant;
24501         var parseDiagnostics;
24502         var jsDocDiagnostics;
24503         var syntaxCursor;
24504         var currentToken;
24505         var nodeCount;
24506         var identifiers;
24507         var privateIdentifiers;
24508         var identifierCount;
24509         var parsingContext;
24510         var notParenthesizedArrow;
24511         var contextFlags;
24512         var topLevel = true;
24513         var parseErrorBeforeNextFinishedNode = false;
24514         function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) {
24515             var _a;
24516             if (setParentNodes === void 0) { setParentNodes = false; }
24517             scriptKind = ts.ensureScriptKind(fileName, scriptKind);
24518             if (scriptKind === 6) {
24519                 var result_3 = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes);
24520                 ts.convertToObjectWorker(result_3, (_a = result_3.statements[0]) === null || _a === void 0 ? void 0 : _a.expression, result_3.parseDiagnostics, false, undefined, undefined);
24521                 result_3.referencedFiles = ts.emptyArray;
24522                 result_3.typeReferenceDirectives = ts.emptyArray;
24523                 result_3.libReferenceDirectives = ts.emptyArray;
24524                 result_3.amdDependencies = ts.emptyArray;
24525                 result_3.hasNoDefaultLib = false;
24526                 result_3.pragmas = ts.emptyMap;
24527                 return result_3;
24528             }
24529             initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind);
24530             var result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind);
24531             clearState();
24532             return result;
24533         }
24534         Parser.parseSourceFile = parseSourceFile;
24535         function parseIsolatedEntityName(content, languageVersion) {
24536             initializeState("", content, languageVersion, undefined, 1);
24537             nextToken();
24538             var entityName = parseEntityName(true);
24539             var isInvalid = token() === 1 && !parseDiagnostics.length;
24540             clearState();
24541             return isInvalid ? entityName : undefined;
24542         }
24543         Parser.parseIsolatedEntityName = parseIsolatedEntityName;
24544         function parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) {
24545             if (languageVersion === void 0) { languageVersion = 2; }
24546             if (setParentNodes === void 0) { setParentNodes = false; }
24547             initializeState(fileName, sourceText, languageVersion, syntaxCursor, 6);
24548             sourceFlags = contextFlags;
24549             nextToken();
24550             var pos = getNodePos();
24551             var statements, endOfFileToken;
24552             if (token() === 1) {
24553                 statements = createNodeArray([], pos, pos);
24554                 endOfFileToken = parseTokenNode();
24555             }
24556             else {
24557                 var expressions = void 0;
24558                 while (token() !== 1) {
24559                     var expression_1 = void 0;
24560                     switch (token()) {
24561                         case 22:
24562                             expression_1 = parseArrayLiteralExpression();
24563                             break;
24564                         case 110:
24565                         case 95:
24566                         case 104:
24567                             expression_1 = parseTokenNode();
24568                             break;
24569                         case 40:
24570                             if (lookAhead(function () { return nextToken() === 8 && nextToken() !== 58; })) {
24571                                 expression_1 = parsePrefixUnaryExpression();
24572                             }
24573                             else {
24574                                 expression_1 = parseObjectLiteralExpression();
24575                             }
24576                             break;
24577                         case 8:
24578                         case 10:
24579                             if (lookAhead(function () { return nextToken() !== 58; })) {
24580                                 expression_1 = parseLiteralNode();
24581                                 break;
24582                             }
24583                         default:
24584                             expression_1 = parseObjectLiteralExpression();
24585                             break;
24586                     }
24587                     if (expressions && ts.isArray(expressions)) {
24588                         expressions.push(expression_1);
24589                     }
24590                     else if (expressions) {
24591                         expressions = [expressions, expression_1];
24592                     }
24593                     else {
24594                         expressions = expression_1;
24595                         if (token() !== 1) {
24596                             parseErrorAtCurrentToken(ts.Diagnostics.Unexpected_token);
24597                         }
24598                     }
24599                 }
24600                 var expression = ts.isArray(expressions) ? finishNode(factory.createArrayLiteralExpression(expressions), pos) : ts.Debug.checkDefined(expressions);
24601                 var statement = factory.createExpressionStatement(expression);
24602                 finishNode(statement, pos);
24603                 statements = createNodeArray([statement], pos);
24604                 endOfFileToken = parseExpectedToken(1, ts.Diagnostics.Unexpected_token);
24605             }
24606             var sourceFile = createSourceFile(fileName, 2, 6, false, statements, endOfFileToken, sourceFlags);
24607             if (setParentNodes) {
24608                 fixupParentReferences(sourceFile);
24609             }
24610             sourceFile.nodeCount = nodeCount;
24611             sourceFile.identifierCount = identifierCount;
24612             sourceFile.identifiers = identifiers;
24613             sourceFile.parseDiagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
24614             if (jsDocDiagnostics) {
24615                 sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
24616             }
24617             var result = sourceFile;
24618             clearState();
24619             return result;
24620         }
24621         Parser.parseJsonText = parseJsonText;
24622         function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind) {
24623             NodeConstructor = ts.objectAllocator.getNodeConstructor();
24624             TokenConstructor = ts.objectAllocator.getTokenConstructor();
24625             IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor();
24626             PrivateIdentifierConstructor = ts.objectAllocator.getPrivateIdentifierConstructor();
24627             SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor();
24628             fileName = ts.normalizePath(_fileName);
24629             sourceText = _sourceText;
24630             languageVersion = _languageVersion;
24631             syntaxCursor = _syntaxCursor;
24632             scriptKind = _scriptKind;
24633             languageVariant = ts.getLanguageVariant(_scriptKind);
24634             parseDiagnostics = [];
24635             parsingContext = 0;
24636             identifiers = new ts.Map();
24637             privateIdentifiers = new ts.Map();
24638             identifierCount = 0;
24639             nodeCount = 0;
24640             sourceFlags = 0;
24641             topLevel = true;
24642             switch (scriptKind) {
24643                 case 1:
24644                 case 2:
24645                     contextFlags = 131072;
24646                     break;
24647                 case 6:
24648                     contextFlags = 131072 | 33554432;
24649                     break;
24650                 default:
24651                     contextFlags = 0;
24652                     break;
24653             }
24654             parseErrorBeforeNextFinishedNode = false;
24655             scanner.setText(sourceText);
24656             scanner.setOnError(scanError);
24657             scanner.setScriptTarget(languageVersion);
24658             scanner.setLanguageVariant(languageVariant);
24659         }
24660         function clearState() {
24661             scanner.clearCommentDirectives();
24662             scanner.setText("");
24663             scanner.setOnError(undefined);
24664             sourceText = undefined;
24665             languageVersion = undefined;
24666             syntaxCursor = undefined;
24667             scriptKind = undefined;
24668             languageVariant = undefined;
24669             sourceFlags = 0;
24670             parseDiagnostics = undefined;
24671             jsDocDiagnostics = undefined;
24672             parsingContext = 0;
24673             identifiers = undefined;
24674             notParenthesizedArrow = undefined;
24675             topLevel = true;
24676         }
24677         function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind) {
24678             var isDeclarationFile = isDeclarationFileName(fileName);
24679             if (isDeclarationFile) {
24680                 contextFlags |= 8388608;
24681             }
24682             sourceFlags = contextFlags;
24683             nextToken();
24684             var statements = parseList(0, parseStatement);
24685             ts.Debug.assert(token() === 1);
24686             var endOfFileToken = addJSDocComment(parseTokenNode());
24687             var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags);
24688             processCommentPragmas(sourceFile, sourceText);
24689             processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
24690             sourceFile.commentDirectives = scanner.getCommentDirectives();
24691             sourceFile.nodeCount = nodeCount;
24692             sourceFile.identifierCount = identifierCount;
24693             sourceFile.identifiers = identifiers;
24694             sourceFile.parseDiagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
24695             if (jsDocDiagnostics) {
24696                 sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
24697             }
24698             if (setParentNodes) {
24699                 fixupParentReferences(sourceFile);
24700             }
24701             return sourceFile;
24702             function reportPragmaDiagnostic(pos, end, diagnostic) {
24703                 parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, pos, end, diagnostic));
24704             }
24705         }
24706         function withJSDoc(node, hasJSDoc) {
24707             return hasJSDoc ? addJSDocComment(node) : node;
24708         }
24709         var hasDeprecatedTag = false;
24710         function addJSDocComment(node) {
24711             ts.Debug.assert(!node.jsDoc);
24712             var jsDoc = ts.mapDefined(ts.getJSDocCommentRanges(node, sourceText), function (comment) { return JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); });
24713             if (jsDoc.length)
24714                 node.jsDoc = jsDoc;
24715             if (hasDeprecatedTag) {
24716                 hasDeprecatedTag = false;
24717                 node.flags |= 134217728;
24718             }
24719             return node;
24720         }
24721         function reparseTopLevelAwait(sourceFile) {
24722             var savedSyntaxCursor = syntaxCursor;
24723             var baseSyntaxCursor = IncrementalParser.createSyntaxCursor(sourceFile);
24724             syntaxCursor = { currentNode: currentNode };
24725             var statements = [];
24726             var savedParseDiagnostics = parseDiagnostics;
24727             parseDiagnostics = [];
24728             var pos = 0;
24729             var start = findNextStatementWithAwait(sourceFile.statements, 0);
24730             var _loop_3 = function () {
24731                 var prevStatement = sourceFile.statements[pos];
24732                 var nextStatement = sourceFile.statements[start];
24733                 ts.addRange(statements, sourceFile.statements, pos, start);
24734                 pos = findNextStatementWithoutAwait(sourceFile.statements, start);
24735                 var diagnosticStart = ts.findIndex(savedParseDiagnostics, function (diagnostic) { return diagnostic.start >= prevStatement.pos; });
24736                 var diagnosticEnd = diagnosticStart >= 0 ? ts.findIndex(savedParseDiagnostics, function (diagnostic) { return diagnostic.start >= nextStatement.pos; }, diagnosticStart) : -1;
24737                 if (diagnosticStart >= 0) {
24738                     ts.addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart, diagnosticEnd >= 0 ? diagnosticEnd : undefined);
24739                 }
24740                 speculationHelper(function () {
24741                     var savedContextFlags = contextFlags;
24742                     contextFlags |= 32768;
24743                     scanner.setTextPos(nextStatement.pos);
24744                     nextToken();
24745                     while (token() !== 1) {
24746                         var startPos = scanner.getStartPos();
24747                         var statement = parseListElement(0, parseStatement);
24748                         statements.push(statement);
24749                         if (startPos === scanner.getStartPos()) {
24750                             nextToken();
24751                         }
24752                         if (pos >= 0) {
24753                             var nonAwaitStatement = sourceFile.statements[pos];
24754                             if (statement.end === nonAwaitStatement.pos) {
24755                                 break;
24756                             }
24757                             if (statement.end > nonAwaitStatement.pos) {
24758                                 pos = findNextStatementWithoutAwait(sourceFile.statements, pos + 1);
24759                             }
24760                         }
24761                     }
24762                     contextFlags = savedContextFlags;
24763                 }, 2);
24764                 start = pos >= 0 ? findNextStatementWithAwait(sourceFile.statements, pos) : -1;
24765             };
24766             while (start !== -1) {
24767                 _loop_3();
24768             }
24769             if (pos >= 0) {
24770                 var prevStatement_1 = sourceFile.statements[pos];
24771                 ts.addRange(statements, sourceFile.statements, pos);
24772                 var diagnosticStart = ts.findIndex(savedParseDiagnostics, function (diagnostic) { return diagnostic.start >= prevStatement_1.pos; });
24773                 if (diagnosticStart >= 0) {
24774                     ts.addRange(parseDiagnostics, savedParseDiagnostics, diagnosticStart);
24775                 }
24776             }
24777             syntaxCursor = savedSyntaxCursor;
24778             return factory.updateSourceFile(sourceFile, ts.setTextRange(factory.createNodeArray(statements), sourceFile.statements));
24779             function containsPossibleTopLevelAwait(node) {
24780                 return !(node.flags & 32768)
24781                     && !!(node.transformFlags & 16777216);
24782             }
24783             function findNextStatementWithAwait(statements, start) {
24784                 for (var i = start; i < statements.length; i++) {
24785                     if (containsPossibleTopLevelAwait(statements[i])) {
24786                         return i;
24787                     }
24788                 }
24789                 return -1;
24790             }
24791             function findNextStatementWithoutAwait(statements, start) {
24792                 for (var i = start; i < statements.length; i++) {
24793                     if (!containsPossibleTopLevelAwait(statements[i])) {
24794                         return i;
24795                     }
24796                 }
24797                 return -1;
24798             }
24799             function currentNode(position) {
24800                 var node = baseSyntaxCursor.currentNode(position);
24801                 if (topLevel && node && containsPossibleTopLevelAwait(node)) {
24802                     node.intersectsChange = true;
24803                 }
24804                 return node;
24805             }
24806         }
24807         function fixupParentReferences(rootNode) {
24808             ts.setParentRecursive(rootNode, true);
24809         }
24810         Parser.fixupParentReferences = fixupParentReferences;
24811         function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, flags) {
24812             var sourceFile = factory.createSourceFile(statements, endOfFileToken, flags);
24813             ts.setTextRangePosWidth(sourceFile, 0, sourceText.length);
24814             setExternalModuleIndicator(sourceFile);
24815             if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 16777216) {
24816                 sourceFile = reparseTopLevelAwait(sourceFile);
24817             }
24818             sourceFile.text = sourceText;
24819             sourceFile.bindDiagnostics = [];
24820             sourceFile.bindSuggestionDiagnostics = undefined;
24821             sourceFile.languageVersion = languageVersion;
24822             sourceFile.fileName = fileName;
24823             sourceFile.languageVariant = ts.getLanguageVariant(scriptKind);
24824             sourceFile.isDeclarationFile = isDeclarationFile;
24825             sourceFile.scriptKind = scriptKind;
24826             return sourceFile;
24827         }
24828         function setContextFlag(val, flag) {
24829             if (val) {
24830                 contextFlags |= flag;
24831             }
24832             else {
24833                 contextFlags &= ~flag;
24834             }
24835         }
24836         function setDisallowInContext(val) {
24837             setContextFlag(val, 4096);
24838         }
24839         function setYieldContext(val) {
24840             setContextFlag(val, 8192);
24841         }
24842         function setDecoratorContext(val) {
24843             setContextFlag(val, 16384);
24844         }
24845         function setAwaitContext(val) {
24846             setContextFlag(val, 32768);
24847         }
24848         function doOutsideOfContext(context, func) {
24849             var contextFlagsToClear = context & contextFlags;
24850             if (contextFlagsToClear) {
24851                 setContextFlag(false, contextFlagsToClear);
24852                 var result = func();
24853                 setContextFlag(true, contextFlagsToClear);
24854                 return result;
24855             }
24856             return func();
24857         }
24858         function doInsideOfContext(context, func) {
24859             var contextFlagsToSet = context & ~contextFlags;
24860             if (contextFlagsToSet) {
24861                 setContextFlag(true, contextFlagsToSet);
24862                 var result = func();
24863                 setContextFlag(false, contextFlagsToSet);
24864                 return result;
24865             }
24866             return func();
24867         }
24868         function allowInAnd(func) {
24869             return doOutsideOfContext(4096, func);
24870         }
24871         function disallowInAnd(func) {
24872             return doInsideOfContext(4096, func);
24873         }
24874         function doInYieldContext(func) {
24875             return doInsideOfContext(8192, func);
24876         }
24877         function doInDecoratorContext(func) {
24878             return doInsideOfContext(16384, func);
24879         }
24880         function doInAwaitContext(func) {
24881             return doInsideOfContext(32768, func);
24882         }
24883         function doOutsideOfAwaitContext(func) {
24884             return doOutsideOfContext(32768, func);
24885         }
24886         function doInYieldAndAwaitContext(func) {
24887             return doInsideOfContext(8192 | 32768, func);
24888         }
24889         function doOutsideOfYieldAndAwaitContext(func) {
24890             return doOutsideOfContext(8192 | 32768, func);
24891         }
24892         function inContext(flags) {
24893             return (contextFlags & flags) !== 0;
24894         }
24895         function inYieldContext() {
24896             return inContext(8192);
24897         }
24898         function inDisallowInContext() {
24899             return inContext(4096);
24900         }
24901         function inDecoratorContext() {
24902             return inContext(16384);
24903         }
24904         function inAwaitContext() {
24905             return inContext(32768);
24906         }
24907         function parseErrorAtCurrentToken(message, arg0) {
24908             parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
24909         }
24910         function parseErrorAtPosition(start, length, message, arg0) {
24911             var lastError = ts.lastOrUndefined(parseDiagnostics);
24912             if (!lastError || start !== lastError.start) {
24913                 parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
24914             }
24915             parseErrorBeforeNextFinishedNode = true;
24916         }
24917         function parseErrorAt(start, end, message, arg0) {
24918             parseErrorAtPosition(start, end - start, message, arg0);
24919         }
24920         function parseErrorAtRange(range, message, arg0) {
24921             parseErrorAt(range.pos, range.end, message, arg0);
24922         }
24923         function scanError(message, length) {
24924             parseErrorAtPosition(scanner.getTextPos(), length, message);
24925         }
24926         function getNodePos() {
24927             return scanner.getStartPos();
24928         }
24929         function hasPrecedingJSDocComment() {
24930             return scanner.hasPrecedingJSDocComment();
24931         }
24932         function token() {
24933             return currentToken;
24934         }
24935         function nextTokenWithoutCheck() {
24936             return currentToken = scanner.scan();
24937         }
24938         function nextTokenAnd(func) {
24939             nextToken();
24940             return func();
24941         }
24942         function nextToken() {
24943             if (ts.isKeyword(currentToken) && (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape())) {
24944                 parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), ts.Diagnostics.Keywords_cannot_contain_escape_characters);
24945             }
24946             return nextTokenWithoutCheck();
24947         }
24948         function nextTokenJSDoc() {
24949             return currentToken = scanner.scanJsDocToken();
24950         }
24951         function reScanGreaterToken() {
24952             return currentToken = scanner.reScanGreaterToken();
24953         }
24954         function reScanSlashToken() {
24955             return currentToken = scanner.reScanSlashToken();
24956         }
24957         function reScanTemplateToken(isTaggedTemplate) {
24958             return currentToken = scanner.reScanTemplateToken(isTaggedTemplate);
24959         }
24960         function reScanTemplateHeadOrNoSubstitutionTemplate() {
24961             return currentToken = scanner.reScanTemplateHeadOrNoSubstitutionTemplate();
24962         }
24963         function reScanLessThanToken() {
24964             return currentToken = scanner.reScanLessThanToken();
24965         }
24966         function reScanHashToken() {
24967             return currentToken = scanner.reScanHashToken();
24968         }
24969         function scanJsxIdentifier() {
24970             return currentToken = scanner.scanJsxIdentifier();
24971         }
24972         function scanJsxText() {
24973             return currentToken = scanner.scanJsxToken();
24974         }
24975         function scanJsxAttributeValue() {
24976             return currentToken = scanner.scanJsxAttributeValue();
24977         }
24978         function speculationHelper(callback, speculationKind) {
24979             var saveToken = currentToken;
24980             var saveParseDiagnosticsLength = parseDiagnostics.length;
24981             var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
24982             var saveContextFlags = contextFlags;
24983             var result = speculationKind !== 0
24984                 ? scanner.lookAhead(callback)
24985                 : scanner.tryScan(callback);
24986             ts.Debug.assert(saveContextFlags === contextFlags);
24987             if (!result || speculationKind !== 0) {
24988                 currentToken = saveToken;
24989                 if (speculationKind !== 2) {
24990                     parseDiagnostics.length = saveParseDiagnosticsLength;
24991                 }
24992                 parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
24993             }
24994             return result;
24995         }
24996         function lookAhead(callback) {
24997             return speculationHelper(callback, 1);
24998         }
24999         function tryParse(callback) {
25000             return speculationHelper(callback, 0);
25001         }
25002         function isBindingIdentifier() {
25003             if (token() === 79) {
25004                 return true;
25005             }
25006             return token() > 116;
25007         }
25008         function isIdentifier() {
25009             if (token() === 79) {
25010                 return true;
25011             }
25012             if (token() === 125 && inYieldContext()) {
25013                 return false;
25014             }
25015             if (token() === 132 && inAwaitContext()) {
25016                 return false;
25017             }
25018             return token() > 116;
25019         }
25020         function parseExpected(kind, diagnosticMessage, shouldAdvance) {
25021             if (shouldAdvance === void 0) { shouldAdvance = true; }
25022             if (token() === kind) {
25023                 if (shouldAdvance) {
25024                     nextToken();
25025                 }
25026                 return true;
25027             }
25028             if (diagnosticMessage) {
25029                 parseErrorAtCurrentToken(diagnosticMessage);
25030             }
25031             else {
25032                 parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
25033             }
25034             return false;
25035         }
25036         var viableKeywordSuggestions = Object.keys(ts.textToKeywordObj).filter(function (keyword) { return keyword.length > 2; });
25037         function parseErrorForMissingSemicolonAfter(node) {
25038             var _a;
25039             if (ts.isTaggedTemplateExpression(node)) {
25040                 parseErrorAt(ts.skipTrivia(sourceText, node.template.pos), node.template.end, ts.Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings);
25041                 return;
25042             }
25043             var expressionText = ts.isIdentifier(node) ? ts.idText(node) : undefined;
25044             if (!expressionText || !ts.isIdentifierText(expressionText, languageVersion)) {
25045                 parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25046                 return;
25047             }
25048             var pos = ts.skipTrivia(sourceText, node.pos);
25049             switch (expressionText) {
25050                 case "const":
25051                 case "let":
25052                 case "var":
25053                     parseErrorAt(pos, node.end, ts.Diagnostics.Variable_declaration_not_allowed_at_this_location);
25054                     return;
25055                 case "declare":
25056                     return;
25057                 case "interface":
25058                     parseErrorForInvalidName(ts.Diagnostics.Interface_name_cannot_be_0, ts.Diagnostics.Interface_must_be_given_a_name, 18);
25059                     return;
25060                 case "is":
25061                     parseErrorAt(pos, scanner.getTextPos(), ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
25062                     return;
25063                 case "module":
25064                 case "namespace":
25065                     parseErrorForInvalidName(ts.Diagnostics.Namespace_name_cannot_be_0, ts.Diagnostics.Namespace_must_be_given_a_name, 18);
25066                     return;
25067                 case "type":
25068                     parseErrorForInvalidName(ts.Diagnostics.Type_alias_name_cannot_be_0, ts.Diagnostics.Type_alias_must_be_given_a_name, 63);
25069                     return;
25070             }
25071             var suggestion = (_a = ts.getSpellingSuggestion(expressionText, viableKeywordSuggestions, function (n) { return n; })) !== null && _a !== void 0 ? _a : getSpaceSuggestion(expressionText);
25072             if (suggestion) {
25073                 parseErrorAt(pos, node.end, ts.Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
25074                 return;
25075             }
25076             if (token() === 0) {
25077                 return;
25078             }
25079             parseErrorAt(pos, node.end, ts.Diagnostics.Unexpected_keyword_or_identifier);
25080         }
25081         function parseErrorForInvalidName(nameDiagnostic, blankDiagnostic, tokenIfBlankName) {
25082             if (token() === tokenIfBlankName) {
25083                 parseErrorAtCurrentToken(blankDiagnostic);
25084             }
25085             else {
25086                 parseErrorAtCurrentToken(nameDiagnostic, scanner.getTokenValue());
25087             }
25088         }
25089         function getSpaceSuggestion(expressionText) {
25090             for (var _i = 0, viableKeywordSuggestions_1 = viableKeywordSuggestions; _i < viableKeywordSuggestions_1.length; _i++) {
25091                 var keyword = viableKeywordSuggestions_1[_i];
25092                 if (expressionText.length > keyword.length + 2 && ts.startsWith(expressionText, keyword)) {
25093                     return "".concat(keyword, " ").concat(expressionText.slice(keyword.length));
25094                 }
25095             }
25096             return undefined;
25097         }
25098         function parseSemicolonAfterPropertyName(name, type, initializer) {
25099             if (token() === 59 && !scanner.hasPrecedingLineBreak()) {
25100                 parseErrorAtCurrentToken(ts.Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations);
25101                 return;
25102             }
25103             if (token() === 20) {
25104                 parseErrorAtCurrentToken(ts.Diagnostics.Cannot_start_a_function_call_in_a_type_annotation);
25105                 nextToken();
25106                 return;
25107             }
25108             if (type && !canParseSemicolon()) {
25109                 if (initializer) {
25110                     parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25111                 }
25112                 else {
25113                     parseErrorAtCurrentToken(ts.Diagnostics.Expected_for_property_initializer);
25114                 }
25115                 return;
25116             }
25117             if (tryParseSemicolon()) {
25118                 return;
25119             }
25120             if (initializer) {
25121                 if (token() === 18) {
25122                     parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25123                 }
25124                 return;
25125             }
25126             parseErrorForMissingSemicolonAfter(name);
25127         }
25128         function parseExpectedJSDoc(kind) {
25129             if (token() === kind) {
25130                 nextTokenJSDoc();
25131                 return true;
25132             }
25133             parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
25134             return false;
25135         }
25136         function parseOptional(t) {
25137             if (token() === t) {
25138                 nextToken();
25139                 return true;
25140             }
25141             return false;
25142         }
25143         function parseOptionalToken(t) {
25144             if (token() === t) {
25145                 return parseTokenNode();
25146             }
25147             return undefined;
25148         }
25149         function parseOptionalTokenJSDoc(t) {
25150             if (token() === t) {
25151                 return parseTokenNodeJSDoc();
25152             }
25153             return undefined;
25154         }
25155         function parseExpectedToken(t, diagnosticMessage, arg0) {
25156             return parseOptionalToken(t) ||
25157                 createMissingNode(t, false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
25158         }
25159         function parseExpectedTokenJSDoc(t) {
25160             return parseOptionalTokenJSDoc(t) ||
25161                 createMissingNode(t, false, ts.Diagnostics._0_expected, ts.tokenToString(t));
25162         }
25163         function parseTokenNode() {
25164             var pos = getNodePos();
25165             var kind = token();
25166             nextToken();
25167             return finishNode(factory.createToken(kind), pos);
25168         }
25169         function parseTokenNodeJSDoc() {
25170             var pos = getNodePos();
25171             var kind = token();
25172             nextTokenJSDoc();
25173             return finishNode(factory.createToken(kind), pos);
25174         }
25175         function canParseSemicolon() {
25176             if (token() === 26) {
25177                 return true;
25178             }
25179             return token() === 19 || token() === 1 || scanner.hasPrecedingLineBreak();
25180         }
25181         function tryParseSemicolon() {
25182             if (!canParseSemicolon()) {
25183                 return false;
25184             }
25185             if (token() === 26) {
25186                 nextToken();
25187             }
25188             return true;
25189         }
25190         function parseSemicolon() {
25191             return tryParseSemicolon() || parseExpected(26);
25192         }
25193         function createNodeArray(elements, pos, end, hasTrailingComma) {
25194             var array = factory.createNodeArray(elements, hasTrailingComma);
25195             ts.setTextRangePosEnd(array, pos, end !== null && end !== void 0 ? end : scanner.getStartPos());
25196             return array;
25197         }
25198         function finishNode(node, pos, end) {
25199             ts.setTextRangePosEnd(node, pos, end !== null && end !== void 0 ? end : scanner.getStartPos());
25200             if (contextFlags) {
25201                 node.flags |= contextFlags;
25202             }
25203             if (parseErrorBeforeNextFinishedNode) {
25204                 parseErrorBeforeNextFinishedNode = false;
25205                 node.flags |= 65536;
25206             }
25207             return node;
25208         }
25209         function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) {
25210             if (reportAtCurrentPosition) {
25211                 parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);
25212             }
25213             else if (diagnosticMessage) {
25214                 parseErrorAtCurrentToken(diagnosticMessage, arg0);
25215             }
25216             var pos = getNodePos();
25217             var result = kind === 79 ? factory.createIdentifier("", undefined, undefined) :
25218                 ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", undefined) :
25219                     kind === 8 ? factory.createNumericLiteral("", undefined) :
25220                         kind === 10 ? factory.createStringLiteral("", undefined) :
25221                             kind === 275 ? factory.createMissingDeclaration() :
25222                                 factory.createToken(kind);
25223             return finishNode(result, pos);
25224         }
25225         function internIdentifier(text) {
25226             var identifier = identifiers.get(text);
25227             if (identifier === undefined) {
25228                 identifiers.set(text, identifier = text);
25229             }
25230             return identifier;
25231         }
25232         function createIdentifier(isIdentifier, diagnosticMessage, privateIdentifierDiagnosticMessage) {
25233             if (isIdentifier) {
25234                 identifierCount++;
25235                 var pos = getNodePos();
25236                 var originalKeywordKind = token();
25237                 var text = internIdentifier(scanner.getTokenValue());
25238                 nextTokenWithoutCheck();
25239                 return finishNode(factory.createIdentifier(text, undefined, originalKeywordKind), pos);
25240             }
25241             if (token() === 80) {
25242                 parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
25243                 return createIdentifier(true);
25244             }
25245             if (token() === 0 && scanner.tryScan(function () { return scanner.reScanInvalidIdentifier() === 79; })) {
25246                 return createIdentifier(true);
25247             }
25248             identifierCount++;
25249             var reportAtCurrentPosition = token() === 1;
25250             var isReservedWord = scanner.isReservedWord();
25251             var msgArg = scanner.getTokenText();
25252             var defaultMessage = isReservedWord ?
25253                 ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here :
25254                 ts.Diagnostics.Identifier_expected;
25255             return createMissingNode(79, reportAtCurrentPosition, diagnosticMessage || defaultMessage, msgArg);
25256         }
25257         function parseBindingIdentifier(privateIdentifierDiagnosticMessage) {
25258             return createIdentifier(isBindingIdentifier(), undefined, privateIdentifierDiagnosticMessage);
25259         }
25260         function parseIdentifier(diagnosticMessage, privateIdentifierDiagnosticMessage) {
25261             return createIdentifier(isIdentifier(), diagnosticMessage, privateIdentifierDiagnosticMessage);
25262         }
25263         function parseIdentifierName(diagnosticMessage) {
25264             return createIdentifier(ts.tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
25265         }
25266         function isLiteralPropertyName() {
25267             return ts.tokenIsIdentifierOrKeyword(token()) ||
25268                 token() === 10 ||
25269                 token() === 8;
25270         }
25271         function isAssertionKey() {
25272             return ts.tokenIsIdentifierOrKeyword(token()) ||
25273                 token() === 10;
25274         }
25275         function parsePropertyNameWorker(allowComputedPropertyNames) {
25276             if (token() === 10 || token() === 8) {
25277                 var node = parseLiteralNode();
25278                 node.text = internIdentifier(node.text);
25279                 return node;
25280             }
25281             if (allowComputedPropertyNames && token() === 22) {
25282                 return parseComputedPropertyName();
25283             }
25284             if (token() === 80) {
25285                 return parsePrivateIdentifier();
25286             }
25287             return parseIdentifierName();
25288         }
25289         function parsePropertyName() {
25290             return parsePropertyNameWorker(true);
25291         }
25292         function parseComputedPropertyName() {
25293             var pos = getNodePos();
25294             parseExpected(22);
25295             var expression = allowInAnd(parseExpression);
25296             parseExpected(23);
25297             return finishNode(factory.createComputedPropertyName(expression), pos);
25298         }
25299         function internPrivateIdentifier(text) {
25300             var privateIdentifier = privateIdentifiers.get(text);
25301             if (privateIdentifier === undefined) {
25302                 privateIdentifiers.set(text, privateIdentifier = text);
25303             }
25304             return privateIdentifier;
25305         }
25306         function parsePrivateIdentifier() {
25307             var pos = getNodePos();
25308             var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText()));
25309             nextToken();
25310             return finishNode(node, pos);
25311         }
25312         function parseContextualModifier(t) {
25313             return token() === t && tryParse(nextTokenCanFollowModifier);
25314         }
25315         function nextTokenIsOnSameLineAndCanFollowModifier() {
25316             nextToken();
25317             if (scanner.hasPrecedingLineBreak()) {
25318                 return false;
25319             }
25320             return canFollowModifier();
25321         }
25322         function nextTokenCanFollowModifier() {
25323             switch (token()) {
25324                 case 85:
25325                     return nextToken() === 92;
25326                 case 93:
25327                     nextToken();
25328                     if (token() === 88) {
25329                         return lookAhead(nextTokenCanFollowDefaultKeyword);
25330                     }
25331                     if (token() === 151) {
25332                         return lookAhead(nextTokenCanFollowExportModifier);
25333                     }
25334                     return canFollowExportModifier();
25335                 case 88:
25336                     return nextTokenCanFollowDefaultKeyword();
25337                 case 124:
25338                 case 136:
25339                 case 148:
25340                     nextToken();
25341                     return canFollowModifier();
25342                 default:
25343                     return nextTokenIsOnSameLineAndCanFollowModifier();
25344             }
25345         }
25346         function canFollowExportModifier() {
25347             return token() !== 41
25348                 && token() !== 127
25349                 && token() !== 18
25350                 && canFollowModifier();
25351         }
25352         function nextTokenCanFollowExportModifier() {
25353             nextToken();
25354             return canFollowExportModifier();
25355         }
25356         function parseAnyContextualModifier() {
25357             return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier);
25358         }
25359         function canFollowModifier() {
25360             return token() === 22
25361                 || token() === 18
25362                 || token() === 41
25363                 || token() === 25
25364                 || isLiteralPropertyName();
25365         }
25366         function nextTokenCanFollowDefaultKeyword() {
25367             nextToken();
25368             return token() === 84 || token() === 98 ||
25369                 token() === 118 ||
25370                 (token() === 126 && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
25371                 (token() === 131 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
25372         }
25373         function isListElement(parsingContext, inErrorRecovery) {
25374             var node = currentNode(parsingContext);
25375             if (node) {
25376                 return true;
25377             }
25378             switch (parsingContext) {
25379                 case 0:
25380                 case 1:
25381                 case 3:
25382                     return !(token() === 26 && inErrorRecovery) && isStartOfStatement();
25383                 case 2:
25384                     return token() === 82 || token() === 88;
25385                 case 4:
25386                     return lookAhead(isTypeMemberStart);
25387                 case 5:
25388                     return lookAhead(isClassMemberStart) || (token() === 26 && !inErrorRecovery);
25389                 case 6:
25390                     return token() === 22 || isLiteralPropertyName();
25391                 case 12:
25392                     switch (token()) {
25393                         case 22:
25394                         case 41:
25395                         case 25:
25396                         case 24:
25397                             return true;
25398                         default:
25399                             return isLiteralPropertyName();
25400                     }
25401                 case 18:
25402                     return isLiteralPropertyName();
25403                 case 9:
25404                     return token() === 22 || token() === 25 || isLiteralPropertyName();
25405                 case 24:
25406                     return isAssertionKey();
25407                 case 7:
25408                     if (token() === 18) {
25409                         return lookAhead(isValidHeritageClauseObjectLiteral);
25410                     }
25411                     if (!inErrorRecovery) {
25412                         return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();
25413                     }
25414                     else {
25415                         return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();
25416                     }
25417                 case 8:
25418                     return isBindingIdentifierOrPrivateIdentifierOrPattern();
25419                 case 10:
25420                     return token() === 27 || token() === 25 || isBindingIdentifierOrPrivateIdentifierOrPattern();
25421                 case 19:
25422                     return isIdentifier();
25423                 case 15:
25424                     switch (token()) {
25425                         case 27:
25426                         case 24:
25427                             return true;
25428                     }
25429                 case 11:
25430                     return token() === 25 || isStartOfExpression();
25431                 case 16:
25432                     return isStartOfParameter(false);
25433                 case 17:
25434                     return isStartOfParameter(true);
25435                 case 20:
25436                 case 21:
25437                     return token() === 27 || isStartOfType();
25438                 case 22:
25439                     return isHeritageClause();
25440                 case 23:
25441                     return ts.tokenIsIdentifierOrKeyword(token());
25442                 case 13:
25443                     return ts.tokenIsIdentifierOrKeyword(token()) || token() === 18;
25444                 case 14:
25445                     return true;
25446             }
25447             return ts.Debug.fail("Non-exhaustive case in 'isListElement'.");
25448         }
25449         function isValidHeritageClauseObjectLiteral() {
25450             ts.Debug.assert(token() === 18);
25451             if (nextToken() === 19) {
25452                 var next = nextToken();
25453                 return next === 27 || next === 18 || next === 94 || next === 117;
25454             }
25455             return true;
25456         }
25457         function nextTokenIsIdentifier() {
25458             nextToken();
25459             return isIdentifier();
25460         }
25461         function nextTokenIsIdentifierOrKeyword() {
25462             nextToken();
25463             return ts.tokenIsIdentifierOrKeyword(token());
25464         }
25465         function nextTokenIsIdentifierOrKeywordOrGreaterThan() {
25466             nextToken();
25467             return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
25468         }
25469         function isHeritageClauseExtendsOrImplementsKeyword() {
25470             if (token() === 117 ||
25471                 token() === 94) {
25472                 return lookAhead(nextTokenIsStartOfExpression);
25473             }
25474             return false;
25475         }
25476         function nextTokenIsStartOfExpression() {
25477             nextToken();
25478             return isStartOfExpression();
25479         }
25480         function nextTokenIsStartOfType() {
25481             nextToken();
25482             return isStartOfType();
25483         }
25484         function isListTerminator(kind) {
25485             if (token() === 1) {
25486                 return true;
25487             }
25488             switch (kind) {
25489                 case 1:
25490                 case 2:
25491                 case 4:
25492                 case 5:
25493                 case 6:
25494                 case 12:
25495                 case 9:
25496                 case 23:
25497                 case 24:
25498                     return token() === 19;
25499                 case 3:
25500                     return token() === 19 || token() === 82 || token() === 88;
25501                 case 7:
25502                     return token() === 18 || token() === 94 || token() === 117;
25503                 case 8:
25504                     return isVariableDeclaratorListTerminator();
25505                 case 19:
25506                     return token() === 31 || token() === 20 || token() === 18 || token() === 94 || token() === 117;
25507                 case 11:
25508                     return token() === 21 || token() === 26;
25509                 case 15:
25510                 case 21:
25511                 case 10:
25512                     return token() === 23;
25513                 case 17:
25514                 case 16:
25515                 case 18:
25516                     return token() === 21 || token() === 23;
25517                 case 20:
25518                     return token() !== 27;
25519                 case 22:
25520                     return token() === 18 || token() === 19;
25521                 case 13:
25522                     return token() === 31 || token() === 43;
25523                 case 14:
25524                     return token() === 29 && lookAhead(nextTokenIsSlash);
25525                 default:
25526                     return false;
25527             }
25528         }
25529         function isVariableDeclaratorListTerminator() {
25530             if (canParseSemicolon()) {
25531                 return true;
25532             }
25533             if (isInOrOfKeyword(token())) {
25534                 return true;
25535             }
25536             if (token() === 38) {
25537                 return true;
25538             }
25539             return false;
25540         }
25541         function isInSomeParsingContext() {
25542             for (var kind = 0; kind < 25; kind++) {
25543                 if (parsingContext & (1 << kind)) {
25544                     if (isListElement(kind, true) || isListTerminator(kind)) {
25545                         return true;
25546                     }
25547                 }
25548             }
25549             return false;
25550         }
25551         function parseList(kind, parseElement) {
25552             var saveParsingContext = parsingContext;
25553             parsingContext |= 1 << kind;
25554             var list = [];
25555             var listPos = getNodePos();
25556             while (!isListTerminator(kind)) {
25557                 if (isListElement(kind, false)) {
25558                     list.push(parseListElement(kind, parseElement));
25559                     continue;
25560                 }
25561                 if (abortParsingListOrMoveToNextToken(kind)) {
25562                     break;
25563                 }
25564             }
25565             parsingContext = saveParsingContext;
25566             return createNodeArray(list, listPos);
25567         }
25568         function parseListElement(parsingContext, parseElement) {
25569             var node = currentNode(parsingContext);
25570             if (node) {
25571                 return consumeNode(node);
25572             }
25573             return parseElement();
25574         }
25575         function currentNode(parsingContext) {
25576             if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
25577                 return undefined;
25578             }
25579             var node = syntaxCursor.currentNode(scanner.getStartPos());
25580             if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
25581                 return undefined;
25582             }
25583             var nodeContextFlags = node.flags & 25358336;
25584             if (nodeContextFlags !== contextFlags) {
25585                 return undefined;
25586             }
25587             if (!canReuseNode(node, parsingContext)) {
25588                 return undefined;
25589             }
25590             if (node.jsDocCache) {
25591                 node.jsDocCache = undefined;
25592             }
25593             return node;
25594         }
25595         function consumeNode(node) {
25596             scanner.setTextPos(node.end);
25597             nextToken();
25598             return node;
25599         }
25600         function isReusableParsingContext(parsingContext) {
25601             switch (parsingContext) {
25602                 case 5:
25603                 case 2:
25604                 case 0:
25605                 case 1:
25606                 case 3:
25607                 case 6:
25608                 case 4:
25609                 case 8:
25610                 case 17:
25611                 case 16:
25612                     return true;
25613             }
25614             return false;
25615         }
25616         function canReuseNode(node, parsingContext) {
25617             switch (parsingContext) {
25618                 case 5:
25619                     return isReusableClassMember(node);
25620                 case 2:
25621                     return isReusableSwitchClause(node);
25622                 case 0:
25623                 case 1:
25624                 case 3:
25625                     return isReusableStatement(node);
25626                 case 6:
25627                     return isReusableEnumMember(node);
25628                 case 4:
25629                     return isReusableTypeMember(node);
25630                 case 8:
25631                     return isReusableVariableDeclaration(node);
25632                 case 17:
25633                 case 16:
25634                     return isReusableParameter(node);
25635             }
25636             return false;
25637         }
25638         function isReusableClassMember(node) {
25639             if (node) {
25640                 switch (node.kind) {
25641                     case 170:
25642                     case 175:
25643                     case 171:
25644                     case 172:
25645                     case 166:
25646                     case 233:
25647                         return true;
25648                     case 168:
25649                         var methodDeclaration = node;
25650                         var nameIsConstructor = methodDeclaration.name.kind === 79 &&
25651                             methodDeclaration.name.originalKeywordKind === 134;
25652                         return !nameIsConstructor;
25653                 }
25654             }
25655             return false;
25656         }
25657         function isReusableSwitchClause(node) {
25658             if (node) {
25659                 switch (node.kind) {
25660                     case 288:
25661                     case 289:
25662                         return true;
25663                 }
25664             }
25665             return false;
25666         }
25667         function isReusableStatement(node) {
25668             if (node) {
25669                 switch (node.kind) {
25670                     case 255:
25671                     case 236:
25672                     case 234:
25673                     case 238:
25674                     case 237:
25675                     case 250:
25676                     case 246:
25677                     case 248:
25678                     case 245:
25679                     case 244:
25680                     case 242:
25681                     case 243:
25682                     case 241:
25683                     case 240:
25684                     case 247:
25685                     case 235:
25686                     case 251:
25687                     case 249:
25688                     case 239:
25689                     case 252:
25690                     case 265:
25691                     case 264:
25692                     case 271:
25693                     case 270:
25694                     case 260:
25695                     case 256:
25696                     case 257:
25697                     case 259:
25698                     case 258:
25699                         return true;
25700                 }
25701             }
25702             return false;
25703         }
25704         function isReusableEnumMember(node) {
25705             return node.kind === 297;
25706         }
25707         function isReusableTypeMember(node) {
25708             if (node) {
25709                 switch (node.kind) {
25710                     case 174:
25711                     case 167:
25712                     case 175:
25713                     case 165:
25714                     case 173:
25715                         return true;
25716                 }
25717             }
25718             return false;
25719         }
25720         function isReusableVariableDeclaration(node) {
25721             if (node.kind !== 253) {
25722                 return false;
25723             }
25724             var variableDeclarator = node;
25725             return variableDeclarator.initializer === undefined;
25726         }
25727         function isReusableParameter(node) {
25728             if (node.kind !== 163) {
25729                 return false;
25730             }
25731             var parameter = node;
25732             return parameter.initializer === undefined;
25733         }
25734         function abortParsingListOrMoveToNextToken(kind) {
25735             parsingContextErrors(kind);
25736             if (isInSomeParsingContext()) {
25737                 return true;
25738             }
25739             nextToken();
25740             return false;
25741         }
25742         function parsingContextErrors(context) {
25743             switch (context) {
25744                 case 0:
25745                     return token() === 88
25746                         ? parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(93))
25747                         : parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected);
25748                 case 1: return parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected);
25749                 case 2: return parseErrorAtCurrentToken(ts.Diagnostics.case_or_default_expected);
25750                 case 3: return parseErrorAtCurrentToken(ts.Diagnostics.Statement_expected);
25751                 case 18:
25752                 case 4: return parseErrorAtCurrentToken(ts.Diagnostics.Property_or_signature_expected);
25753                 case 5: return parseErrorAtCurrentToken(ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
25754                 case 6: return parseErrorAtCurrentToken(ts.Diagnostics.Enum_member_expected);
25755                 case 7: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_expected);
25756                 case 8:
25757                     return ts.isKeyword(token())
25758                         ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, ts.tokenToString(token()))
25759                         : parseErrorAtCurrentToken(ts.Diagnostics.Variable_declaration_expected);
25760                 case 9: return parseErrorAtCurrentToken(ts.Diagnostics.Property_destructuring_pattern_expected);
25761                 case 10: return parseErrorAtCurrentToken(ts.Diagnostics.Array_element_destructuring_pattern_expected);
25762                 case 11: return parseErrorAtCurrentToken(ts.Diagnostics.Argument_expression_expected);
25763                 case 12: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
25764                 case 15: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
25765                 case 17: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
25766                 case 16:
25767                     return ts.isKeyword(token())
25768                         ? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
25769                         : parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
25770                 case 19: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
25771                 case 20: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
25772                 case 21: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
25773                 case 22: return parseErrorAtCurrentToken(ts.Diagnostics.Unexpected_token_expected);
25774                 case 23: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
25775                 case 13: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
25776                 case 14: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
25777                 default: return [undefined];
25778             }
25779         }
25780         function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
25781             var saveParsingContext = parsingContext;
25782             parsingContext |= 1 << kind;
25783             var list = [];
25784             var listPos = getNodePos();
25785             var commaStart = -1;
25786             while (true) {
25787                 if (isListElement(kind, false)) {
25788                     var startPos = scanner.getStartPos();
25789                     list.push(parseListElement(kind, parseElement));
25790                     commaStart = scanner.getTokenPos();
25791                     if (parseOptional(27)) {
25792                         continue;
25793                     }
25794                     commaStart = -1;
25795                     if (isListTerminator(kind)) {
25796                         break;
25797                     }
25798                     parseExpected(27, getExpectedCommaDiagnostic(kind));
25799                     if (considerSemicolonAsDelimiter && token() === 26 && !scanner.hasPrecedingLineBreak()) {
25800                         nextToken();
25801                     }
25802                     if (startPos === scanner.getStartPos()) {
25803                         nextToken();
25804                     }
25805                     continue;
25806                 }
25807                 if (isListTerminator(kind)) {
25808                     break;
25809                 }
25810                 if (abortParsingListOrMoveToNextToken(kind)) {
25811                     break;
25812                 }
25813             }
25814             parsingContext = saveParsingContext;
25815             return createNodeArray(list, listPos, undefined, commaStart >= 0);
25816         }
25817         function getExpectedCommaDiagnostic(kind) {
25818             return kind === 6 ? ts.Diagnostics.An_enum_member_name_must_be_followed_by_a_or : undefined;
25819         }
25820         function createMissingList() {
25821             var list = createNodeArray([], getNodePos());
25822             list.isMissingList = true;
25823             return list;
25824         }
25825         function isMissingList(arr) {
25826             return !!arr.isMissingList;
25827         }
25828         function parseBracketedList(kind, parseElement, open, close) {
25829             if (parseExpected(open)) {
25830                 var result = parseDelimitedList(kind, parseElement);
25831                 parseExpected(close);
25832                 return result;
25833             }
25834             return createMissingList();
25835         }
25836         function parseEntityName(allowReservedWords, diagnosticMessage) {
25837             var pos = getNodePos();
25838             var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
25839             var dotPos = getNodePos();
25840             while (parseOptional(24)) {
25841                 if (token() === 29) {
25842                     entity.jsdocDotPos = dotPos;
25843                     break;
25844                 }
25845                 dotPos = getNodePos();
25846                 entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, false)), pos);
25847             }
25848             return entity;
25849         }
25850         function createQualifiedName(entity, name) {
25851             return finishNode(factory.createQualifiedName(entity, name), entity.pos);
25852         }
25853         function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
25854             if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {
25855                 var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
25856                 if (matchesPattern) {
25857                     return createMissingNode(79, true, ts.Diagnostics.Identifier_expected);
25858                 }
25859             }
25860             if (token() === 80) {
25861                 var node = parsePrivateIdentifier();
25862                 return allowPrivateIdentifiers ? node : createMissingNode(79, true, ts.Diagnostics.Identifier_expected);
25863             }
25864             return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
25865         }
25866         function parseTemplateSpans(isTaggedTemplate) {
25867             var pos = getNodePos();
25868             var list = [];
25869             var node;
25870             do {
25871                 node = parseTemplateSpan(isTaggedTemplate);
25872                 list.push(node);
25873             } while (node.literal.kind === 16);
25874             return createNodeArray(list, pos);
25875         }
25876         function parseTemplateExpression(isTaggedTemplate) {
25877             var pos = getNodePos();
25878             return finishNode(factory.createTemplateExpression(parseTemplateHead(isTaggedTemplate), parseTemplateSpans(isTaggedTemplate)), pos);
25879         }
25880         function parseTemplateType() {
25881             var pos = getNodePos();
25882             return finishNode(factory.createTemplateLiteralType(parseTemplateHead(false), parseTemplateTypeSpans()), pos);
25883         }
25884         function parseTemplateTypeSpans() {
25885             var pos = getNodePos();
25886             var list = [];
25887             var node;
25888             do {
25889                 node = parseTemplateTypeSpan();
25890                 list.push(node);
25891             } while (node.literal.kind === 16);
25892             return createNodeArray(list, pos);
25893         }
25894         function parseTemplateTypeSpan() {
25895             var pos = getNodePos();
25896             return finishNode(factory.createTemplateLiteralTypeSpan(parseType(), parseLiteralOfTemplateSpan(false)), pos);
25897         }
25898         function parseLiteralOfTemplateSpan(isTaggedTemplate) {
25899             if (token() === 19) {
25900                 reScanTemplateToken(isTaggedTemplate);
25901                 return parseTemplateMiddleOrTemplateTail();
25902             }
25903             else {
25904                 return parseExpectedToken(17, ts.Diagnostics._0_expected, ts.tokenToString(19));
25905             }
25906         }
25907         function parseTemplateSpan(isTaggedTemplate) {
25908             var pos = getNodePos();
25909             return finishNode(factory.createTemplateSpan(allowInAnd(parseExpression), parseLiteralOfTemplateSpan(isTaggedTemplate)), pos);
25910         }
25911         function parseLiteralNode() {
25912             return parseLiteralLikeNode(token());
25913         }
25914         function parseTemplateHead(isTaggedTemplate) {
25915             if (isTaggedTemplate) {
25916                 reScanTemplateHeadOrNoSubstitutionTemplate();
25917             }
25918             var fragment = parseLiteralLikeNode(token());
25919             ts.Debug.assert(fragment.kind === 15, "Template head has wrong token kind");
25920             return fragment;
25921         }
25922         function parseTemplateMiddleOrTemplateTail() {
25923             var fragment = parseLiteralLikeNode(token());
25924             ts.Debug.assert(fragment.kind === 16 || fragment.kind === 17, "Template fragment has wrong token kind");
25925             return fragment;
25926         }
25927         function getTemplateLiteralRawText(kind) {
25928             var isLast = kind === 14 || kind === 17;
25929             var tokenText = scanner.getTokenText();
25930             return tokenText.substring(1, tokenText.length - (scanner.isUnterminated() ? 0 : isLast ? 1 : 2));
25931         }
25932         function parseLiteralLikeNode(kind) {
25933             var pos = getNodePos();
25934             var node = ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048) :
25935                 kind === 8 ? factory.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) :
25936                     kind === 10 ? factory.createStringLiteral(scanner.getTokenValue(), undefined, scanner.hasExtendedUnicodeEscape()) :
25937                         ts.isLiteralKind(kind) ? factory.createLiteralLikeNode(kind, scanner.getTokenValue()) :
25938                             ts.Debug.fail();
25939             if (scanner.hasExtendedUnicodeEscape()) {
25940                 node.hasExtendedUnicodeEscape = true;
25941             }
25942             if (scanner.isUnterminated()) {
25943                 node.isUnterminated = true;
25944             }
25945             nextToken();
25946             return finishNode(node, pos);
25947         }
25948         function parseEntityNameOfTypeReference() {
25949             return parseEntityName(true, ts.Diagnostics.Type_expected);
25950         }
25951         function parseTypeArgumentsOfTypeReference() {
25952             if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29) {
25953                 return parseBracketedList(20, parseType, 29, 31);
25954             }
25955         }
25956         function parseTypeReference() {
25957             var pos = getNodePos();
25958             return finishNode(factory.createTypeReferenceNode(parseEntityNameOfTypeReference(), parseTypeArgumentsOfTypeReference()), pos);
25959         }
25960         function typeHasArrowFunctionBlockingParseError(node) {
25961             switch (node.kind) {
25962                 case 177:
25963                     return ts.nodeIsMissing(node.typeName);
25964                 case 178:
25965                 case 179: {
25966                     var _a = node, parameters = _a.parameters, type = _a.type;
25967                     return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
25968                 }
25969                 case 190:
25970                     return typeHasArrowFunctionBlockingParseError(node.type);
25971                 default:
25972                     return false;
25973             }
25974         }
25975         function parseThisTypePredicate(lhs) {
25976             nextToken();
25977             return finishNode(factory.createTypePredicateNode(undefined, lhs, parseType()), lhs.pos);
25978         }
25979         function parseThisTypeNode() {
25980             var pos = getNodePos();
25981             nextToken();
25982             return finishNode(factory.createThisTypeNode(), pos);
25983         }
25984         function parseJSDocAllType() {
25985             var pos = getNodePos();
25986             nextToken();
25987             return finishNode(factory.createJSDocAllType(), pos);
25988         }
25989         function parseJSDocNonNullableType() {
25990             var pos = getNodePos();
25991             nextToken();
25992             return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos);
25993         }
25994         function parseJSDocUnknownOrNullableType() {
25995             var pos = getNodePos();
25996             nextToken();
25997             if (token() === 27 ||
25998                 token() === 19 ||
25999                 token() === 21 ||
26000                 token() === 31 ||
26001                 token() === 63 ||
26002                 token() === 51) {
26003                 return finishNode(factory.createJSDocUnknownType(), pos);
26004             }
26005             else {
26006                 return finishNode(factory.createJSDocNullableType(parseType()), pos);
26007             }
26008         }
26009         function parseJSDocFunctionType() {
26010             var pos = getNodePos();
26011             var hasJSDoc = hasPrecedingJSDocComment();
26012             if (lookAhead(nextTokenIsOpenParen)) {
26013                 nextToken();
26014                 var parameters = parseParameters(4 | 32);
26015                 var type = parseReturnType(58, false);
26016                 return withJSDoc(finishNode(factory.createJSDocFunctionType(parameters, type), pos), hasJSDoc);
26017             }
26018             return finishNode(factory.createTypeReferenceNode(parseIdentifierName(), undefined), pos);
26019         }
26020         function parseJSDocParameter() {
26021             var pos = getNodePos();
26022             var name;
26023             if (token() === 108 || token() === 103) {
26024                 name = parseIdentifierName();
26025                 parseExpected(58);
26026             }
26027             return finishNode(factory.createParameterDeclaration(undefined, undefined, undefined, name, undefined, parseJSDocType(), undefined), pos);
26028         }
26029         function parseJSDocType() {
26030             scanner.setInJSDocType(true);
26031             var pos = getNodePos();
26032             if (parseOptional(141)) {
26033                 var moduleTag = factory.createJSDocNamepathType(undefined);
26034                 terminate: while (true) {
26035                     switch (token()) {
26036                         case 19:
26037                         case 1:
26038                         case 27:
26039                         case 5:
26040                             break terminate;
26041                         default:
26042                             nextTokenJSDoc();
26043                     }
26044                 }
26045                 scanner.setInJSDocType(false);
26046                 return finishNode(moduleTag, pos);
26047             }
26048             var hasDotDotDot = parseOptional(25);
26049             var type = parseTypeOrTypePredicate();
26050             scanner.setInJSDocType(false);
26051             if (hasDotDotDot) {
26052                 type = finishNode(factory.createJSDocVariadicType(type), pos);
26053             }
26054             if (token() === 63) {
26055                 nextToken();
26056                 return finishNode(factory.createJSDocOptionalType(type), pos);
26057             }
26058             return type;
26059         }
26060         function parseTypeQuery() {
26061             var pos = getNodePos();
26062             parseExpected(112);
26063             return finishNode(factory.createTypeQueryNode(parseEntityName(true)), pos);
26064         }
26065         function parseTypeParameter() {
26066             var pos = getNodePos();
26067             var name = parseIdentifier();
26068             var constraint;
26069             var expression;
26070             if (parseOptional(94)) {
26071                 if (isStartOfType() || !isStartOfExpression()) {
26072                     constraint = parseType();
26073                 }
26074                 else {
26075                     expression = parseUnaryExpressionOrHigher();
26076                 }
26077             }
26078             var defaultType = parseOptional(63) ? parseType() : undefined;
26079             var node = factory.createTypeParameterDeclaration(name, constraint, defaultType);
26080             node.expression = expression;
26081             return finishNode(node, pos);
26082         }
26083         function parseTypeParameters() {
26084             if (token() === 29) {
26085                 return parseBracketedList(19, parseTypeParameter, 29, 31);
26086             }
26087         }
26088         function isStartOfParameter(isJSDocParameter) {
26089             return token() === 25 ||
26090                 isBindingIdentifierOrPrivateIdentifierOrPattern() ||
26091                 ts.isModifierKind(token()) ||
26092                 token() === 59 ||
26093                 isStartOfType(!isJSDocParameter);
26094         }
26095         function parseNameOfParameter(modifiers) {
26096             var name = parseIdentifierOrPattern(ts.Diagnostics.Private_identifiers_cannot_be_used_as_parameters);
26097             if (ts.getFullWidth(name) === 0 && !ts.some(modifiers) && ts.isModifierKind(token())) {
26098                 nextToken();
26099             }
26100             return name;
26101         }
26102         function parseParameterInOuterAwaitContext() {
26103             return parseParameterWorker(true);
26104         }
26105         function parseParameter() {
26106             return parseParameterWorker(false);
26107         }
26108         function parseParameterWorker(inOuterAwaitContext) {
26109             var pos = getNodePos();
26110             var hasJSDoc = hasPrecedingJSDocComment();
26111             var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
26112             if (token() === 108) {
26113                 var node_1 = factory.createParameterDeclaration(decorators, undefined, undefined, createIdentifier(true), undefined, parseTypeAnnotation(), undefined);
26114                 if (decorators) {
26115                     parseErrorAtRange(decorators[0], ts.Diagnostics.Decorators_may_not_be_applied_to_this_parameters);
26116                 }
26117                 return withJSDoc(finishNode(node_1, pos), hasJSDoc);
26118             }
26119             var savedTopLevel = topLevel;
26120             topLevel = false;
26121             var modifiers = parseModifiers();
26122             var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, parseOptionalToken(25), parseNameOfParameter(modifiers), parseOptionalToken(57), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
26123             topLevel = savedTopLevel;
26124             return node;
26125         }
26126         function parseReturnType(returnToken, isType) {
26127             if (shouldParseReturnType(returnToken, isType)) {
26128                 return parseTypeOrTypePredicate();
26129             }
26130         }
26131         function shouldParseReturnType(returnToken, isType) {
26132             if (returnToken === 38) {
26133                 parseExpected(returnToken);
26134                 return true;
26135             }
26136             else if (parseOptional(58)) {
26137                 return true;
26138             }
26139             else if (isType && token() === 38) {
26140                 parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(58));
26141                 nextToken();
26142                 return true;
26143             }
26144             return false;
26145         }
26146         function parseParametersWorker(flags) {
26147             var savedYieldContext = inYieldContext();
26148             var savedAwaitContext = inAwaitContext();
26149             setYieldContext(!!(flags & 1));
26150             setAwaitContext(!!(flags & 2));
26151             var parameters = flags & 32 ?
26152                 parseDelimitedList(17, parseJSDocParameter) :
26153                 parseDelimitedList(16, savedAwaitContext ? parseParameterInOuterAwaitContext : parseParameter);
26154             setYieldContext(savedYieldContext);
26155             setAwaitContext(savedAwaitContext);
26156             return parameters;
26157         }
26158         function parseParameters(flags) {
26159             if (!parseExpected(20)) {
26160                 return createMissingList();
26161             }
26162             var parameters = parseParametersWorker(flags);
26163             parseExpected(21);
26164             return parameters;
26165         }
26166         function parseTypeMemberSemicolon() {
26167             if (parseOptional(27)) {
26168                 return;
26169             }
26170             parseSemicolon();
26171         }
26172         function parseSignatureMember(kind) {
26173             var pos = getNodePos();
26174             var hasJSDoc = hasPrecedingJSDocComment();
26175             if (kind === 174) {
26176                 parseExpected(103);
26177             }
26178             var typeParameters = parseTypeParameters();
26179             var parameters = parseParameters(4);
26180             var type = parseReturnType(58, true);
26181             parseTypeMemberSemicolon();
26182             var node = kind === 173
26183                 ? factory.createCallSignature(typeParameters, parameters, type)
26184                 : factory.createConstructSignature(typeParameters, parameters, type);
26185             return withJSDoc(finishNode(node, pos), hasJSDoc);
26186         }
26187         function isIndexSignature() {
26188             return token() === 22 && lookAhead(isUnambiguouslyIndexSignature);
26189         }
26190         function isUnambiguouslyIndexSignature() {
26191             nextToken();
26192             if (token() === 25 || token() === 23) {
26193                 return true;
26194             }
26195             if (ts.isModifierKind(token())) {
26196                 nextToken();
26197                 if (isIdentifier()) {
26198                     return true;
26199                 }
26200             }
26201             else if (!isIdentifier()) {
26202                 return false;
26203             }
26204             else {
26205                 nextToken();
26206             }
26207             if (token() === 58 || token() === 27) {
26208                 return true;
26209             }
26210             if (token() !== 57) {
26211                 return false;
26212             }
26213             nextToken();
26214             return token() === 58 || token() === 27 || token() === 23;
26215         }
26216         function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) {
26217             var parameters = parseBracketedList(16, parseParameter, 22, 23);
26218             var type = parseTypeAnnotation();
26219             parseTypeMemberSemicolon();
26220             var node = factory.createIndexSignature(decorators, modifiers, parameters, type);
26221             return withJSDoc(finishNode(node, pos), hasJSDoc);
26222         }
26223         function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) {
26224             var name = parsePropertyName();
26225             var questionToken = parseOptionalToken(57);
26226             var node;
26227             if (token() === 20 || token() === 29) {
26228                 var typeParameters = parseTypeParameters();
26229                 var parameters = parseParameters(4);
26230                 var type = parseReturnType(58, true);
26231                 node = factory.createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type);
26232             }
26233             else {
26234                 var type = parseTypeAnnotation();
26235                 node = factory.createPropertySignature(modifiers, name, questionToken, type);
26236                 if (token() === 63)
26237                     node.initializer = parseInitializer();
26238             }
26239             parseTypeMemberSemicolon();
26240             return withJSDoc(finishNode(node, pos), hasJSDoc);
26241         }
26242         function isTypeMemberStart() {
26243             if (token() === 20 ||
26244                 token() === 29 ||
26245                 token() === 136 ||
26246                 token() === 148) {
26247                 return true;
26248             }
26249             var idToken = false;
26250             while (ts.isModifierKind(token())) {
26251                 idToken = true;
26252                 nextToken();
26253             }
26254             if (token() === 22) {
26255                 return true;
26256             }
26257             if (isLiteralPropertyName()) {
26258                 idToken = true;
26259                 nextToken();
26260             }
26261             if (idToken) {
26262                 return token() === 20 ||
26263                     token() === 29 ||
26264                     token() === 57 ||
26265                     token() === 58 ||
26266                     token() === 27 ||
26267                     canParseSemicolon();
26268             }
26269             return false;
26270         }
26271         function parseTypeMember() {
26272             if (token() === 20 || token() === 29) {
26273                 return parseSignatureMember(173);
26274             }
26275             if (token() === 103 && lookAhead(nextTokenIsOpenParenOrLessThan)) {
26276                 return parseSignatureMember(174);
26277             }
26278             var pos = getNodePos();
26279             var hasJSDoc = hasPrecedingJSDocComment();
26280             var modifiers = parseModifiers();
26281             if (parseContextualModifier(136)) {
26282                 return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 171);
26283             }
26284             if (parseContextualModifier(148)) {
26285                 return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172);
26286             }
26287             if (isIndexSignature()) {
26288                 return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers);
26289             }
26290             return parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers);
26291         }
26292         function nextTokenIsOpenParenOrLessThan() {
26293             nextToken();
26294             return token() === 20 || token() === 29;
26295         }
26296         function nextTokenIsDot() {
26297             return nextToken() === 24;
26298         }
26299         function nextTokenIsOpenParenOrLessThanOrDot() {
26300             switch (nextToken()) {
26301                 case 20:
26302                 case 29:
26303                 case 24:
26304                     return true;
26305             }
26306             return false;
26307         }
26308         function parseTypeLiteral() {
26309             var pos = getNodePos();
26310             return finishNode(factory.createTypeLiteralNode(parseObjectTypeMembers()), pos);
26311         }
26312         function parseObjectTypeMembers() {
26313             var members;
26314             if (parseExpected(18)) {
26315                 members = parseList(4, parseTypeMember);
26316                 parseExpected(19);
26317             }
26318             else {
26319                 members = createMissingList();
26320             }
26321             return members;
26322         }
26323         function isStartOfMappedType() {
26324             nextToken();
26325             if (token() === 39 || token() === 40) {
26326                 return nextToken() === 144;
26327             }
26328             if (token() === 144) {
26329                 nextToken();
26330             }
26331             return token() === 22 && nextTokenIsIdentifier() && nextToken() === 101;
26332         }
26333         function parseMappedTypeParameter() {
26334             var pos = getNodePos();
26335             var name = parseIdentifierName();
26336             parseExpected(101);
26337             var type = parseType();
26338             return finishNode(factory.createTypeParameterDeclaration(name, type, undefined), pos);
26339         }
26340         function parseMappedType() {
26341             var pos = getNodePos();
26342             parseExpected(18);
26343             var readonlyToken;
26344             if (token() === 144 || token() === 39 || token() === 40) {
26345                 readonlyToken = parseTokenNode();
26346                 if (readonlyToken.kind !== 144) {
26347                     parseExpected(144);
26348                 }
26349             }
26350             parseExpected(22);
26351             var typeParameter = parseMappedTypeParameter();
26352             var nameType = parseOptional(127) ? parseType() : undefined;
26353             parseExpected(23);
26354             var questionToken;
26355             if (token() === 57 || token() === 39 || token() === 40) {
26356                 questionToken = parseTokenNode();
26357                 if (questionToken.kind !== 57) {
26358                     parseExpected(57);
26359                 }
26360             }
26361             var type = parseTypeAnnotation();
26362             parseSemicolon();
26363             var members = parseList(4, parseTypeMember);
26364             parseExpected(19);
26365             return finishNode(factory.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
26366         }
26367         function parseTupleElementType() {
26368             var pos = getNodePos();
26369             if (parseOptional(25)) {
26370                 return finishNode(factory.createRestTypeNode(parseType()), pos);
26371             }
26372             var type = parseType();
26373             if (ts.isJSDocNullableType(type) && type.pos === type.type.pos) {
26374                 var node = factory.createOptionalTypeNode(type.type);
26375                 ts.setTextRange(node, type);
26376                 node.flags = type.flags;
26377                 return node;
26378             }
26379             return type;
26380         }
26381         function isNextTokenColonOrQuestionColon() {
26382             return nextToken() === 58 || (token() === 57 && nextToken() === 58);
26383         }
26384         function isTupleElementName() {
26385             if (token() === 25) {
26386                 return ts.tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
26387             }
26388             return ts.tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
26389         }
26390         function parseTupleElementNameOrTupleElementType() {
26391             if (lookAhead(isTupleElementName)) {
26392                 var pos = getNodePos();
26393                 var hasJSDoc = hasPrecedingJSDocComment();
26394                 var dotDotDotToken = parseOptionalToken(25);
26395                 var name = parseIdentifierName();
26396                 var questionToken = parseOptionalToken(57);
26397                 parseExpected(58);
26398                 var type = parseTupleElementType();
26399                 var node = factory.createNamedTupleMember(dotDotDotToken, name, questionToken, type);
26400                 return withJSDoc(finishNode(node, pos), hasJSDoc);
26401             }
26402             return parseTupleElementType();
26403         }
26404         function parseTupleType() {
26405             var pos = getNodePos();
26406             return finishNode(factory.createTupleTypeNode(parseBracketedList(21, parseTupleElementNameOrTupleElementType, 22, 23)), pos);
26407         }
26408         function parseParenthesizedType() {
26409             var pos = getNodePos();
26410             parseExpected(20);
26411             var type = parseType();
26412             parseExpected(21);
26413             return finishNode(factory.createParenthesizedType(type), pos);
26414         }
26415         function parseModifiersForConstructorType() {
26416             var modifiers;
26417             if (token() === 126) {
26418                 var pos = getNodePos();
26419                 nextToken();
26420                 var modifier = finishNode(factory.createToken(126), pos);
26421                 modifiers = createNodeArray([modifier], pos);
26422             }
26423             return modifiers;
26424         }
26425         function parseFunctionOrConstructorType() {
26426             var pos = getNodePos();
26427             var hasJSDoc = hasPrecedingJSDocComment();
26428             var modifiers = parseModifiersForConstructorType();
26429             var isConstructorType = parseOptional(103);
26430             var typeParameters = parseTypeParameters();
26431             var parameters = parseParameters(4);
26432             var type = parseReturnType(38, false);
26433             var node = isConstructorType
26434                 ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, type)
26435                 : factory.createFunctionTypeNode(typeParameters, parameters, type);
26436             if (!isConstructorType)
26437                 node.modifiers = modifiers;
26438             return withJSDoc(finishNode(node, pos), hasJSDoc);
26439         }
26440         function parseKeywordAndNoDot() {
26441             var node = parseTokenNode();
26442             return token() === 24 ? undefined : node;
26443         }
26444         function parseLiteralTypeNode(negative) {
26445             var pos = getNodePos();
26446             if (negative) {
26447                 nextToken();
26448             }
26449             var expression = token() === 110 || token() === 95 || token() === 104 ?
26450                 parseTokenNode() :
26451                 parseLiteralLikeNode(token());
26452             if (negative) {
26453                 expression = finishNode(factory.createPrefixUnaryExpression(40, expression), pos);
26454             }
26455             return finishNode(factory.createLiteralTypeNode(expression), pos);
26456         }
26457         function isStartOfTypeOfImportType() {
26458             nextToken();
26459             return token() === 100;
26460         }
26461         function parseImportType() {
26462             sourceFlags |= 1048576;
26463             var pos = getNodePos();
26464             var isTypeOf = parseOptional(112);
26465             parseExpected(100);
26466             parseExpected(20);
26467             var type = parseType();
26468             parseExpected(21);
26469             var qualifier = parseOptional(24) ? parseEntityNameOfTypeReference() : undefined;
26470             var typeArguments = parseTypeArgumentsOfTypeReference();
26471             return finishNode(factory.createImportTypeNode(type, qualifier, typeArguments, isTypeOf), pos);
26472         }
26473         function nextTokenIsNumericOrBigIntLiteral() {
26474             nextToken();
26475             return token() === 8 || token() === 9;
26476         }
26477         function parseNonArrayType() {
26478             switch (token()) {
26479                 case 130:
26480                 case 154:
26481                 case 149:
26482                 case 146:
26483                 case 157:
26484                 case 150:
26485                 case 133:
26486                 case 152:
26487                 case 143:
26488                 case 147:
26489                     return tryParse(parseKeywordAndNoDot) || parseTypeReference();
26490                 case 66:
26491                     scanner.reScanAsteriskEqualsToken();
26492                 case 41:
26493                     return parseJSDocAllType();
26494                 case 60:
26495                     scanner.reScanQuestionToken();
26496                 case 57:
26497                     return parseJSDocUnknownOrNullableType();
26498                 case 98:
26499                     return parseJSDocFunctionType();
26500                 case 53:
26501                     return parseJSDocNonNullableType();
26502                 case 14:
26503                 case 10:
26504                 case 8:
26505                 case 9:
26506                 case 110:
26507                 case 95:
26508                 case 104:
26509                     return parseLiteralTypeNode();
26510                 case 40:
26511                     return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(true) : parseTypeReference();
26512                 case 114:
26513                     return parseTokenNode();
26514                 case 108: {
26515                     var thisKeyword = parseThisTypeNode();
26516                     if (token() === 139 && !scanner.hasPrecedingLineBreak()) {
26517                         return parseThisTypePredicate(thisKeyword);
26518                     }
26519                     else {
26520                         return thisKeyword;
26521                     }
26522                 }
26523                 case 112:
26524                     return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
26525                 case 18:
26526                     return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
26527                 case 22:
26528                     return parseTupleType();
26529                 case 20:
26530                     return parseParenthesizedType();
26531                 case 100:
26532                     return parseImportType();
26533                 case 128:
26534                     return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference();
26535                 case 15:
26536                     return parseTemplateType();
26537                 default:
26538                     return parseTypeReference();
26539             }
26540         }
26541         function isStartOfType(inStartOfParameter) {
26542             switch (token()) {
26543                 case 130:
26544                 case 154:
26545                 case 149:
26546                 case 146:
26547                 case 157:
26548                 case 133:
26549                 case 144:
26550                 case 150:
26551                 case 153:
26552                 case 114:
26553                 case 152:
26554                 case 104:
26555                 case 108:
26556                 case 112:
26557                 case 143:
26558                 case 18:
26559                 case 22:
26560                 case 29:
26561                 case 51:
26562                 case 50:
26563                 case 103:
26564                 case 10:
26565                 case 8:
26566                 case 9:
26567                 case 110:
26568                 case 95:
26569                 case 147:
26570                 case 41:
26571                 case 57:
26572                 case 53:
26573                 case 25:
26574                 case 137:
26575                 case 100:
26576                 case 128:
26577                 case 14:
26578                 case 15:
26579                     return true;
26580                 case 98:
26581                     return !inStartOfParameter;
26582                 case 40:
26583                     return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
26584                 case 20:
26585                     return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType);
26586                 default:
26587                     return isIdentifier();
26588             }
26589         }
26590         function isStartOfParenthesizedOrFunctionType() {
26591             nextToken();
26592             return token() === 21 || isStartOfParameter(false) || isStartOfType();
26593         }
26594         function parsePostfixTypeOrHigher() {
26595             var pos = getNodePos();
26596             var type = parseNonArrayType();
26597             while (!scanner.hasPrecedingLineBreak()) {
26598                 switch (token()) {
26599                     case 53:
26600                         nextToken();
26601                         type = finishNode(factory.createJSDocNonNullableType(type), pos);
26602                         break;
26603                     case 57:
26604                         if (lookAhead(nextTokenIsStartOfType)) {
26605                             return type;
26606                         }
26607                         nextToken();
26608                         type = finishNode(factory.createJSDocNullableType(type), pos);
26609                         break;
26610                     case 22:
26611                         parseExpected(22);
26612                         if (isStartOfType()) {
26613                             var indexType = parseType();
26614                             parseExpected(23);
26615                             type = finishNode(factory.createIndexedAccessTypeNode(type, indexType), pos);
26616                         }
26617                         else {
26618                             parseExpected(23);
26619                             type = finishNode(factory.createArrayTypeNode(type), pos);
26620                         }
26621                         break;
26622                     default:
26623                         return type;
26624                 }
26625             }
26626             return type;
26627         }
26628         function parseTypeOperator(operator) {
26629             var pos = getNodePos();
26630             parseExpected(operator);
26631             return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
26632         }
26633         function parseTypeParameterOfInferType() {
26634             var pos = getNodePos();
26635             return finishNode(factory.createTypeParameterDeclaration(parseIdentifier(), undefined, undefined), pos);
26636         }
26637         function parseInferType() {
26638             var pos = getNodePos();
26639             parseExpected(137);
26640             return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos);
26641         }
26642         function parseTypeOperatorOrHigher() {
26643             var operator = token();
26644             switch (operator) {
26645                 case 140:
26646                 case 153:
26647                 case 144:
26648                     return parseTypeOperator(operator);
26649                 case 137:
26650                     return parseInferType();
26651             }
26652             return parsePostfixTypeOrHigher();
26653         }
26654         function parseFunctionOrConstructorTypeToError(isInUnionType) {
26655             if (isStartOfFunctionTypeOrConstructorType()) {
26656                 var type = parseFunctionOrConstructorType();
26657                 var diagnostic = void 0;
26658                 if (ts.isFunctionTypeNode(type)) {
26659                     diagnostic = isInUnionType
26660                         ? ts.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_a_union_type
26661                         : ts.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type;
26662                 }
26663                 else {
26664                     diagnostic = isInUnionType
26665                         ? ts.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type
26666                         : ts.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type;
26667                 }
26668                 parseErrorAtRange(type, diagnostic);
26669                 return type;
26670             }
26671             return undefined;
26672         }
26673         function parseUnionOrIntersectionType(operator, parseConstituentType, createTypeNode) {
26674             var pos = getNodePos();
26675             var isUnionType = operator === 51;
26676             var hasLeadingOperator = parseOptional(operator);
26677             var type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(isUnionType)
26678                 || parseConstituentType();
26679             if (token() === operator || hasLeadingOperator) {
26680                 var types = [type];
26681                 while (parseOptional(operator)) {
26682                     types.push(parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType());
26683                 }
26684                 type = finishNode(createTypeNode(createNodeArray(types, pos)), pos);
26685             }
26686             return type;
26687         }
26688         function parseIntersectionTypeOrHigher() {
26689             return parseUnionOrIntersectionType(50, parseTypeOperatorOrHigher, factory.createIntersectionTypeNode);
26690         }
26691         function parseUnionTypeOrHigher() {
26692             return parseUnionOrIntersectionType(51, parseIntersectionTypeOrHigher, factory.createUnionTypeNode);
26693         }
26694         function nextTokenIsNewKeyword() {
26695             nextToken();
26696             return token() === 103;
26697         }
26698         function isStartOfFunctionTypeOrConstructorType() {
26699             if (token() === 29) {
26700                 return true;
26701             }
26702             if (token() === 20 && lookAhead(isUnambiguouslyStartOfFunctionType)) {
26703                 return true;
26704             }
26705             return token() === 103 ||
26706                 token() === 126 && lookAhead(nextTokenIsNewKeyword);
26707         }
26708         function skipParameterStart() {
26709             if (ts.isModifierKind(token())) {
26710                 parseModifiers();
26711             }
26712             if (isIdentifier() || token() === 108) {
26713                 nextToken();
26714                 return true;
26715             }
26716             if (token() === 22 || token() === 18) {
26717                 var previousErrorCount = parseDiagnostics.length;
26718                 parseIdentifierOrPattern();
26719                 return previousErrorCount === parseDiagnostics.length;
26720             }
26721             return false;
26722         }
26723         function isUnambiguouslyStartOfFunctionType() {
26724             nextToken();
26725             if (token() === 21 || token() === 25) {
26726                 return true;
26727             }
26728             if (skipParameterStart()) {
26729                 if (token() === 58 || token() === 27 ||
26730                     token() === 57 || token() === 63) {
26731                     return true;
26732                 }
26733                 if (token() === 21) {
26734                     nextToken();
26735                     if (token() === 38) {
26736                         return true;
26737                     }
26738                 }
26739             }
26740             return false;
26741         }
26742         function parseTypeOrTypePredicate() {
26743             var pos = getNodePos();
26744             var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
26745             var type = parseType();
26746             if (typePredicateVariable) {
26747                 return finishNode(factory.createTypePredicateNode(undefined, typePredicateVariable, type), pos);
26748             }
26749             else {
26750                 return type;
26751             }
26752         }
26753         function parseTypePredicatePrefix() {
26754             var id = parseIdentifier();
26755             if (token() === 139 && !scanner.hasPrecedingLineBreak()) {
26756                 nextToken();
26757                 return id;
26758             }
26759         }
26760         function parseAssertsTypePredicate() {
26761             var pos = getNodePos();
26762             var assertsModifier = parseExpectedToken(128);
26763             var parameterName = token() === 108 ? parseThisTypeNode() : parseIdentifier();
26764             var type = parseOptional(139) ? parseType() : undefined;
26765             return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos);
26766         }
26767         function parseType() {
26768             return doOutsideOfContext(40960, parseTypeWorker);
26769         }
26770         function parseTypeWorker(noConditionalTypes) {
26771             if (isStartOfFunctionTypeOrConstructorType()) {
26772                 return parseFunctionOrConstructorType();
26773             }
26774             var pos = getNodePos();
26775             var type = parseUnionTypeOrHigher();
26776             if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(94)) {
26777                 var extendsType = parseTypeWorker(true);
26778                 parseExpected(57);
26779                 var trueType = parseTypeWorker();
26780                 parseExpected(58);
26781                 var falseType = parseTypeWorker();
26782                 return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos);
26783             }
26784             return type;
26785         }
26786         function parseTypeAnnotation() {
26787             return parseOptional(58) ? parseType() : undefined;
26788         }
26789         function isStartOfLeftHandSideExpression() {
26790             switch (token()) {
26791                 case 108:
26792                 case 106:
26793                 case 104:
26794                 case 110:
26795                 case 95:
26796                 case 8:
26797                 case 9:
26798                 case 10:
26799                 case 14:
26800                 case 15:
26801                 case 20:
26802                 case 22:
26803                 case 18:
26804                 case 98:
26805                 case 84:
26806                 case 103:
26807                 case 43:
26808                 case 68:
26809                 case 79:
26810                     return true;
26811                 case 100:
26812                     return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
26813                 default:
26814                     return isIdentifier();
26815             }
26816         }
26817         function isStartOfExpression() {
26818             if (isStartOfLeftHandSideExpression()) {
26819                 return true;
26820             }
26821             switch (token()) {
26822                 case 39:
26823                 case 40:
26824                 case 54:
26825                 case 53:
26826                 case 89:
26827                 case 112:
26828                 case 114:
26829                 case 45:
26830                 case 46:
26831                 case 29:
26832                 case 132:
26833                 case 125:
26834                 case 80:
26835                     return true;
26836                 default:
26837                     if (isBinaryOperator()) {
26838                         return true;
26839                     }
26840                     return isIdentifier();
26841             }
26842         }
26843         function isStartOfExpressionStatement() {
26844             return token() !== 18 &&
26845                 token() !== 98 &&
26846                 token() !== 84 &&
26847                 token() !== 59 &&
26848                 isStartOfExpression();
26849         }
26850         function parseExpression() {
26851             var saveDecoratorContext = inDecoratorContext();
26852             if (saveDecoratorContext) {
26853                 setDecoratorContext(false);
26854             }
26855             var pos = getNodePos();
26856             var expr = parseAssignmentExpressionOrHigher();
26857             var operatorToken;
26858             while ((operatorToken = parseOptionalToken(27))) {
26859                 expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
26860             }
26861             if (saveDecoratorContext) {
26862                 setDecoratorContext(true);
26863             }
26864             return expr;
26865         }
26866         function parseInitializer() {
26867             return parseOptional(63) ? parseAssignmentExpressionOrHigher() : undefined;
26868         }
26869         function parseAssignmentExpressionOrHigher() {
26870             if (isYieldExpression()) {
26871                 return parseYieldExpression();
26872             }
26873             var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
26874             if (arrowExpression) {
26875                 return arrowExpression;
26876             }
26877             var pos = getNodePos();
26878             var expr = parseBinaryExpressionOrHigher(0);
26879             if (expr.kind === 79 && token() === 38) {
26880                 return parseSimpleArrowFunctionExpression(pos, expr, undefined);
26881             }
26882             if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
26883                 return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
26884             }
26885             return parseConditionalExpressionRest(expr, pos);
26886         }
26887         function isYieldExpression() {
26888             if (token() === 125) {
26889                 if (inYieldContext()) {
26890                     return true;
26891                 }
26892                 return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
26893             }
26894             return false;
26895         }
26896         function nextTokenIsIdentifierOnSameLine() {
26897             nextToken();
26898             return !scanner.hasPrecedingLineBreak() && isIdentifier();
26899         }
26900         function parseYieldExpression() {
26901             var pos = getNodePos();
26902             nextToken();
26903             if (!scanner.hasPrecedingLineBreak() &&
26904                 (token() === 41 || isStartOfExpression())) {
26905                 return finishNode(factory.createYieldExpression(parseOptionalToken(41), parseAssignmentExpressionOrHigher()), pos);
26906             }
26907             else {
26908                 return finishNode(factory.createYieldExpression(undefined, undefined), pos);
26909             }
26910         }
26911         function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
26912             ts.Debug.assert(token() === 38, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
26913             var parameter = factory.createParameterDeclaration(undefined, undefined, undefined, identifier, undefined, undefined, undefined);
26914             finishNode(parameter, identifier.pos);
26915             var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
26916             var equalsGreaterThanToken = parseExpectedToken(38);
26917             var body = parseArrowFunctionExpressionBody(!!asyncModifier);
26918             var node = factory.createArrowFunction(asyncModifier, undefined, parameters, undefined, equalsGreaterThanToken, body);
26919             return addJSDocComment(finishNode(node, pos));
26920         }
26921         function tryParseParenthesizedArrowFunctionExpression() {
26922             var triState = isParenthesizedArrowFunctionExpression();
26923             if (triState === 0) {
26924                 return undefined;
26925             }
26926             return triState === 1 ?
26927                 parseParenthesizedArrowFunctionExpression(true) :
26928                 tryParse(parsePossibleParenthesizedArrowFunctionExpression);
26929         }
26930         function isParenthesizedArrowFunctionExpression() {
26931             if (token() === 20 || token() === 29 || token() === 131) {
26932                 return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
26933             }
26934             if (token() === 38) {
26935                 return 1;
26936             }
26937             return 0;
26938         }
26939         function isParenthesizedArrowFunctionExpressionWorker() {
26940             if (token() === 131) {
26941                 nextToken();
26942                 if (scanner.hasPrecedingLineBreak()) {
26943                     return 0;
26944                 }
26945                 if (token() !== 20 && token() !== 29) {
26946                     return 0;
26947                 }
26948             }
26949             var first = token();
26950             var second = nextToken();
26951             if (first === 20) {
26952                 if (second === 21) {
26953                     var third = nextToken();
26954                     switch (third) {
26955                         case 38:
26956                         case 58:
26957                         case 18:
26958                             return 1;
26959                         default:
26960                             return 0;
26961                     }
26962                 }
26963                 if (second === 22 || second === 18) {
26964                     return 2;
26965                 }
26966                 if (second === 25) {
26967                     return 1;
26968                 }
26969                 if (ts.isModifierKind(second) && second !== 131 && lookAhead(nextTokenIsIdentifier)) {
26970                     return 1;
26971                 }
26972                 if (!isIdentifier() && second !== 108) {
26973                     return 0;
26974                 }
26975                 switch (nextToken()) {
26976                     case 58:
26977                         return 1;
26978                     case 57:
26979                         nextToken();
26980                         if (token() === 58 || token() === 27 || token() === 63 || token() === 21) {
26981                             return 1;
26982                         }
26983                         return 0;
26984                     case 27:
26985                     case 63:
26986                     case 21:
26987                         return 2;
26988                 }
26989                 return 0;
26990             }
26991             else {
26992                 ts.Debug.assert(first === 29);
26993                 if (!isIdentifier()) {
26994                     return 0;
26995                 }
26996                 if (languageVariant === 1) {
26997                     var isArrowFunctionInJsx = lookAhead(function () {
26998                         var third = nextToken();
26999                         if (third === 94) {
27000                             var fourth = nextToken();
27001                             switch (fourth) {
27002                                 case 63:
27003                                 case 31:
27004                                     return false;
27005                                 default:
27006                                     return true;
27007                             }
27008                         }
27009                         else if (third === 27) {
27010                             return true;
27011                         }
27012                         return false;
27013                     });
27014                     if (isArrowFunctionInJsx) {
27015                         return 1;
27016                     }
27017                     return 0;
27018                 }
27019                 return 2;
27020             }
27021         }
27022         function parsePossibleParenthesizedArrowFunctionExpression() {
27023             var tokenPos = scanner.getTokenPos();
27024             if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
27025                 return undefined;
27026             }
27027             var result = parseParenthesizedArrowFunctionExpression(false);
27028             if (!result) {
27029                 (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
27030             }
27031             return result;
27032         }
27033         function tryParseAsyncSimpleArrowFunctionExpression() {
27034             if (token() === 131) {
27035                 if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
27036                     var pos = getNodePos();
27037                     var asyncModifier = parseModifiersForArrowFunction();
27038                     var expr = parseBinaryExpressionOrHigher(0);
27039                     return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
27040                 }
27041             }
27042             return undefined;
27043         }
27044         function isUnParenthesizedAsyncArrowFunctionWorker() {
27045             if (token() === 131) {
27046                 nextToken();
27047                 if (scanner.hasPrecedingLineBreak() || token() === 38) {
27048                     return 0;
27049                 }
27050                 var expr = parseBinaryExpressionOrHigher(0);
27051                 if (!scanner.hasPrecedingLineBreak() && expr.kind === 79 && token() === 38) {
27052                     return 1;
27053                 }
27054             }
27055             return 0;
27056         }
27057         function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
27058             var pos = getNodePos();
27059             var hasJSDoc = hasPrecedingJSDocComment();
27060             var modifiers = parseModifiersForArrowFunction();
27061             var isAsync = ts.some(modifiers, ts.isAsyncModifier) ? 2 : 0;
27062             var typeParameters = parseTypeParameters();
27063             var parameters;
27064             if (!parseExpected(20)) {
27065                 if (!allowAmbiguity) {
27066                     return undefined;
27067                 }
27068                 parameters = createMissingList();
27069             }
27070             else {
27071                 parameters = parseParametersWorker(isAsync);
27072                 if (!parseExpected(21) && !allowAmbiguity) {
27073                     return undefined;
27074                 }
27075             }
27076             var type = parseReturnType(58, false);
27077             if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
27078                 return undefined;
27079             }
27080             var hasJSDocFunctionType = type && ts.isJSDocFunctionType(type);
27081             if (!allowAmbiguity && token() !== 38 && (hasJSDocFunctionType || token() !== 18)) {
27082                 return undefined;
27083             }
27084             var lastToken = token();
27085             var equalsGreaterThanToken = parseExpectedToken(38);
27086             var body = (lastToken === 38 || lastToken === 18)
27087                 ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
27088                 : parseIdentifier();
27089             var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
27090             return withJSDoc(finishNode(node, pos), hasJSDoc);
27091         }
27092         function parseArrowFunctionExpressionBody(isAsync) {
27093             if (token() === 18) {
27094                 return parseFunctionBlock(isAsync ? 2 : 0);
27095             }
27096             if (token() !== 26 &&
27097                 token() !== 98 &&
27098                 token() !== 84 &&
27099                 isStartOfStatement() &&
27100                 !isStartOfExpressionStatement()) {
27101                 return parseFunctionBlock(16 | (isAsync ? 2 : 0));
27102             }
27103             var savedTopLevel = topLevel;
27104             topLevel = false;
27105             var node = isAsync
27106                 ? doInAwaitContext(parseAssignmentExpressionOrHigher)
27107                 : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
27108             topLevel = savedTopLevel;
27109             return node;
27110         }
27111         function parseConditionalExpressionRest(leftOperand, pos) {
27112             var questionToken = parseOptionalToken(57);
27113             if (!questionToken) {
27114                 return leftOperand;
27115             }
27116             var colonToken;
27117             return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
27118                 ? parseAssignmentExpressionOrHigher()
27119                 : createMissingNode(79, false, ts.Diagnostics._0_expected, ts.tokenToString(58))), pos);
27120         }
27121         function parseBinaryExpressionOrHigher(precedence) {
27122             var pos = getNodePos();
27123             var leftOperand = parseUnaryExpressionOrHigher();
27124             return parseBinaryExpressionRest(precedence, leftOperand, pos);
27125         }
27126         function isInOrOfKeyword(t) {
27127             return t === 101 || t === 159;
27128         }
27129         function parseBinaryExpressionRest(precedence, leftOperand, pos) {
27130             while (true) {
27131                 reScanGreaterToken();
27132                 var newPrecedence = ts.getBinaryOperatorPrecedence(token());
27133                 var consumeCurrentOperator = token() === 42 ?
27134                     newPrecedence >= precedence :
27135                     newPrecedence > precedence;
27136                 if (!consumeCurrentOperator) {
27137                     break;
27138                 }
27139                 if (token() === 101 && inDisallowInContext()) {
27140                     break;
27141                 }
27142                 if (token() === 127) {
27143                     if (scanner.hasPrecedingLineBreak()) {
27144                         break;
27145                     }
27146                     else {
27147                         nextToken();
27148                         leftOperand = makeAsExpression(leftOperand, parseType());
27149                     }
27150                 }
27151                 else {
27152                     leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence), pos);
27153                 }
27154             }
27155             return leftOperand;
27156         }
27157         function isBinaryOperator() {
27158             if (inDisallowInContext() && token() === 101) {
27159                 return false;
27160             }
27161             return ts.getBinaryOperatorPrecedence(token()) > 0;
27162         }
27163         function makeBinaryExpression(left, operatorToken, right, pos) {
27164             return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos);
27165         }
27166         function makeAsExpression(left, right) {
27167             return finishNode(factory.createAsExpression(left, right), left.pos);
27168         }
27169         function parsePrefixUnaryExpression() {
27170             var pos = getNodePos();
27171             return finishNode(factory.createPrefixUnaryExpression(token(), nextTokenAnd(parseSimpleUnaryExpression)), pos);
27172         }
27173         function parseDeleteExpression() {
27174             var pos = getNodePos();
27175             return finishNode(factory.createDeleteExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
27176         }
27177         function parseTypeOfExpression() {
27178             var pos = getNodePos();
27179             return finishNode(factory.createTypeOfExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
27180         }
27181         function parseVoidExpression() {
27182             var pos = getNodePos();
27183             return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
27184         }
27185         function isAwaitExpression() {
27186             if (token() === 132) {
27187                 if (inAwaitContext()) {
27188                     return true;
27189                 }
27190                 return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine);
27191             }
27192             return false;
27193         }
27194         function parseAwaitExpression() {
27195             var pos = getNodePos();
27196             return finishNode(factory.createAwaitExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
27197         }
27198         function parseUnaryExpressionOrHigher() {
27199             if (isUpdateExpression()) {
27200                 var pos = getNodePos();
27201                 var updateExpression = parseUpdateExpression();
27202                 return token() === 42 ?
27203                     parseBinaryExpressionRest(ts.getBinaryOperatorPrecedence(token()), updateExpression, pos) :
27204                     updateExpression;
27205             }
27206             var unaryOperator = token();
27207             var simpleUnaryExpression = parseSimpleUnaryExpression();
27208             if (token() === 42) {
27209                 var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
27210                 var end = simpleUnaryExpression.end;
27211                 if (simpleUnaryExpression.kind === 210) {
27212                     parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
27213                 }
27214                 else {
27215                     parseErrorAt(pos, end, ts.Diagnostics.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, ts.tokenToString(unaryOperator));
27216                 }
27217             }
27218             return simpleUnaryExpression;
27219         }
27220         function parseSimpleUnaryExpression() {
27221             switch (token()) {
27222                 case 39:
27223                 case 40:
27224                 case 54:
27225                 case 53:
27226                     return parsePrefixUnaryExpression();
27227                 case 89:
27228                     return parseDeleteExpression();
27229                 case 112:
27230                     return parseTypeOfExpression();
27231                 case 114:
27232                     return parseVoidExpression();
27233                 case 29:
27234                     return parseTypeAssertion();
27235                 case 132:
27236                     if (isAwaitExpression()) {
27237                         return parseAwaitExpression();
27238                     }
27239                 default:
27240                     return parseUpdateExpression();
27241             }
27242         }
27243         function isUpdateExpression() {
27244             switch (token()) {
27245                 case 39:
27246                 case 40:
27247                 case 54:
27248                 case 53:
27249                 case 89:
27250                 case 112:
27251                 case 114:
27252                 case 132:
27253                     return false;
27254                 case 29:
27255                     if (languageVariant !== 1) {
27256                         return false;
27257                     }
27258                 default:
27259                     return true;
27260             }
27261         }
27262         function parseUpdateExpression() {
27263             if (token() === 45 || token() === 46) {
27264                 var pos = getNodePos();
27265                 return finishNode(factory.createPrefixUnaryExpression(token(), nextTokenAnd(parseLeftHandSideExpressionOrHigher)), pos);
27266             }
27267             else if (languageVariant === 1 && token() === 29 && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) {
27268                 return parseJsxElementOrSelfClosingElementOrFragment(true);
27269             }
27270             var expression = parseLeftHandSideExpressionOrHigher();
27271             ts.Debug.assert(ts.isLeftHandSideExpression(expression));
27272             if ((token() === 45 || token() === 46) && !scanner.hasPrecedingLineBreak()) {
27273                 var operator = token();
27274                 nextToken();
27275                 return finishNode(factory.createPostfixUnaryExpression(expression, operator), expression.pos);
27276             }
27277             return expression;
27278         }
27279         function parseLeftHandSideExpressionOrHigher() {
27280             var pos = getNodePos();
27281             var expression;
27282             if (token() === 100) {
27283                 if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
27284                     sourceFlags |= 1048576;
27285                     expression = parseTokenNode();
27286                 }
27287                 else if (lookAhead(nextTokenIsDot)) {
27288                     nextToken();
27289                     nextToken();
27290                     expression = finishNode(factory.createMetaProperty(100, parseIdentifierName()), pos);
27291                     sourceFlags |= 2097152;
27292                 }
27293                 else {
27294                     expression = parseMemberExpressionOrHigher();
27295                 }
27296             }
27297             else {
27298                 expression = token() === 106 ? parseSuperExpression() : parseMemberExpressionOrHigher();
27299             }
27300             return parseCallExpressionRest(pos, expression);
27301         }
27302         function parseMemberExpressionOrHigher() {
27303             var pos = getNodePos();
27304             var expression = parsePrimaryExpression();
27305             return parseMemberExpressionRest(pos, expression, true);
27306         }
27307         function parseSuperExpression() {
27308             var pos = getNodePos();
27309             var expression = parseTokenNode();
27310             if (token() === 29) {
27311                 var startPos = getNodePos();
27312                 var typeArguments = tryParse(parseTypeArgumentsInExpression);
27313                 if (typeArguments !== undefined) {
27314                     parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
27315                 }
27316             }
27317             if (token() === 20 || token() === 24 || token() === 22) {
27318                 return expression;
27319             }
27320             parseExpectedToken(24, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
27321             return finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot(true, true)), pos);
27322         }
27323         function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
27324             var pos = getNodePos();
27325             var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
27326             var result;
27327             if (opening.kind === 279) {
27328                 var children = parseJsxChildren(opening);
27329                 var closingElement = void 0;
27330                 var lastChild = children[children.length - 1];
27331                 if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 277
27332                     && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName)
27333                     && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) {
27334                     var end = lastChild.children.end;
27335                     var newLast = finishNode(factory.createJsxElement(lastChild.openingElement, lastChild.children, finishNode(factory.createJsxClosingElement(finishNode(factory.createIdentifier(""), end, end)), end, end)), lastChild.openingElement.pos, end);
27336                     children = createNodeArray(__spreadArray(__spreadArray([], children.slice(0, children.length - 1), true), [newLast], false), children.pos, end);
27337                     closingElement = lastChild.closingElement;
27338                 }
27339                 else {
27340                     closingElement = parseJsxClosingElement(opening, inExpressionContext);
27341                     if (!tagNamesAreEquivalent(opening.tagName, closingElement.tagName)) {
27342                         if (openingTag && ts.isJsxOpeningElement(openingTag) && tagNamesAreEquivalent(closingElement.tagName, openingTag.tagName)) {
27343                             parseErrorAtRange(opening.tagName, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, opening.tagName));
27344                         }
27345                         else {
27346                             parseErrorAtRange(closingElement.tagName, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNodeFromSourceText(sourceText, opening.tagName));
27347                         }
27348                     }
27349                 }
27350                 result = finishNode(factory.createJsxElement(opening, children, closingElement), pos);
27351             }
27352             else if (opening.kind === 282) {
27353                 result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos);
27354             }
27355             else {
27356                 ts.Debug.assert(opening.kind === 278);
27357                 result = opening;
27358             }
27359             if (inExpressionContext && token() === 29) {
27360                 var topBadPos_1 = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
27361                 var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true, topBadPos_1); });
27362                 if (invalidElement) {
27363                     var operatorToken = createMissingNode(27, false);
27364                     ts.setTextRangePosWidth(operatorToken, invalidElement.pos, 0);
27365                     parseErrorAt(ts.skipTrivia(sourceText, topBadPos_1), invalidElement.end, ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
27366                     return finishNode(factory.createBinaryExpression(result, operatorToken, invalidElement), pos);
27367                 }
27368             }
27369             return result;
27370         }
27371         function parseJsxText() {
27372             var pos = getNodePos();
27373             var node = factory.createJsxText(scanner.getTokenValue(), currentToken === 12);
27374             currentToken = scanner.scanJsxToken();
27375             return finishNode(node, pos);
27376         }
27377         function parseJsxChild(openingTag, token) {
27378             switch (token) {
27379                 case 1:
27380                     if (ts.isJsxOpeningFragment(openingTag)) {
27381                         parseErrorAtRange(openingTag, ts.Diagnostics.JSX_fragment_has_no_corresponding_closing_tag);
27382                     }
27383                     else {
27384                         var tag = openingTag.tagName;
27385                         var start = ts.skipTrivia(sourceText, tag.pos);
27386                         parseErrorAt(start, tag.end, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
27387                     }
27388                     return undefined;
27389                 case 30:
27390                 case 7:
27391                     return undefined;
27392                 case 11:
27393                 case 12:
27394                     return parseJsxText();
27395                 case 18:
27396                     return parseJsxExpression(false);
27397                 case 29:
27398                     return parseJsxElementOrSelfClosingElementOrFragment(false, undefined, openingTag);
27399                 default:
27400                     return ts.Debug.assertNever(token);
27401             }
27402         }
27403         function parseJsxChildren(openingTag) {
27404             var list = [];
27405             var listPos = getNodePos();
27406             var saveParsingContext = parsingContext;
27407             parsingContext |= 1 << 14;
27408             while (true) {
27409                 var child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken());
27410                 if (!child)
27411                     break;
27412                 list.push(child);
27413                 if (ts.isJsxOpeningElement(openingTag)
27414                     && (child === null || child === void 0 ? void 0 : child.kind) === 277
27415                     && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName)
27416                     && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) {
27417                     break;
27418                 }
27419             }
27420             parsingContext = saveParsingContext;
27421             return createNodeArray(list, listPos);
27422         }
27423         function parseJsxAttributes() {
27424             var pos = getNodePos();
27425             return finishNode(factory.createJsxAttributes(parseList(13, parseJsxAttribute)), pos);
27426         }
27427         function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
27428             var pos = getNodePos();
27429             parseExpected(29);
27430             if (token() === 31) {
27431                 scanJsxText();
27432                 return finishNode(factory.createJsxOpeningFragment(), pos);
27433             }
27434             var tagName = parseJsxElementName();
27435             var typeArguments = (contextFlags & 131072) === 0 ? tryParseTypeArguments() : undefined;
27436             var attributes = parseJsxAttributes();
27437             var node;
27438             if (token() === 31) {
27439                 scanJsxText();
27440                 node = factory.createJsxOpeningElement(tagName, typeArguments, attributes);
27441             }
27442             else {
27443                 parseExpected(43);
27444                 if (parseExpected(31, undefined, false)) {
27445                     if (inExpressionContext) {
27446                         nextToken();
27447                     }
27448                     else {
27449                         scanJsxText();
27450                     }
27451                 }
27452                 node = factory.createJsxSelfClosingElement(tagName, typeArguments, attributes);
27453             }
27454             return finishNode(node, pos);
27455         }
27456         function parseJsxElementName() {
27457             var pos = getNodePos();
27458             scanJsxIdentifier();
27459             var expression = token() === 108 ?
27460                 parseTokenNode() : parseIdentifierName();
27461             while (parseOptional(24)) {
27462                 expression = finishNode(factory.createPropertyAccessExpression(expression, parseRightSideOfDot(true, false)), pos);
27463             }
27464             return expression;
27465         }
27466         function parseJsxExpression(inExpressionContext) {
27467             var pos = getNodePos();
27468             if (!parseExpected(18)) {
27469                 return undefined;
27470             }
27471             var dotDotDotToken;
27472             var expression;
27473             if (token() !== 19) {
27474                 dotDotDotToken = parseOptionalToken(25);
27475                 expression = parseExpression();
27476             }
27477             if (inExpressionContext) {
27478                 parseExpected(19);
27479             }
27480             else {
27481                 if (parseExpected(19, undefined, false)) {
27482                     scanJsxText();
27483                 }
27484             }
27485             return finishNode(factory.createJsxExpression(dotDotDotToken, expression), pos);
27486         }
27487         function parseJsxAttribute() {
27488             if (token() === 18) {
27489                 return parseJsxSpreadAttribute();
27490             }
27491             scanJsxIdentifier();
27492             var pos = getNodePos();
27493             return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 ? undefined :
27494                 scanJsxAttributeValue() === 10 ? parseLiteralNode() :
27495                     parseJsxExpression(true)), pos);
27496         }
27497         function parseJsxSpreadAttribute() {
27498             var pos = getNodePos();
27499             parseExpected(18);
27500             parseExpected(25);
27501             var expression = parseExpression();
27502             parseExpected(19);
27503             return finishNode(factory.createJsxSpreadAttribute(expression), pos);
27504         }
27505         function parseJsxClosingElement(open, inExpressionContext) {
27506             var pos = getNodePos();
27507             parseExpected(30);
27508             var tagName = parseJsxElementName();
27509             if (parseExpected(31, undefined, false)) {
27510                 if (inExpressionContext || !tagNamesAreEquivalent(open.tagName, tagName)) {
27511                     nextToken();
27512                 }
27513                 else {
27514                     scanJsxText();
27515                 }
27516             }
27517             return finishNode(factory.createJsxClosingElement(tagName), pos);
27518         }
27519         function parseJsxClosingFragment(inExpressionContext) {
27520             var pos = getNodePos();
27521             parseExpected(30);
27522             if (ts.tokenIsIdentifierOrKeyword(token())) {
27523                 parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
27524             }
27525             if (parseExpected(31, undefined, false)) {
27526                 if (inExpressionContext) {
27527                     nextToken();
27528                 }
27529                 else {
27530                     scanJsxText();
27531                 }
27532             }
27533             return finishNode(factory.createJsxJsxClosingFragment(), pos);
27534         }
27535         function parseTypeAssertion() {
27536             var pos = getNodePos();
27537             parseExpected(29);
27538             var type = parseType();
27539             parseExpected(31);
27540             var expression = parseSimpleUnaryExpression();
27541             return finishNode(factory.createTypeAssertion(type, expression), pos);
27542         }
27543         function nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate() {
27544             nextToken();
27545             return ts.tokenIsIdentifierOrKeyword(token())
27546                 || token() === 22
27547                 || isTemplateStartOfTaggedTemplate();
27548         }
27549         function isStartOfOptionalPropertyOrElementAccessChain() {
27550             return token() === 28
27551                 && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate);
27552         }
27553         function tryReparseOptionalChain(node) {
27554             if (node.flags & 32) {
27555                 return true;
27556             }
27557             if (ts.isNonNullExpression(node)) {
27558                 var expr = node.expression;
27559                 while (ts.isNonNullExpression(expr) && !(expr.flags & 32)) {
27560                     expr = expr.expression;
27561                 }
27562                 if (expr.flags & 32) {
27563                     while (ts.isNonNullExpression(node)) {
27564                         node.flags |= 32;
27565                         node = node.expression;
27566                     }
27567                     return true;
27568                 }
27569             }
27570             return false;
27571         }
27572         function parsePropertyAccessExpressionRest(pos, expression, questionDotToken) {
27573             var name = parseRightSideOfDot(true, true);
27574             var isOptionalChain = questionDotToken || tryReparseOptionalChain(expression);
27575             var propertyAccess = isOptionalChain ?
27576                 factory.createPropertyAccessChain(expression, questionDotToken, name) :
27577                 factory.createPropertyAccessExpression(expression, name);
27578             if (isOptionalChain && ts.isPrivateIdentifier(propertyAccess.name)) {
27579                 parseErrorAtRange(propertyAccess.name, ts.Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
27580             }
27581             return finishNode(propertyAccess, pos);
27582         }
27583         function parseElementAccessExpressionRest(pos, expression, questionDotToken) {
27584             var argumentExpression;
27585             if (token() === 23) {
27586                 argumentExpression = createMissingNode(79, true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
27587             }
27588             else {
27589                 var argument = allowInAnd(parseExpression);
27590                 if (ts.isStringOrNumericLiteralLike(argument)) {
27591                     argument.text = internIdentifier(argument.text);
27592                 }
27593                 argumentExpression = argument;
27594             }
27595             parseExpected(23);
27596             var indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ?
27597                 factory.createElementAccessChain(expression, questionDotToken, argumentExpression) :
27598                 factory.createElementAccessExpression(expression, argumentExpression);
27599             return finishNode(indexedAccess, pos);
27600         }
27601         function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
27602             while (true) {
27603                 var questionDotToken = void 0;
27604                 var isPropertyAccess = false;
27605                 if (allowOptionalChain && isStartOfOptionalPropertyOrElementAccessChain()) {
27606                     questionDotToken = parseExpectedToken(28);
27607                     isPropertyAccess = ts.tokenIsIdentifierOrKeyword(token());
27608                 }
27609                 else {
27610                     isPropertyAccess = parseOptional(24);
27611                 }
27612                 if (isPropertyAccess) {
27613                     expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken);
27614                     continue;
27615                 }
27616                 if (!questionDotToken && token() === 53 && !scanner.hasPrecedingLineBreak()) {
27617                     nextToken();
27618                     expression = finishNode(factory.createNonNullExpression(expression), pos);
27619                     continue;
27620                 }
27621                 if ((questionDotToken || !inDecoratorContext()) && parseOptional(22)) {
27622                     expression = parseElementAccessExpressionRest(pos, expression, questionDotToken);
27623                     continue;
27624                 }
27625                 if (isTemplateStartOfTaggedTemplate()) {
27626                     expression = parseTaggedTemplateRest(pos, expression, questionDotToken, undefined);
27627                     continue;
27628                 }
27629                 return expression;
27630             }
27631         }
27632         function isTemplateStartOfTaggedTemplate() {
27633             return token() === 14 || token() === 15;
27634         }
27635         function parseTaggedTemplateRest(pos, tag, questionDotToken, typeArguments) {
27636             var tagExpression = factory.createTaggedTemplateExpression(tag, typeArguments, token() === 14 ?
27637                 (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) :
27638                 parseTemplateExpression(true));
27639             if (questionDotToken || tag.flags & 32) {
27640                 tagExpression.flags |= 32;
27641             }
27642             tagExpression.questionDotToken = questionDotToken;
27643             return finishNode(tagExpression, pos);
27644         }
27645         function parseCallExpressionRest(pos, expression) {
27646             while (true) {
27647                 expression = parseMemberExpressionRest(pos, expression, true);
27648                 var questionDotToken = parseOptionalToken(28);
27649                 if ((contextFlags & 131072) === 0 && (token() === 29 || token() === 47)) {
27650                     var typeArguments = tryParse(parseTypeArgumentsInExpression);
27651                     if (typeArguments) {
27652                         if (isTemplateStartOfTaggedTemplate()) {
27653                             expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
27654                             continue;
27655                         }
27656                         var argumentList = parseArgumentList();
27657                         var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
27658                             factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
27659                             factory.createCallExpression(expression, typeArguments, argumentList);
27660                         expression = finishNode(callExpr, pos);
27661                         continue;
27662                     }
27663                 }
27664                 else if (token() === 20) {
27665                     var argumentList = parseArgumentList();
27666                     var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
27667                         factory.createCallChain(expression, questionDotToken, undefined, argumentList) :
27668                         factory.createCallExpression(expression, undefined, argumentList);
27669                     expression = finishNode(callExpr, pos);
27670                     continue;
27671                 }
27672                 if (questionDotToken) {
27673                     var name = createMissingNode(79, false, ts.Diagnostics.Identifier_expected);
27674                     expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
27675                 }
27676                 break;
27677             }
27678             return expression;
27679         }
27680         function parseArgumentList() {
27681             parseExpected(20);
27682             var result = parseDelimitedList(11, parseArgumentExpression);
27683             parseExpected(21);
27684             return result;
27685         }
27686         function parseTypeArgumentsInExpression() {
27687             if ((contextFlags & 131072) !== 0) {
27688                 return undefined;
27689             }
27690             if (reScanLessThanToken() !== 29) {
27691                 return undefined;
27692             }
27693             nextToken();
27694             var typeArguments = parseDelimitedList(20, parseType);
27695             if (!parseExpected(31)) {
27696                 return undefined;
27697             }
27698             return typeArguments && canFollowTypeArgumentsInExpression()
27699                 ? typeArguments
27700                 : undefined;
27701         }
27702         function canFollowTypeArgumentsInExpression() {
27703             switch (token()) {
27704                 case 20:
27705                 case 14:
27706                 case 15:
27707                 case 24:
27708                 case 21:
27709                 case 23:
27710                 case 58:
27711                 case 26:
27712                 case 57:
27713                 case 34:
27714                 case 36:
27715                 case 35:
27716                 case 37:
27717                 case 55:
27718                 case 56:
27719                 case 60:
27720                 case 52:
27721                 case 50:
27722                 case 51:
27723                 case 19:
27724                 case 1:
27725                     return true;
27726                 case 27:
27727                 case 18:
27728                 default:
27729                     return false;
27730             }
27731         }
27732         function parsePrimaryExpression() {
27733             switch (token()) {
27734                 case 8:
27735                 case 9:
27736                 case 10:
27737                 case 14:
27738                     return parseLiteralNode();
27739                 case 108:
27740                 case 106:
27741                 case 104:
27742                 case 110:
27743                 case 95:
27744                     return parseTokenNode();
27745                 case 20:
27746                     return parseParenthesizedExpression();
27747                 case 22:
27748                     return parseArrayLiteralExpression();
27749                 case 18:
27750                     return parseObjectLiteralExpression();
27751                 case 131:
27752                     if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {
27753                         break;
27754                     }
27755                     return parseFunctionExpression();
27756                 case 84:
27757                     return parseClassExpression();
27758                 case 98:
27759                     return parseFunctionExpression();
27760                 case 103:
27761                     return parseNewExpressionOrNewDotTarget();
27762                 case 43:
27763                 case 68:
27764                     if (reScanSlashToken() === 13) {
27765                         return parseLiteralNode();
27766                     }
27767                     break;
27768                 case 15:
27769                     return parseTemplateExpression(false);
27770                 case 80:
27771                     return parsePrivateIdentifier();
27772             }
27773             return parseIdentifier(ts.Diagnostics.Expression_expected);
27774         }
27775         function parseParenthesizedExpression() {
27776             var pos = getNodePos();
27777             var hasJSDoc = hasPrecedingJSDocComment();
27778             parseExpected(20);
27779             var expression = allowInAnd(parseExpression);
27780             parseExpected(21);
27781             return withJSDoc(finishNode(factory.createParenthesizedExpression(expression), pos), hasJSDoc);
27782         }
27783         function parseSpreadElement() {
27784             var pos = getNodePos();
27785             parseExpected(25);
27786             var expression = parseAssignmentExpressionOrHigher();
27787             return finishNode(factory.createSpreadElement(expression), pos);
27788         }
27789         function parseArgumentOrArrayLiteralElement() {
27790             return token() === 25 ? parseSpreadElement() :
27791                 token() === 27 ? finishNode(factory.createOmittedExpression(), getNodePos()) :
27792                     parseAssignmentExpressionOrHigher();
27793         }
27794         function parseArgumentExpression() {
27795             return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
27796         }
27797         function parseArrayLiteralExpression() {
27798             var pos = getNodePos();
27799             parseExpected(22);
27800             var multiLine = scanner.hasPrecedingLineBreak();
27801             var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
27802             parseExpected(23);
27803             return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
27804         }
27805         function parseObjectLiteralElement() {
27806             var pos = getNodePos();
27807             var hasJSDoc = hasPrecedingJSDocComment();
27808             if (parseOptionalToken(25)) {
27809                 var expression = parseAssignmentExpressionOrHigher();
27810                 return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
27811             }
27812             var decorators = parseDecorators();
27813             var modifiers = parseModifiers();
27814             if (parseContextualModifier(136)) {
27815                 return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 171);
27816             }
27817             if (parseContextualModifier(148)) {
27818                 return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
27819             }
27820             var asteriskToken = parseOptionalToken(41);
27821             var tokenIsIdentifier = isIdentifier();
27822             var name = parsePropertyName();
27823             var questionToken = parseOptionalToken(57);
27824             var exclamationToken = parseOptionalToken(53);
27825             if (asteriskToken || token() === 20 || token() === 29) {
27826                 return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken);
27827             }
27828             var node;
27829             var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58);
27830             if (isShorthandPropertyAssignment) {
27831                 var equalsToken = parseOptionalToken(63);
27832                 var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
27833                 node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
27834                 node.equalsToken = equalsToken;
27835             }
27836             else {
27837                 parseExpected(58);
27838                 var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
27839                 node = factory.createPropertyAssignment(name, initializer);
27840             }
27841             node.decorators = decorators;
27842             node.modifiers = modifiers;
27843             node.questionToken = questionToken;
27844             node.exclamationToken = exclamationToken;
27845             return withJSDoc(finishNode(node, pos), hasJSDoc);
27846         }
27847         function parseObjectLiteralExpression() {
27848             var pos = getNodePos();
27849             var openBracePosition = scanner.getTokenPos();
27850             parseExpected(18);
27851             var multiLine = scanner.hasPrecedingLineBreak();
27852             var properties = parseDelimitedList(12, parseObjectLiteralElement, true);
27853             if (!parseExpected(19)) {
27854                 var lastError = ts.lastOrUndefined(parseDiagnostics);
27855                 if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
27856                     ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
27857                 }
27858             }
27859             return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
27860         }
27861         function parseFunctionExpression() {
27862             var savedDecoratorContext = inDecoratorContext();
27863             setDecoratorContext(false);
27864             var pos = getNodePos();
27865             var hasJSDoc = hasPrecedingJSDocComment();
27866             var modifiers = parseModifiers();
27867             parseExpected(98);
27868             var asteriskToken = parseOptionalToken(41);
27869             var isGenerator = asteriskToken ? 1 : 0;
27870             var isAsync = ts.some(modifiers, ts.isAsyncModifier) ? 2 : 0;
27871             var name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalBindingIdentifier) :
27872                 isGenerator ? doInYieldContext(parseOptionalBindingIdentifier) :
27873                     isAsync ? doInAwaitContext(parseOptionalBindingIdentifier) :
27874                         parseOptionalBindingIdentifier();
27875             var typeParameters = parseTypeParameters();
27876             var parameters = parseParameters(isGenerator | isAsync);
27877             var type = parseReturnType(58, false);
27878             var body = parseFunctionBlock(isGenerator | isAsync);
27879             setDecoratorContext(savedDecoratorContext);
27880             var node = factory.createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body);
27881             return withJSDoc(finishNode(node, pos), hasJSDoc);
27882         }
27883         function parseOptionalBindingIdentifier() {
27884             return isBindingIdentifier() ? parseBindingIdentifier() : undefined;
27885         }
27886         function parseNewExpressionOrNewDotTarget() {
27887             var pos = getNodePos();
27888             parseExpected(103);
27889             if (parseOptional(24)) {
27890                 var name = parseIdentifierName();
27891                 return finishNode(factory.createMetaProperty(103, name), pos);
27892             }
27893             var expressionPos = getNodePos();
27894             var expression = parsePrimaryExpression();
27895             var typeArguments;
27896             while (true) {
27897                 expression = parseMemberExpressionRest(expressionPos, expression, false);
27898                 typeArguments = tryParse(parseTypeArgumentsInExpression);
27899                 if (isTemplateStartOfTaggedTemplate()) {
27900                     ts.Debug.assert(!!typeArguments, "Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
27901                     expression = parseTaggedTemplateRest(expressionPos, expression, undefined, typeArguments);
27902                     typeArguments = undefined;
27903                 }
27904                 break;
27905             }
27906             var argumentsArray;
27907             if (token() === 20) {
27908                 argumentsArray = parseArgumentList();
27909             }
27910             else if (typeArguments) {
27911                 parseErrorAt(pos, scanner.getStartPos(), ts.Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
27912             }
27913             return finishNode(factory.createNewExpression(expression, typeArguments, argumentsArray), pos);
27914         }
27915         function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
27916             var pos = getNodePos();
27917             var hasJSDoc = hasPrecedingJSDocComment();
27918             var openBracePosition = scanner.getTokenPos();
27919             if (parseExpected(18, diagnosticMessage) || ignoreMissingOpenBrace) {
27920                 var multiLine = scanner.hasPrecedingLineBreak();
27921                 var statements = parseList(1, parseStatement);
27922                 if (!parseExpected(19)) {
27923                     var lastError = ts.lastOrUndefined(parseDiagnostics);
27924                     if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
27925                         ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
27926                     }
27927                 }
27928                 var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
27929                 if (token() === 63) {
27930                     parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
27931                     nextToken();
27932                 }
27933                 return result;
27934             }
27935             else {
27936                 var statements = createMissingList();
27937                 return withJSDoc(finishNode(factory.createBlock(statements, undefined), pos), hasJSDoc);
27938             }
27939         }
27940         function parseFunctionBlock(flags, diagnosticMessage) {
27941             var savedYieldContext = inYieldContext();
27942             setYieldContext(!!(flags & 1));
27943             var savedAwaitContext = inAwaitContext();
27944             setAwaitContext(!!(flags & 2));
27945             var savedTopLevel = topLevel;
27946             topLevel = false;
27947             var saveDecoratorContext = inDecoratorContext();
27948             if (saveDecoratorContext) {
27949                 setDecoratorContext(false);
27950             }
27951             var block = parseBlock(!!(flags & 16), diagnosticMessage);
27952             if (saveDecoratorContext) {
27953                 setDecoratorContext(true);
27954             }
27955             topLevel = savedTopLevel;
27956             setYieldContext(savedYieldContext);
27957             setAwaitContext(savedAwaitContext);
27958             return block;
27959         }
27960         function parseEmptyStatement() {
27961             var pos = getNodePos();
27962             var hasJSDoc = hasPrecedingJSDocComment();
27963             parseExpected(26);
27964             return withJSDoc(finishNode(factory.createEmptyStatement(), pos), hasJSDoc);
27965         }
27966         function parseIfStatement() {
27967             var pos = getNodePos();
27968             var hasJSDoc = hasPrecedingJSDocComment();
27969             parseExpected(99);
27970             parseExpected(20);
27971             var expression = allowInAnd(parseExpression);
27972             parseExpected(21);
27973             var thenStatement = parseStatement();
27974             var elseStatement = parseOptional(91) ? parseStatement() : undefined;
27975             return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
27976         }
27977         function parseDoStatement() {
27978             var pos = getNodePos();
27979             var hasJSDoc = hasPrecedingJSDocComment();
27980             parseExpected(90);
27981             var statement = parseStatement();
27982             parseExpected(115);
27983             parseExpected(20);
27984             var expression = allowInAnd(parseExpression);
27985             parseExpected(21);
27986             parseOptional(26);
27987             return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc);
27988         }
27989         function parseWhileStatement() {
27990             var pos = getNodePos();
27991             var hasJSDoc = hasPrecedingJSDocComment();
27992             parseExpected(115);
27993             parseExpected(20);
27994             var expression = allowInAnd(parseExpression);
27995             parseExpected(21);
27996             var statement = parseStatement();
27997             return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
27998         }
27999         function parseForOrForInOrForOfStatement() {
28000             var pos = getNodePos();
28001             var hasJSDoc = hasPrecedingJSDocComment();
28002             parseExpected(97);
28003             var awaitToken = parseOptionalToken(132);
28004             parseExpected(20);
28005             var initializer;
28006             if (token() !== 26) {
28007                 if (token() === 113 || token() === 119 || token() === 85) {
28008                     initializer = parseVariableDeclarationList(true);
28009                 }
28010                 else {
28011                     initializer = disallowInAnd(parseExpression);
28012                 }
28013             }
28014             var node;
28015             if (awaitToken ? parseExpected(159) : parseOptional(159)) {
28016                 var expression = allowInAnd(parseAssignmentExpressionOrHigher);
28017                 parseExpected(21);
28018                 node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
28019             }
28020             else if (parseOptional(101)) {
28021                 var expression = allowInAnd(parseExpression);
28022                 parseExpected(21);
28023                 node = factory.createForInStatement(initializer, expression, parseStatement());
28024             }
28025             else {
28026                 parseExpected(26);
28027                 var condition = token() !== 26 && token() !== 21
28028                     ? allowInAnd(parseExpression)
28029                     : undefined;
28030                 parseExpected(26);
28031                 var incrementor = token() !== 21
28032                     ? allowInAnd(parseExpression)
28033                     : undefined;
28034                 parseExpected(21);
28035                 node = factory.createForStatement(initializer, condition, incrementor, parseStatement());
28036             }
28037             return withJSDoc(finishNode(node, pos), hasJSDoc);
28038         }
28039         function parseBreakOrContinueStatement(kind) {
28040             var pos = getNodePos();
28041             var hasJSDoc = hasPrecedingJSDocComment();
28042             parseExpected(kind === 245 ? 81 : 86);
28043             var label = canParseSemicolon() ? undefined : parseIdentifier();
28044             parseSemicolon();
28045             var node = kind === 245
28046                 ? factory.createBreakStatement(label)
28047                 : factory.createContinueStatement(label);
28048             return withJSDoc(finishNode(node, pos), hasJSDoc);
28049         }
28050         function parseReturnStatement() {
28051             var pos = getNodePos();
28052             var hasJSDoc = hasPrecedingJSDocComment();
28053             parseExpected(105);
28054             var expression = canParseSemicolon() ? undefined : allowInAnd(parseExpression);
28055             parseSemicolon();
28056             return withJSDoc(finishNode(factory.createReturnStatement(expression), pos), hasJSDoc);
28057         }
28058         function parseWithStatement() {
28059             var pos = getNodePos();
28060             var hasJSDoc = hasPrecedingJSDocComment();
28061             parseExpected(116);
28062             parseExpected(20);
28063             var expression = allowInAnd(parseExpression);
28064             parseExpected(21);
28065             var statement = doInsideOfContext(16777216, parseStatement);
28066             return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
28067         }
28068         function parseCaseClause() {
28069             var pos = getNodePos();
28070             parseExpected(82);
28071             var expression = allowInAnd(parseExpression);
28072             parseExpected(58);
28073             var statements = parseList(3, parseStatement);
28074             return finishNode(factory.createCaseClause(expression, statements), pos);
28075         }
28076         function parseDefaultClause() {
28077             var pos = getNodePos();
28078             parseExpected(88);
28079             parseExpected(58);
28080             var statements = parseList(3, parseStatement);
28081             return finishNode(factory.createDefaultClause(statements), pos);
28082         }
28083         function parseCaseOrDefaultClause() {
28084             return token() === 82 ? parseCaseClause() : parseDefaultClause();
28085         }
28086         function parseCaseBlock() {
28087             var pos = getNodePos();
28088             parseExpected(18);
28089             var clauses = parseList(2, parseCaseOrDefaultClause);
28090             parseExpected(19);
28091             return finishNode(factory.createCaseBlock(clauses), pos);
28092         }
28093         function parseSwitchStatement() {
28094             var pos = getNodePos();
28095             var hasJSDoc = hasPrecedingJSDocComment();
28096             parseExpected(107);
28097             parseExpected(20);
28098             var expression = allowInAnd(parseExpression);
28099             parseExpected(21);
28100             var caseBlock = parseCaseBlock();
28101             return withJSDoc(finishNode(factory.createSwitchStatement(expression, caseBlock), pos), hasJSDoc);
28102         }
28103         function parseThrowStatement() {
28104             var pos = getNodePos();
28105             var hasJSDoc = hasPrecedingJSDocComment();
28106             parseExpected(109);
28107             var expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
28108             if (expression === undefined) {
28109                 identifierCount++;
28110                 expression = finishNode(factory.createIdentifier(""), getNodePos());
28111             }
28112             if (!tryParseSemicolon()) {
28113                 parseErrorForMissingSemicolonAfter(expression);
28114             }
28115             return withJSDoc(finishNode(factory.createThrowStatement(expression), pos), hasJSDoc);
28116         }
28117         function parseTryStatement() {
28118             var pos = getNodePos();
28119             var hasJSDoc = hasPrecedingJSDocComment();
28120             parseExpected(111);
28121             var tryBlock = parseBlock(false);
28122             var catchClause = token() === 83 ? parseCatchClause() : undefined;
28123             var finallyBlock;
28124             if (!catchClause || token() === 96) {
28125                 parseExpected(96);
28126                 finallyBlock = parseBlock(false);
28127             }
28128             return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
28129         }
28130         function parseCatchClause() {
28131             var pos = getNodePos();
28132             parseExpected(83);
28133             var variableDeclaration;
28134             if (parseOptional(20)) {
28135                 variableDeclaration = parseVariableDeclaration();
28136                 parseExpected(21);
28137             }
28138             else {
28139                 variableDeclaration = undefined;
28140             }
28141             var block = parseBlock(false);
28142             return finishNode(factory.createCatchClause(variableDeclaration, block), pos);
28143         }
28144         function parseDebuggerStatement() {
28145             var pos = getNodePos();
28146             var hasJSDoc = hasPrecedingJSDocComment();
28147             parseExpected(87);
28148             parseSemicolon();
28149             return withJSDoc(finishNode(factory.createDebuggerStatement(), pos), hasJSDoc);
28150         }
28151         function parseExpressionOrLabeledStatement() {
28152             var pos = getNodePos();
28153             var hasJSDoc = hasPrecedingJSDocComment();
28154             var node;
28155             var hasParen = token() === 20;
28156             var expression = allowInAnd(parseExpression);
28157             if (ts.isIdentifier(expression) && parseOptional(58)) {
28158                 node = factory.createLabeledStatement(expression, parseStatement());
28159             }
28160             else {
28161                 if (!tryParseSemicolon()) {
28162                     parseErrorForMissingSemicolonAfter(expression);
28163                 }
28164                 node = factory.createExpressionStatement(expression);
28165                 if (hasParen) {
28166                     hasJSDoc = false;
28167                 }
28168             }
28169             return withJSDoc(finishNode(node, pos), hasJSDoc);
28170         }
28171         function nextTokenIsIdentifierOrKeywordOnSameLine() {
28172             nextToken();
28173             return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak();
28174         }
28175         function nextTokenIsClassKeywordOnSameLine() {
28176             nextToken();
28177             return token() === 84 && !scanner.hasPrecedingLineBreak();
28178         }
28179         function nextTokenIsFunctionKeywordOnSameLine() {
28180             nextToken();
28181             return token() === 98 && !scanner.hasPrecedingLineBreak();
28182         }
28183         function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
28184             nextToken();
28185             return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8 || token() === 9 || token() === 10) && !scanner.hasPrecedingLineBreak();
28186         }
28187         function isDeclaration() {
28188             while (true) {
28189                 switch (token()) {
28190                     case 113:
28191                     case 119:
28192                     case 85:
28193                     case 98:
28194                     case 84:
28195                     case 92:
28196                         return true;
28197                     case 118:
28198                     case 151:
28199                         return nextTokenIsIdentifierOnSameLine();
28200                     case 141:
28201                     case 142:
28202                         return nextTokenIsIdentifierOrStringLiteralOnSameLine();
28203                     case 126:
28204                     case 131:
28205                     case 135:
28206                     case 121:
28207                     case 122:
28208                     case 123:
28209                     case 144:
28210                         nextToken();
28211                         if (scanner.hasPrecedingLineBreak()) {
28212                             return false;
28213                         }
28214                         continue;
28215                     case 156:
28216                         nextToken();
28217                         return token() === 18 || token() === 79 || token() === 93;
28218                     case 100:
28219                         nextToken();
28220                         return token() === 10 || token() === 41 ||
28221                             token() === 18 || ts.tokenIsIdentifierOrKeyword(token());
28222                     case 93:
28223                         var currentToken_1 = nextToken();
28224                         if (currentToken_1 === 151) {
28225                             currentToken_1 = lookAhead(nextToken);
28226                         }
28227                         if (currentToken_1 === 63 || currentToken_1 === 41 ||
28228                             currentToken_1 === 18 || currentToken_1 === 88 ||
28229                             currentToken_1 === 127) {
28230                             return true;
28231                         }
28232                         continue;
28233                     case 124:
28234                         nextToken();
28235                         continue;
28236                     default:
28237                         return false;
28238                 }
28239             }
28240         }
28241         function isStartOfDeclaration() {
28242             return lookAhead(isDeclaration);
28243         }
28244         function isStartOfStatement() {
28245             switch (token()) {
28246                 case 59:
28247                 case 26:
28248                 case 18:
28249                 case 113:
28250                 case 119:
28251                 case 98:
28252                 case 84:
28253                 case 92:
28254                 case 99:
28255                 case 90:
28256                 case 115:
28257                 case 97:
28258                 case 86:
28259                 case 81:
28260                 case 105:
28261                 case 116:
28262                 case 107:
28263                 case 109:
28264                 case 111:
28265                 case 87:
28266                 case 83:
28267                 case 96:
28268                     return true;
28269                 case 100:
28270                     return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
28271                 case 85:
28272                 case 93:
28273                     return isStartOfDeclaration();
28274                 case 131:
28275                 case 135:
28276                 case 118:
28277                 case 141:
28278                 case 142:
28279                 case 151:
28280                 case 156:
28281                     return true;
28282                 case 123:
28283                 case 121:
28284                 case 122:
28285                 case 124:
28286                 case 144:
28287                     return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
28288                 default:
28289                     return isStartOfExpression();
28290             }
28291         }
28292         function nextTokenIsBindingIdentifierOrStartOfDestructuring() {
28293             nextToken();
28294             return isBindingIdentifier() || token() === 18 || token() === 22;
28295         }
28296         function isLetDeclaration() {
28297             return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuring);
28298         }
28299         function parseStatement() {
28300             switch (token()) {
28301                 case 26:
28302                     return parseEmptyStatement();
28303                 case 18:
28304                     return parseBlock(false);
28305                 case 113:
28306                     return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined);
28307                 case 119:
28308                     if (isLetDeclaration()) {
28309                         return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined);
28310                     }
28311                     break;
28312                 case 98:
28313                     return parseFunctionDeclaration(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined);
28314                 case 84:
28315                     return parseClassDeclaration(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined);
28316                 case 99:
28317                     return parseIfStatement();
28318                 case 90:
28319                     return parseDoStatement();
28320                 case 115:
28321                     return parseWhileStatement();
28322                 case 97:
28323                     return parseForOrForInOrForOfStatement();
28324                 case 86:
28325                     return parseBreakOrContinueStatement(244);
28326                 case 81:
28327                     return parseBreakOrContinueStatement(245);
28328                 case 105:
28329                     return parseReturnStatement();
28330                 case 116:
28331                     return parseWithStatement();
28332                 case 107:
28333                     return parseSwitchStatement();
28334                 case 109:
28335                     return parseThrowStatement();
28336                 case 111:
28337                 case 83:
28338                 case 96:
28339                     return parseTryStatement();
28340                 case 87:
28341                     return parseDebuggerStatement();
28342                 case 59:
28343                     return parseDeclaration();
28344                 case 131:
28345                 case 118:
28346                 case 151:
28347                 case 141:
28348                 case 142:
28349                 case 135:
28350                 case 85:
28351                 case 92:
28352                 case 93:
28353                 case 100:
28354                 case 121:
28355                 case 122:
28356                 case 123:
28357                 case 126:
28358                 case 124:
28359                 case 144:
28360                 case 156:
28361                     if (isStartOfDeclaration()) {
28362                         return parseDeclaration();
28363                     }
28364                     break;
28365             }
28366             return parseExpressionOrLabeledStatement();
28367         }
28368         function isDeclareModifier(modifier) {
28369             return modifier.kind === 135;
28370         }
28371         function parseDeclaration() {
28372             var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
28373             if (isAmbient) {
28374                 var node = tryReuseAmbientDeclaration();
28375                 if (node) {
28376                     return node;
28377                 }
28378             }
28379             var pos = getNodePos();
28380             var hasJSDoc = hasPrecedingJSDocComment();
28381             var decorators = parseDecorators();
28382             var modifiers = parseModifiers();
28383             if (isAmbient) {
28384                 for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
28385                     var m = _a[_i];
28386                     m.flags |= 8388608;
28387                 }
28388                 return doInsideOfContext(8388608, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
28389             }
28390             else {
28391                 return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
28392             }
28393         }
28394         function tryReuseAmbientDeclaration() {
28395             return doInsideOfContext(8388608, function () {
28396                 var node = currentNode(parsingContext);
28397                 if (node) {
28398                     return consumeNode(node);
28399                 }
28400             });
28401         }
28402         function parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers) {
28403             switch (token()) {
28404                 case 113:
28405                 case 119:
28406                 case 85:
28407                     return parseVariableStatement(pos, hasJSDoc, decorators, modifiers);
28408                 case 98:
28409                     return parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers);
28410                 case 84:
28411                     return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers);
28412                 case 118:
28413                     return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers);
28414                 case 151:
28415                     return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers);
28416                 case 92:
28417                     return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers);
28418                 case 156:
28419                 case 141:
28420                 case 142:
28421                     return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers);
28422                 case 100:
28423                     return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers);
28424                 case 93:
28425                     nextToken();
28426                     switch (token()) {
28427                         case 88:
28428                         case 63:
28429                             return parseExportAssignment(pos, hasJSDoc, decorators, modifiers);
28430                         case 127:
28431                             return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers);
28432                         default:
28433                             return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers);
28434                     }
28435                 default:
28436                     if (decorators || modifiers) {
28437                         var missing = createMissingNode(275, true, ts.Diagnostics.Declaration_expected);
28438                         ts.setTextRangePos(missing, pos);
28439                         missing.decorators = decorators;
28440                         missing.modifiers = modifiers;
28441                         return missing;
28442                     }
28443                     return undefined;
28444             }
28445         }
28446         function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
28447             nextToken();
28448             return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10);
28449         }
28450         function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
28451             if (token() !== 18 && canParseSemicolon()) {
28452                 parseSemicolon();
28453                 return;
28454             }
28455             return parseFunctionBlock(flags, diagnosticMessage);
28456         }
28457         function parseArrayBindingElement() {
28458             var pos = getNodePos();
28459             if (token() === 27) {
28460                 return finishNode(factory.createOmittedExpression(), pos);
28461             }
28462             var dotDotDotToken = parseOptionalToken(25);
28463             var name = parseIdentifierOrPattern();
28464             var initializer = parseInitializer();
28465             return finishNode(factory.createBindingElement(dotDotDotToken, undefined, name, initializer), pos);
28466         }
28467         function parseObjectBindingElement() {
28468             var pos = getNodePos();
28469             var dotDotDotToken = parseOptionalToken(25);
28470             var tokenIsIdentifier = isBindingIdentifier();
28471             var propertyName = parsePropertyName();
28472             var name;
28473             if (tokenIsIdentifier && token() !== 58) {
28474                 name = propertyName;
28475                 propertyName = undefined;
28476             }
28477             else {
28478                 parseExpected(58);
28479                 name = parseIdentifierOrPattern();
28480             }
28481             var initializer = parseInitializer();
28482             return finishNode(factory.createBindingElement(dotDotDotToken, propertyName, name, initializer), pos);
28483         }
28484         function parseObjectBindingPattern() {
28485             var pos = getNodePos();
28486             parseExpected(18);
28487             var elements = parseDelimitedList(9, parseObjectBindingElement);
28488             parseExpected(19);
28489             return finishNode(factory.createObjectBindingPattern(elements), pos);
28490         }
28491         function parseArrayBindingPattern() {
28492             var pos = getNodePos();
28493             parseExpected(22);
28494             var elements = parseDelimitedList(10, parseArrayBindingElement);
28495             parseExpected(23);
28496             return finishNode(factory.createArrayBindingPattern(elements), pos);
28497         }
28498         function isBindingIdentifierOrPrivateIdentifierOrPattern() {
28499             return token() === 18
28500                 || token() === 22
28501                 || token() === 80
28502                 || isBindingIdentifier();
28503         }
28504         function parseIdentifierOrPattern(privateIdentifierDiagnosticMessage) {
28505             if (token() === 22) {
28506                 return parseArrayBindingPattern();
28507             }
28508             if (token() === 18) {
28509                 return parseObjectBindingPattern();
28510             }
28511             return parseBindingIdentifier(privateIdentifierDiagnosticMessage);
28512         }
28513         function parseVariableDeclarationAllowExclamation() {
28514             return parseVariableDeclaration(true);
28515         }
28516         function parseVariableDeclaration(allowExclamation) {
28517             var pos = getNodePos();
28518             var hasJSDoc = hasPrecedingJSDocComment();
28519             var name = parseIdentifierOrPattern(ts.Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations);
28520             var exclamationToken;
28521             if (allowExclamation && name.kind === 79 &&
28522                 token() === 53 && !scanner.hasPrecedingLineBreak()) {
28523                 exclamationToken = parseTokenNode();
28524             }
28525             var type = parseTypeAnnotation();
28526             var initializer = isInOrOfKeyword(token()) ? undefined : parseInitializer();
28527             var node = factory.createVariableDeclaration(name, exclamationToken, type, initializer);
28528             return withJSDoc(finishNode(node, pos), hasJSDoc);
28529         }
28530         function parseVariableDeclarationList(inForStatementInitializer) {
28531             var pos = getNodePos();
28532             var flags = 0;
28533             switch (token()) {
28534                 case 113:
28535                     break;
28536                 case 119:
28537                     flags |= 1;
28538                     break;
28539                 case 85:
28540                     flags |= 2;
28541                     break;
28542                 default:
28543                     ts.Debug.fail();
28544             }
28545             nextToken();
28546             var declarations;
28547             if (token() === 159 && lookAhead(canFollowContextualOfKeyword)) {
28548                 declarations = createMissingList();
28549             }
28550             else {
28551                 var savedDisallowIn = inDisallowInContext();
28552                 setDisallowInContext(inForStatementInitializer);
28553                 declarations = parseDelimitedList(8, inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation);
28554                 setDisallowInContext(savedDisallowIn);
28555             }
28556             return finishNode(factory.createVariableDeclarationList(declarations, flags), pos);
28557         }
28558         function canFollowContextualOfKeyword() {
28559             return nextTokenIsIdentifier() && nextToken() === 21;
28560         }
28561         function parseVariableStatement(pos, hasJSDoc, decorators, modifiers) {
28562             var declarationList = parseVariableDeclarationList(false);
28563             parseSemicolon();
28564             var node = factory.createVariableStatement(modifiers, declarationList);
28565             node.decorators = decorators;
28566             return withJSDoc(finishNode(node, pos), hasJSDoc);
28567         }
28568         function parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers) {
28569             var savedAwaitContext = inAwaitContext();
28570             var modifierFlags = ts.modifiersToFlags(modifiers);
28571             parseExpected(98);
28572             var asteriskToken = parseOptionalToken(41);
28573             var name = modifierFlags & 512 ? parseOptionalBindingIdentifier() : parseBindingIdentifier();
28574             var isGenerator = asteriskToken ? 1 : 0;
28575             var isAsync = modifierFlags & 256 ? 2 : 0;
28576             var typeParameters = parseTypeParameters();
28577             if (modifierFlags & 1)
28578                 setAwaitContext(true);
28579             var parameters = parseParameters(isGenerator | isAsync);
28580             var type = parseReturnType(58, false);
28581             var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected);
28582             setAwaitContext(savedAwaitContext);
28583             var node = factory.createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body);
28584             return withJSDoc(finishNode(node, pos), hasJSDoc);
28585         }
28586         function parseConstructorName() {
28587             if (token() === 134) {
28588                 return parseExpected(134);
28589             }
28590             if (token() === 10 && lookAhead(nextToken) === 20) {
28591                 return tryParse(function () {
28592                     var literalNode = parseLiteralNode();
28593                     return literalNode.text === "constructor" ? literalNode : undefined;
28594                 });
28595             }
28596         }
28597         function tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers) {
28598             return tryParse(function () {
28599                 if (parseConstructorName()) {
28600                     var typeParameters = parseTypeParameters();
28601                     var parameters = parseParameters(0);
28602                     var type = parseReturnType(58, false);
28603                     var body = parseFunctionBlockOrSemicolon(0, ts.Diagnostics.or_expected);
28604                     var node = factory.createConstructorDeclaration(decorators, modifiers, parameters, body);
28605                     node.typeParameters = typeParameters;
28606                     node.type = type;
28607                     return withJSDoc(finishNode(node, pos), hasJSDoc);
28608                 }
28609             });
28610         }
28611         function parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken, diagnosticMessage) {
28612             var isGenerator = asteriskToken ? 1 : 0;
28613             var isAsync = ts.some(modifiers, ts.isAsyncModifier) ? 2 : 0;
28614             var typeParameters = parseTypeParameters();
28615             var parameters = parseParameters(isGenerator | isAsync);
28616             var type = parseReturnType(58, false);
28617             var body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage);
28618             var node = factory.createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body);
28619             node.exclamationToken = exclamationToken;
28620             return withJSDoc(finishNode(node, pos), hasJSDoc);
28621         }
28622         function parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken) {
28623             var exclamationToken = !questionToken && !scanner.hasPrecedingLineBreak() ? parseOptionalToken(53) : undefined;
28624             var type = parseTypeAnnotation();
28625             var initializer = doOutsideOfContext(8192 | 32768 | 4096, parseInitializer);
28626             parseSemicolonAfterPropertyName(name, type, initializer);
28627             var node = factory.createPropertyDeclaration(decorators, modifiers, name, questionToken || exclamationToken, type, initializer);
28628             return withJSDoc(finishNode(node, pos), hasJSDoc);
28629         }
28630         function parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers) {
28631             var asteriskToken = parseOptionalToken(41);
28632             var name = parsePropertyName();
28633             var questionToken = parseOptionalToken(57);
28634             if (asteriskToken || token() === 20 || token() === 29) {
28635                 return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, undefined, ts.Diagnostics.or_expected);
28636             }
28637             return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
28638         }
28639         function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
28640             var name = parsePropertyName();
28641             var typeParameters = parseTypeParameters();
28642             var parameters = parseParameters(0);
28643             var type = parseReturnType(58, false);
28644             var body = parseFunctionBlockOrSemicolon(0);
28645             var node = kind === 171
28646                 ? factory.createGetAccessorDeclaration(decorators, modifiers, name, parameters, type, body)
28647                 : factory.createSetAccessorDeclaration(decorators, modifiers, name, parameters, body);
28648             node.typeParameters = typeParameters;
28649             if (type && node.kind === 172)
28650                 node.type = type;
28651             return withJSDoc(finishNode(node, pos), hasJSDoc);
28652         }
28653         function isClassMemberStart() {
28654             var idToken;
28655             if (token() === 59) {
28656                 return true;
28657             }
28658             while (ts.isModifierKind(token())) {
28659                 idToken = token();
28660                 if (ts.isClassMemberModifier(idToken)) {
28661                     return true;
28662                 }
28663                 nextToken();
28664             }
28665             if (token() === 41) {
28666                 return true;
28667             }
28668             if (isLiteralPropertyName()) {
28669                 idToken = token();
28670                 nextToken();
28671             }
28672             if (token() === 22) {
28673                 return true;
28674             }
28675             if (idToken !== undefined) {
28676                 if (!ts.isKeyword(idToken) || idToken === 148 || idToken === 136) {
28677                     return true;
28678                 }
28679                 switch (token()) {
28680                     case 20:
28681                     case 29:
28682                     case 53:
28683                     case 58:
28684                     case 63:
28685                     case 57:
28686                         return true;
28687                     default:
28688                         return canParseSemicolon();
28689                 }
28690             }
28691             return false;
28692         }
28693         function parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers) {
28694             parseExpectedToken(124);
28695             var body = parseClassStaticBlockBody();
28696             return withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(decorators, modifiers, body), pos), hasJSDoc);
28697         }
28698         function parseClassStaticBlockBody() {
28699             var savedYieldContext = inYieldContext();
28700             var savedAwaitContext = inAwaitContext();
28701             setYieldContext(false);
28702             setAwaitContext(true);
28703             var body = parseBlock(false);
28704             setYieldContext(savedYieldContext);
28705             setAwaitContext(savedAwaitContext);
28706             return body;
28707         }
28708         function parseDecoratorExpression() {
28709             if (inAwaitContext() && token() === 132) {
28710                 var pos = getNodePos();
28711                 var awaitExpression = parseIdentifier(ts.Diagnostics.Expression_expected);
28712                 nextToken();
28713                 var memberExpression = parseMemberExpressionRest(pos, awaitExpression, true);
28714                 return parseCallExpressionRest(pos, memberExpression);
28715             }
28716             return parseLeftHandSideExpressionOrHigher();
28717         }
28718         function tryParseDecorator() {
28719             var pos = getNodePos();
28720             if (!parseOptional(59)) {
28721                 return undefined;
28722             }
28723             var expression = doInDecoratorContext(parseDecoratorExpression);
28724             return finishNode(factory.createDecorator(expression), pos);
28725         }
28726         function parseDecorators() {
28727             var pos = getNodePos();
28728             var list, decorator;
28729             while (decorator = tryParseDecorator()) {
28730                 list = ts.append(list, decorator);
28731             }
28732             return list && createNodeArray(list, pos);
28733         }
28734         function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
28735             var pos = getNodePos();
28736             var kind = token();
28737             if (token() === 85 && permitInvalidConstAsModifier) {
28738                 if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
28739                     return undefined;
28740                 }
28741             }
28742             else if (stopOnStartOfClassStaticBlock && token() === 124 && lookAhead(nextTokenIsOpenBrace)) {
28743                 return undefined;
28744             }
28745             else if (hasSeenStaticModifier && token() === 124) {
28746                 return undefined;
28747             }
28748             else {
28749                 if (!parseAnyContextualModifier()) {
28750                     return undefined;
28751                 }
28752             }
28753             return finishNode(factory.createToken(kind), pos);
28754         }
28755         function parseModifiers(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) {
28756             var pos = getNodePos();
28757             var list, modifier, hasSeenStatic = false;
28758             while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
28759                 if (modifier.kind === 124)
28760                     hasSeenStatic = true;
28761                 list = ts.append(list, modifier);
28762             }
28763             return list && createNodeArray(list, pos);
28764         }
28765         function parseModifiersForArrowFunction() {
28766             var modifiers;
28767             if (token() === 131) {
28768                 var pos = getNodePos();
28769                 nextToken();
28770                 var modifier = finishNode(factory.createToken(131), pos);
28771                 modifiers = createNodeArray([modifier], pos);
28772             }
28773             return modifiers;
28774         }
28775         function parseClassElement() {
28776             var pos = getNodePos();
28777             if (token() === 26) {
28778                 nextToken();
28779                 return finishNode(factory.createSemicolonClassElement(), pos);
28780             }
28781             var hasJSDoc = hasPrecedingJSDocComment();
28782             var decorators = parseDecorators();
28783             var modifiers = parseModifiers(true, true);
28784             if (token() === 124 && lookAhead(nextTokenIsOpenBrace)) {
28785                 return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
28786             }
28787             if (parseContextualModifier(136)) {
28788                 return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 171);
28789             }
28790             if (parseContextualModifier(148)) {
28791                 return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
28792             }
28793             if (token() === 134 || token() === 10) {
28794                 var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
28795                 if (constructorDeclaration) {
28796                     return constructorDeclaration;
28797                 }
28798             }
28799             if (isIndexSignature()) {
28800                 return parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers);
28801             }
28802             if (ts.tokenIsIdentifierOrKeyword(token()) ||
28803                 token() === 10 ||
28804                 token() === 8 ||
28805                 token() === 41 ||
28806                 token() === 22) {
28807                 var isAmbient = ts.some(modifiers, isDeclareModifier);
28808                 if (isAmbient) {
28809                     for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
28810                         var m = _a[_i];
28811                         m.flags |= 8388608;
28812                     }
28813                     return doInsideOfContext(8388608, function () { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); });
28814                 }
28815                 else {
28816                     return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers);
28817                 }
28818             }
28819             if (decorators || modifiers) {
28820                 var name = createMissingNode(79, true, ts.Diagnostics.Declaration_expected);
28821                 return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, undefined);
28822             }
28823             return ts.Debug.fail("Should not have attempted to parse class member declaration.");
28824         }
28825         function parseClassExpression() {
28826             return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined, 225);
28827         }
28828         function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) {
28829             return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 256);
28830         }
28831         function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) {
28832             var savedAwaitContext = inAwaitContext();
28833             parseExpected(84);
28834             var name = parseNameOfClassDeclarationOrExpression();
28835             var typeParameters = parseTypeParameters();
28836             if (ts.some(modifiers, ts.isExportModifier))
28837                 setAwaitContext(true);
28838             var heritageClauses = parseHeritageClauses();
28839             var members;
28840             if (parseExpected(18)) {
28841                 members = parseClassMembers();
28842                 parseExpected(19);
28843             }
28844             else {
28845                 members = createMissingList();
28846             }
28847             setAwaitContext(savedAwaitContext);
28848             var node = kind === 256
28849                 ? factory.createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members)
28850                 : factory.createClassExpression(decorators, modifiers, name, typeParameters, heritageClauses, members);
28851             return withJSDoc(finishNode(node, pos), hasJSDoc);
28852         }
28853         function parseNameOfClassDeclarationOrExpression() {
28854             return isBindingIdentifier() && !isImplementsClause()
28855                 ? createIdentifier(isBindingIdentifier())
28856                 : undefined;
28857         }
28858         function isImplementsClause() {
28859             return token() === 117 && lookAhead(nextTokenIsIdentifierOrKeyword);
28860         }
28861         function parseHeritageClauses() {
28862             if (isHeritageClause()) {
28863                 return parseList(22, parseHeritageClause);
28864             }
28865             return undefined;
28866         }
28867         function parseHeritageClause() {
28868             var pos = getNodePos();
28869             var tok = token();
28870             ts.Debug.assert(tok === 94 || tok === 117);
28871             nextToken();
28872             var types = parseDelimitedList(7, parseExpressionWithTypeArguments);
28873             return finishNode(factory.createHeritageClause(tok, types), pos);
28874         }
28875         function parseExpressionWithTypeArguments() {
28876             var pos = getNodePos();
28877             var expression = parseLeftHandSideExpressionOrHigher();
28878             var typeArguments = tryParseTypeArguments();
28879             return finishNode(factory.createExpressionWithTypeArguments(expression, typeArguments), pos);
28880         }
28881         function tryParseTypeArguments() {
28882             return token() === 29 ?
28883                 parseBracketedList(20, parseType, 29, 31) : undefined;
28884         }
28885         function isHeritageClause() {
28886             return token() === 94 || token() === 117;
28887         }
28888         function parseClassMembers() {
28889             return parseList(5, parseClassElement);
28890         }
28891         function parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers) {
28892             parseExpected(118);
28893             var name = parseIdentifier();
28894             var typeParameters = parseTypeParameters();
28895             var heritageClauses = parseHeritageClauses();
28896             var members = parseObjectTypeMembers();
28897             var node = factory.createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members);
28898             return withJSDoc(finishNode(node, pos), hasJSDoc);
28899         }
28900         function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) {
28901             parseExpected(151);
28902             var name = parseIdentifier();
28903             var typeParameters = parseTypeParameters();
28904             parseExpected(63);
28905             var type = token() === 138 && tryParse(parseKeywordAndNoDot) || parseType();
28906             parseSemicolon();
28907             var node = factory.createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type);
28908             return withJSDoc(finishNode(node, pos), hasJSDoc);
28909         }
28910         function parseEnumMember() {
28911             var pos = getNodePos();
28912             var hasJSDoc = hasPrecedingJSDocComment();
28913             var name = parsePropertyName();
28914             var initializer = allowInAnd(parseInitializer);
28915             return withJSDoc(finishNode(factory.createEnumMember(name, initializer), pos), hasJSDoc);
28916         }
28917         function parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers) {
28918             parseExpected(92);
28919             var name = parseIdentifier();
28920             var members;
28921             if (parseExpected(18)) {
28922                 members = doOutsideOfYieldAndAwaitContext(function () { return parseDelimitedList(6, parseEnumMember); });
28923                 parseExpected(19);
28924             }
28925             else {
28926                 members = createMissingList();
28927             }
28928             var node = factory.createEnumDeclaration(decorators, modifiers, name, members);
28929             return withJSDoc(finishNode(node, pos), hasJSDoc);
28930         }
28931         function parseModuleBlock() {
28932             var pos = getNodePos();
28933             var statements;
28934             if (parseExpected(18)) {
28935                 statements = parseList(1, parseStatement);
28936                 parseExpected(19);
28937             }
28938             else {
28939                 statements = createMissingList();
28940             }
28941             return finishNode(factory.createModuleBlock(statements), pos);
28942         }
28943         function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags) {
28944             var namespaceFlag = flags & 16;
28945             var name = parseIdentifier();
28946             var body = parseOptional(24)
28947                 ? parseModuleOrNamespaceDeclaration(getNodePos(), false, undefined, undefined, 4 | namespaceFlag)
28948                 : parseModuleBlock();
28949             var node = factory.createModuleDeclaration(decorators, modifiers, name, body, flags);
28950             return withJSDoc(finishNode(node, pos), hasJSDoc);
28951         }
28952         function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) {
28953             var flags = 0;
28954             var name;
28955             if (token() === 156) {
28956                 name = parseIdentifier();
28957                 flags |= 1024;
28958             }
28959             else {
28960                 name = parseLiteralNode();
28961                 name.text = internIdentifier(name.text);
28962             }
28963             var body;
28964             if (token() === 18) {
28965                 body = parseModuleBlock();
28966             }
28967             else {
28968                 parseSemicolon();
28969             }
28970             var node = factory.createModuleDeclaration(decorators, modifiers, name, body, flags);
28971             return withJSDoc(finishNode(node, pos), hasJSDoc);
28972         }
28973         function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) {
28974             var flags = 0;
28975             if (token() === 156) {
28976                 return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers);
28977             }
28978             else if (parseOptional(142)) {
28979                 flags |= 16;
28980             }
28981             else {
28982                 parseExpected(141);
28983                 if (token() === 10) {
28984                     return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers);
28985                 }
28986             }
28987             return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags);
28988         }
28989         function isExternalModuleReference() {
28990             return token() === 145 &&
28991                 lookAhead(nextTokenIsOpenParen);
28992         }
28993         function nextTokenIsOpenParen() {
28994             return nextToken() === 20;
28995         }
28996         function nextTokenIsOpenBrace() {
28997             return nextToken() === 18;
28998         }
28999         function nextTokenIsSlash() {
29000             return nextToken() === 43;
29001         }
29002         function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) {
29003             parseExpected(127);
29004             parseExpected(142);
29005             var name = parseIdentifier();
29006             parseSemicolon();
29007             var node = factory.createNamespaceExportDeclaration(name);
29008             node.decorators = decorators;
29009             node.modifiers = modifiers;
29010             return withJSDoc(finishNode(node, pos), hasJSDoc);
29011         }
29012         function parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers) {
29013             parseExpected(100);
29014             var afterImportPos = scanner.getStartPos();
29015             var identifier;
29016             if (isIdentifier()) {
29017                 identifier = parseIdentifier();
29018             }
29019             var isTypeOnly = false;
29020             if (token() !== 155 &&
29021                 (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" &&
29022                 (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
29023                 isTypeOnly = true;
29024                 identifier = isIdentifier() ? parseIdentifier() : undefined;
29025             }
29026             if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
29027                 return parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly);
29028             }
29029             var importClause;
29030             if (identifier ||
29031                 token() === 41 ||
29032                 token() === 18) {
29033                 importClause = parseImportClause(identifier, afterImportPos, isTypeOnly);
29034                 parseExpected(155);
29035             }
29036             var moduleSpecifier = parseModuleSpecifier();
29037             var assertClause;
29038             if (token() === 129 && !scanner.hasPrecedingLineBreak()) {
29039                 assertClause = parseAssertClause();
29040             }
29041             parseSemicolon();
29042             var node = factory.createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause);
29043             return withJSDoc(finishNode(node, pos), hasJSDoc);
29044         }
29045         function parseAssertEntry() {
29046             var pos = getNodePos();
29047             var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10);
29048             parseExpected(58);
29049             var value = parseLiteralLikeNode(10);
29050             return finishNode(factory.createAssertEntry(name, value), pos);
29051         }
29052         function parseAssertClause() {
29053             var pos = getNodePos();
29054             parseExpected(129);
29055             var openBracePosition = scanner.getTokenPos();
29056             if (parseExpected(18)) {
29057                 var multiLine = scanner.hasPrecedingLineBreak();
29058                 var elements = parseDelimitedList(24, parseAssertEntry, true);
29059                 if (!parseExpected(19)) {
29060                     var lastError = ts.lastOrUndefined(parseDiagnostics);
29061                     if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
29062                         ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
29063                     }
29064                 }
29065                 return finishNode(factory.createAssertClause(elements, multiLine), pos);
29066             }
29067             else {
29068                 var elements = createNodeArray([], getNodePos(), undefined, false);
29069                 return finishNode(factory.createAssertClause(elements, false), pos);
29070             }
29071         }
29072         function tokenAfterImportDefinitelyProducesImportDeclaration() {
29073             return token() === 41 || token() === 18;
29074         }
29075         function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() {
29076             return token() === 27 || token() === 155;
29077         }
29078         function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) {
29079             parseExpected(63);
29080             var moduleReference = parseModuleReference();
29081             parseSemicolon();
29082             var node = factory.createImportEqualsDeclaration(decorators, modifiers, isTypeOnly, identifier, moduleReference);
29083             var finished = withJSDoc(finishNode(node, pos), hasJSDoc);
29084             return finished;
29085         }
29086         function parseImportClause(identifier, pos, isTypeOnly) {
29087             var namedBindings;
29088             if (!identifier ||
29089                 parseOptional(27)) {
29090                 namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports(268);
29091             }
29092             return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos);
29093         }
29094         function parseModuleReference() {
29095             return isExternalModuleReference()
29096                 ? parseExternalModuleReference()
29097                 : parseEntityName(false);
29098         }
29099         function parseExternalModuleReference() {
29100             var pos = getNodePos();
29101             parseExpected(145);
29102             parseExpected(20);
29103             var expression = parseModuleSpecifier();
29104             parseExpected(21);
29105             return finishNode(factory.createExternalModuleReference(expression), pos);
29106         }
29107         function parseModuleSpecifier() {
29108             if (token() === 10) {
29109                 var result = parseLiteralNode();
29110                 result.text = internIdentifier(result.text);
29111                 return result;
29112             }
29113             else {
29114                 return parseExpression();
29115             }
29116         }
29117         function parseNamespaceImport() {
29118             var pos = getNodePos();
29119             parseExpected(41);
29120             parseExpected(127);
29121             var name = parseIdentifier();
29122             return finishNode(factory.createNamespaceImport(name), pos);
29123         }
29124         function parseNamedImportsOrExports(kind) {
29125             var pos = getNodePos();
29126             var node = kind === 268
29127                 ? factory.createNamedImports(parseBracketedList(23, parseImportSpecifier, 18, 19))
29128                 : factory.createNamedExports(parseBracketedList(23, parseExportSpecifier, 18, 19));
29129             return finishNode(node, pos);
29130         }
29131         function parseExportSpecifier() {
29132             return parseImportOrExportSpecifier(274);
29133         }
29134         function parseImportSpecifier() {
29135             return parseImportOrExportSpecifier(269);
29136         }
29137         function parseImportOrExportSpecifier(kind) {
29138             var pos = getNodePos();
29139             var checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
29140             var checkIdentifierStart = scanner.getTokenPos();
29141             var checkIdentifierEnd = scanner.getTextPos();
29142             var isTypeOnly = false;
29143             var propertyName;
29144             var canParseAsKeyword = true;
29145             var name = parseIdentifierName();
29146             if (name.escapedText === "type") {
29147                 if (token() === 127) {
29148                     var firstAs = parseIdentifierName();
29149                     if (token() === 127) {
29150                         var secondAs = parseIdentifierName();
29151                         if (ts.tokenIsIdentifierOrKeyword(token())) {
29152                             isTypeOnly = true;
29153                             propertyName = firstAs;
29154                             name = parseNameWithKeywordCheck();
29155                             canParseAsKeyword = false;
29156                         }
29157                         else {
29158                             propertyName = name;
29159                             name = secondAs;
29160                             canParseAsKeyword = false;
29161                         }
29162                     }
29163                     else if (ts.tokenIsIdentifierOrKeyword(token())) {
29164                         propertyName = name;
29165                         canParseAsKeyword = false;
29166                         name = parseNameWithKeywordCheck();
29167                     }
29168                     else {
29169                         isTypeOnly = true;
29170                         name = firstAs;
29171                     }
29172                 }
29173                 else if (ts.tokenIsIdentifierOrKeyword(token())) {
29174                     isTypeOnly = true;
29175                     name = parseNameWithKeywordCheck();
29176                 }
29177             }
29178             if (canParseAsKeyword && token() === 127) {
29179                 propertyName = name;
29180                 parseExpected(127);
29181                 name = parseNameWithKeywordCheck();
29182             }
29183             if (kind === 269 && checkIdentifierIsKeyword) {
29184                 parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
29185             }
29186             var node = kind === 269
29187                 ? factory.createImportSpecifier(isTypeOnly, propertyName, name)
29188                 : factory.createExportSpecifier(isTypeOnly, propertyName, name);
29189             return finishNode(node, pos);
29190             function parseNameWithKeywordCheck() {
29191                 checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
29192                 checkIdentifierStart = scanner.getTokenPos();
29193                 checkIdentifierEnd = scanner.getTextPos();
29194                 return parseIdentifierName();
29195             }
29196         }
29197         function parseNamespaceExport(pos) {
29198             return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos);
29199         }
29200         function parseExportDeclaration(pos, hasJSDoc, decorators, modifiers) {
29201             var savedAwaitContext = inAwaitContext();
29202             setAwaitContext(true);
29203             var exportClause;
29204             var moduleSpecifier;
29205             var assertClause;
29206             var isTypeOnly = parseOptional(151);
29207             var namespaceExportPos = getNodePos();
29208             if (parseOptional(41)) {
29209                 if (parseOptional(127)) {
29210                     exportClause = parseNamespaceExport(namespaceExportPos);
29211                 }
29212                 parseExpected(155);
29213                 moduleSpecifier = parseModuleSpecifier();
29214             }
29215             else {
29216                 exportClause = parseNamedImportsOrExports(272);
29217                 if (token() === 155 || (token() === 10 && !scanner.hasPrecedingLineBreak())) {
29218                     parseExpected(155);
29219                     moduleSpecifier = parseModuleSpecifier();
29220                 }
29221             }
29222             if (moduleSpecifier && token() === 129 && !scanner.hasPrecedingLineBreak()) {
29223                 assertClause = parseAssertClause();
29224             }
29225             parseSemicolon();
29226             setAwaitContext(savedAwaitContext);
29227             var node = factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
29228             return withJSDoc(finishNode(node, pos), hasJSDoc);
29229         }
29230         function parseExportAssignment(pos, hasJSDoc, decorators, modifiers) {
29231             var savedAwaitContext = inAwaitContext();
29232             setAwaitContext(true);
29233             var isExportEquals;
29234             if (parseOptional(63)) {
29235                 isExportEquals = true;
29236             }
29237             else {
29238                 parseExpected(88);
29239             }
29240             var expression = parseAssignmentExpressionOrHigher();
29241             parseSemicolon();
29242             setAwaitContext(savedAwaitContext);
29243             var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
29244             return withJSDoc(finishNode(node, pos), hasJSDoc);
29245         }
29246         function setExternalModuleIndicator(sourceFile) {
29247             sourceFile.externalModuleIndicator =
29248                 ts.forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) ||
29249                     getImportMetaIfNecessary(sourceFile);
29250         }
29251         function isAnExternalModuleIndicatorNode(node) {
29252             return hasModifierOfKind(node, 93)
29253                 || ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
29254                 || ts.isImportDeclaration(node)
29255                 || ts.isExportAssignment(node)
29256                 || ts.isExportDeclaration(node) ? node : undefined;
29257         }
29258         function getImportMetaIfNecessary(sourceFile) {
29259             return sourceFile.flags & 2097152 ?
29260                 walkTreeForExternalModuleIndicators(sourceFile) :
29261                 undefined;
29262         }
29263         function walkTreeForExternalModuleIndicators(node) {
29264             return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
29265         }
29266         function hasModifierOfKind(node, kind) {
29267             return ts.some(node.modifiers, function (m) { return m.kind === kind; });
29268         }
29269         function isImportMeta(node) {
29270             return ts.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta";
29271         }
29272         var JSDocParser;
29273         (function (JSDocParser) {
29274             function parseJSDocTypeExpressionForTests(content, start, length) {
29275                 initializeState("file.js", content, 99, undefined, 1);
29276                 scanner.setText(content, start, length);
29277                 currentToken = scanner.scan();
29278                 var jsDocTypeExpression = parseJSDocTypeExpression();
29279                 var sourceFile = createSourceFile("file.js", 99, 1, false, [], factory.createToken(1), 0);
29280                 var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29281                 if (jsDocDiagnostics) {
29282                     sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
29283                 }
29284                 clearState();
29285                 return jsDocTypeExpression ? { jsDocTypeExpression: jsDocTypeExpression, diagnostics: diagnostics } : undefined;
29286             }
29287             JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
29288             function parseJSDocTypeExpression(mayOmitBraces) {
29289                 var pos = getNodePos();
29290                 var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18);
29291                 var type = doInsideOfContext(4194304, parseJSDocType);
29292                 if (!mayOmitBraces || hasBrace) {
29293                     parseExpectedJSDoc(19);
29294                 }
29295                 var result = factory.createJSDocTypeExpression(type);
29296                 fixupParentReferences(result);
29297                 return finishNode(result, pos);
29298             }
29299             JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
29300             function parseJSDocNameReference() {
29301                 var pos = getNodePos();
29302                 var hasBrace = parseOptional(18);
29303                 var p2 = getNodePos();
29304                 var entityName = parseEntityName(false);
29305                 while (token() === 80) {
29306                     reScanHashToken();
29307                     nextTokenJSDoc();
29308                     entityName = finishNode(factory.createJSDocMemberName(entityName, parseIdentifier()), p2);
29309                 }
29310                 if (hasBrace) {
29311                     parseExpectedJSDoc(19);
29312                 }
29313                 var result = factory.createJSDocNameReference(entityName);
29314                 fixupParentReferences(result);
29315                 return finishNode(result, pos);
29316             }
29317             JSDocParser.parseJSDocNameReference = parseJSDocNameReference;
29318             function parseIsolatedJSDocComment(content, start, length) {
29319                 initializeState("", content, 99, undefined, 1);
29320                 var jsDoc = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29321                 var sourceFile = { languageVariant: 0, text: content };
29322                 var diagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
29323                 clearState();
29324                 return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined;
29325             }
29326             JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment;
29327             function parseJSDocComment(parent, start, length) {
29328                 var saveToken = currentToken;
29329                 var saveParseDiagnosticsLength = parseDiagnostics.length;
29330                 var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
29331                 var comment = doInsideOfContext(4194304, function () { return parseJSDocCommentWorker(start, length); });
29332                 ts.setParent(comment, parent);
29333                 if (contextFlags & 131072) {
29334                     if (!jsDocDiagnostics) {
29335                         jsDocDiagnostics = [];
29336                     }
29337                     jsDocDiagnostics.push.apply(jsDocDiagnostics, parseDiagnostics);
29338                 }
29339                 currentToken = saveToken;
29340                 parseDiagnostics.length = saveParseDiagnosticsLength;
29341                 parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
29342                 return comment;
29343             }
29344             JSDocParser.parseJSDocComment = parseJSDocComment;
29345             function parseJSDocCommentWorker(start, length) {
29346                 if (start === void 0) { start = 0; }
29347                 var content = sourceText;
29348                 var end = length === undefined ? content.length : start + length;
29349                 length = end - start;
29350                 ts.Debug.assert(start >= 0);
29351                 ts.Debug.assert(start <= end);
29352                 ts.Debug.assert(end <= content.length);
29353                 if (!isJSDocLikeText(content, start)) {
29354                     return undefined;
29355                 }
29356                 var tags;
29357                 var tagsPos;
29358                 var tagsEnd;
29359                 var linkEnd;
29360                 var commentsPos;
29361                 var comments = [];
29362                 var parts = [];
29363                 return scanner.scanRange(start + 3, length - 5, function () {
29364                     var state = 1;
29365                     var margin;
29366                     var indent = start - (content.lastIndexOf("\n", start) + 1) + 4;
29367                     function pushComment(text) {
29368                         if (!margin) {
29369                             margin = indent;
29370                         }
29371                         comments.push(text);
29372                         indent += text.length;
29373                     }
29374                     nextTokenJSDoc();
29375                     while (parseOptionalJsdoc(5))
29376                         ;
29377                     if (parseOptionalJsdoc(4)) {
29378                         state = 0;
29379                         indent = 0;
29380                     }
29381                     loop: while (true) {
29382                         switch (token()) {
29383                             case 59:
29384                                 if (state === 0 || state === 1) {
29385                                     removeTrailingWhitespace(comments);
29386                                     if (!commentsPos)
29387                                         commentsPos = getNodePos();
29388                                     addTag(parseTag(indent));
29389                                     state = 0;
29390                                     margin = undefined;
29391                                 }
29392                                 else {
29393                                     pushComment(scanner.getTokenText());
29394                                 }
29395                                 break;
29396                             case 4:
29397                                 comments.push(scanner.getTokenText());
29398                                 state = 0;
29399                                 indent = 0;
29400                                 break;
29401                             case 41:
29402                                 var asterisk = scanner.getTokenText();
29403                                 if (state === 1 || state === 2) {
29404                                     state = 2;
29405                                     pushComment(asterisk);
29406                                 }
29407                                 else {
29408                                     state = 1;
29409                                     indent += asterisk.length;
29410                                 }
29411                                 break;
29412                             case 5:
29413                                 var whitespace = scanner.getTokenText();
29414                                 if (state === 2) {
29415                                     comments.push(whitespace);
29416                                 }
29417                                 else if (margin !== undefined && indent + whitespace.length > margin) {
29418                                     comments.push(whitespace.slice(margin - indent));
29419                                 }
29420                                 indent += whitespace.length;
29421                                 break;
29422                             case 1:
29423                                 break loop;
29424                             case 18:
29425                                 state = 2;
29426                                 var commentEnd = scanner.getStartPos();
29427                                 var linkStart = scanner.getTextPos() - 1;
29428                                 var link = parseJSDocLink(linkStart);
29429                                 if (link) {
29430                                     if (!linkEnd) {
29431                                         removeLeadingNewlines(comments);
29432                                     }
29433                                     parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : start, commentEnd));
29434                                     parts.push(link);
29435                                     comments = [];
29436                                     linkEnd = scanner.getTextPos();
29437                                     break;
29438                                 }
29439                             default:
29440                                 state = 2;
29441                                 pushComment(scanner.getTokenText());
29442                                 break;
29443                         }
29444                         nextTokenJSDoc();
29445                     }
29446                     removeTrailingWhitespace(comments);
29447                     if (parts.length && comments.length) {
29448                         parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : start, commentsPos));
29449                     }
29450                     if (parts.length && tags)
29451                         ts.Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set");
29452                     var tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
29453                     return finishNode(factory.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : comments.length ? comments.join("") : undefined, tagsArray), start, end);
29454                 });
29455                 function removeLeadingNewlines(comments) {
29456                     while (comments.length && (comments[0] === "\n" || comments[0] === "\r")) {
29457                         comments.shift();
29458                     }
29459                 }
29460                 function removeTrailingWhitespace(comments) {
29461                     while (comments.length && comments[comments.length - 1].trim() === "") {
29462                         comments.pop();
29463                     }
29464                 }
29465                 function isNextNonwhitespaceTokenEndOfFile() {
29466                     while (true) {
29467                         nextTokenJSDoc();
29468                         if (token() === 1) {
29469                             return true;
29470                         }
29471                         if (!(token() === 5 || token() === 4)) {
29472                             return false;
29473                         }
29474                     }
29475                 }
29476                 function skipWhitespace() {
29477                     if (token() === 5 || token() === 4) {
29478                         if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
29479                             return;
29480                         }
29481                     }
29482                     while (token() === 5 || token() === 4) {
29483                         nextTokenJSDoc();
29484                     }
29485                 }
29486                 function skipWhitespaceOrAsterisk() {
29487                     if (token() === 5 || token() === 4) {
29488                         if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
29489                             return "";
29490                         }
29491                     }
29492                     var precedingLineBreak = scanner.hasPrecedingLineBreak();
29493                     var seenLineBreak = false;
29494                     var indentText = "";
29495                     while ((precedingLineBreak && token() === 41) || token() === 5 || token() === 4) {
29496                         indentText += scanner.getTokenText();
29497                         if (token() === 4) {
29498                             precedingLineBreak = true;
29499                             seenLineBreak = true;
29500                             indentText = "";
29501                         }
29502                         else if (token() === 41) {
29503                             precedingLineBreak = false;
29504                         }
29505                         nextTokenJSDoc();
29506                     }
29507                     return seenLineBreak ? indentText : "";
29508                 }
29509                 function parseTag(margin) {
29510                     ts.Debug.assert(token() === 59);
29511                     var start = scanner.getTokenPos();
29512                     nextTokenJSDoc();
29513                     var tagName = parseJSDocIdentifierName(undefined);
29514                     var indentText = skipWhitespaceOrAsterisk();
29515                     var tag;
29516                     switch (tagName.escapedText) {
29517                         case "author":
29518                             tag = parseAuthorTag(start, tagName, margin, indentText);
29519                             break;
29520                         case "implements":
29521                             tag = parseImplementsTag(start, tagName, margin, indentText);
29522                             break;
29523                         case "augments":
29524                         case "extends":
29525                             tag = parseAugmentsTag(start, tagName, margin, indentText);
29526                             break;
29527                         case "class":
29528                         case "constructor":
29529                             tag = parseSimpleTag(start, factory.createJSDocClassTag, tagName, margin, indentText);
29530                             break;
29531                         case "public":
29532                             tag = parseSimpleTag(start, factory.createJSDocPublicTag, tagName, margin, indentText);
29533                             break;
29534                         case "private":
29535                             tag = parseSimpleTag(start, factory.createJSDocPrivateTag, tagName, margin, indentText);
29536                             break;
29537                         case "protected":
29538                             tag = parseSimpleTag(start, factory.createJSDocProtectedTag, tagName, margin, indentText);
29539                             break;
29540                         case "readonly":
29541                             tag = parseSimpleTag(start, factory.createJSDocReadonlyTag, tagName, margin, indentText);
29542                             break;
29543                         case "override":
29544                             tag = parseSimpleTag(start, factory.createJSDocOverrideTag, tagName, margin, indentText);
29545                             break;
29546                         case "deprecated":
29547                             hasDeprecatedTag = true;
29548                             tag = parseSimpleTag(start, factory.createJSDocDeprecatedTag, tagName, margin, indentText);
29549                             break;
29550                         case "this":
29551                             tag = parseThisTag(start, tagName, margin, indentText);
29552                             break;
29553                         case "enum":
29554                             tag = parseEnumTag(start, tagName, margin, indentText);
29555                             break;
29556                         case "arg":
29557                         case "argument":
29558                         case "param":
29559                             return parseParameterOrPropertyTag(start, tagName, 2, margin);
29560                         case "return":
29561                         case "returns":
29562                             tag = parseReturnTag(start, tagName, margin, indentText);
29563                             break;
29564                         case "template":
29565                             tag = parseTemplateTag(start, tagName, margin, indentText);
29566                             break;
29567                         case "type":
29568                             tag = parseTypeTag(start, tagName, margin, indentText);
29569                             break;
29570                         case "typedef":
29571                             tag = parseTypedefTag(start, tagName, margin, indentText);
29572                             break;
29573                         case "callback":
29574                             tag = parseCallbackTag(start, tagName, margin, indentText);
29575                             break;
29576                         case "see":
29577                             tag = parseSeeTag(start, tagName, margin, indentText);
29578                             break;
29579                         default:
29580                             tag = parseUnknownTag(start, tagName, margin, indentText);
29581                             break;
29582                     }
29583                     return tag;
29584                 }
29585                 function parseTrailingTagComments(pos, end, margin, indentText) {
29586                     if (!indentText) {
29587                         margin += end - pos;
29588                     }
29589                     return parseTagComments(margin, indentText.slice(margin));
29590                 }
29591                 function parseTagComments(indent, initialMargin) {
29592                     var commentsPos = getNodePos();
29593                     var comments = [];
29594                     var parts = [];
29595                     var linkEnd;
29596                     var state = 0;
29597                     var previousWhitespace = true;
29598                     var margin;
29599                     function pushComment(text) {
29600                         if (!margin) {
29601                             margin = indent;
29602                         }
29603                         comments.push(text);
29604                         indent += text.length;
29605                     }
29606                     if (initialMargin !== undefined) {
29607                         if (initialMargin !== "") {
29608                             pushComment(initialMargin);
29609                         }
29610                         state = 1;
29611                     }
29612                     var tok = token();
29613                     loop: while (true) {
29614                         switch (tok) {
29615                             case 4:
29616                                 state = 0;
29617                                 comments.push(scanner.getTokenText());
29618                                 indent = 0;
29619                                 break;
29620                             case 59:
29621                                 if (state === 3
29622                                     || state === 2 && (!previousWhitespace || lookAhead(isNextJSDocTokenWhitespace))) {
29623                                     comments.push(scanner.getTokenText());
29624                                     break;
29625                                 }
29626                                 scanner.setTextPos(scanner.getTextPos() - 1);
29627                             case 1:
29628                                 break loop;
29629                             case 5:
29630                                 if (state === 2 || state === 3) {
29631                                     pushComment(scanner.getTokenText());
29632                                 }
29633                                 else {
29634                                     var whitespace = scanner.getTokenText();
29635                                     if (margin !== undefined && indent + whitespace.length > margin) {
29636                                         comments.push(whitespace.slice(margin - indent));
29637                                     }
29638                                     indent += whitespace.length;
29639                                 }
29640                                 break;
29641                             case 18:
29642                                 state = 2;
29643                                 var commentEnd = scanner.getStartPos();
29644                                 var linkStart = scanner.getTextPos() - 1;
29645                                 var link = parseJSDocLink(linkStart);
29646                                 if (link) {
29647                                     parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : commentsPos, commentEnd));
29648                                     parts.push(link);
29649                                     comments = [];
29650                                     linkEnd = scanner.getTextPos();
29651                                 }
29652                                 else {
29653                                     pushComment(scanner.getTokenText());
29654                                 }
29655                                 break;
29656                             case 61:
29657                                 if (state === 3) {
29658                                     state = 2;
29659                                 }
29660                                 else {
29661                                     state = 3;
29662                                 }
29663                                 pushComment(scanner.getTokenText());
29664                                 break;
29665                             case 41:
29666                                 if (state === 0) {
29667                                     state = 1;
29668                                     indent += 1;
29669                                     break;
29670                                 }
29671                             default:
29672                                 if (state !== 3) {
29673                                     state = 2;
29674                                 }
29675                                 pushComment(scanner.getTokenText());
29676                                 break;
29677                         }
29678                         previousWhitespace = token() === 5;
29679                         tok = nextTokenJSDoc();
29680                     }
29681                     removeLeadingNewlines(comments);
29682                     removeTrailingWhitespace(comments);
29683                     if (parts.length) {
29684                         if (comments.length) {
29685                             parts.push(finishNode(factory.createJSDocText(comments.join("")), linkEnd !== null && linkEnd !== void 0 ? linkEnd : commentsPos));
29686                         }
29687                         return createNodeArray(parts, commentsPos, scanner.getTextPos());
29688                     }
29689                     else if (comments.length) {
29690                         return comments.join("");
29691                     }
29692                 }
29693                 function isNextJSDocTokenWhitespace() {
29694                     var next = nextTokenJSDoc();
29695                     return next === 5 || next === 4;
29696                 }
29697                 function parseJSDocLink(start) {
29698                     var linkType = tryParse(parseJSDocLinkPrefix);
29699                     if (!linkType) {
29700                         return undefined;
29701                     }
29702                     nextTokenJSDoc();
29703                     skipWhitespace();
29704                     var p2 = getNodePos();
29705                     var name = ts.tokenIsIdentifierOrKeyword(token())
29706                         ? parseEntityName(true)
29707                         : undefined;
29708                     if (name) {
29709                         while (token() === 80) {
29710                             reScanHashToken();
29711                             nextTokenJSDoc();
29712                             name = finishNode(factory.createJSDocMemberName(name, parseIdentifier()), p2);
29713                         }
29714                     }
29715                     var text = [];
29716                     while (token() !== 19 && token() !== 4 && token() !== 1) {
29717                         text.push(scanner.getTokenText());
29718                         nextTokenJSDoc();
29719                     }
29720                     var create = linkType === "link" ? factory.createJSDocLink
29721                         : linkType === "linkcode" ? factory.createJSDocLinkCode
29722                             : factory.createJSDocLinkPlain;
29723                     return finishNode(create(name, text.join("")), start, scanner.getTextPos());
29724                 }
29725                 function parseJSDocLinkPrefix() {
29726                     skipWhitespaceOrAsterisk();
29727                     if (token() === 18
29728                         && nextTokenJSDoc() === 59
29729                         && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc())) {
29730                         var kind = scanner.getTokenValue();
29731                         if (kind === "link" || kind === "linkcode" || kind === "linkplain") {
29732                             return kind;
29733                         }
29734                     }
29735                 }
29736                 function parseUnknownTag(start, tagName, indent, indentText) {
29737                     return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start);
29738                 }
29739                 function addTag(tag) {
29740                     if (!tag) {
29741                         return;
29742                     }
29743                     if (!tags) {
29744                         tags = [tag];
29745                         tagsPos = tag.pos;
29746                     }
29747                     else {
29748                         tags.push(tag);
29749                     }
29750                     tagsEnd = tag.end;
29751                 }
29752                 function tryParseTypeExpression() {
29753                     skipWhitespaceOrAsterisk();
29754                     return token() === 18 ? parseJSDocTypeExpression() : undefined;
29755                 }
29756                 function parseBracketNameInPropertyAndParamTag() {
29757                     var isBracketed = parseOptionalJsdoc(22);
29758                     if (isBracketed) {
29759                         skipWhitespace();
29760                     }
29761                     var isBackquoted = parseOptionalJsdoc(61);
29762                     var name = parseJSDocEntityName();
29763                     if (isBackquoted) {
29764                         parseExpectedTokenJSDoc(61);
29765                     }
29766                     if (isBracketed) {
29767                         skipWhitespace();
29768                         if (parseOptionalToken(63)) {
29769                             parseExpression();
29770                         }
29771                         parseExpected(23);
29772                     }
29773                     return { name: name, isBracketed: isBracketed };
29774                 }
29775                 function isObjectOrObjectArrayTypeReference(node) {
29776                     switch (node.kind) {
29777                         case 147:
29778                             return true;
29779                         case 182:
29780                             return isObjectOrObjectArrayTypeReference(node.elementType);
29781                         default:
29782                             return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments;
29783                     }
29784                 }
29785                 function parseParameterOrPropertyTag(start, tagName, target, indent) {
29786                     var typeExpression = tryParseTypeExpression();
29787                     var isNameFirst = !typeExpression;
29788                     skipWhitespaceOrAsterisk();
29789                     var _a = parseBracketNameInPropertyAndParamTag(), name = _a.name, isBracketed = _a.isBracketed;
29790                     var indentText = skipWhitespaceOrAsterisk();
29791                     if (isNameFirst && !lookAhead(parseJSDocLinkPrefix)) {
29792                         typeExpression = tryParseTypeExpression();
29793                     }
29794                     var comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
29795                     var nestedTypeLiteral = target !== 4 && parseNestedTypeLiteral(typeExpression, name, target, indent);
29796                     if (nestedTypeLiteral) {
29797                         typeExpression = nestedTypeLiteral;
29798                         isNameFirst = true;
29799                     }
29800                     var result = target === 1
29801                         ? factory.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment)
29802                         : factory.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
29803                     return finishNode(result, start);
29804                 }
29805                 function parseNestedTypeLiteral(typeExpression, name, target, indent) {
29806                     if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
29807                         var pos = getNodePos();
29808                         var child = void 0;
29809                         var children = void 0;
29810                         while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
29811                             if (child.kind === 338 || child.kind === 345) {
29812                                 children = ts.append(children, child);
29813                             }
29814                         }
29815                         if (children) {
29816                             var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 182), pos);
29817                             return finishNode(factory.createJSDocTypeExpression(literal), pos);
29818                         }
29819                     }
29820                 }
29821                 function parseReturnTag(start, tagName, indent, indentText) {
29822                     if (ts.some(tags, ts.isJSDocReturnTag)) {
29823                         parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
29824                     }
29825                     var typeExpression = tryParseTypeExpression();
29826                     return finishNode(factory.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start);
29827                 }
29828                 function parseTypeTag(start, tagName, indent, indentText) {
29829                     if (ts.some(tags, ts.isJSDocTypeTag)) {
29830                         parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
29831                     }
29832                     var typeExpression = parseJSDocTypeExpression(true);
29833                     var comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined;
29834                     return finishNode(factory.createJSDocTypeTag(tagName, typeExpression, comments), start);
29835                 }
29836                 function parseSeeTag(start, tagName, indent, indentText) {
29837                     var isMarkdownOrJSDocLink = token() === 22
29838                         || lookAhead(function () { return nextTokenJSDoc() === 59 && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue() === "link"; });
29839                     var nameExpression = isMarkdownOrJSDocLink ? undefined : parseJSDocNameReference();
29840                     var comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined;
29841                     return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start);
29842                 }
29843                 function parseAuthorTag(start, tagName, indent, indentText) {
29844                     var commentStart = getNodePos();
29845                     var textOnly = parseAuthorNameAndEmail();
29846                     var commentEnd = scanner.getStartPos();
29847                     var comments = parseTrailingTagComments(start, commentEnd, indent, indentText);
29848                     if (!comments) {
29849                         commentEnd = scanner.getStartPos();
29850                     }
29851                     var allParts = typeof comments !== "string"
29852                         ? createNodeArray(ts.concatenate([finishNode(textOnly, commentStart, commentEnd)], comments), commentStart)
29853                         : textOnly.text + comments;
29854                     return finishNode(factory.createJSDocAuthorTag(tagName, allParts), start);
29855                 }
29856                 function parseAuthorNameAndEmail() {
29857                     var comments = [];
29858                     var inEmail = false;
29859                     var token = scanner.getToken();
29860                     while (token !== 1 && token !== 4) {
29861                         if (token === 29) {
29862                             inEmail = true;
29863                         }
29864                         else if (token === 59 && !inEmail) {
29865                             break;
29866                         }
29867                         else if (token === 31 && inEmail) {
29868                             comments.push(scanner.getTokenText());
29869                             scanner.setTextPos(scanner.getTokenPos() + 1);
29870                             break;
29871                         }
29872                         comments.push(scanner.getTokenText());
29873                         token = nextTokenJSDoc();
29874                     }
29875                     return factory.createJSDocText(comments.join(""));
29876                 }
29877                 function parseImplementsTag(start, tagName, margin, indentText) {
29878                     var className = parseExpressionWithTypeArgumentsForAugments();
29879                     return finishNode(factory.createJSDocImplementsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start);
29880                 }
29881                 function parseAugmentsTag(start, tagName, margin, indentText) {
29882                     var className = parseExpressionWithTypeArgumentsForAugments();
29883                     return finishNode(factory.createJSDocAugmentsTag(tagName, className, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start);
29884                 }
29885                 function parseExpressionWithTypeArgumentsForAugments() {
29886                     var usedBrace = parseOptional(18);
29887                     var pos = getNodePos();
29888                     var expression = parsePropertyAccessEntityNameExpression();
29889                     var typeArguments = tryParseTypeArguments();
29890                     var node = factory.createExpressionWithTypeArguments(expression, typeArguments);
29891                     var res = finishNode(node, pos);
29892                     if (usedBrace) {
29893                         parseExpected(19);
29894                     }
29895                     return res;
29896                 }
29897                 function parsePropertyAccessEntityNameExpression() {
29898                     var pos = getNodePos();
29899                     var node = parseJSDocIdentifierName();
29900                     while (parseOptional(24)) {
29901                         var name = parseJSDocIdentifierName();
29902                         node = finishNode(factory.createPropertyAccessExpression(node, name), pos);
29903                     }
29904                     return node;
29905                 }
29906                 function parseSimpleTag(start, createTag, tagName, margin, indentText) {
29907                     return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start);
29908                 }
29909                 function parseThisTag(start, tagName, margin, indentText) {
29910                     var typeExpression = parseJSDocTypeExpression(true);
29911                     skipWhitespace();
29912                     return finishNode(factory.createJSDocThisTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start);
29913                 }
29914                 function parseEnumTag(start, tagName, margin, indentText) {
29915                     var typeExpression = parseJSDocTypeExpression(true);
29916                     skipWhitespace();
29917                     return finishNode(factory.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start);
29918                 }
29919                 function parseTypedefTag(start, tagName, indent, indentText) {
29920                     var _a;
29921                     var typeExpression = tryParseTypeExpression();
29922                     skipWhitespaceOrAsterisk();
29923                     var fullName = parseJSDocTypeNameWithNamespace();
29924                     skipWhitespace();
29925                     var comment = parseTagComments(indent);
29926                     var end;
29927                     if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) {
29928                         var child = void 0;
29929                         var childTypeTag = void 0;
29930                         var jsDocPropertyTags = void 0;
29931                         var hasChildren = false;
29932                         while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
29933                             hasChildren = true;
29934                             if (child.kind === 341) {
29935                                 if (childTypeTag) {
29936                                     parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
29937                                     var lastError = ts.lastOrUndefined(parseDiagnostics);
29938                                     if (lastError) {
29939                                         ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
29940                                     }
29941                                     break;
29942                                 }
29943                                 else {
29944                                     childTypeTag = child;
29945                                 }
29946                             }
29947                             else {
29948                                 jsDocPropertyTags = ts.append(jsDocPropertyTags, child);
29949                             }
29950                         }
29951                         if (hasChildren) {
29952                             var isArrayType = typeExpression && typeExpression.type.kind === 182;
29953                             var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType);
29954                             typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
29955                                 childTypeTag.typeExpression :
29956                                 finishNode(jsdocTypeLiteral, start);
29957                             end = typeExpression.end;
29958                         }
29959                     }
29960                     end = end || comment !== undefined ?
29961                         getNodePos() :
29962                         ((_a = fullName !== null && fullName !== void 0 ? fullName : typeExpression) !== null && _a !== void 0 ? _a : tagName).end;
29963                     if (!comment) {
29964                         comment = parseTrailingTagComments(start, end, indent, indentText);
29965                     }
29966                     var typedefTag = factory.createJSDocTypedefTag(tagName, typeExpression, fullName, comment);
29967                     return finishNode(typedefTag, start, end);
29968                 }
29969                 function parseJSDocTypeNameWithNamespace(nested) {
29970                     var pos = scanner.getTokenPos();
29971                     if (!ts.tokenIsIdentifierOrKeyword(token())) {
29972                         return undefined;
29973                     }
29974                     var typeNameOrNamespaceName = parseJSDocIdentifierName();
29975                     if (parseOptional(24)) {
29976                         var body = parseJSDocTypeNameWithNamespace(true);
29977                         var jsDocNamespaceNode = factory.createModuleDeclaration(undefined, undefined, typeNameOrNamespaceName, body, nested ? 4 : undefined);
29978                         return finishNode(jsDocNamespaceNode, pos);
29979                     }
29980                     if (nested) {
29981                         typeNameOrNamespaceName.isInJSDocNamespace = true;
29982                     }
29983                     return typeNameOrNamespaceName;
29984                 }
29985                 function parseCallbackTagParameters(indent) {
29986                     var pos = getNodePos();
29987                     var child;
29988                     var parameters;
29989                     while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4, indent); })) {
29990                         parameters = ts.append(parameters, child);
29991                     }
29992                     return createNodeArray(parameters || [], pos);
29993                 }
29994                 function parseCallbackTag(start, tagName, indent, indentText) {
29995                     var fullName = parseJSDocTypeNameWithNamespace();
29996                     skipWhitespace();
29997                     var comment = parseTagComments(indent);
29998                     var parameters = parseCallbackTagParameters(indent);
29999                     var returnTag = tryParse(function () {
30000                         if (parseOptionalJsdoc(59)) {
30001                             var tag = parseTag(indent);
30002                             if (tag && tag.kind === 339) {
30003                                 return tag;
30004                             }
30005                         }
30006                     });
30007                     var typeExpression = finishNode(factory.createJSDocSignature(undefined, parameters, returnTag), start);
30008                     if (!comment) {
30009                         comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
30010                     }
30011                     return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
30012                 }
30013                 function escapedTextsEqual(a, b) {
30014                     while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
30015                         if (!ts.isIdentifier(a) && !ts.isIdentifier(b) && a.right.escapedText === b.right.escapedText) {
30016                             a = a.left;
30017                             b = b.left;
30018                         }
30019                         else {
30020                             return false;
30021                         }
30022                     }
30023                     return a.escapedText === b.escapedText;
30024                 }
30025                 function parseChildPropertyTag(indent) {
30026                     return parseChildParameterOrPropertyTag(1, indent);
30027                 }
30028                 function parseChildParameterOrPropertyTag(target, indent, name) {
30029                     var canParseTag = true;
30030                     var seenAsterisk = false;
30031                     while (true) {
30032                         switch (nextTokenJSDoc()) {
30033                             case 59:
30034                                 if (canParseTag) {
30035                                     var child = tryParseChildTag(target, indent);
30036                                     if (child && (child.kind === 338 || child.kind === 345) &&
30037                                         target !== 4 &&
30038                                         name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
30039                                         return false;
30040                                     }
30041                                     return child;
30042                                 }
30043                                 seenAsterisk = false;
30044                                 break;
30045                             case 4:
30046                                 canParseTag = true;
30047                                 seenAsterisk = false;
30048                                 break;
30049                             case 41:
30050                                 if (seenAsterisk) {
30051                                     canParseTag = false;
30052                                 }
30053                                 seenAsterisk = true;
30054                                 break;
30055                             case 79:
30056                                 canParseTag = false;
30057                                 break;
30058                             case 1:
30059                                 return false;
30060                         }
30061                     }
30062                 }
30063                 function tryParseChildTag(target, indent) {
30064                     ts.Debug.assert(token() === 59);
30065                     var start = scanner.getStartPos();
30066                     nextTokenJSDoc();
30067                     var tagName = parseJSDocIdentifierName();
30068                     skipWhitespace();
30069                     var t;
30070                     switch (tagName.escapedText) {
30071                         case "type":
30072                             return target === 1 && parseTypeTag(start, tagName);
30073                         case "prop":
30074                         case "property":
30075                             t = 1;
30076                             break;
30077                         case "arg":
30078                         case "argument":
30079                         case "param":
30080                             t = 2 | 4;
30081                             break;
30082                         default:
30083                             return false;
30084                     }
30085                     if (!(target & t)) {
30086                         return false;
30087                     }
30088                     return parseParameterOrPropertyTag(start, tagName, target, indent);
30089                 }
30090                 function parseTemplateTagTypeParameter() {
30091                     var typeParameterPos = getNodePos();
30092                     var isBracketed = parseOptionalJsdoc(22);
30093                     if (isBracketed) {
30094                         skipWhitespace();
30095                     }
30096                     var name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
30097                     var defaultType;
30098                     if (isBracketed) {
30099                         skipWhitespace();
30100                         parseExpected(63);
30101                         defaultType = doInsideOfContext(4194304, parseJSDocType);
30102                         parseExpected(23);
30103                     }
30104                     if (ts.nodeIsMissing(name)) {
30105                         return undefined;
30106                     }
30107                     return finishNode(factory.createTypeParameterDeclaration(name, undefined, defaultType), typeParameterPos);
30108                 }
30109                 function parseTemplateTagTypeParameters() {
30110                     var pos = getNodePos();
30111                     var typeParameters = [];
30112                     do {
30113                         skipWhitespace();
30114                         var node = parseTemplateTagTypeParameter();
30115                         if (node !== undefined) {
30116                             typeParameters.push(node);
30117                         }
30118                         skipWhitespaceOrAsterisk();
30119                     } while (parseOptionalJsdoc(27));
30120                     return createNodeArray(typeParameters, pos);
30121                 }
30122                 function parseTemplateTag(start, tagName, indent, indentText) {
30123                     var constraint = token() === 18 ? parseJSDocTypeExpression() : undefined;
30124                     var typeParameters = parseTemplateTagTypeParameters();
30125                     return finishNode(factory.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start);
30126                 }
30127                 function parseOptionalJsdoc(t) {
30128                     if (token() === t) {
30129                         nextTokenJSDoc();
30130                         return true;
30131                     }
30132                     return false;
30133                 }
30134                 function parseJSDocEntityName() {
30135                     var entity = parseJSDocIdentifierName();
30136                     if (parseOptional(22)) {
30137                         parseExpected(23);
30138                     }
30139                     while (parseOptional(24)) {
30140                         var name = parseJSDocIdentifierName();
30141                         if (parseOptional(22)) {
30142                             parseExpected(23);
30143                         }
30144                         entity = createQualifiedName(entity, name);
30145                     }
30146                     return entity;
30147                 }
30148                 function parseJSDocIdentifierName(message) {
30149                     if (!ts.tokenIsIdentifierOrKeyword(token())) {
30150                         return createMissingNode(79, !message, message || ts.Diagnostics.Identifier_expected);
30151                     }
30152                     identifierCount++;
30153                     var pos = scanner.getTokenPos();
30154                     var end = scanner.getTextPos();
30155                     var originalKeywordKind = token();
30156                     var text = internIdentifier(scanner.getTokenValue());
30157                     var result = finishNode(factory.createIdentifier(text, undefined, originalKeywordKind), pos, end);
30158                     nextTokenJSDoc();
30159                     return result;
30160                 }
30161             }
30162         })(JSDocParser = Parser.JSDocParser || (Parser.JSDocParser = {}));
30163     })(Parser || (Parser = {}));
30164     var IncrementalParser;
30165     (function (IncrementalParser) {
30166         function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
30167             aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2);
30168             checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks);
30169             if (ts.textChangeRangeIsUnchanged(textChangeRange)) {
30170                 return sourceFile;
30171             }
30172             if (sourceFile.statements.length === 0) {
30173                 return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true, sourceFile.scriptKind);
30174             }
30175             var incrementalSourceFile = sourceFile;
30176             ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);
30177             incrementalSourceFile.hasBeenIncrementallyParsed = true;
30178             Parser.fixupParentReferences(incrementalSourceFile);
30179             var oldText = sourceFile.text;
30180             var syntaxCursor = createSyntaxCursor(sourceFile);
30181             var changeRange = extendToAffectedRange(sourceFile, textChangeRange);
30182             checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks);
30183             ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start);
30184             ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span));
30185             ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)));
30186             var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
30187             updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
30188             var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind);
30189             result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks);
30190             result.impliedNodeFormat = sourceFile.impliedNodeFormat;
30191             return result;
30192         }
30193         IncrementalParser.updateSourceFile = updateSourceFile;
30194         function getNewCommentDirectives(oldDirectives, newDirectives, changeStart, changeRangeOldEnd, delta, oldText, newText, aggressiveChecks) {
30195             if (!oldDirectives)
30196                 return newDirectives;
30197             var commentDirectives;
30198             var addedNewlyScannedDirectives = false;
30199             for (var _i = 0, oldDirectives_1 = oldDirectives; _i < oldDirectives_1.length; _i++) {
30200                 var directive = oldDirectives_1[_i];
30201                 var range = directive.range, type = directive.type;
30202                 if (range.end < changeStart) {
30203                     commentDirectives = ts.append(commentDirectives, directive);
30204                 }
30205                 else if (range.pos > changeRangeOldEnd) {
30206                     addNewlyScannedDirectives();
30207                     var updatedDirective = {
30208                         range: { pos: range.pos + delta, end: range.end + delta },
30209                         type: type
30210                     };
30211                     commentDirectives = ts.append(commentDirectives, updatedDirective);
30212                     if (aggressiveChecks) {
30213                         ts.Debug.assert(oldText.substring(range.pos, range.end) === newText.substring(updatedDirective.range.pos, updatedDirective.range.end));
30214                     }
30215                 }
30216             }
30217             addNewlyScannedDirectives();
30218             return commentDirectives;
30219             function addNewlyScannedDirectives() {
30220                 if (addedNewlyScannedDirectives)
30221                     return;
30222                 addedNewlyScannedDirectives = true;
30223                 if (!commentDirectives) {
30224                     commentDirectives = newDirectives;
30225                 }
30226                 else if (newDirectives) {
30227                     commentDirectives.push.apply(commentDirectives, newDirectives);
30228                 }
30229             }
30230         }
30231         function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) {
30232             if (isArray) {
30233                 visitArray(element);
30234             }
30235             else {
30236                 visitNode(element);
30237             }
30238             return;
30239             function visitNode(node) {
30240                 var text = "";
30241                 if (aggressiveChecks && shouldCheckNode(node)) {
30242                     text = oldText.substring(node.pos, node.end);
30243                 }
30244                 if (node._children) {
30245                     node._children = undefined;
30246                 }
30247                 ts.setTextRangePosEnd(node, node.pos + delta, node.end + delta);
30248                 if (aggressiveChecks && shouldCheckNode(node)) {
30249                     ts.Debug.assert(text === newText.substring(node.pos, node.end));
30250                 }
30251                 forEachChild(node, visitNode, visitArray);
30252                 if (ts.hasJSDocNodes(node)) {
30253                     for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
30254                         var jsDocComment = _a[_i];
30255                         visitNode(jsDocComment);
30256                     }
30257                 }
30258                 checkNodePositions(node, aggressiveChecks);
30259             }
30260             function visitArray(array) {
30261                 array._children = undefined;
30262                 ts.setTextRangePosEnd(array, array.pos + delta, array.end + delta);
30263                 for (var _i = 0, array_9 = array; _i < array_9.length; _i++) {
30264                     var node = array_9[_i];
30265                     visitNode(node);
30266                 }
30267             }
30268         }
30269         function shouldCheckNode(node) {
30270             switch (node.kind) {
30271                 case 10:
30272                 case 8:
30273                 case 79:
30274                     return true;
30275             }
30276             return false;
30277         }
30278         function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) {
30279             ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range");
30280             ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range");
30281             ts.Debug.assert(element.pos <= element.end);
30282             var pos = Math.min(element.pos, changeRangeNewEnd);
30283             var end = element.end >= changeRangeOldEnd ?
30284                 element.end + delta :
30285                 Math.min(element.end, changeRangeNewEnd);
30286             ts.Debug.assert(pos <= end);
30287             if (element.parent) {
30288                 ts.Debug.assertGreaterThanOrEqual(pos, element.parent.pos);
30289                 ts.Debug.assertLessThanOrEqual(end, element.parent.end);
30290             }
30291             ts.setTextRangePosEnd(element, pos, end);
30292         }
30293         function checkNodePositions(node, aggressiveChecks) {
30294             if (aggressiveChecks) {
30295                 var pos_2 = node.pos;
30296                 var visitNode_1 = function (child) {
30297                     ts.Debug.assert(child.pos >= pos_2);
30298                     pos_2 = child.end;
30299                 };
30300                 if (ts.hasJSDocNodes(node)) {
30301                     for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
30302                         var jsDocComment = _a[_i];
30303                         visitNode_1(jsDocComment);
30304                     }
30305                 }
30306                 forEachChild(node, visitNode_1);
30307                 ts.Debug.assert(pos_2 <= node.end);
30308             }
30309         }
30310         function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {
30311             visitNode(sourceFile);
30312             return;
30313             function visitNode(child) {
30314                 ts.Debug.assert(child.pos <= child.end);
30315                 if (child.pos > changeRangeOldEnd) {
30316                     moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks);
30317                     return;
30318                 }
30319                 var fullEnd = child.end;
30320                 if (fullEnd >= changeStart) {
30321                     child.intersectsChange = true;
30322                     child._children = undefined;
30323                     adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
30324                     forEachChild(child, visitNode, visitArray);
30325                     if (ts.hasJSDocNodes(child)) {
30326                         for (var _i = 0, _a = child.jsDoc; _i < _a.length; _i++) {
30327                             var jsDocComment = _a[_i];
30328                             visitNode(jsDocComment);
30329                         }
30330                     }
30331                     checkNodePositions(child, aggressiveChecks);
30332                     return;
30333                 }
30334                 ts.Debug.assert(fullEnd < changeStart);
30335             }
30336             function visitArray(array) {
30337                 ts.Debug.assert(array.pos <= array.end);
30338                 if (array.pos > changeRangeOldEnd) {
30339                     moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks);
30340                     return;
30341                 }
30342                 var fullEnd = array.end;
30343                 if (fullEnd >= changeStart) {
30344                     array.intersectsChange = true;
30345                     array._children = undefined;
30346                     adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
30347                     for (var _i = 0, array_10 = array; _i < array_10.length; _i++) {
30348                         var node = array_10[_i];
30349                         visitNode(node);
30350                     }
30351                     return;
30352                 }
30353                 ts.Debug.assert(fullEnd < changeStart);
30354             }
30355         }
30356         function extendToAffectedRange(sourceFile, changeRange) {
30357             var maxLookahead = 1;
30358             var start = changeRange.span.start;
30359             for (var i = 0; start > 0 && i <= maxLookahead; i++) {
30360                 var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start);
30361                 ts.Debug.assert(nearestNode.pos <= start);
30362                 var position = nearestNode.pos;
30363                 start = Math.max(0, position - 1);
30364             }
30365             var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span));
30366             var finalLength = changeRange.newLength + (changeRange.span.start - start);
30367             return ts.createTextChangeRange(finalSpan, finalLength);
30368         }
30369         function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) {
30370             var bestResult = sourceFile;
30371             var lastNodeEntirelyBeforePosition;
30372             forEachChild(sourceFile, visit);
30373             if (lastNodeEntirelyBeforePosition) {
30374                 var lastChildOfLastEntireNodeBeforePosition = getLastDescendant(lastNodeEntirelyBeforePosition);
30375                 if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) {
30376                     bestResult = lastChildOfLastEntireNodeBeforePosition;
30377                 }
30378             }
30379             return bestResult;
30380             function getLastDescendant(node) {
30381                 while (true) {
30382                     var lastChild = ts.getLastChild(node);
30383                     if (lastChild) {
30384                         node = lastChild;
30385                     }
30386                     else {
30387                         return node;
30388                     }
30389                 }
30390             }
30391             function visit(child) {
30392                 if (ts.nodeIsMissing(child)) {
30393                     return;
30394                 }
30395                 if (child.pos <= position) {
30396                     if (child.pos >= bestResult.pos) {
30397                         bestResult = child;
30398                     }
30399                     if (position < child.end) {
30400                         forEachChild(child, visit);
30401                         return true;
30402                     }
30403                     else {
30404                         ts.Debug.assert(child.end <= position);
30405                         lastNodeEntirelyBeforePosition = child;
30406                     }
30407                 }
30408                 else {
30409                     ts.Debug.assert(child.pos > position);
30410                     return true;
30411                 }
30412             }
30413         }
30414         function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) {
30415             var oldText = sourceFile.text;
30416             if (textChangeRange) {
30417                 ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length);
30418                 if (aggressiveChecks || ts.Debug.shouldAssert(3)) {
30419                     var oldTextPrefix = oldText.substr(0, textChangeRange.span.start);
30420                     var newTextPrefix = newText.substr(0, textChangeRange.span.start);
30421                     ts.Debug.assert(oldTextPrefix === newTextPrefix);
30422                     var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length);
30423                     var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length);
30424                     ts.Debug.assert(oldTextSuffix === newTextSuffix);
30425                 }
30426             }
30427         }
30428         function createSyntaxCursor(sourceFile) {
30429             var currentArray = sourceFile.statements;
30430             var currentArrayIndex = 0;
30431             ts.Debug.assert(currentArrayIndex < currentArray.length);
30432             var current = currentArray[currentArrayIndex];
30433             var lastQueriedPosition = -1;
30434             return {
30435                 currentNode: function (position) {
30436                     if (position !== lastQueriedPosition) {
30437                         if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) {
30438                             currentArrayIndex++;
30439                             current = currentArray[currentArrayIndex];
30440                         }
30441                         if (!current || current.pos !== position) {
30442                             findHighestListElementThatStartsAtPosition(position);
30443                         }
30444                     }
30445                     lastQueriedPosition = position;
30446                     ts.Debug.assert(!current || current.pos === position);
30447                     return current;
30448                 }
30449             };
30450             function findHighestListElementThatStartsAtPosition(position) {
30451                 currentArray = undefined;
30452                 currentArrayIndex = -1;
30453                 current = undefined;
30454                 forEachChild(sourceFile, visitNode, visitArray);
30455                 return;
30456                 function visitNode(node) {
30457                     if (position >= node.pos && position < node.end) {
30458                         forEachChild(node, visitNode, visitArray);
30459                         return true;
30460                     }
30461                     return false;
30462                 }
30463                 function visitArray(array) {
30464                     if (position >= array.pos && position < array.end) {
30465                         for (var i = 0; i < array.length; i++) {
30466                             var child = array[i];
30467                             if (child) {
30468                                 if (child.pos === position) {
30469                                     currentArray = array;
30470                                     currentArrayIndex = i;
30471                                     current = child;
30472                                     return true;
30473                                 }
30474                                 else {
30475                                     if (child.pos < position && position < child.end) {
30476                                         forEachChild(child, visitNode, visitArray);
30477                                         return true;
30478                                     }
30479                                 }
30480                             }
30481                         }
30482                     }
30483                     return false;
30484                 }
30485             }
30486         }
30487         IncrementalParser.createSyntaxCursor = createSyntaxCursor;
30488     })(IncrementalParser || (IncrementalParser = {}));
30489     function isDeclarationFileName(fileName) {
30490         return ts.fileExtensionIsOneOf(fileName, [".d.ts", ".d.mts", ".d.cts"]);
30491     }
30492     ts.isDeclarationFileName = isDeclarationFileName;
30493     function processCommentPragmas(context, sourceText) {
30494         var pragmas = [];
30495         for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
30496             var range = _a[_i];
30497             var comment = sourceText.substring(range.pos, range.end);
30498             extractPragmas(pragmas, range, comment);
30499         }
30500         context.pragmas = new ts.Map();
30501         for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
30502             var pragma = pragmas_1[_b];
30503             if (context.pragmas.has(pragma.name)) {
30504                 var currentValue = context.pragmas.get(pragma.name);
30505                 if (currentValue instanceof Array) {
30506                     currentValue.push(pragma.args);
30507                 }
30508                 else {
30509                     context.pragmas.set(pragma.name, [currentValue, pragma.args]);
30510                 }
30511                 continue;
30512             }
30513             context.pragmas.set(pragma.name, pragma.args);
30514         }
30515     }
30516     ts.processCommentPragmas = processCommentPragmas;
30517     function processPragmasIntoFields(context, reportDiagnostic) {
30518         context.checkJsDirective = undefined;
30519         context.referencedFiles = [];
30520         context.typeReferenceDirectives = [];
30521         context.libReferenceDirectives = [];
30522         context.amdDependencies = [];
30523         context.hasNoDefaultLib = false;
30524         context.pragmas.forEach(function (entryOrList, key) {
30525             switch (key) {
30526                 case "reference": {
30527                     var referencedFiles_1 = context.referencedFiles;
30528                     var typeReferenceDirectives_1 = context.typeReferenceDirectives;
30529                     var libReferenceDirectives_1 = context.libReferenceDirectives;
30530                     ts.forEach(ts.toArray(entryOrList), function (arg) {
30531                         var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
30532                         if (arg.arguments["no-default-lib"]) {
30533                             context.hasNoDefaultLib = true;
30534                         }
30535                         else if (types) {
30536                             typeReferenceDirectives_1.push({ pos: types.pos, end: types.end, fileName: types.value });
30537                         }
30538                         else if (lib) {
30539                             libReferenceDirectives_1.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
30540                         }
30541                         else if (path) {
30542                             referencedFiles_1.push({ pos: path.pos, end: path.end, fileName: path.value });
30543                         }
30544                         else {
30545                             reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, ts.Diagnostics.Invalid_reference_directive_syntax);
30546                         }
30547                     });
30548                     break;
30549                 }
30550                 case "amd-dependency": {
30551                     context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
30552                     break;
30553                 }
30554                 case "amd-module": {
30555                     if (entryOrList instanceof Array) {
30556                         for (var _i = 0, entryOrList_1 = entryOrList; _i < entryOrList_1.length; _i++) {
30557                             var entry = entryOrList_1[_i];
30558                             if (context.moduleName) {
30559                                 reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, ts.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments);
30560                             }
30561                             context.moduleName = entry.arguments.name;
30562                         }
30563                     }
30564                     else {
30565                         context.moduleName = entryOrList.arguments.name;
30566                     }
30567                     break;
30568                 }
30569                 case "ts-nocheck":
30570                 case "ts-check": {
30571                     ts.forEach(ts.toArray(entryOrList), function (entry) {
30572                         if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
30573                             context.checkJsDirective = {
30574                                 enabled: key === "ts-check",
30575                                 end: entry.range.end,
30576                                 pos: entry.range.pos
30577                             };
30578                         }
30579                     });
30580                     break;
30581                 }
30582                 case "jsx":
30583                 case "jsxfrag":
30584                 case "jsximportsource":
30585                 case "jsxruntime":
30586                     return;
30587                 default: ts.Debug.fail("Unhandled pragma kind");
30588             }
30589         });
30590     }
30591     ts.processPragmasIntoFields = processPragmasIntoFields;
30592     var namedArgRegExCache = new ts.Map();
30593     function getNamedArgRegEx(name) {
30594         if (namedArgRegExCache.has(name)) {
30595             return namedArgRegExCache.get(name);
30596         }
30597         var result = new RegExp("(\\s".concat(name, "\\s*=\\s*)(?:(?:'([^']*)')|(?:\"([^\"]*)\"))"), "im");
30598         namedArgRegExCache.set(name, result);
30599         return result;
30600     }
30601     var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
30602     var singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;
30603     function extractPragmas(pragmas, range, text) {
30604         var tripleSlash = range.kind === 2 && tripleSlashXMLCommentStartRegEx.exec(text);
30605         if (tripleSlash) {
30606             var name = tripleSlash[1].toLowerCase();
30607             var pragma = ts.commentPragmas[name];
30608             if (!pragma || !(pragma.kind & 1)) {
30609                 return;
30610             }
30611             if (pragma.args) {
30612                 var argument = {};
30613                 for (var _i = 0, _a = pragma.args; _i < _a.length; _i++) {
30614                     var arg = _a[_i];
30615                     var matcher = getNamedArgRegEx(arg.name);
30616                     var matchResult = matcher.exec(text);
30617                     if (!matchResult && !arg.optional) {
30618                         return;
30619                     }
30620                     else if (matchResult) {
30621                         var value = matchResult[2] || matchResult[3];
30622                         if (arg.captureSpan) {
30623                             var startPos = range.pos + matchResult.index + matchResult[1].length + 1;
30624                             argument[arg.name] = {
30625                                 value: value,
30626                                 pos: startPos,
30627                                 end: startPos + value.length
30628                             };
30629                         }
30630                         else {
30631                             argument[arg.name] = value;
30632                         }
30633                     }
30634                 }
30635                 pragmas.push({ name: name, args: { arguments: argument, range: range } });
30636             }
30637             else {
30638                 pragmas.push({ name: name, args: { arguments: {}, range: range } });
30639             }
30640             return;
30641         }
30642         var singleLine = range.kind === 2 && singleLinePragmaRegEx.exec(text);
30643         if (singleLine) {
30644             return addPragmaForMatch(pragmas, range, 2, singleLine);
30645         }
30646         if (range.kind === 3) {
30647             var multiLinePragmaRegEx = /@(\S+)(\s+.*)?$/gim;
30648             var multiLineMatch = void 0;
30649             while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
30650                 addPragmaForMatch(pragmas, range, 4, multiLineMatch);
30651             }
30652         }
30653     }
30654     function addPragmaForMatch(pragmas, range, kind, match) {
30655         if (!match)
30656             return;
30657         var name = match[1].toLowerCase();
30658         var pragma = ts.commentPragmas[name];
30659         if (!pragma || !(pragma.kind & kind)) {
30660             return;
30661         }
30662         var args = match[2];
30663         var argument = getNamedPragmaArguments(pragma, args);
30664         if (argument === "fail")
30665             return;
30666         pragmas.push({ name: name, args: { arguments: argument, range: range } });
30667         return;
30668     }
30669     function getNamedPragmaArguments(pragma, text) {
30670         if (!text)
30671             return {};
30672         if (!pragma.args)
30673             return {};
30674         var args = ts.trimString(text).split(/\s+/);
30675         var argMap = {};
30676         for (var i = 0; i < pragma.args.length; i++) {
30677             var argument = pragma.args[i];
30678             if (!args[i] && !argument.optional) {
30679                 return "fail";
30680             }
30681             if (argument.captureSpan) {
30682                 return ts.Debug.fail("Capture spans not yet implemented for non-xml pragmas");
30683             }
30684             argMap[argument.name] = args[i];
30685         }
30686         return argMap;
30687     }
30688     function tagNamesAreEquivalent(lhs, rhs) {
30689         if (lhs.kind !== rhs.kind) {
30690             return false;
30691         }
30692         if (lhs.kind === 79) {
30693             return lhs.escapedText === rhs.escapedText;
30694         }
30695         if (lhs.kind === 108) {
30696             return true;
30697         }
30698         return lhs.name.escapedText === rhs.name.escapedText &&
30699             tagNamesAreEquivalent(lhs.expression, rhs.expression);
30700     }
30701     ts.tagNamesAreEquivalent = tagNamesAreEquivalent;
30702 })(ts || (ts = {}));
30703 var ts;
30704 (function (ts) {
30705     ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean", defaultValueDescription: "false" };
30706     var jsxOptionMap = new ts.Map(ts.getEntries({
30707         "preserve": 1,
30708         "react-native": 3,
30709         "react": 2,
30710         "react-jsx": 4,
30711         "react-jsxdev": 5,
30712     }));
30713     ts.inverseJsxOptionMap = new ts.Map(ts.arrayFrom(ts.mapIterator(jsxOptionMap.entries(), function (_a) {
30714         var key = _a[0], value = _a[1];
30715         return ["" + value, key];
30716     })));
30717     var libEntries = [
30718         ["es5", "lib.es5.d.ts"],
30719         ["es6", "lib.es2015.d.ts"],
30720         ["es2015", "lib.es2015.d.ts"],
30721         ["es7", "lib.es2016.d.ts"],
30722         ["es2016", "lib.es2016.d.ts"],
30723         ["es2017", "lib.es2017.d.ts"],
30724         ["es2018", "lib.es2018.d.ts"],
30725         ["es2019", "lib.es2019.d.ts"],
30726         ["es2020", "lib.es2020.d.ts"],
30727         ["es2021", "lib.es2021.d.ts"],
30728         ["esnext", "lib.esnext.d.ts"],
30729         ["dom", "lib.dom.d.ts"],
30730         ["dom.iterable", "lib.dom.iterable.d.ts"],
30731         ["webworker", "lib.webworker.d.ts"],
30732         ["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
30733         ["webworker.iterable", "lib.webworker.iterable.d.ts"],
30734         ["scripthost", "lib.scripthost.d.ts"],
30735         ["es2015.core", "lib.es2015.core.d.ts"],
30736         ["es2015.collection", "lib.es2015.collection.d.ts"],
30737         ["es2015.generator", "lib.es2015.generator.d.ts"],
30738         ["es2015.iterable", "lib.es2015.iterable.d.ts"],
30739         ["es2015.promise", "lib.es2015.promise.d.ts"],
30740         ["es2015.proxy", "lib.es2015.proxy.d.ts"],
30741         ["es2015.reflect", "lib.es2015.reflect.d.ts"],
30742         ["es2015.symbol", "lib.es2015.symbol.d.ts"],
30743         ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
30744         ["es2016.array.include", "lib.es2016.array.include.d.ts"],
30745         ["es2017.object", "lib.es2017.object.d.ts"],
30746         ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
30747         ["es2017.string", "lib.es2017.string.d.ts"],
30748         ["es2017.intl", "lib.es2017.intl.d.ts"],
30749         ["es2017.typedarrays", "lib.es2017.typedarrays.d.ts"],
30750         ["es2018.asyncgenerator", "lib.es2018.asyncgenerator.d.ts"],
30751         ["es2018.asynciterable", "lib.es2018.asynciterable.d.ts"],
30752         ["es2018.intl", "lib.es2018.intl.d.ts"],
30753         ["es2018.promise", "lib.es2018.promise.d.ts"],
30754         ["es2018.regexp", "lib.es2018.regexp.d.ts"],
30755         ["es2019.array", "lib.es2019.array.d.ts"],
30756         ["es2019.object", "lib.es2019.object.d.ts"],
30757         ["es2019.string", "lib.es2019.string.d.ts"],
30758         ["es2019.symbol", "lib.es2019.symbol.d.ts"],
30759         ["es2020.bigint", "lib.es2020.bigint.d.ts"],
30760         ["es2020.promise", "lib.es2020.promise.d.ts"],
30761         ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
30762         ["es2020.string", "lib.es2020.string.d.ts"],
30763         ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
30764         ["es2020.intl", "lib.es2020.intl.d.ts"],
30765         ["es2021.promise", "lib.es2021.promise.d.ts"],
30766         ["es2021.string", "lib.es2021.string.d.ts"],
30767         ["es2021.weakref", "lib.es2021.weakref.d.ts"],
30768         ["es2021.intl", "lib.es2021.intl.d.ts"],
30769         ["esnext.array", "lib.es2019.array.d.ts"],
30770         ["esnext.symbol", "lib.es2019.symbol.d.ts"],
30771         ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
30772         ["esnext.intl", "lib.esnext.intl.d.ts"],
30773         ["esnext.bigint", "lib.es2020.bigint.d.ts"],
30774         ["esnext.string", "lib.es2021.string.d.ts"],
30775         ["esnext.promise", "lib.es2021.promise.d.ts"],
30776         ["esnext.weakref", "lib.es2021.weakref.d.ts"]
30777     ];
30778     ts.libs = libEntries.map(function (entry) { return entry[0]; });
30779     ts.libMap = new ts.Map(libEntries);
30780     ts.optionsForWatch = [
30781         {
30782             name: "watchFile",
30783             type: new ts.Map(ts.getEntries({
30784                 fixedpollinginterval: ts.WatchFileKind.FixedPollingInterval,
30785                 prioritypollinginterval: ts.WatchFileKind.PriorityPollingInterval,
30786                 dynamicprioritypolling: ts.WatchFileKind.DynamicPriorityPolling,
30787                 fixedchunksizepolling: ts.WatchFileKind.FixedChunkSizePolling,
30788                 usefsevents: ts.WatchFileKind.UseFsEvents,
30789                 usefseventsonparentdirectory: ts.WatchFileKind.UseFsEventsOnParentDirectory,
30790             })),
30791             category: ts.Diagnostics.Watch_and_Build_Modes,
30792             description: ts.Diagnostics.Specify_how_the_TypeScript_watch_mode_works,
30793         },
30794         {
30795             name: "watchDirectory",
30796             type: new ts.Map(ts.getEntries({
30797                 usefsevents: ts.WatchDirectoryKind.UseFsEvents,
30798                 fixedpollinginterval: ts.WatchDirectoryKind.FixedPollingInterval,
30799                 dynamicprioritypolling: ts.WatchDirectoryKind.DynamicPriorityPolling,
30800                 fixedchunksizepolling: ts.WatchDirectoryKind.FixedChunkSizePolling,
30801             })),
30802             category: ts.Diagnostics.Watch_and_Build_Modes,
30803             description: ts.Diagnostics.Specify_how_directories_are_watched_on_systems_that_lack_recursive_file_watching_functionality,
30804         },
30805         {
30806             name: "fallbackPolling",
30807             type: new ts.Map(ts.getEntries({
30808                 fixedinterval: ts.PollingWatchKind.FixedInterval,
30809                 priorityinterval: ts.PollingWatchKind.PriorityInterval,
30810                 dynamicpriority: ts.PollingWatchKind.DynamicPriority,
30811                 fixedchunksize: ts.PollingWatchKind.FixedChunkSize,
30812             })),
30813             category: ts.Diagnostics.Watch_and_Build_Modes,
30814             description: ts.Diagnostics.Specify_what_approach_the_watcher_should_use_if_the_system_runs_out_of_native_file_watchers,
30815         },
30816         {
30817             name: "synchronousWatchDirectory",
30818             type: "boolean",
30819             category: ts.Diagnostics.Watch_and_Build_Modes,
30820             description: ts.Diagnostics.Synchronously_call_callbacks_and_update_the_state_of_directory_watchers_on_platforms_that_don_t_support_recursive_watching_natively,
30821             defaultValueDescription: "false",
30822         },
30823         {
30824             name: "excludeDirectories",
30825             type: "list",
30826             element: {
30827                 name: "excludeDirectory",
30828                 type: "string",
30829                 isFilePath: true,
30830                 extraValidation: specToDiagnostic
30831             },
30832             category: ts.Diagnostics.Watch_and_Build_Modes,
30833             description: ts.Diagnostics.Remove_a_list_of_directories_from_the_watch_process,
30834         },
30835         {
30836             name: "excludeFiles",
30837             type: "list",
30838             element: {
30839                 name: "excludeFile",
30840                 type: "string",
30841                 isFilePath: true,
30842                 extraValidation: specToDiagnostic
30843             },
30844             category: ts.Diagnostics.Watch_and_Build_Modes,
30845             description: ts.Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing,
30846         },
30847     ];
30848     ts.commonOptionsWithBuild = [
30849         {
30850             name: "help",
30851             shortName: "h",
30852             type: "boolean",
30853             showInSimplifiedHelpView: true,
30854             category: ts.Diagnostics.Command_line_Options,
30855             description: ts.Diagnostics.Print_this_message,
30856             defaultValueDescription: "false",
30857         },
30858         {
30859             name: "help",
30860             shortName: "?",
30861             type: "boolean",
30862             defaultValueDescription: "false",
30863         },
30864         {
30865             name: "watch",
30866             shortName: "w",
30867             type: "boolean",
30868             showInSimplifiedHelpView: true,
30869             isCommandLineOnly: true,
30870             category: ts.Diagnostics.Command_line_Options,
30871             description: ts.Diagnostics.Watch_input_files,
30872             defaultValueDescription: "false",
30873         },
30874         {
30875             name: "preserveWatchOutput",
30876             type: "boolean",
30877             showInSimplifiedHelpView: false,
30878             category: ts.Diagnostics.Output_Formatting,
30879             description: ts.Diagnostics.Disable_wiping_the_console_in_watch_mode,
30880             defaultValueDescription: "false",
30881         },
30882         {
30883             name: "listFiles",
30884             type: "boolean",
30885             category: ts.Diagnostics.Compiler_Diagnostics,
30886             description: ts.Diagnostics.Print_all_of_the_files_read_during_the_compilation,
30887             defaultValueDescription: "false"
30888         },
30889         {
30890             name: "explainFiles",
30891             type: "boolean",
30892             category: ts.Diagnostics.Compiler_Diagnostics,
30893             description: ts.Diagnostics.Print_files_read_during_the_compilation_including_why_it_was_included,
30894             defaultValueDescription: "false",
30895         },
30896         {
30897             name: "listEmittedFiles",
30898             type: "boolean",
30899             category: ts.Diagnostics.Compiler_Diagnostics,
30900             description: ts.Diagnostics.Print_the_names_of_emitted_files_after_a_compilation,
30901             defaultValueDescription: "false"
30902         },
30903         {
30904             name: "pretty",
30905             type: "boolean",
30906             showInSimplifiedHelpView: true,
30907             category: ts.Diagnostics.Output_Formatting,
30908             description: ts.Diagnostics.Enable_color_and_formatting_in_TypeScript_s_output_to_make_compiler_errors_easier_to_read,
30909             defaultValueDescription: "true"
30910         },
30911         {
30912             name: "traceResolution",
30913             type: "boolean",
30914             category: ts.Diagnostics.Compiler_Diagnostics,
30915             description: ts.Diagnostics.Log_paths_used_during_the_moduleResolution_process,
30916             defaultValueDescription: "false"
30917         },
30918         {
30919             name: "diagnostics",
30920             type: "boolean",
30921             category: ts.Diagnostics.Compiler_Diagnostics,
30922             description: ts.Diagnostics.Output_compiler_performance_information_after_building,
30923             defaultValueDescription: "false"
30924         },
30925         {
30926             name: "extendedDiagnostics",
30927             type: "boolean",
30928             category: ts.Diagnostics.Compiler_Diagnostics,
30929             description: ts.Diagnostics.Output_more_detailed_compiler_performance_information_after_building,
30930             defaultValueDescription: "false"
30931         },
30932         {
30933             name: "generateCpuProfile",
30934             type: "string",
30935             isFilePath: true,
30936             paramType: ts.Diagnostics.FILE_OR_DIRECTORY,
30937             category: ts.Diagnostics.Compiler_Diagnostics,
30938             description: ts.Diagnostics.Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging,
30939             defaultValueDescription: "profile.cpuprofile"
30940         },
30941         {
30942             name: "generateTrace",
30943             type: "string",
30944             isFilePath: true,
30945             isCommandLineOnly: true,
30946             paramType: ts.Diagnostics.DIRECTORY,
30947             category: ts.Diagnostics.Compiler_Diagnostics,
30948             description: ts.Diagnostics.Generates_an_event_trace_and_a_list_of_types
30949         },
30950         {
30951             name: "incremental",
30952             shortName: "i",
30953             type: "boolean",
30954             category: ts.Diagnostics.Projects,
30955             description: ts.Diagnostics.Enable_incremental_compilation,
30956             transpileOptionValue: undefined,
30957             defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
30958         },
30959         {
30960             name: "assumeChangesOnlyAffectDirectDependencies",
30961             type: "boolean",
30962             affectsSemanticDiagnostics: true,
30963             affectsEmit: true,
30964             category: ts.Diagnostics.Watch_and_Build_Modes,
30965             description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
30966             defaultValueDescription: "false",
30967         },
30968         {
30969             name: "locale",
30970             type: "string",
30971             category: ts.Diagnostics.Command_line_Options,
30972             isCommandLineOnly: true,
30973             description: ts.Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit,
30974             defaultValueDescription: ts.Diagnostics.Platform_specific
30975         },
30976     ];
30977     ts.targetOptionDeclaration = {
30978         name: "target",
30979         shortName: "t",
30980         type: new ts.Map(ts.getEntries({
30981             es3: 0,
30982             es5: 1,
30983             es6: 2,
30984             es2015: 2,
30985             es2016: 3,
30986             es2017: 4,
30987             es2018: 5,
30988             es2019: 6,
30989             es2020: 7,
30990             es2021: 8,
30991             esnext: 99,
30992         })),
30993         affectsSourceFile: true,
30994         affectsModuleResolution: true,
30995         affectsEmit: true,
30996         paramType: ts.Diagnostics.VERSION,
30997         showInSimplifiedHelpView: true,
30998         category: ts.Diagnostics.Language_and_Environment,
30999         description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31000         defaultValueDescription: "ES3"
31001     };
31002     var commandOptionsWithoutBuild = [
31003         {
31004             name: "all",
31005             type: "boolean",
31006             showInSimplifiedHelpView: true,
31007             category: ts.Diagnostics.Command_line_Options,
31008             description: ts.Diagnostics.Show_all_compiler_options,
31009             defaultValueDescription: "false",
31010         },
31011         {
31012             name: "version",
31013             shortName: "v",
31014             type: "boolean",
31015             showInSimplifiedHelpView: true,
31016             category: ts.Diagnostics.Command_line_Options,
31017             description: ts.Diagnostics.Print_the_compiler_s_version,
31018             defaultValueDescription: "false",
31019         },
31020         {
31021             name: "init",
31022             type: "boolean",
31023             showInSimplifiedHelpView: true,
31024             category: ts.Diagnostics.Command_line_Options,
31025             description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file,
31026             defaultValueDescription: "false",
31027         },
31028         {
31029             name: "project",
31030             shortName: "p",
31031             type: "string",
31032             isFilePath: true,
31033             showInSimplifiedHelpView: true,
31034             category: ts.Diagnostics.Command_line_Options,
31035             paramType: ts.Diagnostics.FILE_OR_DIRECTORY,
31036             description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json,
31037         },
31038         {
31039             name: "build",
31040             type: "boolean",
31041             shortName: "b",
31042             showInSimplifiedHelpView: true,
31043             category: ts.Diagnostics.Command_line_Options,
31044             description: ts.Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
31045             defaultValueDescription: "false",
31046         },
31047         {
31048             name: "showConfig",
31049             type: "boolean",
31050             showInSimplifiedHelpView: true,
31051             category: ts.Diagnostics.Command_line_Options,
31052             isCommandLineOnly: true,
31053             description: ts.Diagnostics.Print_the_final_configuration_instead_of_building,
31054             defaultValueDescription: "false",
31055         },
31056         {
31057             name: "listFilesOnly",
31058             type: "boolean",
31059             category: ts.Diagnostics.Command_line_Options,
31060             affectsSemanticDiagnostics: true,
31061             affectsEmit: true,
31062             isCommandLineOnly: true,
31063             description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31064             defaultValueDescription: "false",
31065         },
31066         ts.targetOptionDeclaration,
31067         {
31068             name: "module",
31069             shortName: "m",
31070             type: new ts.Map(ts.getEntries({
31071                 none: ts.ModuleKind.None,
31072                 commonjs: ts.ModuleKind.CommonJS,
31073                 amd: ts.ModuleKind.AMD,
31074                 system: ts.ModuleKind.System,
31075                 umd: ts.ModuleKind.UMD,
31076                 es6: ts.ModuleKind.ES2015,
31077                 es2015: ts.ModuleKind.ES2015,
31078                 es2020: ts.ModuleKind.ES2020,
31079                 es2022: ts.ModuleKind.ES2022,
31080                 esnext: ts.ModuleKind.ESNext,
31081                 node12: ts.ModuleKind.Node12,
31082                 nodenext: ts.ModuleKind.NodeNext,
31083             })),
31084             affectsModuleResolution: true,
31085             affectsEmit: true,
31086             paramType: ts.Diagnostics.KIND,
31087             showInSimplifiedHelpView: true,
31088             category: ts.Diagnostics.Modules,
31089             description: ts.Diagnostics.Specify_what_module_code_is_generated,
31090         },
31091         {
31092             name: "lib",
31093             type: "list",
31094             element: {
31095                 name: "lib",
31096                 type: ts.libMap
31097             },
31098             affectsProgramStructure: true,
31099             showInSimplifiedHelpView: true,
31100             category: ts.Diagnostics.Language_and_Environment,
31101             description: ts.Diagnostics.Specify_a_set_of_bundled_library_declaration_files_that_describe_the_target_runtime_environment,
31102             transpileOptionValue: undefined
31103         },
31104         {
31105             name: "allowJs",
31106             type: "boolean",
31107             affectsModuleResolution: true,
31108             showInSimplifiedHelpView: true,
31109             category: ts.Diagnostics.JavaScript_Support,
31110             description: ts.Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
31111             defaultValueDescription: "false"
31112         },
31113         {
31114             name: "checkJs",
31115             type: "boolean",
31116             showInSimplifiedHelpView: true,
31117             category: ts.Diagnostics.JavaScript_Support,
31118             description: ts.Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
31119             defaultValueDescription: "false"
31120         },
31121         {
31122             name: "jsx",
31123             type: jsxOptionMap,
31124             affectsSourceFile: true,
31125             affectsEmit: true,
31126             affectsModuleResolution: true,
31127             paramType: ts.Diagnostics.KIND,
31128             showInSimplifiedHelpView: true,
31129             category: ts.Diagnostics.Language_and_Environment,
31130             description: ts.Diagnostics.Specify_what_JSX_code_is_generated,
31131             defaultValueDescription: "undefined"
31132         },
31133         {
31134             name: "declaration",
31135             shortName: "d",
31136             type: "boolean",
31137             affectsEmit: true,
31138             showInSimplifiedHelpView: true,
31139             category: ts.Diagnostics.Emit,
31140             transpileOptionValue: undefined,
31141             description: ts.Diagnostics.Generate_d_ts_files_from_TypeScript_and_JavaScript_files_in_your_project,
31142             defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set,
31143         },
31144         {
31145             name: "declarationMap",
31146             type: "boolean",
31147             affectsEmit: true,
31148             showInSimplifiedHelpView: true,
31149             category: ts.Diagnostics.Emit,
31150             transpileOptionValue: undefined,
31151             defaultValueDescription: "false",
31152             description: ts.Diagnostics.Create_sourcemaps_for_d_ts_files
31153         },
31154         {
31155             name: "emitDeclarationOnly",
31156             type: "boolean",
31157             affectsEmit: true,
31158             showInSimplifiedHelpView: true,
31159             category: ts.Diagnostics.Emit,
31160             description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
31161             transpileOptionValue: undefined,
31162             defaultValueDescription: "false",
31163         },
31164         {
31165             name: "sourceMap",
31166             type: "boolean",
31167             affectsEmit: true,
31168             showInSimplifiedHelpView: true,
31169             category: ts.Diagnostics.Emit,
31170             defaultValueDescription: "false",
31171             description: ts.Diagnostics.Create_source_map_files_for_emitted_JavaScript_files,
31172         },
31173         {
31174             name: "outFile",
31175             type: "string",
31176             affectsEmit: true,
31177             isFilePath: true,
31178             paramType: ts.Diagnostics.FILE,
31179             showInSimplifiedHelpView: true,
31180             category: ts.Diagnostics.Emit,
31181             description: ts.Diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output,
31182             transpileOptionValue: undefined,
31183         },
31184         {
31185             name: "outDir",
31186             type: "string",
31187             affectsEmit: true,
31188             isFilePath: true,
31189             paramType: ts.Diagnostics.DIRECTORY,
31190             showInSimplifiedHelpView: true,
31191             category: ts.Diagnostics.Emit,
31192             description: ts.Diagnostics.Specify_an_output_folder_for_all_emitted_files,
31193         },
31194         {
31195             name: "rootDir",
31196             type: "string",
31197             affectsEmit: true,
31198             isFilePath: true,
31199             paramType: ts.Diagnostics.LOCATION,
31200             category: ts.Diagnostics.Modules,
31201             description: ts.Diagnostics.Specify_the_root_folder_within_your_source_files,
31202             defaultValueDescription: ts.Diagnostics.Computed_from_the_list_of_input_files
31203         },
31204         {
31205             name: "composite",
31206             type: "boolean",
31207             affectsEmit: true,
31208             isTSConfigOnly: true,
31209             category: ts.Diagnostics.Projects,
31210             transpileOptionValue: undefined,
31211             defaultValueDescription: "false",
31212             description: ts.Diagnostics.Enable_constraints_that_allow_a_TypeScript_project_to_be_used_with_project_references,
31213         },
31214         {
31215             name: "tsBuildInfoFile",
31216             type: "string",
31217             affectsEmit: true,
31218             isFilePath: true,
31219             paramType: ts.Diagnostics.FILE,
31220             category: ts.Diagnostics.Projects,
31221             transpileOptionValue: undefined,
31222             defaultValueDescription: ".tsbuildinfo",
31223             description: ts.Diagnostics.Specify_the_folder_for_tsbuildinfo_incremental_compilation_files,
31224         },
31225         {
31226             name: "removeComments",
31227             type: "boolean",
31228             affectsEmit: true,
31229             showInSimplifiedHelpView: true,
31230             category: ts.Diagnostics.Emit,
31231             defaultValueDescription: "false",
31232             description: ts.Diagnostics.Disable_emitting_comments,
31233         },
31234         {
31235             name: "noEmit",
31236             type: "boolean",
31237             showInSimplifiedHelpView: true,
31238             category: ts.Diagnostics.Emit,
31239             description: ts.Diagnostics.Disable_emitting_files_from_a_compilation,
31240             transpileOptionValue: undefined,
31241             defaultValueDescription: "false"
31242         },
31243         {
31244             name: "importHelpers",
31245             type: "boolean",
31246             affectsEmit: true,
31247             category: ts.Diagnostics.Emit,
31248             description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
31249             defaultValueDescription: "false"
31250         },
31251         {
31252             name: "importsNotUsedAsValues",
31253             type: new ts.Map(ts.getEntries({
31254                 remove: 0,
31255                 preserve: 1,
31256                 error: 2,
31257             })),
31258             affectsEmit: true,
31259             affectsSemanticDiagnostics: true,
31260             category: ts.Diagnostics.Emit,
31261             description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types
31262         },
31263         {
31264             name: "downlevelIteration",
31265             type: "boolean",
31266             affectsEmit: true,
31267             category: ts.Diagnostics.Emit,
31268             description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
31269             defaultValueDescription: "false"
31270         },
31271         {
31272             name: "isolatedModules",
31273             type: "boolean",
31274             category: ts.Diagnostics.Interop_Constraints,
31275             description: ts.Diagnostics.Ensure_that_each_file_can_be_safely_transpiled_without_relying_on_other_imports,
31276             transpileOptionValue: true,
31277             defaultValueDescription: "false"
31278         },
31279         {
31280             name: "strict",
31281             type: "boolean",
31282             showInSimplifiedHelpView: true,
31283             category: ts.Diagnostics.Type_Checking,
31284             description: ts.Diagnostics.Enable_all_strict_type_checking_options,
31285             defaultValueDescription: "false"
31286         },
31287         {
31288             name: "noImplicitAny",
31289             type: "boolean",
31290             affectsSemanticDiagnostics: true,
31291             strictFlag: true,
31292             category: ts.Diagnostics.Type_Checking,
31293             description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
31294             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31295         },
31296         {
31297             name: "strictNullChecks",
31298             type: "boolean",
31299             affectsSemanticDiagnostics: true,
31300             strictFlag: true,
31301             category: ts.Diagnostics.Type_Checking,
31302             description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
31303             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31304         },
31305         {
31306             name: "strictFunctionTypes",
31307             type: "boolean",
31308             strictFlag: true,
31309             category: ts.Diagnostics.Type_Checking,
31310             description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
31311             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31312         },
31313         {
31314             name: "strictBindCallApply",
31315             type: "boolean",
31316             strictFlag: true,
31317             category: ts.Diagnostics.Type_Checking,
31318             description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
31319             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31320         },
31321         {
31322             name: "strictPropertyInitialization",
31323             type: "boolean",
31324             affectsSemanticDiagnostics: true,
31325             strictFlag: true,
31326             category: ts.Diagnostics.Type_Checking,
31327             description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
31328             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31329         },
31330         {
31331             name: "noImplicitThis",
31332             type: "boolean",
31333             affectsSemanticDiagnostics: true,
31334             strictFlag: true,
31335             category: ts.Diagnostics.Type_Checking,
31336             description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
31337             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31338         },
31339         {
31340             name: "useUnknownInCatchVariables",
31341             type: "boolean",
31342             affectsSemanticDiagnostics: true,
31343             strictFlag: true,
31344             category: ts.Diagnostics.Type_Checking,
31345             description: ts.Diagnostics.Type_catch_clause_variables_as_unknown_instead_of_any,
31346             defaultValueDescription: "false",
31347         },
31348         {
31349             name: "alwaysStrict",
31350             type: "boolean",
31351             affectsSourceFile: true,
31352             strictFlag: true,
31353             category: ts.Diagnostics.Type_Checking,
31354             description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
31355             defaultValueDescription: ts.Diagnostics.false_unless_strict_is_set
31356         },
31357         {
31358             name: "noUnusedLocals",
31359             type: "boolean",
31360             affectsSemanticDiagnostics: true,
31361             category: ts.Diagnostics.Type_Checking,
31362             description: ts.Diagnostics.Enable_error_reporting_when_a_local_variables_aren_t_read,
31363             defaultValueDescription: "false"
31364         },
31365         {
31366             name: "noUnusedParameters",
31367             type: "boolean",
31368             affectsSemanticDiagnostics: true,
31369             category: ts.Diagnostics.Type_Checking,
31370             description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
31371             defaultValueDescription: "false"
31372         },
31373         {
31374             name: "exactOptionalPropertyTypes",
31375             type: "boolean",
31376             affectsSemanticDiagnostics: true,
31377             category: ts.Diagnostics.Type_Checking,
31378             description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
31379             defaultValueDescription: "false",
31380         },
31381         {
31382             name: "noImplicitReturns",
31383             type: "boolean",
31384             affectsSemanticDiagnostics: true,
31385             category: ts.Diagnostics.Type_Checking,
31386             description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
31387             defaultValueDescription: "false"
31388         },
31389         {
31390             name: "noFallthroughCasesInSwitch",
31391             type: "boolean",
31392             affectsBindDiagnostics: true,
31393             affectsSemanticDiagnostics: true,
31394             category: ts.Diagnostics.Type_Checking,
31395             description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
31396             defaultValueDescription: "false",
31397         },
31398         {
31399             name: "noUncheckedIndexedAccess",
31400             type: "boolean",
31401             affectsSemanticDiagnostics: true,
31402             category: ts.Diagnostics.Type_Checking,
31403             description: ts.Diagnostics.Include_undefined_in_index_signature_results,
31404             defaultValueDescription: "false",
31405         },
31406         {
31407             name: "noImplicitOverride",
31408             type: "boolean",
31409             affectsSemanticDiagnostics: true,
31410             category: ts.Diagnostics.Type_Checking,
31411             description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
31412             defaultValueDescription: "false",
31413         },
31414         {
31415             name: "noPropertyAccessFromIndexSignature",
31416             type: "boolean",
31417             showInSimplifiedHelpView: false,
31418             category: ts.Diagnostics.Type_Checking,
31419             description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
31420             defaultValueDescription: "false"
31421         },
31422         {
31423             name: "moduleResolution",
31424             type: new ts.Map(ts.getEntries({
31425                 node: ts.ModuleResolutionKind.NodeJs,
31426                 classic: ts.ModuleResolutionKind.Classic,
31427                 node12: ts.ModuleResolutionKind.Node12,
31428                 nodenext: ts.ModuleResolutionKind.NodeNext,
31429             })),
31430             affectsModuleResolution: true,
31431             paramType: ts.Diagnostics.STRATEGY,
31432             category: ts.Diagnostics.Modules,
31433             description: ts.Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
31434             defaultValueDescription: ts.Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
31435         },
31436         {
31437             name: "baseUrl",
31438             type: "string",
31439             affectsModuleResolution: true,
31440             isFilePath: true,
31441             category: ts.Diagnostics.Modules,
31442             description: ts.Diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names
31443         },
31444         {
31445             name: "paths",
31446             type: "object",
31447             affectsModuleResolution: true,
31448             isTSConfigOnly: true,
31449             category: ts.Diagnostics.Modules,
31450             description: ts.Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations,
31451             transpileOptionValue: undefined
31452         },
31453         {
31454             name: "rootDirs",
31455             type: "list",
31456             isTSConfigOnly: true,
31457             element: {
31458                 name: "rootDirs",
31459                 type: "string",
31460                 isFilePath: true
31461             },
31462             affectsModuleResolution: true,
31463             category: ts.Diagnostics.Modules,
31464             description: ts.Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules,
31465             transpileOptionValue: undefined,
31466             defaultValueDescription: ts.Diagnostics.Computed_from_the_list_of_input_files
31467         },
31468         {
31469             name: "typeRoots",
31470             type: "list",
31471             element: {
31472                 name: "typeRoots",
31473                 type: "string",
31474                 isFilePath: true
31475             },
31476             affectsModuleResolution: true,
31477             category: ts.Diagnostics.Modules,
31478             description: ts.Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types
31479         },
31480         {
31481             name: "types",
31482             type: "list",
31483             element: {
31484                 name: "types",
31485                 type: "string"
31486             },
31487             affectsProgramStructure: true,
31488             showInSimplifiedHelpView: true,
31489             category: ts.Diagnostics.Modules,
31490             description: ts.Diagnostics.Specify_type_package_names_to_be_included_without_being_referenced_in_a_source_file,
31491             transpileOptionValue: undefined
31492         },
31493         {
31494             name: "allowSyntheticDefaultImports",
31495             type: "boolean",
31496             affectsSemanticDiagnostics: true,
31497             category: ts.Diagnostics.Interop_Constraints,
31498             description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
31499             defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
31500         },
31501         {
31502             name: "esModuleInterop",
31503             type: "boolean",
31504             affectsSemanticDiagnostics: true,
31505             affectsEmit: true,
31506             showInSimplifiedHelpView: true,
31507             category: ts.Diagnostics.Interop_Constraints,
31508             description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
31509             defaultValueDescription: "false"
31510         },
31511         {
31512             name: "preserveSymlinks",
31513             type: "boolean",
31514             category: ts.Diagnostics.Interop_Constraints,
31515             description: ts.Diagnostics.Disable_resolving_symlinks_to_their_realpath_This_correlates_to_the_same_flag_in_node,
31516             defaultValueDescription: "false",
31517         },
31518         {
31519             name: "allowUmdGlobalAccess",
31520             type: "boolean",
31521             affectsSemanticDiagnostics: true,
31522             category: ts.Diagnostics.Modules,
31523             description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
31524             defaultValueDescription: "false"
31525         },
31526         {
31527             name: "sourceRoot",
31528             type: "string",
31529             affectsEmit: true,
31530             paramType: ts.Diagnostics.LOCATION,
31531             category: ts.Diagnostics.Emit,
31532             description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
31533         },
31534         {
31535             name: "mapRoot",
31536             type: "string",
31537             affectsEmit: true,
31538             paramType: ts.Diagnostics.LOCATION,
31539             category: ts.Diagnostics.Emit,
31540             description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
31541         },
31542         {
31543             name: "inlineSourceMap",
31544             type: "boolean",
31545             affectsEmit: true,
31546             category: ts.Diagnostics.Emit,
31547             description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
31548             defaultValueDescription: "false"
31549         },
31550         {
31551             name: "inlineSources",
31552             type: "boolean",
31553             affectsEmit: true,
31554             category: ts.Diagnostics.Emit,
31555             description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
31556             defaultValueDescription: "false"
31557         },
31558         {
31559             name: "experimentalDecorators",
31560             type: "boolean",
31561             affectsSemanticDiagnostics: true,
31562             category: ts.Diagnostics.Language_and_Environment,
31563             description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
31564             defaultValueDescription: "false",
31565         },
31566         {
31567             name: "emitDecoratorMetadata",
31568             type: "boolean",
31569             affectsSemanticDiagnostics: true,
31570             affectsEmit: true,
31571             category: ts.Diagnostics.Language_and_Environment,
31572             description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
31573             defaultValueDescription: "false",
31574         },
31575         {
31576             name: "jsxFactory",
31577             type: "string",
31578             category: ts.Diagnostics.Language_and_Environment,
31579             description: ts.Diagnostics.Specify_the_JSX_factory_function_used_when_targeting_React_JSX_emit_e_g_React_createElement_or_h,
31580             defaultValueDescription: "`React.createElement`"
31581         },
31582         {
31583             name: "jsxFragmentFactory",
31584             type: "string",
31585             category: ts.Diagnostics.Language_and_Environment,
31586             description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
31587         },
31588         {
31589             name: "jsxImportSource",
31590             type: "string",
31591             affectsSemanticDiagnostics: true,
31592             affectsEmit: true,
31593             affectsModuleResolution: true,
31594             category: ts.Diagnostics.Language_and_Environment,
31595             description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
31596             defaultValueDescription: "react"
31597         },
31598         {
31599             name: "resolveJsonModule",
31600             type: "boolean",
31601             affectsModuleResolution: true,
31602             category: ts.Diagnostics.Modules,
31603             description: ts.Diagnostics.Enable_importing_json_files,
31604             defaultValueDescription: "false"
31605         },
31606         {
31607             name: "out",
31608             type: "string",
31609             affectsEmit: true,
31610             isFilePath: false,
31611             category: ts.Diagnostics.Backwards_Compatibility,
31612             paramType: ts.Diagnostics.FILE,
31613             transpileOptionValue: undefined,
31614             description: ts.Diagnostics.Deprecated_setting_Use_outFile_instead,
31615         },
31616         {
31617             name: "reactNamespace",
31618             type: "string",
31619             affectsEmit: true,
31620             category: ts.Diagnostics.Language_and_Environment,
31621             description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
31622             defaultValueDescription: "`React`",
31623         },
31624         {
31625             name: "skipDefaultLibCheck",
31626             type: "boolean",
31627             category: ts.Diagnostics.Completeness,
31628             description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
31629             defaultValueDescription: "false",
31630         },
31631         {
31632             name: "charset",
31633             type: "string",
31634             category: ts.Diagnostics.Backwards_Compatibility,
31635             description: ts.Diagnostics.No_longer_supported_In_early_versions_manually_set_the_text_encoding_for_reading_files,
31636             defaultValueDescription: "utf8"
31637         },
31638         {
31639             name: "emitBOM",
31640             type: "boolean",
31641             affectsEmit: true,
31642             category: ts.Diagnostics.Emit,
31643             description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
31644             defaultValueDescription: "false"
31645         },
31646         {
31647             name: "newLine",
31648             type: new ts.Map(ts.getEntries({
31649                 crlf: 0,
31650                 lf: 1
31651             })),
31652             affectsEmit: true,
31653             paramType: ts.Diagnostics.NEWLINE,
31654             category: ts.Diagnostics.Emit,
31655             description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
31656             defaultValueDescription: ts.Diagnostics.Platform_specific
31657         },
31658         {
31659             name: "noErrorTruncation",
31660             type: "boolean",
31661             affectsSemanticDiagnostics: true,
31662             category: ts.Diagnostics.Output_Formatting,
31663             description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
31664             defaultValueDescription: "false"
31665         },
31666         {
31667             name: "noLib",
31668             type: "boolean",
31669             category: ts.Diagnostics.Language_and_Environment,
31670             affectsProgramStructure: true,
31671             description: ts.Diagnostics.Disable_including_any_library_files_including_the_default_lib_d_ts,
31672             transpileOptionValue: true,
31673             defaultValueDescription: "false"
31674         },
31675         {
31676             name: "noResolve",
31677             type: "boolean",
31678             affectsModuleResolution: true,
31679             category: ts.Diagnostics.Modules,
31680             description: ts.Diagnostics.Disallow_import_s_require_s_or_reference_s_from_expanding_the_number_of_files_TypeScript_should_add_to_a_project,
31681             transpileOptionValue: true,
31682             defaultValueDescription: "false"
31683         },
31684         {
31685             name: "stripInternal",
31686             type: "boolean",
31687             affectsEmit: true,
31688             category: ts.Diagnostics.Emit,
31689             description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
31690             defaultValueDescription: "false",
31691         },
31692         {
31693             name: "disableSizeLimit",
31694             type: "boolean",
31695             affectsProgramStructure: true,
31696             category: ts.Diagnostics.Editor_Support,
31697             description: ts.Diagnostics.Remove_the_20mb_cap_on_total_source_code_size_for_JavaScript_files_in_the_TypeScript_language_server,
31698             defaultValueDescription: "false"
31699         },
31700         {
31701             name: "disableSourceOfProjectReferenceRedirect",
31702             type: "boolean",
31703             isTSConfigOnly: true,
31704             category: ts.Diagnostics.Projects,
31705             description: ts.Diagnostics.Disable_preferring_source_files_instead_of_declaration_files_when_referencing_composite_projects,
31706             defaultValueDescription: "false",
31707         },
31708         {
31709             name: "disableSolutionSearching",
31710             type: "boolean",
31711             isTSConfigOnly: true,
31712             category: ts.Diagnostics.Projects,
31713             description: ts.Diagnostics.Opt_a_project_out_of_multi_project_reference_checking_when_editing,
31714             defaultValueDescription: "false",
31715         },
31716         {
31717             name: "disableReferencedProjectLoad",
31718             type: "boolean",
31719             isTSConfigOnly: true,
31720             category: ts.Diagnostics.Projects,
31721             description: ts.Diagnostics.Reduce_the_number_of_projects_loaded_automatically_by_TypeScript,
31722             defaultValueDescription: "false",
31723         },
31724         {
31725             name: "noImplicitUseStrict",
31726             type: "boolean",
31727             affectsSemanticDiagnostics: true,
31728             category: ts.Diagnostics.Backwards_Compatibility,
31729             description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
31730             defaultValueDescription: "false"
31731         },
31732         {
31733             name: "noEmitHelpers",
31734             type: "boolean",
31735             affectsEmit: true,
31736             category: ts.Diagnostics.Emit,
31737             description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
31738             defaultValueDescription: "false"
31739         },
31740         {
31741             name: "noEmitOnError",
31742             type: "boolean",
31743             affectsEmit: true,
31744             category: ts.Diagnostics.Emit,
31745             transpileOptionValue: undefined,
31746             description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
31747             defaultValueDescription: "false"
31748         },
31749         {
31750             name: "preserveConstEnums",
31751             type: "boolean",
31752             affectsEmit: true,
31753             category: ts.Diagnostics.Emit,
31754             description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
31755             defaultValueDescription: "false",
31756         },
31757         {
31758             name: "declarationDir",
31759             type: "string",
31760             affectsEmit: true,
31761             isFilePath: true,
31762             paramType: ts.Diagnostics.DIRECTORY,
31763             category: ts.Diagnostics.Emit,
31764             transpileOptionValue: undefined,
31765             description: ts.Diagnostics.Specify_the_output_directory_for_generated_declaration_files,
31766         },
31767         {
31768             name: "skipLibCheck",
31769             type: "boolean",
31770             category: ts.Diagnostics.Completeness,
31771             description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
31772             defaultValueDescription: "false"
31773         },
31774         {
31775             name: "allowUnusedLabels",
31776             type: "boolean",
31777             affectsBindDiagnostics: true,
31778             affectsSemanticDiagnostics: true,
31779             category: ts.Diagnostics.Type_Checking,
31780             description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
31781             defaultValueDescription: "undefined"
31782         },
31783         {
31784             name: "allowUnreachableCode",
31785             type: "boolean",
31786             affectsBindDiagnostics: true,
31787             affectsSemanticDiagnostics: true,
31788             category: ts.Diagnostics.Type_Checking,
31789             description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
31790             defaultValueDescription: "undefined"
31791         },
31792         {
31793             name: "suppressExcessPropertyErrors",
31794             type: "boolean",
31795             affectsSemanticDiagnostics: true,
31796             category: ts.Diagnostics.Backwards_Compatibility,
31797             description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
31798             defaultValueDescription: "false"
31799         },
31800         {
31801             name: "suppressImplicitAnyIndexErrors",
31802             type: "boolean",
31803             affectsSemanticDiagnostics: true,
31804             category: ts.Diagnostics.Backwards_Compatibility,
31805             description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
31806             defaultValueDescription: "false"
31807         },
31808         {
31809             name: "forceConsistentCasingInFileNames",
31810             type: "boolean",
31811             affectsModuleResolution: true,
31812             category: ts.Diagnostics.Interop_Constraints,
31813             description: ts.Diagnostics.Ensure_that_casing_is_correct_in_imports,
31814             defaultValueDescription: "false"
31815         },
31816         {
31817             name: "maxNodeModuleJsDepth",
31818             type: "number",
31819             affectsModuleResolution: true,
31820             category: ts.Diagnostics.JavaScript_Support,
31821             description: ts.Diagnostics.Specify_the_maximum_folder_depth_used_for_checking_JavaScript_files_from_node_modules_Only_applicable_with_allowJs,
31822             defaultValueDescription: "0"
31823         },
31824         {
31825             name: "noStrictGenericChecks",
31826             type: "boolean",
31827             affectsSemanticDiagnostics: true,
31828             category: ts.Diagnostics.Backwards_Compatibility,
31829             description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
31830             defaultValueDescription: "false"
31831         },
31832         {
31833             name: "useDefineForClassFields",
31834             type: "boolean",
31835             affectsSemanticDiagnostics: true,
31836             affectsEmit: true,
31837             category: ts.Diagnostics.Language_and_Environment,
31838             description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
31839             defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
31840         },
31841         {
31842             name: "preserveValueImports",
31843             type: "boolean",
31844             affectsEmit: true,
31845             category: ts.Diagnostics.Emit,
31846             description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
31847             defaultValueDescription: "false",
31848         },
31849         {
31850             name: "keyofStringsOnly",
31851             type: "boolean",
31852             category: ts.Diagnostics.Backwards_Compatibility,
31853             description: ts.Diagnostics.Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option,
31854             defaultValueDescription: "false"
31855         },
31856         {
31857             name: "plugins",
31858             type: "list",
31859             isTSConfigOnly: true,
31860             element: {
31861                 name: "plugin",
31862                 type: "object"
31863             },
31864             description: ts.Diagnostics.List_of_language_service_plugins,
31865             category: ts.Diagnostics.Editor_Support,
31866         },
31867     ];
31868     ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
31869     ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
31870     ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
31871     ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
31872     ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
31873         return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
31874     });
31875     ts.optionsAffectingProgramStructure = ts.optionDeclarations.filter(function (option) { return !!option.affectsProgramStructure; });
31876     ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
31877         return ts.hasProperty(option, "transpileOptionValue");
31878     });
31879     ts.optionsForBuild = [
31880         {
31881             name: "verbose",
31882             shortName: "v",
31883             category: ts.Diagnostics.Command_line_Options,
31884             description: ts.Diagnostics.Enable_verbose_logging,
31885             type: "boolean",
31886             defaultValueDescription: "false",
31887         },
31888         {
31889             name: "dry",
31890             shortName: "d",
31891             category: ts.Diagnostics.Command_line_Options,
31892             description: ts.Diagnostics.Show_what_would_be_built_or_deleted_if_specified_with_clean,
31893             type: "boolean",
31894             defaultValueDescription: "false",
31895         },
31896         {
31897             name: "force",
31898             shortName: "f",
31899             category: ts.Diagnostics.Command_line_Options,
31900             description: ts.Diagnostics.Build_all_projects_including_those_that_appear_to_be_up_to_date,
31901             type: "boolean",
31902             defaultValueDescription: "false",
31903         },
31904         {
31905             name: "clean",
31906             category: ts.Diagnostics.Command_line_Options,
31907             description: ts.Diagnostics.Delete_the_outputs_of_all_projects,
31908             type: "boolean",
31909             defaultValueDescription: "false",
31910         }
31911     ];
31912     ts.buildOpts = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), ts.optionsForBuild, true);
31913     ts.typeAcquisitionDeclarations = [
31914         {
31915             name: "enableAutoDiscovery",
31916             type: "boolean",
31917             defaultValueDescription: "false",
31918         },
31919         {
31920             name: "enable",
31921             type: "boolean",
31922             defaultValueDescription: "false",
31923         },
31924         {
31925             name: "include",
31926             type: "list",
31927             element: {
31928                 name: "include",
31929                 type: "string"
31930             }
31931         },
31932         {
31933             name: "exclude",
31934             type: "list",
31935             element: {
31936                 name: "exclude",
31937                 type: "string"
31938             }
31939         },
31940         {
31941             name: "disableFilenameBasedTypeAcquisition",
31942             type: "boolean",
31943             defaultValueDescription: "false",
31944         },
31945     ];
31946     function createOptionNameMap(optionDeclarations) {
31947         var optionsNameMap = new ts.Map();
31948         var shortOptionNames = new ts.Map();
31949         ts.forEach(optionDeclarations, function (option) {
31950             optionsNameMap.set(option.name.toLowerCase(), option);
31951             if (option.shortName) {
31952                 shortOptionNames.set(option.shortName, option.name);
31953             }
31954         });
31955         return { optionsNameMap: optionsNameMap, shortOptionNames: shortOptionNames };
31956     }
31957     ts.createOptionNameMap = createOptionNameMap;
31958     var optionsNameMapCache;
31959     function getOptionsNameMap() {
31960         return optionsNameMapCache || (optionsNameMapCache = createOptionNameMap(ts.optionDeclarations));
31961     }
31962     ts.getOptionsNameMap = getOptionsNameMap;
31963     var compilerOptionsAlternateMode = {
31964         diagnostic: ts.Diagnostics.Compiler_option_0_may_only_be_used_with_build,
31965         getOptionsNameMap: getBuildOptionsNameMap
31966     };
31967     ts.defaultInitCompilerOptions = {
31968         module: ts.ModuleKind.CommonJS,
31969         target: 3,
31970         strict: true,
31971         esModuleInterop: true,
31972         forceConsistentCasingInFileNames: true,
31973         skipLibCheck: true
31974     };
31975     function convertEnableAutoDiscoveryToEnable(typeAcquisition) {
31976         if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
31977             return {
31978                 enable: typeAcquisition.enableAutoDiscovery,
31979                 include: typeAcquisition.include || [],
31980                 exclude: typeAcquisition.exclude || []
31981             };
31982         }
31983         return typeAcquisition;
31984     }
31985     ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable;
31986     function createCompilerDiagnosticForInvalidCustomType(opt) {
31987         return createDiagnosticForInvalidCustomType(opt, ts.createCompilerDiagnostic);
31988     }
31989     ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
31990     function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
31991         var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'".concat(key, "'"); }).join(", ");
31992         return createDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--".concat(opt.name), namesOfType);
31993     }
31994     function parseCustomTypeOption(opt, value, errors) {
31995         return convertJsonOptionOfCustomType(opt, ts.trimString(value || ""), errors);
31996     }
31997     ts.parseCustomTypeOption = parseCustomTypeOption;
31998     function parseListTypeOption(opt, value, errors) {
31999         if (value === void 0) { value = ""; }
32000         value = ts.trimString(value);
32001         if (ts.startsWith(value, "-")) {
32002             return undefined;
32003         }
32004         if (value === "") {
32005             return [];
32006         }
32007         var values = value.split(",");
32008         switch (opt.element.type) {
32009             case "number":
32010                 return ts.mapDefined(values, function (v) { return validateJsonOptionValue(opt.element, parseInt(v), errors); });
32011             case "string":
32012                 return ts.mapDefined(values, function (v) { return validateJsonOptionValue(opt.element, v || "", errors); });
32013             default:
32014                 return ts.mapDefined(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); });
32015         }
32016     }
32017     ts.parseListTypeOption = parseListTypeOption;
32018     function getOptionName(option) {
32019         return option.name;
32020     }
32021     function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) {
32022         var _a;
32023         if ((_a = diagnostics.alternateMode) === null || _a === void 0 ? void 0 : _a.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
32024             return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption);
32025         }
32026         var possibleOption = ts.getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
32027         return possibleOption ?
32028             createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) :
32029             createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
32030     }
32031     function parseCommandLineWorker(diagnostics, commandLine, readFile) {
32032         var options = {};
32033         var watchOptions;
32034         var fileNames = [];
32035         var errors = [];
32036         parseStrings(commandLine);
32037         return {
32038             options: options,
32039             watchOptions: watchOptions,
32040             fileNames: fileNames,
32041             errors: errors
32042         };
32043         function parseStrings(args) {
32044             var i = 0;
32045             while (i < args.length) {
32046                 var s = args[i];
32047                 i++;
32048                 if (s.charCodeAt(0) === 64) {
32049                     parseResponseFile(s.slice(1));
32050                 }
32051                 else if (s.charCodeAt(0) === 45) {
32052                     var inputOptionName = s.slice(s.charCodeAt(1) === 45 ? 2 : 1);
32053                     var opt = getOptionDeclarationFromName(diagnostics.getOptionsNameMap, inputOptionName, true);
32054                     if (opt) {
32055                         i = parseOptionValue(args, i, diagnostics, opt, options, errors);
32056                     }
32057                     else {
32058                         var watchOpt = getOptionDeclarationFromName(watchOptionsDidYouMeanDiagnostics.getOptionsNameMap, inputOptionName, true);
32059                         if (watchOpt) {
32060                             i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
32061                         }
32062                         else {
32063                             errors.push(createUnknownOptionError(inputOptionName, diagnostics, ts.createCompilerDiagnostic, s));
32064                         }
32065                     }
32066                 }
32067                 else {
32068                     fileNames.push(s);
32069                 }
32070             }
32071         }
32072         function parseResponseFile(fileName) {
32073             var text = tryReadFile(fileName, readFile || (function (fileName) { return ts.sys.readFile(fileName); }));
32074             if (!ts.isString(text)) {
32075                 errors.push(text);
32076                 return;
32077             }
32078             var args = [];
32079             var pos = 0;
32080             while (true) {
32081                 while (pos < text.length && text.charCodeAt(pos) <= 32)
32082                     pos++;
32083                 if (pos >= text.length)
32084                     break;
32085                 var start = pos;
32086                 if (text.charCodeAt(start) === 34) {
32087                     pos++;
32088                     while (pos < text.length && text.charCodeAt(pos) !== 34)
32089                         pos++;
32090                     if (pos < text.length) {
32091                         args.push(text.substring(start + 1, pos));
32092                         pos++;
32093                     }
32094                     else {
32095                         errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));
32096                     }
32097                 }
32098                 else {
32099                     while (text.charCodeAt(pos) > 32)
32100                         pos++;
32101                     args.push(text.substring(start, pos));
32102                 }
32103             }
32104             parseStrings(args);
32105         }
32106     }
32107     ts.parseCommandLineWorker = parseCommandLineWorker;
32108     function parseOptionValue(args, i, diagnostics, opt, options, errors) {
32109         if (opt.isTSConfigOnly) {
32110             var optValue = args[i];
32111             if (optValue === "null") {
32112                 options[opt.name] = undefined;
32113                 i++;
32114             }
32115             else if (opt.type === "boolean") {
32116                 if (optValue === "false") {
32117                     options[opt.name] = validateJsonOptionValue(opt, false, errors);
32118                     i++;
32119                 }
32120                 else {
32121                     if (optValue === "true")
32122                         i++;
32123                     errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line, opt.name));
32124                 }
32125             }
32126             else {
32127                 errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line, opt.name));
32128                 if (optValue && !ts.startsWith(optValue, "-"))
32129                     i++;
32130             }
32131         }
32132         else {
32133             if (!args[i] && opt.type !== "boolean") {
32134                 errors.push(ts.createCompilerDiagnostic(diagnostics.optionTypeMismatchDiagnostic, opt.name, getCompilerOptionValueTypeString(opt)));
32135             }
32136             if (args[i] !== "null") {
32137                 switch (opt.type) {
32138                     case "number":
32139                         options[opt.name] = validateJsonOptionValue(opt, parseInt(args[i]), errors);
32140                         i++;
32141                         break;
32142                     case "boolean":
32143                         var optValue = args[i];
32144                         options[opt.name] = validateJsonOptionValue(opt, optValue !== "false", errors);
32145                         if (optValue === "false" || optValue === "true") {
32146                             i++;
32147                         }
32148                         break;
32149                     case "string":
32150                         options[opt.name] = validateJsonOptionValue(opt, args[i] || "", errors);
32151                         i++;
32152                         break;
32153                     case "list":
32154                         var result = parseListTypeOption(opt, args[i], errors);
32155                         options[opt.name] = result || [];
32156                         if (result) {
32157                             i++;
32158                         }
32159                         break;
32160                     default:
32161                         options[opt.name] = parseCustomTypeOption(opt, args[i], errors);
32162                         i++;
32163                         break;
32164                 }
32165             }
32166             else {
32167                 options[opt.name] = undefined;
32168                 i++;
32169             }
32170         }
32171         return i;
32172     }
32173     ts.compilerOptionsDidYouMeanDiagnostics = {
32174         alternateMode: compilerOptionsAlternateMode,
32175         getOptionsNameMap: getOptionsNameMap,
32176         optionDeclarations: ts.optionDeclarations,
32177         unknownOptionDiagnostic: ts.Diagnostics.Unknown_compiler_option_0,
32178         unknownDidYouMeanDiagnostic: ts.Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
32179         optionTypeMismatchDiagnostic: ts.Diagnostics.Compiler_option_0_expects_an_argument
32180     };
32181     function parseCommandLine(commandLine, readFile) {
32182         return parseCommandLineWorker(ts.compilerOptionsDidYouMeanDiagnostics, commandLine, readFile);
32183     }
32184     ts.parseCommandLine = parseCommandLine;
32185     function getOptionFromName(optionName, allowShort) {
32186         return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
32187     }
32188     ts.getOptionFromName = getOptionFromName;
32189     function getOptionDeclarationFromName(getOptionNameMap, optionName, allowShort) {
32190         if (allowShort === void 0) { allowShort = false; }
32191         optionName = optionName.toLowerCase();
32192         var _a = getOptionNameMap(), optionsNameMap = _a.optionsNameMap, shortOptionNames = _a.shortOptionNames;
32193         if (allowShort) {
32194             var short = shortOptionNames.get(optionName);
32195             if (short !== undefined) {
32196                 optionName = short;
32197             }
32198         }
32199         return optionsNameMap.get(optionName);
32200     }
32201     var buildOptionsNameMapCache;
32202     function getBuildOptionsNameMap() {
32203         return buildOptionsNameMapCache || (buildOptionsNameMapCache = createOptionNameMap(ts.buildOpts));
32204     }
32205     var buildOptionsAlternateMode = {
32206         diagnostic: ts.Diagnostics.Compiler_option_0_may_not_be_used_with_build,
32207         getOptionsNameMap: getOptionsNameMap
32208     };
32209     var buildOptionsDidYouMeanDiagnostics = {
32210         alternateMode: buildOptionsAlternateMode,
32211         getOptionsNameMap: getBuildOptionsNameMap,
32212         optionDeclarations: ts.buildOpts,
32213         unknownOptionDiagnostic: ts.Diagnostics.Unknown_build_option_0,
32214         unknownDidYouMeanDiagnostic: ts.Diagnostics.Unknown_build_option_0_Did_you_mean_1,
32215         optionTypeMismatchDiagnostic: ts.Diagnostics.Build_option_0_requires_a_value_of_type_1
32216     };
32217     function parseBuildCommand(args) {
32218         var _a = parseCommandLineWorker(buildOptionsDidYouMeanDiagnostics, args), options = _a.options, watchOptions = _a.watchOptions, projects = _a.fileNames, errors = _a.errors;
32219         var buildOptions = options;
32220         if (projects.length === 0) {
32221             projects.push(".");
32222         }
32223         if (buildOptions.clean && buildOptions.force) {
32224             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "force"));
32225         }
32226         if (buildOptions.clean && buildOptions.verbose) {
32227             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "verbose"));
32228         }
32229         if (buildOptions.clean && buildOptions.watch) {
32230             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Options_0_and_1_cannot_be_combined, "clean", "watch"));
32231         }
32232         if (buildOptions.watch && buildOptions.dry) {
32233             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Options_0_and_1_cannot_be_combined, "watch", "dry"));
32234         }
32235         return { buildOptions: buildOptions, watchOptions: watchOptions, projects: projects, errors: errors };
32236     }
32237     ts.parseBuildCommand = parseBuildCommand;
32238     function getDiagnosticText(_message) {
32239         var _args = [];
32240         for (var _i = 1; _i < arguments.length; _i++) {
32241             _args[_i - 1] = arguments[_i];
32242         }
32243         var diagnostic = ts.createCompilerDiagnostic.apply(undefined, arguments);
32244         return diagnostic.messageText;
32245     }
32246     ts.getDiagnosticText = getDiagnosticText;
32247     function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend, extraFileExtensions) {
32248         var configFileText = tryReadFile(configFileName, function (fileName) { return host.readFile(fileName); });
32249         if (!ts.isString(configFileText)) {
32250             host.onUnRecoverableConfigFileDiagnostic(configFileText);
32251             return undefined;
32252         }
32253         var result = ts.parseJsonText(configFileName, configFileText);
32254         var cwd = host.getCurrentDirectory();
32255         result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
32256         result.resolvedPath = result.path;
32257         result.originalFileName = result.fileName;
32258         return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
32259     }
32260     ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
32261     function readConfigFile(fileName, readFile) {
32262         var textOrDiagnostic = tryReadFile(fileName, readFile);
32263         return ts.isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
32264     }
32265     ts.readConfigFile = readConfigFile;
32266     function parseConfigFileTextToJson(fileName, jsonText) {
32267         var jsonSourceFile = ts.parseJsonText(fileName, jsonText);
32268         return {
32269             config: convertConfigFileToObject(jsonSourceFile, jsonSourceFile.parseDiagnostics, false, undefined),
32270             error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
32271         };
32272     }
32273     ts.parseConfigFileTextToJson = parseConfigFileTextToJson;
32274     function readJsonConfigFile(fileName, readFile) {
32275         var textOrDiagnostic = tryReadFile(fileName, readFile);
32276         return ts.isString(textOrDiagnostic) ? ts.parseJsonText(fileName, textOrDiagnostic) : { fileName: fileName, parseDiagnostics: [textOrDiagnostic] };
32277     }
32278     ts.readJsonConfigFile = readJsonConfigFile;
32279     function tryReadFile(fileName, readFile) {
32280         var text;
32281         try {
32282             text = readFile(fileName);
32283         }
32284         catch (e) {
32285             return ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
32286         }
32287         return text === undefined ? ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0, fileName) : text;
32288     }
32289     ts.tryReadFile = tryReadFile;
32290     function commandLineOptionsToMap(options) {
32291         return ts.arrayToMap(options, getOptionName);
32292     }
32293     var typeAcquisitionDidYouMeanDiagnostics = {
32294         optionDeclarations: ts.typeAcquisitionDeclarations,
32295         unknownOptionDiagnostic: ts.Diagnostics.Unknown_type_acquisition_option_0,
32296         unknownDidYouMeanDiagnostic: ts.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1,
32297     };
32298     var watchOptionsNameMapCache;
32299     function getWatchOptionsNameMap() {
32300         return watchOptionsNameMapCache || (watchOptionsNameMapCache = createOptionNameMap(ts.optionsForWatch));
32301     }
32302     var watchOptionsDidYouMeanDiagnostics = {
32303         getOptionsNameMap: getWatchOptionsNameMap,
32304         optionDeclarations: ts.optionsForWatch,
32305         unknownOptionDiagnostic: ts.Diagnostics.Unknown_watch_option_0,
32306         unknownDidYouMeanDiagnostic: ts.Diagnostics.Unknown_watch_option_0_Did_you_mean_1,
32307         optionTypeMismatchDiagnostic: ts.Diagnostics.Watch_option_0_requires_a_value_of_type_1
32308     };
32309     var commandLineCompilerOptionsMapCache;
32310     function getCommandLineCompilerOptionsMap() {
32311         return commandLineCompilerOptionsMapCache || (commandLineCompilerOptionsMapCache = commandLineOptionsToMap(ts.optionDeclarations));
32312     }
32313     var commandLineWatchOptionsMapCache;
32314     function getCommandLineWatchOptionsMap() {
32315         return commandLineWatchOptionsMapCache || (commandLineWatchOptionsMapCache = commandLineOptionsToMap(ts.optionsForWatch));
32316     }
32317     var commandLineTypeAcquisitionMapCache;
32318     function getCommandLineTypeAcquisitionMap() {
32319         return commandLineTypeAcquisitionMapCache || (commandLineTypeAcquisitionMapCache = commandLineOptionsToMap(ts.typeAcquisitionDeclarations));
32320     }
32321     var _tsconfigRootOptions;
32322     function getTsconfigRootOptionsMap() {
32323         if (_tsconfigRootOptions === undefined) {
32324             _tsconfigRootOptions = {
32325                 name: undefined,
32326                 type: "object",
32327                 elementOptions: commandLineOptionsToMap([
32328                     {
32329                         name: "compilerOptions",
32330                         type: "object",
32331                         elementOptions: getCommandLineCompilerOptionsMap(),
32332                         extraKeyDiagnostics: ts.compilerOptionsDidYouMeanDiagnostics,
32333                     },
32334                     {
32335                         name: "watchOptions",
32336                         type: "object",
32337                         elementOptions: getCommandLineWatchOptionsMap(),
32338                         extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics,
32339                     },
32340                     {
32341                         name: "typingOptions",
32342                         type: "object",
32343                         elementOptions: getCommandLineTypeAcquisitionMap(),
32344                         extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics,
32345                     },
32346                     {
32347                         name: "typeAcquisition",
32348                         type: "object",
32349                         elementOptions: getCommandLineTypeAcquisitionMap(),
32350                         extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
32351                     },
32352                     {
32353                         name: "extends",
32354                         type: "string",
32355                         category: ts.Diagnostics.File_Management,
32356                     },
32357                     {
32358                         name: "references",
32359                         type: "list",
32360                         element: {
32361                             name: "references",
32362                             type: "object"
32363                         },
32364                         category: ts.Diagnostics.Projects,
32365                     },
32366                     {
32367                         name: "files",
32368                         type: "list",
32369                         element: {
32370                             name: "files",
32371                             type: "string"
32372                         },
32373                         category: ts.Diagnostics.File_Management,
32374                     },
32375                     {
32376                         name: "include",
32377                         type: "list",
32378                         element: {
32379                             name: "include",
32380                             type: "string"
32381                         },
32382                         category: ts.Diagnostics.File_Management,
32383                         defaultValueDescription: ts.Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk
32384                     },
32385                     {
32386                         name: "exclude",
32387                         type: "list",
32388                         element: {
32389                             name: "exclude",
32390                             type: "string"
32391                         },
32392                         category: ts.Diagnostics.File_Management,
32393                         defaultValueDescription: ts.Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified
32394                     },
32395                     ts.compileOnSaveCommandLineOption
32396                 ])
32397             };
32398         }
32399         return _tsconfigRootOptions;
32400     }
32401     function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) {
32402         var _a;
32403         var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression;
32404         var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined;
32405         if (rootExpression && rootExpression.kind !== 204) {
32406             errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json"));
32407             if (ts.isArrayLiteralExpression(rootExpression)) {
32408                 var firstObject = ts.find(rootExpression.elements, ts.isObjectLiteralExpression);
32409                 if (firstObject) {
32410                     return convertToObjectWorker(sourceFile, firstObject, errors, true, knownRootOptions, optionsIterator);
32411                 }
32412             }
32413             return {};
32414         }
32415         return convertToObjectWorker(sourceFile, rootExpression, errors, true, knownRootOptions, optionsIterator);
32416     }
32417     function convertToObject(sourceFile, errors) {
32418         var _a;
32419         return convertToObjectWorker(sourceFile, (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression, errors, true, undefined, undefined);
32420     }
32421     ts.convertToObject = convertToObject;
32422     function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue, knownRootOptions, jsonConversionNotifier) {
32423         if (!rootExpression) {
32424             return returnValue ? {} : undefined;
32425         }
32426         return convertPropertyValueToJson(rootExpression, knownRootOptions);
32427         function isRootOptionMap(knownOptions) {
32428             return knownRootOptions && knownRootOptions.elementOptions === knownOptions;
32429         }
32430         function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
32431             var result = returnValue ? {} : undefined;
32432             var _loop_4 = function (element) {
32433                 if (element.kind !== 294) {
32434                     errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
32435                     return "continue";
32436                 }
32437                 if (element.questionToken) {
32438                     errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
32439                 }
32440                 if (!isDoubleQuotedString(element.name)) {
32441                     errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, ts.Diagnostics.String_literal_with_double_quotes_expected));
32442                 }
32443                 var textOfKey = ts.isComputedNonLiteralName(element.name) ? undefined : ts.getTextOfPropertyName(element.name);
32444                 var keyText = textOfKey && ts.unescapeLeadingUnderscores(textOfKey);
32445                 var option = keyText && knownOptions ? knownOptions.get(keyText) : undefined;
32446                 if (keyText && extraKeyDiagnostics && !option) {
32447                     if (knownOptions) {
32448                         errors.push(createUnknownOptionError(keyText, extraKeyDiagnostics, function (message, arg0, arg1) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1); }));
32449                     }
32450                     else {
32451                         errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
32452                     }
32453                 }
32454                 var value = convertPropertyValueToJson(element.initializer, option);
32455                 if (typeof keyText !== "undefined") {
32456                     if (returnValue) {
32457                         result[keyText] = value;
32458                     }
32459                     if (jsonConversionNotifier &&
32460                         (parentOption || isRootOptionMap(knownOptions))) {
32461                         var isValidOptionValue = isCompilerOptionsValue(option, value);
32462                         if (parentOption) {
32463                             if (isValidOptionValue) {
32464                                 jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
32465                             }
32466                         }
32467                         else if (isRootOptionMap(knownOptions)) {
32468                             if (isValidOptionValue) {
32469                                 jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
32470                             }
32471                             else if (!option) {
32472                                 jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
32473                             }
32474                         }
32475                     }
32476                 }
32477             };
32478             for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
32479                 var element = _a[_i];
32480                 _loop_4(element);
32481             }
32482             return result;
32483         }
32484         function convertArrayLiteralExpressionToJson(elements, elementOption) {
32485             if (!returnValue) {
32486                 elements.forEach(function (element) { return convertPropertyValueToJson(element, elementOption); });
32487                 return undefined;
32488             }
32489             return ts.filter(elements.map(function (element) { return convertPropertyValueToJson(element, elementOption); }), function (v) { return v !== undefined; });
32490         }
32491         function convertPropertyValueToJson(valueExpression, option) {
32492             var invalidReported;
32493             switch (valueExpression.kind) {
32494                 case 110:
32495                     reportInvalidOptionValue(option && option.type !== "boolean");
32496                     return validateValue(true);
32497                 case 95:
32498                     reportInvalidOptionValue(option && option.type !== "boolean");
32499                     return validateValue(false);
32500                 case 104:
32501                     reportInvalidOptionValue(option && option.name === "extends");
32502                     return validateValue(null);
32503                 case 10:
32504                     if (!isDoubleQuotedString(valueExpression)) {
32505                         errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.String_literal_with_double_quotes_expected));
32506                     }
32507                     reportInvalidOptionValue(option && (ts.isString(option.type) && option.type !== "string"));
32508                     var text = valueExpression.text;
32509                     if (option && !ts.isString(option.type)) {
32510                         var customOption = option;
32511                         if (!customOption.type.has(text.toLowerCase())) {
32512                             errors.push(createDiagnosticForInvalidCustomType(customOption, function (message, arg0, arg1) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1); }));
32513                             invalidReported = true;
32514                         }
32515                     }
32516                     return validateValue(text);
32517                 case 8:
32518                     reportInvalidOptionValue(option && option.type !== "number");
32519                     return validateValue(Number(valueExpression.text));
32520                 case 218:
32521                     if (valueExpression.operator !== 40 || valueExpression.operand.kind !== 8) {
32522                         break;
32523                     }
32524                     reportInvalidOptionValue(option && option.type !== "number");
32525                     return validateValue(-Number(valueExpression.operand.text));
32526                 case 204:
32527                     reportInvalidOptionValue(option && option.type !== "object");
32528                     var objectLiteralExpression = valueExpression;
32529                     if (option) {
32530                         var _a = option, elementOptions = _a.elementOptions, extraKeyDiagnostics = _a.extraKeyDiagnostics, optionName = _a.name;
32531                         return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, elementOptions, extraKeyDiagnostics, optionName));
32532                     }
32533                     else {
32534                         return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined));
32535                     }
32536                 case 203:
32537                     reportInvalidOptionValue(option && option.type !== "list");
32538                     return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element));
32539             }
32540             if (option) {
32541                 reportInvalidOptionValue(true);
32542             }
32543             else {
32544                 errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
32545             }
32546             return undefined;
32547             function validateValue(value) {
32548                 var _a;
32549                 if (!invalidReported) {
32550                     var diagnostic = (_a = option === null || option === void 0 ? void 0 : option.extraValidation) === null || _a === void 0 ? void 0 : _a.call(option, value);
32551                     if (diagnostic) {
32552                         errors.push(ts.createDiagnosticForNodeInSourceFile.apply(void 0, __spreadArray([sourceFile, valueExpression], diagnostic, false)));
32553                         return undefined;
32554                     }
32555                 }
32556                 return value;
32557             }
32558             function reportInvalidOptionValue(isError) {
32559                 if (isError) {
32560                     errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
32561                     invalidReported = true;
32562                 }
32563             }
32564         }
32565         function isDoubleQuotedString(node) {
32566             return ts.isStringLiteral(node) && ts.isStringDoubleQuoted(node, sourceFile);
32567         }
32568     }
32569     ts.convertToObjectWorker = convertToObjectWorker;
32570     function getCompilerOptionValueTypeString(option) {
32571         return option.type === "list" ?
32572             "Array" :
32573             ts.isString(option.type) ? option.type : "string";
32574     }
32575     function isCompilerOptionsValue(option, value) {
32576         if (option) {
32577             if (isNullOrUndefined(value))
32578                 return true;
32579             if (option.type === "list") {
32580                 return ts.isArray(value);
32581             }
32582             var expectedType = ts.isString(option.type) ? option.type : "string";
32583             return typeof value === expectedType;
32584         }
32585         return false;
32586     }
32587     function convertToTSConfig(configParseResult, configFileName, host) {
32588         var _a, _b, _c;
32589         var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
32590         var files = ts.map(ts.filter(configParseResult.fileNames, !((_b = (_a = configParseResult.options.configFile) === null || _a === void 0 ? void 0 : _a.configFileSpecs) === null || _b === void 0 ? void 0 : _b.validatedIncludeSpecs) ? ts.returnTrue : matchesSpecs(configFileName, configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs, configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs, host)), function (f) { return ts.getRelativePathFromFile(ts.getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), ts.getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName); });
32591         var optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: ts.getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames });
32592         var watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions);
32593         var config = __assign(__assign({ compilerOptions: __assign(__assign({}, optionMapToObject(optionMap)), { showConfig: undefined, configFile: undefined, configFilePath: undefined, help: undefined, init: undefined, listFiles: undefined, listEmittedFiles: undefined, project: undefined, build: undefined, version: undefined }), watchOptions: watchOptionMap && optionMapToObject(watchOptionMap), references: ts.map(configParseResult.projectReferences, function (r) { return (__assign(__assign({}, r), { path: r.originalPath ? r.originalPath : "", originalPath: undefined })); }), files: ts.length(files) ? files : undefined }, (((_c = configParseResult.options.configFile) === null || _c === void 0 ? void 0 : _c.configFileSpecs) ? {
32594             include: filterSameAsDefaultInclude(configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs),
32595             exclude: configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs
32596         } : {})), { compileOnSave: !!configParseResult.compileOnSave ? true : undefined });
32597         return config;
32598     }
32599     ts.convertToTSConfig = convertToTSConfig;
32600     function optionMapToObject(optionMap) {
32601         return __assign({}, ts.arrayFrom(optionMap.entries()).reduce(function (prev, cur) {
32602             var _a;
32603             return (__assign(__assign({}, prev), (_a = {}, _a[cur[0]] = cur[1], _a)));
32604         }, {}));
32605     }
32606     function filterSameAsDefaultInclude(specs) {
32607         if (!ts.length(specs))
32608             return undefined;
32609         if (ts.length(specs) !== 1)
32610             return specs;
32611         if (specs[0] === "**/*")
32612             return undefined;
32613         return specs;
32614     }
32615     function matchesSpecs(path, includeSpecs, excludeSpecs, host) {
32616         if (!includeSpecs)
32617             return ts.returnTrue;
32618         var patterns = ts.getFileMatcherPatterns(path, excludeSpecs, includeSpecs, host.useCaseSensitiveFileNames, host.getCurrentDirectory());
32619         var excludeRe = patterns.excludePattern && ts.getRegexFromPattern(patterns.excludePattern, host.useCaseSensitiveFileNames);
32620         var includeRe = patterns.includeFilePattern && ts.getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames);
32621         if (includeRe) {
32622             if (excludeRe) {
32623                 return function (path) { return !(includeRe.test(path) && !excludeRe.test(path)); };
32624             }
32625             return function (path) { return !includeRe.test(path); };
32626         }
32627         if (excludeRe) {
32628             return function (path) { return excludeRe.test(path); };
32629         }
32630         return ts.returnTrue;
32631     }
32632     function getCustomTypeMapOfCommandLineOption(optionDefinition) {
32633         if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean" || optionDefinition.type === "object") {
32634             return undefined;
32635         }
32636         else if (optionDefinition.type === "list") {
32637             return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
32638         }
32639         else {
32640             return optionDefinition.type;
32641         }
32642     }
32643     function getNameOfCompilerOptionValue(value, customTypeMap) {
32644         return ts.forEachEntry(customTypeMap, function (mapValue, key) {
32645             if (mapValue === value) {
32646                 return key;
32647             }
32648         });
32649     }
32650     function serializeCompilerOptions(options, pathOptions) {
32651         return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
32652     }
32653     function serializeWatchOptions(options) {
32654         return serializeOptionBaseObject(options, getWatchOptionsNameMap());
32655     }
32656     function serializeOptionBaseObject(options, _a, pathOptions) {
32657         var optionsNameMap = _a.optionsNameMap;
32658         var result = new ts.Map();
32659         var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
32660         var _loop_5 = function (name) {
32661             if (ts.hasProperty(options, name)) {
32662                 if (optionsNameMap.has(name) && (optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options || optionsNameMap.get(name).category === ts.Diagnostics.Output_Formatting)) {
32663                     return "continue";
32664                 }
32665                 var value = options[name];
32666                 var optionDefinition = optionsNameMap.get(name.toLowerCase());
32667                 if (optionDefinition) {
32668                     var customTypeMap_1 = getCustomTypeMapOfCommandLineOption(optionDefinition);
32669                     if (!customTypeMap_1) {
32670                         if (pathOptions && optionDefinition.isFilePath) {
32671                             result.set(name, ts.getRelativePathFromFile(pathOptions.configFilePath, ts.getNormalizedAbsolutePath(value, ts.getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName));
32672                         }
32673                         else {
32674                             result.set(name, value);
32675                         }
32676                     }
32677                     else {
32678                         if (optionDefinition.type === "list") {
32679                             result.set(name, value.map(function (element) { return getNameOfCompilerOptionValue(element, customTypeMap_1); }));
32680                         }
32681                         else {
32682                             result.set(name, getNameOfCompilerOptionValue(value, customTypeMap_1));
32683                         }
32684                     }
32685                 }
32686             }
32687         };
32688         for (var name in options) {
32689             _loop_5(name);
32690         }
32691         return result;
32692     }
32693     function getCompilerOptionsDiffValue(options, newLine) {
32694         var compilerOptionsMap = getSerializedCompilerOption(options);
32695         return getOverwrittenDefaultOptions();
32696         function makePadding(paddingLength) {
32697             return Array(paddingLength + 1).join(" ");
32698         }
32699         function getOverwrittenDefaultOptions() {
32700             var result = [];
32701             var tab = makePadding(2);
32702             commandOptionsWithoutBuild.forEach(function (cmd) {
32703                 if (!compilerOptionsMap.has(cmd.name)) {
32704                     return;
32705                 }
32706                 var newValue = compilerOptionsMap.get(cmd.name);
32707                 var defaultValue = getDefaultValueForOption(cmd);
32708                 if (newValue !== defaultValue) {
32709                     result.push("".concat(tab).concat(cmd.name, ": ").concat(newValue));
32710                 }
32711                 else if (ts.hasProperty(ts.defaultInitCompilerOptions, cmd.name)) {
32712                     result.push("".concat(tab).concat(cmd.name, ": ").concat(defaultValue));
32713                 }
32714             });
32715             return result.join(newLine) + newLine;
32716         }
32717     }
32718     ts.getCompilerOptionsDiffValue = getCompilerOptionsDiffValue;
32719     function getSerializedCompilerOption(options) {
32720         var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);
32721         return serializeCompilerOptions(compilerOptions);
32722     }
32723     function generateTSConfig(options, fileNames, newLine) {
32724         var compilerOptionsMap = getSerializedCompilerOption(options);
32725         return writeConfigurations();
32726         function makePadding(paddingLength) {
32727             return Array(paddingLength + 1).join(" ");
32728         }
32729         function isAllowedOptionForOutput(_a) {
32730             var category = _a.category, name = _a.name, isCommandLineOnly = _a.isCommandLineOnly;
32731             var categoriesToSkip = [ts.Diagnostics.Command_line_Options, ts.Diagnostics.Editor_Support, ts.Diagnostics.Compiler_Diagnostics, ts.Diagnostics.Backwards_Compatibility, ts.Diagnostics.Watch_and_Build_Modes, ts.Diagnostics.Output_Formatting];
32732             return !isCommandLineOnly && category !== undefined && (!categoriesToSkip.includes(category) || compilerOptionsMap.has(name));
32733         }
32734         function writeConfigurations() {
32735             var categorizedOptions = ts.createMultiMap();
32736             for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
32737                 var option = optionDeclarations_1[_i];
32738                 var category = option.category;
32739                 if (isAllowedOptionForOutput(option)) {
32740                     categorizedOptions.add(ts.getLocaleSpecificMessage(category), option);
32741                 }
32742             }
32743             var marginLength = 0;
32744             var seenKnownKeys = 0;
32745             var entries = [];
32746             categorizedOptions.forEach(function (options, category) {
32747                 if (entries.length !== 0) {
32748                     entries.push({ value: "" });
32749                 }
32750                 entries.push({ value: "/* ".concat(category, " */") });
32751                 for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
32752                     var option = options_1[_i];
32753                     var optionName = void 0;
32754                     if (compilerOptionsMap.has(option.name)) {
32755                         optionName = "\"".concat(option.name, "\": ").concat(JSON.stringify(compilerOptionsMap.get(option.name))).concat((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ",");
32756                     }
32757                     else {
32758                         optionName = "// \"".concat(option.name, "\": ").concat(JSON.stringify(getDefaultValueForOption(option)), ",");
32759                     }
32760                     entries.push({
32761                         value: optionName,
32762                         description: "/* ".concat(option.description && ts.getLocaleSpecificMessage(option.description) || option.name, " */")
32763                     });
32764                     marginLength = Math.max(optionName.length, marginLength);
32765                 }
32766             });
32767             var tab = makePadding(2);
32768             var result = [];
32769             result.push("{");
32770             result.push("".concat(tab, "\"compilerOptions\": {"));
32771             result.push("".concat(tab).concat(tab, "/* ").concat(ts.getLocaleSpecificMessage(ts.Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file), " */"));
32772             result.push("");
32773             for (var _a = 0, entries_2 = entries; _a < entries_2.length; _a++) {
32774                 var entry = entries_2[_a];
32775                 var value = entry.value, _b = entry.description, description = _b === void 0 ? "" : _b;
32776                 result.push(value && "".concat(tab).concat(tab).concat(value).concat(description && (makePadding(marginLength - value.length + 2) + description)));
32777             }
32778             if (fileNames.length) {
32779                 result.push("".concat(tab, "},"));
32780                 result.push("".concat(tab, "\"files\": ["));
32781                 for (var i = 0; i < fileNames.length; i++) {
32782                     result.push("".concat(tab).concat(tab).concat(JSON.stringify(fileNames[i])).concat(i === fileNames.length - 1 ? "" : ","));
32783                 }
32784                 result.push("".concat(tab, "]"));
32785             }
32786             else {
32787                 result.push("".concat(tab, "}"));
32788             }
32789             result.push("}");
32790             return result.join(newLine) + newLine;
32791         }
32792     }
32793     ts.generateTSConfig = generateTSConfig;
32794     function convertToOptionsWithAbsolutePaths(options, toAbsolutePath) {
32795         var result = {};
32796         var optionsNameMap = getOptionsNameMap().optionsNameMap;
32797         for (var name in options) {
32798             if (ts.hasProperty(options, name)) {
32799                 result[name] = convertToOptionValueWithAbsolutePaths(optionsNameMap.get(name.toLowerCase()), options[name], toAbsolutePath);
32800             }
32801         }
32802         if (result.configFilePath) {
32803             result.configFilePath = toAbsolutePath(result.configFilePath);
32804         }
32805         return result;
32806     }
32807     ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
32808     function convertToOptionValueWithAbsolutePaths(option, value, toAbsolutePath) {
32809         if (option && !isNullOrUndefined(value)) {
32810             if (option.type === "list") {
32811                 var values = value;
32812                 if (option.element.isFilePath && values.length) {
32813                     return values.map(toAbsolutePath);
32814                 }
32815             }
32816             else if (option.isFilePath) {
32817                 return toAbsolutePath(value);
32818             }
32819         }
32820         return value;
32821     }
32822     function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
32823         return parseJsonConfigFileContentWorker(json, undefined, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
32824     }
32825     ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
32826     function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
32827         return parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
32828     }
32829     ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
32830     function setConfigFileInOptions(options, configFile) {
32831         if (configFile) {
32832             Object.defineProperty(options, "configFile", { enumerable: false, writable: false, value: configFile });
32833         }
32834     }
32835     ts.setConfigFileInOptions = setConfigFileInOptions;
32836     function isNullOrUndefined(x) {
32837         return x === undefined || x === null;
32838     }
32839     function directoryOfCombinedPath(fileName, basePath) {
32840         return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath));
32841     }
32842     function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
32843         if (existingOptions === void 0) { existingOptions = {}; }
32844         if (resolutionStack === void 0) { resolutionStack = []; }
32845         if (extraFileExtensions === void 0) { extraFileExtensions = []; }
32846         ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
32847         var errors = [];
32848         var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
32849         var raw = parsedConfig.raw;
32850         var options = ts.extend(existingOptions, parsedConfig.options || {});
32851         var watchOptions = existingWatchOptions && parsedConfig.watchOptions ?
32852             ts.extend(existingWatchOptions, parsedConfig.watchOptions) :
32853             parsedConfig.watchOptions || existingWatchOptions;
32854         options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
32855         var configFileSpecs = getConfigFileSpecs();
32856         if (sourceFile)
32857             sourceFile.configFileSpecs = configFileSpecs;
32858         setConfigFileInOptions(options, sourceFile);
32859         var basePathForFileNames = ts.normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
32860         return {
32861             options: options,
32862             watchOptions: watchOptions,
32863             fileNames: getFileNames(basePathForFileNames),
32864             projectReferences: getProjectReferences(basePathForFileNames),
32865             typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(),
32866             raw: raw,
32867             errors: errors,
32868             wildcardDirectories: getWildcardDirectories(configFileSpecs, basePathForFileNames, host.useCaseSensitiveFileNames),
32869             compileOnSave: !!raw.compileOnSave,
32870         };
32871         function getConfigFileSpecs() {
32872             var referencesOfRaw = getPropFromRaw("references", function (element) { return typeof element === "object"; }, "object");
32873             var filesSpecs = toPropValue(getSpecsFromRaw("files"));
32874             if (filesSpecs) {
32875                 var hasZeroOrNoReferences = referencesOfRaw === "no-prop" || ts.isArray(referencesOfRaw) && referencesOfRaw.length === 0;
32876                 var hasExtends = ts.hasProperty(raw, "extends");
32877                 if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) {
32878                     if (sourceFile) {
32879                         var fileName = configFileName || "tsconfig.json";
32880                         var diagnosticMessage = ts.Diagnostics.The_files_list_in_config_file_0_is_empty;
32881                         var nodeValue = ts.firstDefined(ts.getTsConfigPropArray(sourceFile, "files"), function (property) { return property.initializer; });
32882                         var error = nodeValue
32883                             ? ts.createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName)
32884                             : ts.createCompilerDiagnostic(diagnosticMessage, fileName);
32885                         errors.push(error);
32886                     }
32887                     else {
32888                         createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
32889                     }
32890                 }
32891             }
32892             var includeSpecs = toPropValue(getSpecsFromRaw("include"));
32893             var excludeOfRaw = getSpecsFromRaw("exclude");
32894             var excludeSpecs = toPropValue(excludeOfRaw);
32895             if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
32896                 var outDir = raw.compilerOptions.outDir;
32897                 var declarationDir = raw.compilerOptions.declarationDir;
32898                 if (outDir || declarationDir) {
32899                     excludeSpecs = [outDir, declarationDir].filter(function (d) { return !!d; });
32900                 }
32901             }
32902             if (filesSpecs === undefined && includeSpecs === undefined) {
32903                 includeSpecs = ["**/*"];
32904             }
32905             var validatedIncludeSpecs, validatedExcludeSpecs;
32906             if (includeSpecs) {
32907                 validatedIncludeSpecs = validateSpecs(includeSpecs, errors, true, sourceFile, "include");
32908             }
32909             if (excludeSpecs) {
32910                 validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, false, sourceFile, "exclude");
32911             }
32912             return {
32913                 filesSpecs: filesSpecs,
32914                 includeSpecs: includeSpecs,
32915                 excludeSpecs: excludeSpecs,
32916                 validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
32917                 validatedIncludeSpecs: validatedIncludeSpecs,
32918                 validatedExcludeSpecs: validatedExcludeSpecs,
32919                 pathPatterns: undefined,
32920             };
32921         }
32922         function getFileNames(basePath) {
32923             var fileNames = getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions);
32924             if (shouldReportNoInputFiles(fileNames, canJsonReportNoInputFiles(raw), resolutionStack)) {
32925                 errors.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
32926             }
32927             return fileNames;
32928         }
32929         function getProjectReferences(basePath) {
32930             var projectReferences;
32931             var referencesOfRaw = getPropFromRaw("references", function (element) { return typeof element === "object"; }, "object");
32932             if (ts.isArray(referencesOfRaw)) {
32933                 for (var _i = 0, referencesOfRaw_1 = referencesOfRaw; _i < referencesOfRaw_1.length; _i++) {
32934                     var ref = referencesOfRaw_1[_i];
32935                     if (typeof ref.path !== "string") {
32936                         createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string");
32937                     }
32938                     else {
32939                         (projectReferences || (projectReferences = [])).push({
32940                             path: ts.getNormalizedAbsolutePath(ref.path, basePath),
32941                             originalPath: ref.path,
32942                             prepend: ref.prepend,
32943                             circular: ref.circular
32944                         });
32945                     }
32946                 }
32947             }
32948             return projectReferences;
32949         }
32950         function toPropValue(specResult) {
32951             return ts.isArray(specResult) ? specResult : undefined;
32952         }
32953         function getSpecsFromRaw(prop) {
32954             return getPropFromRaw(prop, ts.isString, "string");
32955         }
32956         function getPropFromRaw(prop, validateElement, elementTypeName) {
32957             if (ts.hasProperty(raw, prop) && !isNullOrUndefined(raw[prop])) {
32958                 if (ts.isArray(raw[prop])) {
32959                     var result = raw[prop];
32960                     if (!sourceFile && !ts.every(result, validateElement)) {
32961                         errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, elementTypeName));
32962                     }
32963                     return result;
32964                 }
32965                 else {
32966                     createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, "Array");
32967                     return "not-array";
32968                 }
32969             }
32970             return "no-prop";
32971         }
32972         function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
32973             if (!sourceFile) {
32974                 errors.push(ts.createCompilerDiagnostic(message, arg0, arg1));
32975             }
32976         }
32977     }
32978     function isErrorNoInputFiles(error) {
32979         return error.code === ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
32980     }
32981     function getErrorForNoInputFiles(_a, configFileName) {
32982         var includeSpecs = _a.includeSpecs, excludeSpecs = _a.excludeSpecs;
32983         return 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 || []));
32984     }
32985     function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) {
32986         return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
32987     }
32988     function canJsonReportNoInputFiles(raw) {
32989         return !ts.hasProperty(raw, "files") && !ts.hasProperty(raw, "references");
32990     }
32991     ts.canJsonReportNoInputFiles = canJsonReportNoInputFiles;
32992     function updateErrorForNoInputFiles(fileNames, configFileName, configFileSpecs, configParseDiagnostics, canJsonReportNoInutFiles) {
32993         var existingErrors = configParseDiagnostics.length;
32994         if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) {
32995             configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName));
32996         }
32997         else {
32998             ts.filterMutate(configParseDiagnostics, function (error) { return !isErrorNoInputFiles(error); });
32999         }
33000         return existingErrors !== configParseDiagnostics.length;
33001     }
33002     ts.updateErrorForNoInputFiles = updateErrorForNoInputFiles;
33003     function isSuccessfulParsedTsconfig(value) {
33004         return !!value.options;
33005     }
33006     function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
33007         var _a;
33008         basePath = ts.normalizeSlashes(basePath);
33009         var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
33010         if (resolutionStack.indexOf(resolvedPath) >= 0) {
33011             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, __spreadArray(__spreadArray([], resolutionStack, true), [resolvedPath], false).join(" -> ")));
33012             return { raw: json || convertToObject(sourceFile, errors) };
33013         }
33014         var ownConfig = json ?
33015             parseOwnConfigOfJson(json, host, basePath, configFileName, errors) :
33016             parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors);
33017         if ((_a = ownConfig.options) === null || _a === void 0 ? void 0 : _a.paths) {
33018             ownConfig.options.pathsBasePath = basePath;
33019         }
33020         if (ownConfig.extendedConfigPath) {
33021             resolutionStack = resolutionStack.concat([resolvedPath]);
33022             var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, resolutionStack, errors, extendedConfigCache);
33023             if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
33024                 var baseRaw_1 = extendedConfig.raw;
33025                 var raw_1 = ownConfig.raw;
33026                 var relativeDifference_1;
33027                 var setPropertyInRawIfNotUndefined = function (propertyName) {
33028                     if (!raw_1[propertyName] && baseRaw_1[propertyName]) {
33029                         raw_1[propertyName] = ts.map(baseRaw_1[propertyName], function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1 || (relativeDifference_1 = ts.convertToRelativePath(ts.getDirectoryPath(ownConfig.extendedConfigPath), basePath, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames))), path); });
33030                     }
33031                 };
33032                 setPropertyInRawIfNotUndefined("include");
33033                 setPropertyInRawIfNotUndefined("exclude");
33034                 setPropertyInRawIfNotUndefined("files");
33035                 if (raw_1.compileOnSave === undefined) {
33036                     raw_1.compileOnSave = baseRaw_1.compileOnSave;
33037                 }
33038                 ownConfig.options = ts.assign({}, extendedConfig.options, ownConfig.options);
33039                 ownConfig.watchOptions = ownConfig.watchOptions && extendedConfig.watchOptions ?
33040                     ts.assign({}, extendedConfig.watchOptions, ownConfig.watchOptions) :
33041                     ownConfig.watchOptions || extendedConfig.watchOptions;
33042             }
33043         }
33044         return ownConfig;
33045     }
33046     function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
33047         if (ts.hasProperty(json, "excludes")) {
33048             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
33049         }
33050         var options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors, configFileName);
33051         var typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors, configFileName);
33052         var watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
33053         json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
33054         var extendedConfigPath;
33055         if (json.extends) {
33056             if (!ts.isString(json.extends)) {
33057                 errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string"));
33058             }
33059             else {
33060                 var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
33061                 extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, ts.createCompilerDiagnostic);
33062             }
33063         }
33064         return { raw: json, options: options, watchOptions: watchOptions, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath };
33065     }
33066     function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
33067         var options = getDefaultCompilerOptions(configFileName);
33068         var typeAcquisition, typingOptionstypeAcquisition;
33069         var watchOptions;
33070         var extendedConfigPath;
33071         var rootCompilerOptions;
33072         var optionsIterator = {
33073             onSetValidOptionKeyValueInParent: function (parentOption, option, value) {
33074                 var currentOption;
33075                 switch (parentOption) {
33076                     case "compilerOptions":
33077                         currentOption = options;
33078                         break;
33079                     case "watchOptions":
33080                         currentOption = (watchOptions || (watchOptions = {}));
33081                         break;
33082                     case "typeAcquisition":
33083                         currentOption = (typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)));
33084                         break;
33085                     case "typingOptions":
33086                         currentOption = (typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName)));
33087                         break;
33088                     default:
33089                         ts.Debug.fail("Unknown option");
33090                 }
33091                 currentOption[option.name] = normalizeOptionValue(option, basePath, value);
33092             },
33093             onSetValidOptionKeyValueInRoot: function (key, _keyNode, value, valueNode) {
33094                 switch (key) {
33095                     case "extends":
33096                         var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
33097                         extendedConfigPath = getExtendsConfigPath(value, host, newBase, errors, function (message, arg0) {
33098                             return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0);
33099                         });
33100                         return;
33101                 }
33102             },
33103             onSetUnknownOptionKeyValueInRoot: function (key, keyNode, _value, _valueNode) {
33104                 if (key === "excludes") {
33105                     errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, keyNode, ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
33106                 }
33107                 if (ts.find(commandOptionsWithoutBuild, function (opt) { return opt.name === key; })) {
33108                     rootCompilerOptions = ts.append(rootCompilerOptions, keyNode);
33109                 }
33110             }
33111         };
33112         var json = convertConfigFileToObject(sourceFile, errors, true, optionsIterator);
33113         if (!typeAcquisition) {
33114             if (typingOptionstypeAcquisition) {
33115                 typeAcquisition = (typingOptionstypeAcquisition.enableAutoDiscovery !== undefined) ?
33116                     {
33117                         enable: typingOptionstypeAcquisition.enableAutoDiscovery,
33118                         include: typingOptionstypeAcquisition.include,
33119                         exclude: typingOptionstypeAcquisition.exclude
33120                     } :
33121                     typingOptionstypeAcquisition;
33122             }
33123             else {
33124                 typeAcquisition = getDefaultTypeAcquisition(configFileName);
33125             }
33126         }
33127         if (rootCompilerOptions && json && json.compilerOptions === undefined) {
33128             errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], ts.Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, ts.getTextOfPropertyName(rootCompilerOptions[0])));
33129         }
33130         return { raw: json, options: options, watchOptions: watchOptions, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath };
33131     }
33132     function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
33133         extendedConfig = ts.normalizeSlashes(extendedConfig);
33134         if (ts.isRootedDiskPath(extendedConfig) || ts.startsWith(extendedConfig, "./") || ts.startsWith(extendedConfig, "../")) {
33135             var extendedConfigPath = ts.getNormalizedAbsolutePath(extendedConfig, basePath);
33136             if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) {
33137                 extendedConfigPath = "".concat(extendedConfigPath, ".json");
33138                 if (!host.fileExists(extendedConfigPath)) {
33139                     errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
33140                     return undefined;
33141                 }
33142             }
33143             return extendedConfigPath;
33144         }
33145         var resolved = ts.nodeModuleNameResolver(extendedConfig, ts.combinePaths(basePath, "tsconfig.json"), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, undefined, undefined, true);
33146         if (resolved.resolvedModule) {
33147             return resolved.resolvedModule.resolvedFileName;
33148         }
33149         errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
33150         return undefined;
33151     }
33152     function getExtendedConfig(sourceFile, extendedConfigPath, host, resolutionStack, errors, extendedConfigCache) {
33153         var _a;
33154         var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toFileNameLowerCase(extendedConfigPath);
33155         var value;
33156         var extendedResult;
33157         var extendedConfig;
33158         if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
33159             (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
33160         }
33161         else {
33162             extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
33163             if (!extendedResult.parseDiagnostics.length) {
33164                 extendedConfig = parseConfig(undefined, extendedResult, host, ts.getDirectoryPath(extendedConfigPath), ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
33165             }
33166             if (extendedConfigCache) {
33167                 extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
33168             }
33169         }
33170         if (sourceFile) {
33171             sourceFile.extendedSourceFiles = [extendedResult.fileName];
33172             if (extendedResult.extendedSourceFiles) {
33173                 (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
33174             }
33175         }
33176         if (extendedResult.parseDiagnostics.length) {
33177             errors.push.apply(errors, extendedResult.parseDiagnostics);
33178             return undefined;
33179         }
33180         return extendedConfig;
33181     }
33182     function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
33183         if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) {
33184             return false;
33185         }
33186         var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption.compileOnSave, basePath, errors);
33187         return typeof result === "boolean" && result;
33188     }
33189     function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) {
33190         var errors = [];
33191         var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName);
33192         return { options: options, errors: errors };
33193     }
33194     ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
33195     function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) {
33196         var errors = [];
33197         var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
33198         return { options: options, errors: errors };
33199     }
33200     ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson;
33201     function getDefaultCompilerOptions(configFileName) {
33202         var options = configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json"
33203             ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true, noEmit: true }
33204             : {};
33205         return options;
33206     }
33207     function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
33208         var options = getDefaultCompilerOptions(configFileName);
33209         convertOptionsFromJson(getCommandLineCompilerOptionsMap(), jsonOptions, basePath, options, ts.compilerOptionsDidYouMeanDiagnostics, errors);
33210         if (configFileName) {
33211             options.configFilePath = ts.normalizeSlashes(configFileName);
33212         }
33213         return options;
33214     }
33215     function getDefaultTypeAcquisition(configFileName) {
33216         return { enable: !!configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
33217     }
33218     function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
33219         var options = getDefaultTypeAcquisition(configFileName);
33220         var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
33221         convertOptionsFromJson(getCommandLineTypeAcquisitionMap(), typeAcquisition, basePath, options, typeAcquisitionDidYouMeanDiagnostics, errors);
33222         return options;
33223     }
33224     function convertWatchOptionsFromJsonWorker(jsonOptions, basePath, errors) {
33225         return convertOptionsFromJson(getCommandLineWatchOptionsMap(), jsonOptions, basePath, undefined, watchOptionsDidYouMeanDiagnostics, errors);
33226     }
33227     function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOptions, diagnostics, errors) {
33228         if (!jsonOptions) {
33229             return;
33230         }
33231         for (var id in jsonOptions) {
33232             var opt = optionsNameMap.get(id);
33233             if (opt) {
33234                 (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
33235             }
33236             else {
33237                 errors.push(createUnknownOptionError(id, diagnostics, ts.createCompilerDiagnostic));
33238             }
33239         }
33240         return defaultOptions;
33241     }
33242     function convertJsonOption(opt, value, basePath, errors) {
33243         if (isCompilerOptionsValue(opt, value)) {
33244             var optType = opt.type;
33245             if (optType === "list" && ts.isArray(value)) {
33246                 return convertJsonOptionOfListType(opt, value, basePath, errors);
33247             }
33248             else if (!ts.isString(optType)) {
33249                 return convertJsonOptionOfCustomType(opt, value, errors);
33250             }
33251             var validatedValue = validateJsonOptionValue(opt, value, errors);
33252             return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
33253         }
33254         else {
33255             errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
33256         }
33257     }
33258     ts.convertJsonOption = convertJsonOption;
33259     function normalizeOptionValue(option, basePath, value) {
33260         if (isNullOrUndefined(value))
33261             return undefined;
33262         if (option.type === "list") {
33263             var listOption_1 = option;
33264             if (listOption_1.element.isFilePath || !ts.isString(listOption_1.element.type)) {
33265                 return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return !!v; });
33266             }
33267             return value;
33268         }
33269         else if (!ts.isString(option.type)) {
33270             return option.type.get(ts.isString(value) ? value.toLowerCase() : value);
33271         }
33272         return normalizeNonListOptionValue(option, basePath, value);
33273     }
33274     function normalizeNonListOptionValue(option, basePath, value) {
33275         if (option.isFilePath) {
33276             value = ts.getNormalizedAbsolutePath(value, basePath);
33277             if (value === "") {
33278                 value = ".";
33279             }
33280         }
33281         return value;
33282     }
33283     function validateJsonOptionValue(opt, value, errors) {
33284         var _a;
33285         if (isNullOrUndefined(value))
33286             return undefined;
33287         var d = (_a = opt.extraValidation) === null || _a === void 0 ? void 0 : _a.call(opt, value);
33288         if (!d)
33289             return value;
33290         errors.push(ts.createCompilerDiagnostic.apply(void 0, d));
33291         return undefined;
33292     }
33293     function convertJsonOptionOfCustomType(opt, value, errors) {
33294         if (isNullOrUndefined(value))
33295             return undefined;
33296         var key = value.toLowerCase();
33297         var val = opt.type.get(key);
33298         if (val !== undefined) {
33299             return validateJsonOptionValue(opt, val, errors);
33300         }
33301         else {
33302             errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
33303         }
33304     }
33305     function convertJsonOptionOfListType(option, values, basePath, errors) {
33306         return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; });
33307     }
33308     var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
33309     var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
33310     function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions) {
33311         if (extraFileExtensions === void 0) { extraFileExtensions = ts.emptyArray; }
33312         basePath = ts.normalizePath(basePath);
33313         var keyMapper = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
33314         var literalFileMap = new ts.Map();
33315         var wildcardFileMap = new ts.Map();
33316         var wildCardJsonFileMap = new ts.Map();
33317         var validatedFilesSpec = configFileSpecs.validatedFilesSpec, validatedIncludeSpecs = configFileSpecs.validatedIncludeSpecs, validatedExcludeSpecs = configFileSpecs.validatedExcludeSpecs;
33318         var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
33319         var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
33320         if (validatedFilesSpec) {
33321             for (var _i = 0, validatedFilesSpec_1 = validatedFilesSpec; _i < validatedFilesSpec_1.length; _i++) {
33322                 var fileName = validatedFilesSpec_1[_i];
33323                 var file = ts.getNormalizedAbsolutePath(fileName, basePath);
33324                 literalFileMap.set(keyMapper(file), file);
33325             }
33326         }
33327         var jsonOnlyIncludeRegexes;
33328         if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
33329             var _loop_6 = function (file) {
33330                 if (ts.fileExtensionIs(file, ".json")) {
33331                     if (!jsonOnlyIncludeRegexes) {
33332                         var includes = validatedIncludeSpecs.filter(function (s) { return ts.endsWith(s, ".json"); });
33333                         var includeFilePatterns = ts.map(ts.getRegularExpressionsForWildcards(includes, basePath, "files"), function (pattern) { return "^".concat(pattern, "$"); });
33334                         jsonOnlyIncludeRegexes = includeFilePatterns ? includeFilePatterns.map(function (pattern) { return ts.getRegexFromPattern(pattern, host.useCaseSensitiveFileNames); }) : ts.emptyArray;
33335                     }
33336                     var includeIndex = ts.findIndex(jsonOnlyIncludeRegexes, function (re) { return re.test(file); });
33337                     if (includeIndex !== -1) {
33338                         var key_1 = keyMapper(file);
33339                         if (!literalFileMap.has(key_1) && !wildCardJsonFileMap.has(key_1)) {
33340                             wildCardJsonFileMap.set(key_1, file);
33341                         }
33342                     }
33343                     return "continue";
33344                 }
33345                 if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) {
33346                     return "continue";
33347                 }
33348                 removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper);
33349                 var key = keyMapper(file);
33350                 if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) {
33351                     wildcardFileMap.set(key, file);
33352                 }
33353             };
33354             for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, undefined); _a < _b.length; _a++) {
33355                 var file = _b[_a];
33356                 _loop_6(file);
33357             }
33358         }
33359         var literalFiles = ts.arrayFrom(literalFileMap.values());
33360         var wildcardFiles = ts.arrayFrom(wildcardFileMap.values());
33361         return literalFiles.concat(wildcardFiles, ts.arrayFrom(wildCardJsonFileMap.values()));
33362     }
33363     ts.getFileNamesFromConfigSpecs = getFileNamesFromConfigSpecs;
33364     function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames, currentDirectory) {
33365         var validatedFilesSpec = spec.validatedFilesSpec, validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs;
33366         if (!ts.length(validatedIncludeSpecs) || !ts.length(validatedExcludeSpecs))
33367             return false;
33368         basePath = ts.normalizePath(basePath);
33369         var keyMapper = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
33370         if (validatedFilesSpec) {
33371             for (var _i = 0, validatedFilesSpec_2 = validatedFilesSpec; _i < validatedFilesSpec_2.length; _i++) {
33372                 var fileName = validatedFilesSpec_2[_i];
33373                 if (keyMapper(ts.getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck)
33374                     return false;
33375             }
33376         }
33377         return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath);
33378     }
33379     ts.isExcludedFile = isExcludedFile;
33380     function invalidDotDotAfterRecursiveWildcard(s) {
33381         var wildcardIndex = ts.startsWith(s, "**/") ? 0 : s.indexOf("/**/");
33382         if (wildcardIndex === -1) {
33383             return false;
33384         }
33385         var lastDotIndex = ts.endsWith(s, "/..") ? s.length : s.lastIndexOf("/../");
33386         return lastDotIndex > wildcardIndex;
33387     }
33388     function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) {
33389         return matchesExcludeWorker(pathToCheck, ts.filter(excludeSpecs, function (spec) { return !invalidDotDotAfterRecursiveWildcard(spec); }), useCaseSensitiveFileNames, currentDirectory);
33390     }
33391     ts.matchesExclude = matchesExclude;
33392     function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath) {
33393         var excludePattern = ts.getRegularExpressionForWildcard(excludeSpecs, ts.combinePaths(ts.normalizePath(currentDirectory), basePath), "exclude");
33394         var excludeRegex = excludePattern && ts.getRegexFromPattern(excludePattern, useCaseSensitiveFileNames);
33395         if (!excludeRegex)
33396             return false;
33397         if (excludeRegex.test(pathToCheck))
33398             return true;
33399         return !ts.hasExtension(pathToCheck) && excludeRegex.test(ts.ensureTrailingDirectorySeparator(pathToCheck));
33400     }
33401     function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile, specKey) {
33402         return specs.filter(function (spec) {
33403             if (!ts.isString(spec))
33404                 return false;
33405             var diag = specToDiagnostic(spec, disallowTrailingRecursion);
33406             if (diag !== undefined) {
33407                 errors.push(createDiagnostic.apply(void 0, diag));
33408             }
33409             return diag === undefined;
33410         });
33411         function createDiagnostic(message, spec) {
33412             var element = ts.getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
33413             return element ?
33414                 ts.createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) :
33415                 ts.createCompilerDiagnostic(message, spec);
33416         }
33417     }
33418     function specToDiagnostic(spec, disallowTrailingRecursion) {
33419         if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
33420             return [ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
33421         }
33422         else if (invalidDotDotAfterRecursiveWildcard(spec)) {
33423             return [ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
33424         }
33425     }
33426     function getWildcardDirectories(_a, path, useCaseSensitiveFileNames) {
33427         var include = _a.validatedIncludeSpecs, exclude = _a.validatedExcludeSpecs;
33428         var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude");
33429         var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
33430         var wildcardDirectories = {};
33431         if (include !== undefined) {
33432             var recursiveKeys = [];
33433             for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
33434                 var file = include_1[_i];
33435                 var spec = ts.normalizePath(ts.combinePaths(path, file));
33436                 if (excludeRegex && excludeRegex.test(spec)) {
33437                     continue;
33438                 }
33439                 var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);
33440                 if (match) {
33441                     var key = match.key, flags = match.flags;
33442                     var existingFlags = wildcardDirectories[key];
33443                     if (existingFlags === undefined || existingFlags < flags) {
33444                         wildcardDirectories[key] = flags;
33445                         if (flags === 1) {
33446                             recursiveKeys.push(key);
33447                         }
33448                     }
33449                 }
33450             }
33451             for (var key in wildcardDirectories) {
33452                 if (ts.hasProperty(wildcardDirectories, key)) {
33453                     for (var _b = 0, recursiveKeys_1 = recursiveKeys; _b < recursiveKeys_1.length; _b++) {
33454                         var recursiveKey = recursiveKeys_1[_b];
33455                         if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
33456                             delete wildcardDirectories[key];
33457                         }
33458                     }
33459                 }
33460             }
33461         }
33462         return wildcardDirectories;
33463     }
33464     function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {
33465         var match = wildcardDirectoryPattern.exec(spec);
33466         if (match) {
33467             var questionWildcardIndex = spec.indexOf("?");
33468             var starWildcardIndex = spec.indexOf("*");
33469             var lastDirectorySeperatorIndex = spec.lastIndexOf(ts.directorySeparator);
33470             return {
33471                 key: useCaseSensitiveFileNames ? match[0] : ts.toFileNameLowerCase(match[0]),
33472                 flags: (questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex)
33473                     || (starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex)
33474                     ? 1 : 0
33475             };
33476         }
33477         if (ts.isImplicitGlob(spec)) {
33478             return {
33479                 key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
33480                 flags: 1
33481             };
33482         }
33483         return undefined;
33484     }
33485     function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
33486         var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
33487         if (!extensionGroup) {
33488             return false;
33489         }
33490         for (var _i = 0, extensionGroup_1 = extensionGroup; _i < extensionGroup_1.length; _i++) {
33491             var ext = extensionGroup_1[_i];
33492             if (ts.fileExtensionIs(file, ext)) {
33493                 return false;
33494             }
33495             var higherPriorityPath = keyMapper(ts.changeExtension(file, ext));
33496             if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
33497                 if (ext === ".d.ts" && (ts.fileExtensionIs(file, ".js") || ts.fileExtensionIs(file, ".jsx"))) {
33498                     continue;
33499                 }
33500                 return true;
33501             }
33502         }
33503         return false;
33504     }
33505     function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
33506         var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
33507         if (!extensionGroup) {
33508             return;
33509         }
33510         for (var i = extensionGroup.length - 1; i >= 0; i--) {
33511             var ext = extensionGroup[i];
33512             if (ts.fileExtensionIs(file, ext)) {
33513                 return;
33514             }
33515             var lowerPriorityPath = keyMapper(ts.changeExtension(file, ext));
33516             wildcardFiles.delete(lowerPriorityPath);
33517         }
33518     }
33519     function convertCompilerOptionsForTelemetry(opts) {
33520         var out = {};
33521         for (var key in opts) {
33522             if (opts.hasOwnProperty(key)) {
33523                 var type = getOptionFromName(key);
33524                 if (type !== undefined) {
33525                     out[key] = getOptionValueWithEmptyStrings(opts[key], type);
33526                 }
33527             }
33528         }
33529         return out;
33530     }
33531     ts.convertCompilerOptionsForTelemetry = convertCompilerOptionsForTelemetry;
33532     function getOptionValueWithEmptyStrings(value, option) {
33533         switch (option.type) {
33534             case "object":
33535                 return "";
33536             case "string":
33537                 return "";
33538             case "number":
33539                 return typeof value === "number" ? value : "";
33540             case "boolean":
33541                 return typeof value === "boolean" ? value : "";
33542             case "list":
33543                 var elementType_1 = option.element;
33544                 return ts.isArray(value) ? value.map(function (v) { return getOptionValueWithEmptyStrings(v, elementType_1); }) : "";
33545             default:
33546                 return ts.forEachEntry(option.type, function (optionEnumValue, optionStringValue) {
33547                     if (optionEnumValue === value) {
33548                         return optionStringValue;
33549                     }
33550                 });
33551         }
33552     }
33553     function getDefaultValueForOption(option) {
33554         switch (option.type) {
33555             case "number":
33556                 return 1;
33557             case "boolean":
33558                 return true;
33559             case "string":
33560                 return option.isFilePath ? "./" : "";
33561             case "list":
33562                 return [];
33563             case "object":
33564                 return {};
33565             default:
33566                 var iterResult = option.type.keys().next();
33567                 if (!iterResult.done)
33568                     return iterResult.value;
33569                 return ts.Debug.fail("Expected 'option.type' to have entries.");
33570         }
33571     }
33572 })(ts || (ts = {}));
33573 var ts;
33574 (function (ts) {
33575     function trace(host) {
33576         host.trace(ts.formatMessage.apply(undefined, arguments));
33577     }
33578     ts.trace = trace;
33579     function isTraceEnabled(compilerOptions, host) {
33580         return !!compilerOptions.traceResolution && host.trace !== undefined;
33581     }
33582     ts.isTraceEnabled = isTraceEnabled;
33583     function withPackageId(packageInfo, r) {
33584         var packageId;
33585         if (r && packageInfo) {
33586             var packageJsonContent = packageInfo.packageJsonContent;
33587             if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
33588                 packageId = {
33589                     name: packageJsonContent.name,
33590                     subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
33591                     version: packageJsonContent.version
33592                 };
33593             }
33594         }
33595         return r && { path: r.path, extension: r.ext, packageId: packageId };
33596     }
33597     function noPackageId(r) {
33598         return withPackageId(undefined, r);
33599     }
33600     function removeIgnoredPackageId(r) {
33601         if (r) {
33602             ts.Debug.assert(r.packageId === undefined);
33603             return { path: r.path, ext: r.extension };
33604         }
33605     }
33606     var Extensions;
33607     (function (Extensions) {
33608         Extensions[Extensions["TypeScript"] = 0] = "TypeScript";
33609         Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
33610         Extensions[Extensions["Json"] = 2] = "Json";
33611         Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
33612         Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
33613     })(Extensions || (Extensions = {}));
33614     function resolvedTypeScriptOnly(resolved) {
33615         if (!resolved) {
33616             return undefined;
33617         }
33618         ts.Debug.assert(ts.extensionIsTS(resolved.extension));
33619         return { fileName: resolved.path, packageId: resolved.packageId };
33620     }
33621     function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
33622         var _a;
33623         if (resultFromCache) {
33624             (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
33625             return resultFromCache;
33626         }
33627         return {
33628             resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
33629             failedLookupLocations: failedLookupLocations
33630         };
33631     }
33632     function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
33633         if (!ts.hasProperty(jsonContent, fieldName)) {
33634             if (state.traceEnabled) {
33635                 trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName);
33636             }
33637             return;
33638         }
33639         var value = jsonContent[fieldName];
33640         if (typeof value !== typeOfTag || value === null) {
33641             if (state.traceEnabled) {
33642                 trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2, fieldName, typeOfTag, value === null ? "null" : typeof value);
33643             }
33644             return;
33645         }
33646         return value;
33647     }
33648     function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
33649         var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
33650         if (fileName === undefined) {
33651             return;
33652         }
33653         if (!fileName) {
33654             if (state.traceEnabled) {
33655                 trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
33656             }
33657             return;
33658         }
33659         var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
33660         if (state.traceEnabled) {
33661             trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
33662         }
33663         return path;
33664     }
33665     function readPackageJsonTypesFields(jsonContent, baseDirectory, state) {
33666         return readPackageJsonPathField(jsonContent, "typings", baseDirectory, state)
33667             || readPackageJsonPathField(jsonContent, "types", baseDirectory, state);
33668     }
33669     function readPackageJsonTSConfigField(jsonContent, baseDirectory, state) {
33670         return readPackageJsonPathField(jsonContent, "tsconfig", baseDirectory, state);
33671     }
33672     function readPackageJsonMainField(jsonContent, baseDirectory, state) {
33673         return readPackageJsonPathField(jsonContent, "main", baseDirectory, state);
33674     }
33675     function readPackageJsonTypesVersionsField(jsonContent, state) {
33676         var typesVersions = readPackageJsonField(jsonContent, "typesVersions", "object", state);
33677         if (typesVersions === undefined)
33678             return;
33679         if (state.traceEnabled) {
33680             trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_field_with_version_specific_path_mappings);
33681         }
33682         return typesVersions;
33683     }
33684     function readPackageJsonTypesVersionPaths(jsonContent, state) {
33685         var typesVersions = readPackageJsonTypesVersionsField(jsonContent, state);
33686         if (typesVersions === undefined)
33687             return;
33688         if (state.traceEnabled) {
33689             for (var key in typesVersions) {
33690                 if (ts.hasProperty(typesVersions, key) && !ts.VersionRange.tryParse(key)) {
33691                     trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_is_not_a_valid_semver_range, key);
33692                 }
33693             }
33694         }
33695         var result = getPackageJsonTypesVersionsPaths(typesVersions);
33696         if (!result) {
33697             if (state.traceEnabled) {
33698                 trace(state.host, ts.Diagnostics.package_json_does_not_have_a_typesVersions_entry_that_matches_version_0, ts.versionMajorMinor);
33699             }
33700             return;
33701         }
33702         var bestVersionKey = result.version, bestVersionPaths = result.paths;
33703         if (typeof bestVersionPaths !== "object") {
33704             if (state.traceEnabled) {
33705                 trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2, "typesVersions['".concat(bestVersionKey, "']"), "object", typeof bestVersionPaths);
33706             }
33707             return;
33708         }
33709         return result;
33710     }
33711     var typeScriptVersion;
33712     function getPackageJsonTypesVersionsPaths(typesVersions) {
33713         if (!typeScriptVersion)
33714             typeScriptVersion = new ts.Version(ts.version);
33715         for (var key in typesVersions) {
33716             if (!ts.hasProperty(typesVersions, key))
33717                 continue;
33718             var keyRange = ts.VersionRange.tryParse(key);
33719             if (keyRange === undefined) {
33720                 continue;
33721             }
33722             if (keyRange.test(typeScriptVersion)) {
33723                 return { version: key, paths: typesVersions[key] };
33724             }
33725         }
33726     }
33727     ts.getPackageJsonTypesVersionsPaths = getPackageJsonTypesVersionsPaths;
33728     function getEffectiveTypeRoots(options, host) {
33729         if (options.typeRoots) {
33730             return options.typeRoots;
33731         }
33732         var currentDirectory;
33733         if (options.configFilePath) {
33734             currentDirectory = ts.getDirectoryPath(options.configFilePath);
33735         }
33736         else if (host.getCurrentDirectory) {
33737             currentDirectory = host.getCurrentDirectory();
33738         }
33739         if (currentDirectory !== undefined) {
33740             return getDefaultTypeRoots(currentDirectory, host);
33741         }
33742     }
33743     ts.getEffectiveTypeRoots = getEffectiveTypeRoots;
33744     function getDefaultTypeRoots(currentDirectory, host) {
33745         if (!host.directoryExists) {
33746             return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
33747         }
33748         var typeRoots;
33749         ts.forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) {
33750             var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);
33751             if (host.directoryExists(atTypes)) {
33752                 (typeRoots || (typeRoots = [])).push(atTypes);
33753             }
33754             return undefined;
33755         });
33756         return typeRoots;
33757     }
33758     var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
33759     function arePathsEqual(path1, path2, host) {
33760         var useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
33761         return ts.comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0;
33762     }
33763     function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache) {
33764         var traceEnabled = isTraceEnabled(options, host);
33765         if (redirectedReference) {
33766             options = redirectedReference.commandLine.options;
33767         }
33768         var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
33769         var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
33770         var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, undefined);
33771         if (result) {
33772             if (traceEnabled) {
33773                 trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
33774                 if (redirectedReference)
33775                     trace(host, ts.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName);
33776                 trace(host, ts.Diagnostics.Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1, typeReferenceDirectiveName, containingDirectory);
33777                 traceResult(result);
33778             }
33779             return result;
33780         }
33781         var typeRoots = getEffectiveTypeRoots(options, host);
33782         if (traceEnabled) {
33783             if (containingFile === undefined) {
33784                 if (typeRoots === undefined) {
33785                     trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName);
33786                 }
33787                 else {
33788                     trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots);
33789                 }
33790             }
33791             else {
33792                 if (typeRoots === undefined) {
33793                     trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile);
33794                 }
33795                 else {
33796                     trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots);
33797                 }
33798             }
33799             if (redirectedReference) {
33800                 trace(host, ts.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName);
33801             }
33802         }
33803         var failedLookupLocations = [];
33804         var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.AllFeatures, conditions: ["node", "require", "types"] };
33805         var resolved = primaryLookup();
33806         var primary = true;
33807         if (!resolved) {
33808             resolved = secondaryLookup();
33809             primary = false;
33810         }
33811         var resolvedTypeReferenceDirective;
33812         if (resolved) {
33813             var fileName = resolved.fileName, packageId = resolved.packageId;
33814             var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
33815             resolvedTypeReferenceDirective = {
33816                 primary: primary,
33817                 resolvedFileName: resolvedFileName,
33818                 originalPath: arePathsEqual(fileName, resolvedFileName, host) ? undefined : fileName,
33819                 packageId: packageId,
33820                 isExternalLibraryImport: pathContainsNodeModules(fileName),
33821             };
33822         }
33823         result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
33824         perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, undefined, result);
33825         if (traceEnabled)
33826             traceResult(result);
33827         return result;
33828         function traceResult(result) {
33829             var _a;
33830             if (!((_a = result.resolvedTypeReferenceDirective) === null || _a === void 0 ? void 0 : _a.resolvedFileName)) {
33831                 trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
33832             }
33833             else if (result.resolvedTypeReferenceDirective.packageId) {
33834                 trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, ts.packageIdToString(result.resolvedTypeReferenceDirective.packageId), result.resolvedTypeReferenceDirective.primary);
33835             }
33836             else {
33837                 trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
33838             }
33839         }
33840         function primaryLookup() {
33841             if (typeRoots && typeRoots.length) {
33842                 if (traceEnabled) {
33843                     trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
33844                 }
33845                 return ts.firstDefined(typeRoots, function (typeRoot) {
33846                     var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName);
33847                     var candidateDirectory = ts.getDirectoryPath(candidate);
33848                     var directoryExists = ts.directoryProbablyExists(candidateDirectory, host);
33849                     if (!directoryExists && traceEnabled) {
33850                         trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory);
33851                     }
33852                     return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, !directoryExists, moduleResolutionState));
33853                 });
33854             }
33855             else {
33856                 if (traceEnabled) {
33857                     trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths);
33858                 }
33859             }
33860         }
33861         function secondaryLookup() {
33862             var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);
33863             if (initialLocationForSecondaryLookup !== undefined) {
33864                 if (traceEnabled) {
33865                     trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
33866                 }
33867                 var result_4;
33868                 if (!ts.isExternalModuleNameRelative(typeReferenceDirectiveName)) {
33869                     var searchResult = loadModuleFromNearestNodeModulesDirectory(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, moduleResolutionState, undefined, undefined);
33870                     result_4 = searchResult && searchResult.value;
33871                 }
33872                 else {
33873                     var candidate = ts.normalizePathAndParts(ts.combinePaths(initialLocationForSecondaryLookup, typeReferenceDirectiveName)).path;
33874                     result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, false, moduleResolutionState, true);
33875                 }
33876                 return resolvedTypeScriptOnly(result_4);
33877             }
33878             else {
33879                 if (traceEnabled) {
33880                     trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);
33881                 }
33882             }
33883         }
33884     }
33885     ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
33886     function getAutomaticTypeDirectiveNames(options, host) {
33887         if (options.types) {
33888             return options.types;
33889         }
33890         var result = [];
33891         if (host.directoryExists && host.getDirectories) {
33892             var typeRoots = getEffectiveTypeRoots(options, host);
33893             if (typeRoots) {
33894                 for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
33895                     var root = typeRoots_1[_i];
33896                     if (host.directoryExists(root)) {
33897                         for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) {
33898                             var typeDirectivePath = _b[_a];
33899                             var normalized = ts.normalizePath(typeDirectivePath);
33900                             var packageJsonPath = ts.combinePaths(root, normalized, "package.json");
33901                             var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJson(packageJsonPath, host).typings === null;
33902                             if (!isNotNeededPackage) {
33903                                 var baseFileName = ts.getBaseFileName(normalized);
33904                                 if (baseFileName.charCodeAt(0) !== 46) {
33905                                     result.push(baseFileName);
33906                                 }
33907                             }
33908                         }
33909                     }
33910                 }
33911             }
33912         }
33913         return result;
33914     }
33915     ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
33916     function createCacheWithRedirects(options) {
33917         var ownMap = new ts.Map();
33918         var redirectsMap = new ts.Map();
33919         return {
33920             getOwnMap: getOwnMap,
33921             redirectsMap: redirectsMap,
33922             getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
33923             clear: clear,
33924             setOwnOptions: setOwnOptions,
33925             setOwnMap: setOwnMap
33926         };
33927         function getOwnMap() {
33928             return ownMap;
33929         }
33930         function setOwnOptions(newOptions) {
33931             options = newOptions;
33932         }
33933         function setOwnMap(newOwnMap) {
33934             ownMap = newOwnMap;
33935         }
33936         function getOrCreateMapOfCacheRedirects(redirectedReference) {
33937             if (!redirectedReference) {
33938                 return ownMap;
33939             }
33940             var path = redirectedReference.sourceFile.path;
33941             var redirects = redirectsMap.get(path);
33942             if (!redirects) {
33943                 redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts.Map() : ownMap;
33944                 redirectsMap.set(path, redirects);
33945             }
33946             return redirects;
33947         }
33948         function clear() {
33949             ownMap.clear();
33950             redirectsMap.clear();
33951         }
33952     }
33953     ts.createCacheWithRedirects = createCacheWithRedirects;
33954     function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
33955         var cache;
33956         return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
33957         function getPackageJsonInfo(packageJsonPath) {
33958             return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
33959         }
33960         function setPackageJsonInfo(packageJsonPath, info) {
33961             (cache || (cache = new ts.Map())).set(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
33962         }
33963         function clear() {
33964             cache = undefined;
33965         }
33966         function entries() {
33967             var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
33968             return iter ? ts.arrayFrom(iter) : [];
33969         }
33970     }
33971     function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
33972         var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
33973         var result = cache.get(key);
33974         if (!result) {
33975             result = create();
33976             cache.set(key, result);
33977         }
33978         return result;
33979     }
33980     function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
33981         if (!options.configFile)
33982             return;
33983         if (directoryToModuleNameMap.redirectsMap.size === 0) {
33984             ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
33985             ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
33986             ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
33987             directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
33988             moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
33989         }
33990         else {
33991             ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
33992             var ref = {
33993                 sourceFile: options.configFile,
33994                 commandLine: { options: options }
33995             };
33996             directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
33997             moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
33998         }
33999         directoryToModuleNameMap.setOwnOptions(options);
34000         moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
34001     }
34002     function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
34003         return {
34004             getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
34005             clear: clear,
34006             update: update,
34007         };
34008         function clear() {
34009             directoryToModuleNameMap.clear();
34010         }
34011         function update(options) {
34012             updateRedirectsMap(options, directoryToModuleNameMap);
34013         }
34014         function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
34015             var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
34016             return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
34017         }
34018     }
34019     function createModeAwareCache() {
34020         var underlying = new ts.Map();
34021         var memoizedReverseKeys = new ts.Map();
34022         var cache = {
34023             get: function (specifier, mode) {
34024                 return underlying.get(getUnderlyingCacheKey(specifier, mode));
34025             },
34026             set: function (specifier, mode, value) {
34027                 underlying.set(getUnderlyingCacheKey(specifier, mode), value);
34028                 return cache;
34029             },
34030             delete: function (specifier, mode) {
34031                 underlying.delete(getUnderlyingCacheKey(specifier, mode));
34032                 return cache;
34033             },
34034             has: function (specifier, mode) {
34035                 return underlying.has(getUnderlyingCacheKey(specifier, mode));
34036             },
34037             forEach: function (cb) {
34038                 return underlying.forEach(function (elem, key) {
34039                     var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
34040                     return cb(elem, specifier, mode);
34041                 });
34042             },
34043             size: function () {
34044                 return underlying.size;
34045             }
34046         };
34047         return cache;
34048         function getUnderlyingCacheKey(specifier, mode) {
34049             var result = mode === undefined ? specifier : "".concat(mode, "|").concat(specifier);
34050             memoizedReverseKeys.set(result, [specifier, mode]);
34051             return result;
34052         }
34053     }
34054     ts.createModeAwareCache = createModeAwareCache;
34055     function zipToModeAwareCache(file, keys, values) {
34056         ts.Debug.assert(keys.length === values.length);
34057         var map = createModeAwareCache();
34058         for (var i = 0; i < keys.length; ++i) {
34059             map.set(keys[i], ts.getModeForResolutionAtIndex(file, i), values[i]);
34060         }
34061         return map;
34062     }
34063     ts.zipToModeAwareCache = zipToModeAwareCache;
34064     function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
34065         var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
34066         moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
34067         var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
34068         return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
34069         function clear() {
34070             preDirectoryResolutionCache.clear();
34071             moduleNameToDirectoryMap.clear();
34072             packageJsonInfoCache.clear();
34073         }
34074         function update(options) {
34075             updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
34076         }
34077         function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
34078             ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
34079             return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : "".concat(mode, "|").concat(nonRelativeModuleName), createPerModuleNameCache);
34080         }
34081         function createPerModuleNameCache() {
34082             var directoryPathMap = new ts.Map();
34083             return { get: get, set: set };
34084             function get(directory) {
34085                 return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
34086             }
34087             function set(directory, result) {
34088                 var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
34089                 if (directoryPathMap.has(path)) {
34090                     return;
34091                 }
34092                 directoryPathMap.set(path, result);
34093                 var resolvedFileName = result.resolvedModule &&
34094                     (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
34095                 var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
34096                 var current = path;
34097                 while (current !== commonPrefix) {
34098                     var parent = ts.getDirectoryPath(current);
34099                     if (parent === current || directoryPathMap.has(parent)) {
34100                         break;
34101                     }
34102                     directoryPathMap.set(parent, result);
34103                     current = parent;
34104                 }
34105             }
34106             function getCommonPrefix(directory, resolution) {
34107                 var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
34108                 var i = 0;
34109                 var limit = Math.min(directory.length, resolutionDirectory.length);
34110                 while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
34111                     i++;
34112                 }
34113                 if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
34114                     return directory;
34115                 }
34116                 var rootLength = ts.getRootLength(directory);
34117                 if (i < rootLength) {
34118                     return undefined;
34119                 }
34120                 var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
34121                 if (sep === -1) {
34122                     return undefined;
34123                 }
34124                 return directory.substr(0, Math.max(sep, rootLength));
34125             }
34126         }
34127     }
34128     ts.createModuleResolutionCache = createModuleResolutionCache;
34129     function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
34130         var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
34131         packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
34132         return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
34133         function clear() {
34134             preDirectoryResolutionCache.clear();
34135             packageJsonInfoCache.clear();
34136         }
34137     }
34138     ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
34139     function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
34140         var containingDirectory = ts.getDirectoryPath(containingFile);
34141         var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
34142         if (!perFolderCache)
34143             return undefined;
34144         return perFolderCache.get(moduleName, mode);
34145     }
34146     ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
34147     function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
34148         var traceEnabled = isTraceEnabled(compilerOptions, host);
34149         if (redirectedReference) {
34150             compilerOptions = redirectedReference.commandLine.options;
34151         }
34152         if (traceEnabled) {
34153             trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile);
34154             if (redirectedReference) {
34155                 trace(host, ts.Diagnostics.Using_compiler_options_of_project_reference_redirect_0, redirectedReference.sourceFile.fileName);
34156             }
34157         }
34158         var containingDirectory = ts.getDirectoryPath(containingFile);
34159         var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
34160         var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
34161         if (result) {
34162             if (traceEnabled) {
34163                 trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
34164             }
34165         }
34166         else {
34167             var moduleResolution = compilerOptions.moduleResolution;
34168             if (moduleResolution === undefined) {
34169                 switch (ts.getEmitModuleKind(compilerOptions)) {
34170                     case ts.ModuleKind.CommonJS:
34171                         moduleResolution = ts.ModuleResolutionKind.NodeJs;
34172                         break;
34173                     case ts.ModuleKind.Node12:
34174                         moduleResolution = ts.ModuleResolutionKind.Node12;
34175                         break;
34176                     case ts.ModuleKind.NodeNext:
34177                         moduleResolution = ts.ModuleResolutionKind.NodeNext;
34178                         break;
34179                     default:
34180                         moduleResolution = ts.ModuleResolutionKind.Classic;
34181                         break;
34182                 }
34183                 if (traceEnabled) {
34184                     trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
34185                 }
34186             }
34187             else {
34188                 if (traceEnabled) {
34189                     trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]);
34190                 }
34191             }
34192             ts.perfLogger.logStartResolveModule(moduleName);
34193             switch (moduleResolution) {
34194                 case ts.ModuleResolutionKind.Node12:
34195                     result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
34196                     break;
34197                 case ts.ModuleResolutionKind.NodeNext:
34198                     result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
34199                     break;
34200                 case ts.ModuleResolutionKind.NodeJs:
34201                     result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
34202                     break;
34203                 case ts.ModuleResolutionKind.Classic:
34204                     result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
34205                     break;
34206                 default:
34207                     return ts.Debug.fail("Unexpected moduleResolution: ".concat(moduleResolution));
34208             }
34209             if (result && result.resolvedModule)
34210                 ts.perfLogger.logInfoEvent("Module \"".concat(moduleName, "\" resolved to \"").concat(result.resolvedModule.resolvedFileName, "\""));
34211             ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
34212             if (perFolderCache) {
34213                 perFolderCache.set(moduleName, resolutionMode, result);
34214                 if (!ts.isExternalModuleNameRelative(moduleName)) {
34215                     cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
34216                 }
34217             }
34218         }
34219         if (traceEnabled) {
34220             if (result.resolvedModule) {
34221                 if (result.resolvedModule.packageId) {
34222                     trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
34223                 }
34224                 else {
34225                     trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
34226                 }
34227             }
34228             else {
34229                 trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
34230             }
34231         }
34232         return result;
34233     }
34234     ts.resolveModuleName = resolveModuleName;
34235     function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state) {
34236         var resolved = tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state);
34237         if (resolved)
34238             return resolved.value;
34239         if (!ts.isExternalModuleNameRelative(moduleName)) {
34240             return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state);
34241         }
34242         else {
34243             return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, state);
34244         }
34245     }
34246     function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
34247         var _a;
34248         var _b = state.compilerOptions, baseUrl = _b.baseUrl, paths = _b.paths, configFile = _b.configFile;
34249         if (paths && !ts.pathIsRelative(moduleName)) {
34250             if (state.traceEnabled) {
34251                 if (baseUrl) {
34252                     trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, baseUrl, moduleName);
34253                 }
34254                 trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
34255             }
34256             var baseDirectory = ts.getPathsBasePath(state.compilerOptions, state.host);
34257             var pathPatterns = (configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = ts.tryParsePatterns(paths)) : undefined;
34258             return tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, false, state);
34259         }
34260     }
34261     function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, state) {
34262         if (!state.compilerOptions.rootDirs) {
34263             return undefined;
34264         }
34265         if (state.traceEnabled) {
34266             trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName);
34267         }
34268         var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
34269         var matchedRootDir;
34270         var matchedNormalizedPrefix;
34271         for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) {
34272             var rootDir = _a[_i];
34273             var normalizedRoot = ts.normalizePath(rootDir);
34274             if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) {
34275                 normalizedRoot += ts.directorySeparator;
34276             }
34277             var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) &&
34278                 (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length);
34279             if (state.traceEnabled) {
34280                 trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix);
34281             }
34282             if (isLongestMatchingPrefix) {
34283                 matchedNormalizedPrefix = normalizedRoot;
34284                 matchedRootDir = rootDir;
34285             }
34286         }
34287         if (matchedNormalizedPrefix) {
34288             if (state.traceEnabled) {
34289                 trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix);
34290             }
34291             var suffix = candidate.substr(matchedNormalizedPrefix.length);
34292             if (state.traceEnabled) {
34293                 trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate);
34294             }
34295             var resolvedFileName = loader(extensions, candidate, !ts.directoryProbablyExists(containingDirectory, state.host), state);
34296             if (resolvedFileName) {
34297                 return resolvedFileName;
34298             }
34299             if (state.traceEnabled) {
34300                 trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs);
34301             }
34302             for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) {
34303                 var rootDir = _c[_b];
34304                 if (rootDir === matchedRootDir) {
34305                     continue;
34306                 }
34307                 var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix);
34308                 if (state.traceEnabled) {
34309                     trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1);
34310                 }
34311                 var baseDirectory = ts.getDirectoryPath(candidate_1);
34312                 var resolvedFileName_1 = loader(extensions, candidate_1, !ts.directoryProbablyExists(baseDirectory, state.host), state);
34313                 if (resolvedFileName_1) {
34314                     return resolvedFileName_1;
34315                 }
34316             }
34317             if (state.traceEnabled) {
34318                 trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed);
34319             }
34320         }
34321         return undefined;
34322     }
34323     function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) {
34324         var baseUrl = state.compilerOptions.baseUrl;
34325         if (!baseUrl) {
34326             return undefined;
34327         }
34328         if (state.traceEnabled) {
34329             trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, baseUrl, moduleName);
34330         }
34331         var candidate = ts.normalizePath(ts.combinePaths(baseUrl, moduleName));
34332         if (state.traceEnabled) {
34333             trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, baseUrl, candidate);
34334         }
34335         return loader(extensions, candidate, !ts.directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
34336     }
34337     function resolveJSModule(moduleName, initialDir, host) {
34338         var _a = tryResolveJSModuleWorker(moduleName, initialDir, host), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations;
34339         if (!resolvedModule) {
34340             throw new Error("Could not resolve JS module '".concat(moduleName, "' starting at '").concat(initialDir, "'. Looked in: ").concat(failedLookupLocations.join(", ")));
34341         }
34342         return resolvedModule.resolvedFileName;
34343     }
34344     ts.resolveJSModule = resolveJSModule;
34345     function tryResolveJSModule(moduleName, initialDir, host) {
34346         return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
34347     }
34348     ts.tryResolveJSModule = tryResolveJSModule;
34349     var NodeResolutionFeatures;
34350     (function (NodeResolutionFeatures) {
34351         NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
34352         NodeResolutionFeatures[NodeResolutionFeatures["Imports"] = 2] = "Imports";
34353         NodeResolutionFeatures[NodeResolutionFeatures["SelfName"] = 4] = "SelfName";
34354         NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
34355         NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
34356         NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
34357         NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
34358     })(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
34359     function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
34360         return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Imports | NodeResolutionFeatures.SelfName | NodeResolutionFeatures.Exports, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
34361     }
34362     function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
34363         return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.AllFeatures, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
34364     }
34365     function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
34366         var containingDirectory = ts.getDirectoryPath(containingFile);
34367         var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
34368         return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
34369     }
34370     var jsOnlyExtensions = [Extensions.JavaScript];
34371     var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
34372     var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
34373     var tsconfigExtensions = [Extensions.TSConfig];
34374     function tryResolveJSModuleWorker(moduleName, initialDir, host) {
34375         return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
34376     }
34377     function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
34378         return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
34379     }
34380     ts.nodeModuleNameResolver = nodeModuleNameResolver;
34381     function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
34382         var _a, _b;
34383         var traceEnabled = isTraceEnabled(compilerOptions, host);
34384         var failedLookupLocations = [];
34385         var state = {
34386             compilerOptions: compilerOptions,
34387             host: host,
34388             traceEnabled: traceEnabled,
34389             failedLookupLocations: failedLookupLocations,
34390             packageJsonInfoCache: cache,
34391             features: features,
34392             conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
34393         };
34394         var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
34395         return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
34396         function tryResolve(extensions) {
34397             var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
34398             var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
34399             if (resolved) {
34400                 return toSearchResult({ resolved: resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
34401             }
34402             if (!ts.isExternalModuleNameRelative(moduleName)) {
34403                 var resolved_1;
34404                 if (features & NodeResolutionFeatures.Imports && ts.startsWith(moduleName, "#")) {
34405                     resolved_1 = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
34406                 }
34407                 if (!resolved_1 && features & NodeResolutionFeatures.SelfName) {
34408                     resolved_1 = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
34409                 }
34410                 if (!resolved_1) {
34411                     if (traceEnabled) {
34412                         trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
34413                     }
34414                     resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
34415                 }
34416                 if (!resolved_1)
34417                     return undefined;
34418                 var resolvedValue = resolved_1.value;
34419                 if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
34420                     var path = realPath(resolvedValue.path, host, traceEnabled);
34421                     var originalPath = arePathsEqual(path, resolvedValue.path, host) ? undefined : resolvedValue.path;
34422                     resolvedValue = __assign(__assign({}, resolvedValue), { path: path, originalPath: originalPath });
34423                 }
34424                 return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
34425             }
34426             else {
34427                 var _a = ts.normalizePathAndParts(ts.combinePaths(containingDirectory, moduleName)), candidate = _a.path, parts = _a.parts;
34428                 var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, false, state, true);
34429                 return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
34430             }
34431         }
34432     }
34433     function realPath(path, host, traceEnabled) {
34434         if (!host.realpath) {
34435             return path;
34436         }
34437         var real = ts.normalizePath(host.realpath(path));
34438         if (traceEnabled) {
34439             trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real);
34440         }
34441         ts.Debug.assert(host.fileExists(real), "".concat(path, " linked to nonexistent file ").concat(real));
34442         return real;
34443     }
34444     function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
34445         if (state.traceEnabled) {
34446             trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]);
34447         }
34448         if (!ts.hasTrailingDirectorySeparator(candidate)) {
34449             if (!onlyRecordFailures) {
34450                 var parentOfCandidate = ts.getDirectoryPath(candidate);
34451                 if (!ts.directoryProbablyExists(parentOfCandidate, state.host)) {
34452                     if (state.traceEnabled) {
34453                         trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate);
34454                     }
34455                     onlyRecordFailures = true;
34456                 }
34457             }
34458             var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
34459             if (resolvedFromFile) {
34460                 var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile.path) : undefined;
34461                 var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, false, state) : undefined;
34462                 return withPackageId(packageInfo, resolvedFromFile);
34463             }
34464         }
34465         if (!onlyRecordFailures) {
34466             var candidateExists = ts.directoryProbablyExists(candidate, state.host);
34467             if (!candidateExists) {
34468                 if (state.traceEnabled) {
34469                     trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate);
34470                 }
34471                 onlyRecordFailures = true;
34472             }
34473         }
34474         return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson);
34475     }
34476     ts.nodeModulesPathPart = "/node_modules/";
34477     function pathContainsNodeModules(path) {
34478         return ts.stringContains(path, ts.nodeModulesPathPart);
34479     }
34480     ts.pathContainsNodeModules = pathContainsNodeModules;
34481     function parseNodeModuleFromPath(resolved) {
34482         var path = ts.normalizePath(resolved);
34483         var idx = path.lastIndexOf(ts.nodeModulesPathPart);
34484         if (idx === -1) {
34485             return undefined;
34486         }
34487         var indexAfterNodeModules = idx + ts.nodeModulesPathPart.length;
34488         var indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
34489         if (path.charCodeAt(indexAfterNodeModules) === 64) {
34490             indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
34491         }
34492         return path.slice(0, indexAfterPackageName);
34493     }
34494     ts.parseNodeModuleFromPath = parseNodeModuleFromPath;
34495     function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
34496         var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
34497         return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
34498     }
34499     function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
34500         return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
34501     }
34502     function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
34503         if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
34504             var extensionLess = ts.tryRemoveExtension(candidate, ".json");
34505             var extension = extensionLess ? candidate.substring(extensionLess.length) : "";
34506             return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
34507         }
34508         if (!(state.features & NodeResolutionFeatures.EsmMode)) {
34509             var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
34510             if (resolvedByAddingExtension) {
34511                 return resolvedByAddingExtension;
34512             }
34513         }
34514         return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
34515     }
34516     function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
34517         if (ts.hasJSFileExtension(candidate) || (ts.fileExtensionIs(candidate, ".json") && state.compilerOptions.resolveJsonModule)) {
34518             var extensionless = ts.removeFileExtension(candidate);
34519             var extension = candidate.substring(extensionless.length);
34520             if (state.traceEnabled) {
34521                 trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
34522             }
34523             return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
34524         }
34525     }
34526     function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
34527         if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, [".d.ts", ".d.cts", ".d.mts"])) {
34528             var result = tryFile(candidate, onlyRecordFailures, state);
34529             return result !== undefined ? { path: candidate, ext: ts.forEach([".d.ts", ".d.cts", ".d.mts"], function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
34530         }
34531         return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
34532     }
34533     function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
34534         if (!onlyRecordFailures) {
34535             var directory = ts.getDirectoryPath(candidate);
34536             if (directory) {
34537                 onlyRecordFailures = !ts.directoryProbablyExists(directory, state.host);
34538             }
34539         }
34540         switch (extensions) {
34541             case Extensions.DtsOnly:
34542                 switch (originalExtension) {
34543                     case ".mjs":
34544                     case ".mts":
34545                     case ".d.mts":
34546                         return tryExtension(".d.mts");
34547                     case ".cjs":
34548                     case ".cts":
34549                     case ".d.cts":
34550                         return tryExtension(".d.cts");
34551                     case ".json":
34552                         candidate += ".json";
34553                         return tryExtension(".d.ts");
34554                     default: return tryExtension(".d.ts");
34555                 }
34556             case Extensions.TypeScript:
34557                 switch (originalExtension) {
34558                     case ".mjs":
34559                     case ".mts":
34560                     case ".d.mts":
34561                         return tryExtension(".mts") || tryExtension(".d.mts");
34562                     case ".cjs":
34563                     case ".cts":
34564                     case ".d.cts":
34565                         return tryExtension(".cts") || tryExtension(".d.cts");
34566                     case ".json":
34567                         candidate += ".json";
34568                         return tryExtension(".d.ts");
34569                     default:
34570                         return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
34571                 }
34572             case Extensions.JavaScript:
34573                 switch (originalExtension) {
34574                     case ".mjs":
34575                     case ".mts":
34576                     case ".d.mts":
34577                         return tryExtension(".mjs");
34578                     case ".cjs":
34579                     case ".cts":
34580                     case ".d.cts":
34581                         return tryExtension(".cjs");
34582                     case ".json":
34583                         return tryExtension(".json");
34584                     default:
34585                         return tryExtension(".js") || tryExtension(".jsx");
34586                 }
34587             case Extensions.TSConfig:
34588             case Extensions.Json:
34589                 return tryExtension(".json");
34590         }
34591         function tryExtension(ext) {
34592             var path = tryFile(candidate + ext, onlyRecordFailures, state);
34593             return path === undefined ? undefined : { path: path, ext: ext };
34594         }
34595     }
34596     function tryFile(fileName, onlyRecordFailures, state) {
34597         if (!onlyRecordFailures) {
34598             if (state.host.fileExists(fileName)) {
34599                 if (state.traceEnabled) {
34600                     trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
34601                 }
34602                 return fileName;
34603             }
34604             else {
34605                 if (state.traceEnabled) {
34606                     trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
34607                 }
34608             }
34609         }
34610         state.failedLookupLocations.push(fileName);
34611         return undefined;
34612     }
34613     function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
34614         if (considerPackageJson === void 0) { considerPackageJson = true; }
34615         var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
34616         var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
34617         var versionPaths = packageInfo && packageInfo.versionPaths;
34618         return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
34619     }
34620     function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
34621         var state = {
34622             host: host,
34623             compilerOptions: options,
34624             traceEnabled: isTraceEnabled(options, host),
34625             failedLookupLocations: [],
34626             packageJsonInfoCache: packageJsonInfoCache,
34627             features: 0,
34628             conditions: [],
34629         };
34630         var parts = ts.getPathComponents(fileName);
34631         parts.pop();
34632         while (parts.length > 0) {
34633             var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), false, state);
34634             if (pkg) {
34635                 return pkg;
34636             }
34637             parts.pop();
34638         }
34639         return undefined;
34640     }
34641     ts.getPackageScopeForPath = getPackageScopeForPath;
34642     function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
34643         var _a, _b, _c;
34644         var host = state.host, traceEnabled = state.traceEnabled;
34645         var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
34646         if (onlyRecordFailures) {
34647             state.failedLookupLocations.push(packageJsonPath);
34648             return undefined;
34649         }
34650         var existing = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(packageJsonPath);
34651         if (existing !== undefined) {
34652             if (typeof existing !== "boolean") {
34653                 if (traceEnabled)
34654                     trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
34655                 return existing;
34656             }
34657             else {
34658                 if (existing && traceEnabled)
34659                     trace(host, ts.Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
34660                 state.failedLookupLocations.push(packageJsonPath);
34661                 return undefined;
34662             }
34663         }
34664         var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
34665         if (directoryExists && host.fileExists(packageJsonPath)) {
34666             var packageJsonContent = ts.readJson(packageJsonPath, host);
34667             if (traceEnabled) {
34668                 trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
34669             }
34670             var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
34671             var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
34672             (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
34673             return result;
34674         }
34675         else {
34676             if (directoryExists && traceEnabled) {
34677                 trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath);
34678             }
34679             (_c = state.packageJsonInfoCache) === null || _c === void 0 ? void 0 : _c.setPackageJsonInfo(packageJsonPath, directoryExists);
34680             state.failedLookupLocations.push(packageJsonPath);
34681         }
34682     }
34683     ts.getPackageJsonInfo = getPackageJsonInfo;
34684     function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
34685         var packageFile;
34686         if (jsonContent) {
34687             switch (extensions) {
34688                 case Extensions.JavaScript:
34689                 case Extensions.Json:
34690                     packageFile = readPackageJsonMainField(jsonContent, candidate, state);
34691                     break;
34692                 case Extensions.TypeScript:
34693                     packageFile = readPackageJsonTypesFields(jsonContent, candidate, state) || readPackageJsonMainField(jsonContent, candidate, state);
34694                     break;
34695                 case Extensions.DtsOnly:
34696                     packageFile = readPackageJsonTypesFields(jsonContent, candidate, state);
34697                     break;
34698                 case Extensions.TSConfig:
34699                     packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
34700                     break;
34701                 default:
34702                     return ts.Debug.assertNever(extensions);
34703             }
34704         }
34705         var loader = function (extensions, candidate, onlyRecordFailures, state) {
34706             var fromFile = tryFile(candidate, onlyRecordFailures, state);
34707             if (fromFile) {
34708                 var resolved = resolvedIfExtensionMatches(extensions, fromFile);
34709                 if (resolved) {
34710                     return noPackageId(resolved);
34711                 }
34712                 if (state.traceEnabled) {
34713                     trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile);
34714                 }
34715             }
34716             var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions;
34717             return nodeLoadModuleByRelativeName(nextExtensions, candidate, onlyRecordFailures, state, false);
34718         };
34719         var onlyRecordFailuresForPackageFile = packageFile ? !ts.directoryProbablyExists(ts.getDirectoryPath(packageFile), state.host) : undefined;
34720         var onlyRecordFailuresForIndex = onlyRecordFailures || !ts.directoryProbablyExists(candidate, state.host);
34721         var indexPath = ts.combinePaths(candidate, extensions === Extensions.TSConfig ? "tsconfig" : "index");
34722         if (versionPaths && (!packageFile || ts.containsPath(candidate, packageFile))) {
34723             var moduleName = ts.getRelativePathFromDirectory(candidate, packageFile || indexPath, false);
34724             if (state.traceEnabled) {
34725                 trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, moduleName);
34726             }
34727             var result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, undefined, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
34728             if (result) {
34729                 return removeIgnoredPackageId(result.value);
34730             }
34731         }
34732         var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state));
34733         if (packageFileResult)
34734             return packageFileResult;
34735         if (!(state.features & NodeResolutionFeatures.EsmMode)) {
34736             return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
34737         }
34738     }
34739     function resolvedIfExtensionMatches(extensions, path) {
34740         var ext = ts.tryGetExtensionFromPath(path);
34741         return ext !== undefined && extensionIsOk(extensions, ext) ? { path: path, ext: ext } : undefined;
34742     }
34743     function extensionIsOk(extensions, extension) {
34744         switch (extensions) {
34745             case Extensions.JavaScript:
34746                 return extension === ".js" || extension === ".jsx";
34747             case Extensions.TSConfig:
34748             case Extensions.Json:
34749                 return extension === ".json";
34750             case Extensions.TypeScript:
34751                 return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
34752             case Extensions.DtsOnly:
34753                 return extension === ".d.ts";
34754         }
34755     }
34756     function parsePackageName(moduleName) {
34757         var idx = moduleName.indexOf(ts.directorySeparator);
34758         if (moduleName[0] === "@") {
34759             idx = moduleName.indexOf(ts.directorySeparator, idx + 1);
34760         }
34761         return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
34762     }
34763     ts.parsePackageName = parsePackageName;
34764     function allKeysStartWithDot(obj) {
34765         return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
34766     }
34767     ts.allKeysStartWithDot = allKeysStartWithDot;
34768     function noKeyStartsWithDot(obj) {
34769         return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
34770     }
34771     function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
34772         var _a, _b;
34773         var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
34774         var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
34775         var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
34776         if (!scope || !scope.packageJsonContent.exports) {
34777             return undefined;
34778         }
34779         if (typeof scope.packageJsonContent.name !== "string") {
34780             return undefined;
34781         }
34782         var parts = ts.getPathComponents(moduleName);
34783         var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
34784         if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
34785             return undefined;
34786         }
34787         var trailingParts = parts.slice(nameParts.length);
34788         return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference);
34789     }
34790     function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
34791         if (!scope.packageJsonContent.exports) {
34792             return undefined;
34793         }
34794         if (subpath === ".") {
34795             var mainExport = void 0;
34796             if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
34797                 mainExport = scope.packageJsonContent.exports;
34798             }
34799             else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
34800                 mainExport = scope.packageJsonContent.exports["."];
34801             }
34802             if (mainExport) {
34803                 var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, false);
34804                 return loadModuleFromTargetImportOrExport(mainExport, "", false);
34805             }
34806         }
34807         else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
34808             if (typeof scope.packageJsonContent.exports !== "object") {
34809                 if (state.traceEnabled) {
34810                     trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
34811                 }
34812                 return toSearchResult(undefined);
34813             }
34814             var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, false);
34815             if (result) {
34816                 return result;
34817             }
34818         }
34819         if (state.traceEnabled) {
34820             trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
34821         }
34822         return toSearchResult(undefined);
34823     }
34824     function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) {
34825         var _a, _b;
34826         if (moduleName === "#" || ts.startsWith(moduleName, "#/")) {
34827             if (state.traceEnabled) {
34828                 trace(state.host, ts.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName);
34829             }
34830             return toSearchResult(undefined);
34831         }
34832         var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
34833         var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
34834         var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
34835         if (!scope) {
34836             if (state.traceEnabled) {
34837                 trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
34838             }
34839             return toSearchResult(undefined);
34840         }
34841         if (!scope.packageJsonContent.imports) {
34842             if (state.traceEnabled) {
34843                 trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
34844             }
34845             return toSearchResult(undefined);
34846         }
34847         var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, true);
34848         if (result) {
34849             return result;
34850         }
34851         if (state.traceEnabled) {
34852             trace(state.host, ts.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory);
34853         }
34854         return toSearchResult(undefined);
34855     }
34856     function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
34857         var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
34858         if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
34859             var target = lookupTable[moduleName];
34860             return loadModuleFromTargetImportOrExport(target, "", false);
34861         }
34862         var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), function (a, b) { return a.length - b.length; });
34863         for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
34864             var potentialTarget = expandingKeys_1[_i];
34865             if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
34866                 var target = lookupTable[potentialTarget];
34867                 var starPos = potentialTarget.indexOf("*");
34868                 var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
34869                 return loadModuleFromTargetImportOrExport(target, subpath, true);
34870             }
34871             else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
34872                 var target = lookupTable[potentialTarget];
34873                 var subpath = moduleName.substring(potentialTarget.length - 1);
34874                 return loadModuleFromTargetImportOrExport(target, subpath, true);
34875             }
34876             else if (ts.startsWith(moduleName, potentialTarget)) {
34877                 var target = lookupTable[potentialTarget];
34878                 var subpath = moduleName.substring(potentialTarget.length);
34879                 return loadModuleFromTargetImportOrExport(target, subpath, false);
34880             }
34881         }
34882         function matchesPatternWithTrailer(target, name) {
34883             if (ts.endsWith(target, "*"))
34884                 return false;
34885             var starPos = target.indexOf("*");
34886             if (starPos === -1)
34887                 return false;
34888             return ts.startsWith(name, target.substring(0, starPos)) && ts.endsWith(name, target.substring(starPos + 1));
34889         }
34890     }
34891     function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
34892         return loadModuleFromTargetImportOrExport;
34893         function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
34894             var _a, _b;
34895             if (typeof target === "string") {
34896                 if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
34897                     if (state.traceEnabled) {
34898                         trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34899                     }
34900                     return toSearchResult(undefined);
34901                 }
34902                 if (!ts.startsWith(target, "./")) {
34903                     if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
34904                         var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
34905                         var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
34906                         return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
34907                     }
34908                     if (state.traceEnabled) {
34909                         trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34910                     }
34911                     return toSearchResult(undefined);
34912                 }
34913                 var parts = ts.pathIsRelative(target) ? ts.getPathComponents(target).slice(1) : ts.getPathComponents(target);
34914                 var partsAfterFirst = parts.slice(1);
34915                 if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
34916                     if (state.traceEnabled) {
34917                         trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34918                     }
34919                     return toSearchResult(undefined);
34920                 }
34921                 var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
34922                 var subpathParts = ts.getPathComponents(subpath);
34923                 if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) {
34924                     if (state.traceEnabled) {
34925                         trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34926                     }
34927                     return toSearchResult(undefined);
34928                 }
34929                 var finalPath = ts.getNormalizedAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
34930                 return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, false, state)));
34931             }
34932             else if (typeof target === "object" && target !== null) {
34933                 if (!Array.isArray(target)) {
34934                     for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
34935                         var key = _c[_i];
34936                         if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
34937                             var subTarget = target[key];
34938                             var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
34939                             if (result) {
34940                                 return result;
34941                             }
34942                         }
34943                     }
34944                     return undefined;
34945                 }
34946                 else {
34947                     if (!ts.length(target)) {
34948                         if (state.traceEnabled) {
34949                             trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34950                         }
34951                         return toSearchResult(undefined);
34952                     }
34953                     for (var _d = 0, target_1 = target; _d < target_1.length; _d++) {
34954                         var elem = target_1[_d];
34955                         var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
34956                         if (result) {
34957                             return result;
34958                         }
34959                     }
34960                 }
34961             }
34962             else if (target === null) {
34963                 if (state.traceEnabled) {
34964                     trace(state.host, ts.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
34965                 }
34966                 return toSearchResult(undefined);
34967             }
34968             if (state.traceEnabled) {
34969                 trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
34970             }
34971             return toSearchResult(undefined);
34972         }
34973     }
34974     function isApplicableVersionedTypesKey(conditions, key) {
34975         if (conditions.indexOf("types") === -1)
34976             return false;
34977         if (!ts.startsWith(key, "types@"))
34978             return false;
34979         var range = ts.VersionRange.tryParse(key.substring("types@".length));
34980         if (!range)
34981             return false;
34982         return range.test(ts.version);
34983     }
34984     ts.isApplicableVersionedTypesKey = isApplicableVersionedTypesKey;
34985     function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
34986         return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
34987     }
34988     function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directory, state) {
34989         return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, true, undefined, undefined);
34990     }
34991     function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
34992         var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
34993         return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
34994             if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
34995                 var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
34996                 if (resolutionFromCache) {
34997                     return resolutionFromCache;
34998                 }
34999                 return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
35000             }
35001         });
35002     }
35003     function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
35004         var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
35005         var nodeModulesFolderExists = ts.directoryProbablyExists(nodeModulesFolder, state.host);
35006         if (!nodeModulesFolderExists && state.traceEnabled) {
35007             trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
35008         }
35009         var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
35010         if (packageResult) {
35011             return packageResult;
35012         }
35013         if (extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) {
35014             var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types");
35015             var nodeModulesAtTypesExists = nodeModulesFolderExists;
35016             if (nodeModulesFolderExists && !ts.directoryProbablyExists(nodeModulesAtTypes_1, state.host)) {
35017                 if (state.traceEnabled) {
35018                     trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1);
35019                 }
35020                 nodeModulesAtTypesExists = false;
35021             }
35022             return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state, cache, redirectedReference);
35023         }
35024     }
35025     function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
35026         var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
35027         var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
35028         if (!(state.features & NodeResolutionFeatures.Exports)) {
35029             if (packageInfo) {
35030                 var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
35031                 if (fromFile) {
35032                     return noPackageId(fromFile);
35033                 }
35034                 var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
35035                 return withPackageId(packageInfo, fromDirectory);
35036             }
35037         }
35038         var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
35039         var loader = function (extensions, candidate, onlyRecordFailures, state) {
35040             var _a;
35041             if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
35042                 return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
35043             }
35044             var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
35045                 loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
35046             return withPackageId(packageInfo, pathAndExtension);
35047         };
35048         if (rest !== "") {
35049             var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
35050             packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
35051             if (packageInfo && packageInfo.versionPaths) {
35052                 if (state.traceEnabled) {
35053                     trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
35054                 }
35055                 var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
35056                 var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, undefined, loader, !packageDirectoryExists, state);
35057                 if (fromPaths) {
35058                     return fromPaths.value;
35059                 }
35060             }
35061         }
35062         return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
35063     }
35064     function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
35065         pathPatterns || (pathPatterns = ts.tryParsePatterns(paths));
35066         var matchedPattern = ts.matchPatternOrExact(pathPatterns, moduleName);
35067         if (matchedPattern) {
35068             var matchedStar_1 = ts.isString(matchedPattern) ? undefined : ts.matchedText(matchedPattern, moduleName);
35069             var matchedPatternText = ts.isString(matchedPattern) ? matchedPattern : ts.patternText(matchedPattern);
35070             if (state.traceEnabled) {
35071                 trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText);
35072             }
35073             var resolved = ts.forEach(paths[matchedPatternText], function (subst) {
35074                 var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst;
35075                 var candidate = ts.normalizePath(ts.combinePaths(baseDirectory, path));
35076                 if (state.traceEnabled) {
35077                     trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
35078                 }
35079                 var extension = ts.tryGetExtensionFromPath(subst);
35080                 if (extension !== undefined) {
35081                     var path_1 = tryFile(candidate, onlyRecordFailures, state);
35082                     if (path_1 !== undefined) {
35083                         return noPackageId({ path: path_1, ext: extension });
35084                     }
35085                 }
35086                 return loader(extensions, candidate, onlyRecordFailures || !ts.directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state);
35087             });
35088             return { value: resolved };
35089         }
35090     }
35091     var mangledScopedPackageSeparator = "__";
35092     function mangleScopedPackageNameWithTrace(packageName, state) {
35093         var mangled = mangleScopedPackageName(packageName);
35094         if (state.traceEnabled && mangled !== packageName) {
35095             trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled);
35096         }
35097         return mangled;
35098     }
35099     function getTypesPackageName(packageName) {
35100         return "@types/".concat(mangleScopedPackageName(packageName));
35101     }
35102     ts.getTypesPackageName = getTypesPackageName;
35103     function mangleScopedPackageName(packageName) {
35104         if (ts.startsWith(packageName, "@")) {
35105             var replaceSlash = packageName.replace(ts.directorySeparator, mangledScopedPackageSeparator);
35106             if (replaceSlash !== packageName) {
35107                 return replaceSlash.slice(1);
35108             }
35109         }
35110         return packageName;
35111     }
35112     ts.mangleScopedPackageName = mangleScopedPackageName;
35113     function getPackageNameFromTypesPackageName(mangledName) {
35114         var withoutAtTypePrefix = ts.removePrefix(mangledName, "@types/");
35115         if (withoutAtTypePrefix !== mangledName) {
35116             return unmangleScopedPackageName(withoutAtTypePrefix);
35117         }
35118         return mangledName;
35119     }
35120     ts.getPackageNameFromTypesPackageName = getPackageNameFromTypesPackageName;
35121     function unmangleScopedPackageName(typesPackageName) {
35122         return ts.stringContains(typesPackageName, mangledScopedPackageSeparator) ?
35123             "@" + typesPackageName.replace(mangledScopedPackageSeparator, ts.directorySeparator) :
35124             typesPackageName;
35125     }
35126     ts.unmangleScopedPackageName = unmangleScopedPackageName;
35127     function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
35128         var result = cache && cache.get(containingDirectory);
35129         if (result) {
35130             if (state.traceEnabled) {
35131                 trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
35132             }
35133             state.resultFromCache = result;
35134             return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, originalPath: result.resolvedModule.originalPath || true, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } };
35135         }
35136     }
35137     function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
35138         var traceEnabled = isTraceEnabled(compilerOptions, host);
35139         var failedLookupLocations = [];
35140         var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
35141         var containingDirectory = ts.getDirectoryPath(containingFile);
35142         var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
35143         return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, state.resultFromCache);
35144         function tryResolve(extensions) {
35145             var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
35146             if (resolvedUsingSettings) {
35147                 return { value: resolvedUsingSettings };
35148             }
35149             if (!ts.isExternalModuleNameRelative(moduleName)) {
35150                 var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, undefined, redirectedReference);
35151                 var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
35152                     var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
35153                     if (resolutionFromCache) {
35154                         return resolutionFromCache;
35155                     }
35156                     var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName));
35157                     return toSearchResult(loadModuleFromFileNoPackageId(extensions, searchName, false, state));
35158                 });
35159                 if (resolved_3) {
35160                     return resolved_3;
35161                 }
35162                 if (extensions === Extensions.TypeScript) {
35163                     return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
35164                 }
35165             }
35166             else {
35167                 var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName));
35168                 return toSearchResult(loadModuleFromFileNoPackageId(extensions, candidate, false, state));
35169             }
35170         }
35171     }
35172     ts.classicNameResolver = classicNameResolver;
35173     function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
35174         var traceEnabled = isTraceEnabled(compilerOptions, host);
35175         if (traceEnabled) {
35176             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);
35177         }
35178         var failedLookupLocations = [];
35179         var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [] };
35180         var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
35181         return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, state.resultFromCache);
35182     }
35183     ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
35184     function toSearchResult(value) {
35185         return value !== undefined ? { value: value } : undefined;
35186     }
35187 })(ts || (ts = {}));
35188 var ts;
35189 (function (ts) {
35190     function getModuleInstanceState(node, visited) {
35191         if (node.body && !node.body.parent) {
35192             ts.setParent(node.body, node);
35193             ts.setParentRecursive(node.body, false);
35194         }
35195         return node.body ? getModuleInstanceStateCached(node.body, visited) : 1;
35196     }
35197     ts.getModuleInstanceState = getModuleInstanceState;
35198     function getModuleInstanceStateCached(node, visited) {
35199         if (visited === void 0) { visited = new ts.Map(); }
35200         var nodeId = ts.getNodeId(node);
35201         if (visited.has(nodeId)) {
35202             return visited.get(nodeId) || 0;
35203         }
35204         visited.set(nodeId, undefined);
35205         var result = getModuleInstanceStateWorker(node, visited);
35206         visited.set(nodeId, result);
35207         return result;
35208     }
35209     function getModuleInstanceStateWorker(node, visited) {
35210         switch (node.kind) {
35211             case 257:
35212             case 258:
35213                 return 0;
35214             case 259:
35215                 if (ts.isEnumConst(node)) {
35216                     return 2;
35217                 }
35218                 break;
35219             case 265:
35220             case 264:
35221                 if (!(ts.hasSyntacticModifier(node, 1))) {
35222                     return 0;
35223                 }
35224                 break;
35225             case 271:
35226                 var exportDeclaration = node;
35227                 if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 272) {
35228                     var state = 0;
35229                     for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) {
35230                         var specifier = _a[_i];
35231                         var specifierState = getModuleInstanceStateForAliasTarget(specifier, visited);
35232                         if (specifierState > state) {
35233                             state = specifierState;
35234                         }
35235                         if (state === 1) {
35236                             return state;
35237                         }
35238                     }
35239                     return state;
35240                 }
35241                 break;
35242             case 261: {
35243                 var state_1 = 0;
35244                 ts.forEachChild(node, function (n) {
35245                     var childState = getModuleInstanceStateCached(n, visited);
35246                     switch (childState) {
35247                         case 0:
35248                             return;
35249                         case 2:
35250                             state_1 = 2;
35251                             return;
35252                         case 1:
35253                             state_1 = 1;
35254                             return true;
35255                         default:
35256                             ts.Debug.assertNever(childState);
35257                     }
35258                 });
35259                 return state_1;
35260             }
35261             case 260:
35262                 return getModuleInstanceState(node, visited);
35263             case 79:
35264                 if (node.isInJSDocNamespace) {
35265                     return 0;
35266                 }
35267         }
35268         return 1;
35269     }
35270     function getModuleInstanceStateForAliasTarget(specifier, visited) {
35271         var name = specifier.propertyName || specifier.name;
35272         var p = specifier.parent;
35273         while (p) {
35274             if (ts.isBlock(p) || ts.isModuleBlock(p) || ts.isSourceFile(p)) {
35275                 var statements = p.statements;
35276                 var found = void 0;
35277                 for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
35278                     var statement = statements_2[_i];
35279                     if (ts.nodeHasName(statement, name)) {
35280                         if (!statement.parent) {
35281                             ts.setParent(statement, p);
35282                             ts.setParentRecursive(statement, false);
35283                         }
35284                         var state = getModuleInstanceStateCached(statement, visited);
35285                         if (found === undefined || state > found) {
35286                             found = state;
35287                         }
35288                         if (found === 1) {
35289                             return found;
35290                         }
35291                     }
35292                 }
35293                 if (found !== undefined) {
35294                     return found;
35295                 }
35296             }
35297             p = p.parent;
35298         }
35299         return 1;
35300     }
35301     function initFlowNode(node) {
35302         ts.Debug.attachFlowNodeDebugInfo(node);
35303         return node;
35304     }
35305     var binder = createBinder();
35306     function bindSourceFile(file, options) {
35307         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35308         ts.performance.mark("beforeBind");
35309         ts.perfLogger.logStartBindFile("" + file.fileName);
35310         binder(file, options);
35311         ts.perfLogger.logStopBindFile();
35312         ts.performance.mark("afterBind");
35313         ts.performance.measure("Bind", "beforeBind", "afterBind");
35314         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35315     }
35316     ts.bindSourceFile = bindSourceFile;
35317     function createBinder() {
35318         var file;
35319         var options;
35320         var languageVersion;
35321         var parent;
35322         var container;
35323         var thisParentContainer;
35324         var blockScopeContainer;
35325         var lastContainer;
35326         var delayedTypeAliases;
35327         var seenThisKeyword;
35328         var currentFlow;
35329         var currentBreakTarget;
35330         var currentContinueTarget;
35331         var currentReturnTarget;
35332         var currentTrueTarget;
35333         var currentFalseTarget;
35334         var currentExceptionTarget;
35335         var preSwitchCaseFlow;
35336         var activeLabelList;
35337         var hasExplicitReturn;
35338         var emitFlags;
35339         var inStrictMode;
35340         var inAssignmentPattern = false;
35341         var symbolCount = 0;
35342         var Symbol;
35343         var classifiableNames;
35344         var unreachableFlow = { flags: 1 };
35345         var reportedUnreachableFlow = { flags: 1 };
35346         var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
35347         function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
35348             return ts.createDiagnosticForNodeInSourceFile(ts.getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
35349         }
35350         function bindSourceFile(f, opts) {
35351             file = f;
35352             options = opts;
35353             languageVersion = ts.getEmitScriptTarget(options);
35354             inStrictMode = bindInStrictMode(file, opts);
35355             classifiableNames = new ts.Set();
35356             symbolCount = 0;
35357             Symbol = ts.objectAllocator.getSymbolConstructor();
35358             ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
35359             ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
35360             if (!file.locals) {
35361                 bind(file);
35362                 file.symbolCount = symbolCount;
35363                 file.classifiableNames = classifiableNames;
35364                 delayedBindJSDocTypedefTag();
35365             }
35366             file = undefined;
35367             options = undefined;
35368             languageVersion = undefined;
35369             parent = undefined;
35370             container = undefined;
35371             thisParentContainer = undefined;
35372             blockScopeContainer = undefined;
35373             lastContainer = undefined;
35374             delayedTypeAliases = undefined;
35375             seenThisKeyword = false;
35376             currentFlow = undefined;
35377             currentBreakTarget = undefined;
35378             currentContinueTarget = undefined;
35379             currentReturnTarget = undefined;
35380             currentTrueTarget = undefined;
35381             currentFalseTarget = undefined;
35382             currentExceptionTarget = undefined;
35383             activeLabelList = undefined;
35384             hasExplicitReturn = false;
35385             inAssignmentPattern = false;
35386             emitFlags = 0;
35387         }
35388         return bindSourceFile;
35389         function bindInStrictMode(file, opts) {
35390             if (ts.getStrictOptionValue(opts, "alwaysStrict") && !file.isDeclarationFile) {
35391                 return true;
35392             }
35393             else {
35394                 return !!file.externalModuleIndicator;
35395             }
35396         }
35397         function createSymbol(flags, name) {
35398             symbolCount++;
35399             return new Symbol(flags, name);
35400         }
35401         function addDeclarationToSymbol(symbol, node, symbolFlags) {
35402             symbol.flags |= symbolFlags;
35403             node.symbol = symbol;
35404             symbol.declarations = ts.appendIfUnique(symbol.declarations, node);
35405             if (symbolFlags & (32 | 384 | 1536 | 3) && !symbol.exports) {
35406                 symbol.exports = ts.createSymbolTable();
35407             }
35408             if (symbolFlags & (32 | 64 | 2048 | 4096) && !symbol.members) {
35409                 symbol.members = ts.createSymbolTable();
35410             }
35411             if (symbol.constEnumOnlyModule && (symbol.flags & (16 | 32 | 256))) {
35412                 symbol.constEnumOnlyModule = false;
35413             }
35414             if (symbolFlags & 111551) {
35415                 ts.setValueDeclaration(symbol, node);
35416             }
35417         }
35418         function getDeclarationName(node) {
35419             if (node.kind === 270) {
35420                 return node.isExportEquals ? "export=" : "default";
35421             }
35422             var name = ts.getNameOfDeclaration(node);
35423             if (name) {
35424                 if (ts.isAmbientModule(node)) {
35425                     var moduleName = ts.getTextOfIdentifierOrLiteral(name);
35426                     return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\""));
35427                 }
35428                 if (name.kind === 161) {
35429                     var nameExpression = name.expression;
35430                     if (ts.isStringOrNumericLiteralLike(nameExpression)) {
35431                         return ts.escapeLeadingUnderscores(nameExpression.text);
35432                     }
35433                     if (ts.isSignedNumericLiteral(nameExpression)) {
35434                         return ts.tokenToString(nameExpression.operator) + nameExpression.operand.text;
35435                     }
35436                     else {
35437                         ts.Debug.fail("Only computed properties with literal names have declaration names");
35438                     }
35439                 }
35440                 if (ts.isPrivateIdentifier(name)) {
35441                     var containingClass = ts.getContainingClass(node);
35442                     if (!containingClass) {
35443                         return undefined;
35444                     }
35445                     var containingClassSymbol = containingClass.symbol;
35446                     return ts.getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
35447                 }
35448                 return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
35449             }
35450             switch (node.kind) {
35451                 case 170:
35452                     return "__constructor";
35453                 case 178:
35454                 case 173:
35455                 case 321:
35456                     return "__call";
35457                 case 179:
35458                 case 174:
35459                     return "__new";
35460                 case 175:
35461                     return "__index";
35462                 case 271:
35463                     return "__export";
35464                 case 303:
35465                     return "export=";
35466                 case 220:
35467                     if (ts.getAssignmentDeclarationKind(node) === 2) {
35468                         return "export=";
35469                     }
35470                     ts.Debug.fail("Unknown binary declaration kind");
35471                     break;
35472                 case 315:
35473                     return (ts.isJSDocConstructSignature(node) ? "__new" : "__call");
35474                 case 163:
35475                     ts.Debug.assert(node.parent.kind === 315, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind, ", expected JSDocFunctionType"); });
35476                     var functionType = node.parent;
35477                     var index = functionType.parameters.indexOf(node);
35478                     return "arg" + index;
35479             }
35480         }
35481         function getDisplayName(node) {
35482             return ts.isNamedDeclaration(node) ? ts.declarationNameToString(node.name) : ts.unescapeLeadingUnderscores(ts.Debug.checkDefined(getDeclarationName(node)));
35483         }
35484         function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) {
35485             ts.Debug.assert(isComputedName || !ts.hasDynamicName(node));
35486             var isDefaultExport = ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node) && node.name.escapedText === "default";
35487             var name = isComputedName ? "__computed"
35488                 : isDefaultExport && parent ? "default"
35489                     : getDeclarationName(node);
35490             var symbol;
35491             if (name === undefined) {
35492                 symbol = createSymbol(0, "__missing");
35493             }
35494             else {
35495                 symbol = symbolTable.get(name);
35496                 if (includes & 2885600) {
35497                     classifiableNames.add(name);
35498                 }
35499                 if (!symbol) {
35500                     symbolTable.set(name, symbol = createSymbol(0, name));
35501                     if (isReplaceableByMethod)
35502                         symbol.isReplaceableByMethod = true;
35503                 }
35504                 else if (isReplaceableByMethod && !symbol.isReplaceableByMethod) {
35505                     return symbol;
35506                 }
35507                 else if (symbol.flags & excludes) {
35508                     if (symbol.isReplaceableByMethod) {
35509                         symbolTable.set(name, symbol = createSymbol(0, name));
35510                     }
35511                     else if (!(includes & 3 && symbol.flags & 67108864)) {
35512                         if (ts.isNamedDeclaration(node)) {
35513                             ts.setParent(node.name, node);
35514                         }
35515                         var message_1 = symbol.flags & 2
35516                             ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
35517                             : ts.Diagnostics.Duplicate_identifier_0;
35518                         var messageNeedsName_1 = true;
35519                         if (symbol.flags & 384 || includes & 384) {
35520                             message_1 = ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
35521                             messageNeedsName_1 = false;
35522                         }
35523                         var multipleDefaultExports_1 = false;
35524                         if (ts.length(symbol.declarations)) {
35525                             if (isDefaultExport) {
35526                                 message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
35527                                 messageNeedsName_1 = false;
35528                                 multipleDefaultExports_1 = true;
35529                             }
35530                             else {
35531                                 if (symbol.declarations && symbol.declarations.length &&
35532                                     (node.kind === 270 && !node.isExportEquals)) {
35533                                     message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
35534                                     messageNeedsName_1 = false;
35535                                     multipleDefaultExports_1 = true;
35536                                 }
35537                             }
35538                         }
35539                         var relatedInformation_1 = [];
35540                         if (ts.isTypeAliasDeclaration(node) && ts.nodeIsMissing(node.type) && ts.hasSyntacticModifier(node, 1) && symbol.flags & (2097152 | 788968 | 1920)) {
35541                             relatedInformation_1.push(createDiagnosticForNode(node, ts.Diagnostics.Did_you_mean_0, "export type { ".concat(ts.unescapeLeadingUnderscores(node.name.escapedText), " }")));
35542                         }
35543                         var declarationName_1 = ts.getNameOfDeclaration(node) || node;
35544                         ts.forEach(symbol.declarations, function (declaration, index) {
35545                             var decl = ts.getNameOfDeclaration(declaration) || declaration;
35546                             var diag = createDiagnosticForNode(decl, message_1, messageNeedsName_1 ? getDisplayName(declaration) : undefined);
35547                             file.bindDiagnostics.push(multipleDefaultExports_1 ? ts.addRelatedInfo(diag, createDiagnosticForNode(declarationName_1, index === 0 ? ts.Diagnostics.Another_export_default_is_here : ts.Diagnostics.and_here)) : diag);
35548                             if (multipleDefaultExports_1) {
35549                                 relatedInformation_1.push(createDiagnosticForNode(decl, ts.Diagnostics.The_first_export_default_is_here));
35550                             }
35551                         });
35552                         var diag = createDiagnosticForNode(declarationName_1, message_1, messageNeedsName_1 ? getDisplayName(node) : undefined);
35553                         file.bindDiagnostics.push(ts.addRelatedInfo.apply(void 0, __spreadArray([diag], relatedInformation_1, false)));
35554                         symbol = createSymbol(0, name);
35555                     }
35556                 }
35557             }
35558             addDeclarationToSymbol(symbol, node, includes);
35559             if (symbol.parent) {
35560                 ts.Debug.assert(symbol.parent === parent, "Existing symbol parent should match new one");
35561             }
35562             else {
35563                 symbol.parent = parent;
35564             }
35565             return symbol;
35566         }
35567         function declareModuleMember(node, symbolFlags, symbolExcludes) {
35568             var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1) || jsdocTreatAsExported(node);
35569             if (symbolFlags & 2097152) {
35570                 if (node.kind === 274 || (node.kind === 264 && hasExportModifier)) {
35571                     return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
35572                 }
35573                 else {
35574                     return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
35575                 }
35576             }
35577             else {
35578                 if (ts.isJSDocTypeAlias(node))
35579                     ts.Debug.assert(ts.isInJSFile(node));
35580                 if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64)) {
35581                     if (!container.locals || (ts.hasSyntacticModifier(node, 512) && !getDeclarationName(node))) {
35582                         return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
35583                     }
35584                     var exportKind = symbolFlags & 111551 ? 1048576 : 0;
35585                     var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);
35586                     local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
35587                     node.localSymbol = local;
35588                     return local;
35589                 }
35590                 else {
35591                     return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
35592                 }
35593             }
35594         }
35595         function jsdocTreatAsExported(node) {
35596             if (node.parent && ts.isModuleDeclaration(node)) {
35597                 node = node.parent;
35598             }
35599             if (!ts.isJSDocTypeAlias(node))
35600                 return false;
35601             if (!ts.isJSDocEnumTag(node) && !!node.fullName)
35602                 return true;
35603             var declName = ts.getNameOfDeclaration(node);
35604             if (!declName)
35605                 return false;
35606             if (ts.isPropertyAccessEntityNameExpression(declName.parent) && isTopLevelNamespaceAssignment(declName.parent))
35607                 return true;
35608             if (ts.isDeclaration(declName.parent) && ts.getCombinedModifierFlags(declName.parent) & 1)
35609                 return true;
35610             return false;
35611         }
35612         function bindContainer(node, containerFlags) {
35613             var saveContainer = container;
35614             var saveThisParentContainer = thisParentContainer;
35615             var savedBlockScopeContainer = blockScopeContainer;
35616             if (containerFlags & 1) {
35617                 if (node.kind !== 213) {
35618                     thisParentContainer = container;
35619                 }
35620                 container = blockScopeContainer = node;
35621                 if (containerFlags & 32) {
35622                     container.locals = ts.createSymbolTable();
35623                 }
35624                 addToContainerChain(container);
35625             }
35626             else if (containerFlags & 2) {
35627                 blockScopeContainer = node;
35628                 blockScopeContainer.locals = undefined;
35629             }
35630             if (containerFlags & 4) {
35631                 var saveCurrentFlow = currentFlow;
35632                 var saveBreakTarget = currentBreakTarget;
35633                 var saveContinueTarget = currentContinueTarget;
35634                 var saveReturnTarget = currentReturnTarget;
35635                 var saveExceptionTarget = currentExceptionTarget;
35636                 var saveActiveLabelList = activeLabelList;
35637                 var saveHasExplicitReturn = hasExplicitReturn;
35638                 var isIIFE = containerFlags & 16 && !ts.hasSyntacticModifier(node, 256) &&
35639                     !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node);
35640                 if (!isIIFE) {
35641                     currentFlow = initFlowNode({ flags: 2 });
35642                     if (containerFlags & (16 | 128)) {
35643                         currentFlow.node = node;
35644                     }
35645                 }
35646                 currentReturnTarget = isIIFE || node.kind === 170 || node.kind === 169 || (ts.isInJSFile(node) && (node.kind === 255 || node.kind === 212)) ? createBranchLabel() : undefined;
35647                 currentExceptionTarget = undefined;
35648                 currentBreakTarget = undefined;
35649                 currentContinueTarget = undefined;
35650                 activeLabelList = undefined;
35651                 hasExplicitReturn = false;
35652                 bindChildren(node);
35653                 node.flags &= ~2816;
35654                 if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) {
35655                     node.flags |= 256;
35656                     if (hasExplicitReturn)
35657                         node.flags |= 512;
35658                     node.endFlowNode = currentFlow;
35659                 }
35660                 if (node.kind === 303) {
35661                     node.flags |= emitFlags;
35662                     node.endFlowNode = currentFlow;
35663                 }
35664                 if (currentReturnTarget) {
35665                     addAntecedent(currentReturnTarget, currentFlow);
35666                     currentFlow = finishFlowLabel(currentReturnTarget);
35667                     if (node.kind === 170 || node.kind === 169 || (ts.isInJSFile(node) && (node.kind === 255 || node.kind === 212))) {
35668                         node.returnFlowNode = currentFlow;
35669                     }
35670                 }
35671                 if (!isIIFE) {
35672                     currentFlow = saveCurrentFlow;
35673                 }
35674                 currentBreakTarget = saveBreakTarget;
35675                 currentContinueTarget = saveContinueTarget;
35676                 currentReturnTarget = saveReturnTarget;
35677                 currentExceptionTarget = saveExceptionTarget;
35678                 activeLabelList = saveActiveLabelList;
35679                 hasExplicitReturn = saveHasExplicitReturn;
35680             }
35681             else if (containerFlags & 64) {
35682                 seenThisKeyword = false;
35683                 bindChildren(node);
35684                 node.flags = seenThisKeyword ? node.flags | 128 : node.flags & ~128;
35685             }
35686             else {
35687                 bindChildren(node);
35688             }
35689             container = saveContainer;
35690             thisParentContainer = saveThisParentContainer;
35691             blockScopeContainer = savedBlockScopeContainer;
35692         }
35693         function bindEachFunctionsFirst(nodes) {
35694             bindEach(nodes, function (n) { return n.kind === 255 ? bind(n) : undefined; });
35695             bindEach(nodes, function (n) { return n.kind !== 255 ? bind(n) : undefined; });
35696         }
35697         function bindEach(nodes, bindFunction) {
35698             if (bindFunction === void 0) { bindFunction = bind; }
35699             if (nodes === undefined) {
35700                 return;
35701             }
35702             ts.forEach(nodes, bindFunction);
35703         }
35704         function bindEachChild(node) {
35705             ts.forEachChild(node, bind, bindEach);
35706         }
35707         function bindChildren(node) {
35708             var saveInAssignmentPattern = inAssignmentPattern;
35709             inAssignmentPattern = false;
35710             if (checkUnreachable(node)) {
35711                 bindEachChild(node);
35712                 bindJSDoc(node);
35713                 inAssignmentPattern = saveInAssignmentPattern;
35714                 return;
35715             }
35716             if (node.kind >= 236 && node.kind <= 252 && !options.allowUnreachableCode) {
35717                 node.flowNode = currentFlow;
35718             }
35719             switch (node.kind) {
35720                 case 240:
35721                     bindWhileStatement(node);
35722                     break;
35723                 case 239:
35724                     bindDoStatement(node);
35725                     break;
35726                 case 241:
35727                     bindForStatement(node);
35728                     break;
35729                 case 242:
35730                 case 243:
35731                     bindForInOrForOfStatement(node);
35732                     break;
35733                 case 238:
35734                     bindIfStatement(node);
35735                     break;
35736                 case 246:
35737                 case 250:
35738                     bindReturnOrThrow(node);
35739                     break;
35740                 case 245:
35741                 case 244:
35742                     bindBreakOrContinueStatement(node);
35743                     break;
35744                 case 251:
35745                     bindTryStatement(node);
35746                     break;
35747                 case 248:
35748                     bindSwitchStatement(node);
35749                     break;
35750                 case 262:
35751                     bindCaseBlock(node);
35752                     break;
35753                 case 288:
35754                     bindCaseClause(node);
35755                     break;
35756                 case 237:
35757                     bindExpressionStatement(node);
35758                     break;
35759                 case 249:
35760                     bindLabeledStatement(node);
35761                     break;
35762                 case 218:
35763                     bindPrefixUnaryExpressionFlow(node);
35764                     break;
35765                 case 219:
35766                     bindPostfixUnaryExpressionFlow(node);
35767                     break;
35768                 case 220:
35769                     if (ts.isDestructuringAssignment(node)) {
35770                         inAssignmentPattern = saveInAssignmentPattern;
35771                         bindDestructuringAssignmentFlow(node);
35772                         return;
35773                     }
35774                     bindBinaryExpressionFlow(node);
35775                     break;
35776                 case 214:
35777                     bindDeleteExpressionFlow(node);
35778                     break;
35779                 case 221:
35780                     bindConditionalExpressionFlow(node);
35781                     break;
35782                 case 253:
35783                     bindVariableDeclarationFlow(node);
35784                     break;
35785                 case 205:
35786                 case 206:
35787                     bindAccessExpressionFlow(node);
35788                     break;
35789                 case 207:
35790                     bindCallExpressionFlow(node);
35791                     break;
35792                 case 229:
35793                     bindNonNullExpressionFlow(node);
35794                     break;
35795                 case 343:
35796                 case 336:
35797                 case 337:
35798                     bindJSDocTypeAlias(node);
35799                     break;
35800                 case 303: {
35801                     bindEachFunctionsFirst(node.statements);
35802                     bind(node.endOfFileToken);
35803                     break;
35804                 }
35805                 case 234:
35806                 case 261:
35807                     bindEachFunctionsFirst(node.statements);
35808                     break;
35809                 case 202:
35810                     bindBindingElementFlow(node);
35811                     break;
35812                 case 204:
35813                 case 203:
35814                 case 294:
35815                 case 224:
35816                     inAssignmentPattern = saveInAssignmentPattern;
35817                 default:
35818                     bindEachChild(node);
35819                     break;
35820             }
35821             bindJSDoc(node);
35822             inAssignmentPattern = saveInAssignmentPattern;
35823         }
35824         function isNarrowingExpression(expr) {
35825             switch (expr.kind) {
35826                 case 79:
35827                 case 80:
35828                 case 108:
35829                 case 205:
35830                 case 206:
35831                     return containsNarrowableReference(expr);
35832                 case 207:
35833                     return hasNarrowableArgument(expr);
35834                 case 211:
35835                 case 229:
35836                     return isNarrowingExpression(expr.expression);
35837                 case 220:
35838                     return isNarrowingBinaryExpression(expr);
35839                 case 218:
35840                     return expr.operator === 53 && isNarrowingExpression(expr.operand);
35841                 case 215:
35842                     return isNarrowingExpression(expr.expression);
35843             }
35844             return false;
35845         }
35846         function isNarrowableReference(expr) {
35847             return ts.isDottedName(expr)
35848                 || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
35849                 || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 && isNarrowableReference(expr.right)
35850                 || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
35851                 || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
35852         }
35853         function containsNarrowableReference(expr) {
35854             return isNarrowableReference(expr) || ts.isOptionalChain(expr) && containsNarrowableReference(expr.expression);
35855         }
35856         function hasNarrowableArgument(expr) {
35857             if (expr.arguments) {
35858                 for (var _i = 0, _a = expr.arguments; _i < _a.length; _i++) {
35859                     var argument = _a[_i];
35860                     if (containsNarrowableReference(argument)) {
35861                         return true;
35862                     }
35863                 }
35864             }
35865             if (expr.expression.kind === 205 &&
35866                 containsNarrowableReference(expr.expression.expression)) {
35867                 return true;
35868             }
35869             return false;
35870         }
35871         function isNarrowingTypeofOperands(expr1, expr2) {
35872             return ts.isTypeOfExpression(expr1) && isNarrowableOperand(expr1.expression) && ts.isStringLiteralLike(expr2);
35873         }
35874         function isNarrowingBinaryExpression(expr) {
35875             switch (expr.operatorToken.kind) {
35876                 case 63:
35877                 case 75:
35878                 case 76:
35879                 case 77:
35880                     return containsNarrowableReference(expr.left);
35881                 case 34:
35882                 case 35:
35883                 case 36:
35884                 case 37:
35885                     return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
35886                         isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
35887                 case 102:
35888                     return isNarrowableOperand(expr.left);
35889                 case 101:
35890                     return isNarrowingExpression(expr.right);
35891                 case 27:
35892                     return isNarrowingExpression(expr.right);
35893             }
35894             return false;
35895         }
35896         function isNarrowableOperand(expr) {
35897             switch (expr.kind) {
35898                 case 211:
35899                     return isNarrowableOperand(expr.expression);
35900                 case 220:
35901                     switch (expr.operatorToken.kind) {
35902                         case 63:
35903                             return isNarrowableOperand(expr.left);
35904                         case 27:
35905                             return isNarrowableOperand(expr.right);
35906                     }
35907             }
35908             return containsNarrowableReference(expr);
35909         }
35910         function createBranchLabel() {
35911             return initFlowNode({ flags: 4, antecedents: undefined });
35912         }
35913         function createLoopLabel() {
35914             return initFlowNode({ flags: 8, antecedents: undefined });
35915         }
35916         function createReduceLabel(target, antecedents, antecedent) {
35917             return initFlowNode({ flags: 1024, target: target, antecedents: antecedents, antecedent: antecedent });
35918         }
35919         function setFlowNodeReferenced(flow) {
35920             flow.flags |= flow.flags & 2048 ? 4096 : 2048;
35921         }
35922         function addAntecedent(label, antecedent) {
35923             if (!(antecedent.flags & 1) && !ts.contains(label.antecedents, antecedent)) {
35924                 (label.antecedents || (label.antecedents = [])).push(antecedent);
35925                 setFlowNodeReferenced(antecedent);
35926             }
35927         }
35928         function createFlowCondition(flags, antecedent, expression) {
35929             if (antecedent.flags & 1) {
35930                 return antecedent;
35931             }
35932             if (!expression) {
35933                 return flags & 32 ? antecedent : unreachableFlow;
35934             }
35935             if ((expression.kind === 110 && flags & 64 ||
35936                 expression.kind === 95 && flags & 32) &&
35937                 !ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
35938                 return unreachableFlow;
35939             }
35940             if (!isNarrowingExpression(expression)) {
35941                 return antecedent;
35942             }
35943             setFlowNodeReferenced(antecedent);
35944             return initFlowNode({ flags: flags, antecedent: antecedent, node: expression });
35945         }
35946         function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {
35947             setFlowNodeReferenced(antecedent);
35948             return initFlowNode({ flags: 128, antecedent: antecedent, switchStatement: switchStatement, clauseStart: clauseStart, clauseEnd: clauseEnd });
35949         }
35950         function createFlowMutation(flags, antecedent, node) {
35951             setFlowNodeReferenced(antecedent);
35952             var result = initFlowNode({ flags: flags, antecedent: antecedent, node: node });
35953             if (currentExceptionTarget) {
35954                 addAntecedent(currentExceptionTarget, result);
35955             }
35956             return result;
35957         }
35958         function createFlowCall(antecedent, node) {
35959             setFlowNodeReferenced(antecedent);
35960             return initFlowNode({ flags: 512, antecedent: antecedent, node: node });
35961         }
35962         function finishFlowLabel(flow) {
35963             var antecedents = flow.antecedents;
35964             if (!antecedents) {
35965                 return unreachableFlow;
35966             }
35967             if (antecedents.length === 1) {
35968                 return antecedents[0];
35969             }
35970             return flow;
35971         }
35972         function isStatementCondition(node) {
35973             var parent = node.parent;
35974             switch (parent.kind) {
35975                 case 238:
35976                 case 240:
35977                 case 239:
35978                     return parent.expression === node;
35979                 case 241:
35980                 case 221:
35981                     return parent.condition === node;
35982             }
35983             return false;
35984         }
35985         function isLogicalExpression(node) {
35986             while (true) {
35987                 if (node.kind === 211) {
35988                     node = node.expression;
35989                 }
35990                 else if (node.kind === 218 && node.operator === 53) {
35991                     node = node.operand;
35992                 }
35993                 else {
35994                     return node.kind === 220 && (node.operatorToken.kind === 55 ||
35995                         node.operatorToken.kind === 56 ||
35996                         node.operatorToken.kind === 60);
35997                 }
35998             }
35999         }
36000         function isLogicalAssignmentExpression(node) {
36001             node = ts.skipParentheses(node);
36002             return ts.isBinaryExpression(node) && ts.isLogicalOrCoalescingAssignmentOperator(node.operatorToken.kind);
36003         }
36004         function isTopLevelLogicalExpression(node) {
36005             while (ts.isParenthesizedExpression(node.parent) ||
36006                 ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 53) {
36007                 node = node.parent;
36008             }
36009             return !isStatementCondition(node) &&
36010                 !isLogicalAssignmentExpression(node.parent) &&
36011                 !isLogicalExpression(node.parent) &&
36012                 !(ts.isOptionalChain(node.parent) && node.parent.expression === node);
36013         }
36014         function doWithConditionalBranches(action, value, trueTarget, falseTarget) {
36015             var savedTrueTarget = currentTrueTarget;
36016             var savedFalseTarget = currentFalseTarget;
36017             currentTrueTarget = trueTarget;
36018             currentFalseTarget = falseTarget;
36019             action(value);
36020             currentTrueTarget = savedTrueTarget;
36021             currentFalseTarget = savedFalseTarget;
36022         }
36023         function bindCondition(node, trueTarget, falseTarget) {
36024             doWithConditionalBranches(bind, node, trueTarget, falseTarget);
36025             if (!node || !isLogicalAssignmentExpression(node) && !isLogicalExpression(node) && !(ts.isOptionalChain(node) && ts.isOutermostOptionalChain(node))) {
36026                 addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));
36027                 addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));
36028             }
36029         }
36030         function bindIterativeStatement(node, breakTarget, continueTarget) {
36031             var saveBreakTarget = currentBreakTarget;
36032             var saveContinueTarget = currentContinueTarget;
36033             currentBreakTarget = breakTarget;
36034             currentContinueTarget = continueTarget;
36035             bind(node);
36036             currentBreakTarget = saveBreakTarget;
36037             currentContinueTarget = saveContinueTarget;
36038         }
36039         function setContinueTarget(node, target) {
36040             var label = activeLabelList;
36041             while (label && node.parent.kind === 249) {
36042                 label.continueTarget = target;
36043                 label = label.next;
36044                 node = node.parent;
36045             }
36046             return target;
36047         }
36048         function bindWhileStatement(node) {
36049             var preWhileLabel = setContinueTarget(node, createLoopLabel());
36050             var preBodyLabel = createBranchLabel();
36051             var postWhileLabel = createBranchLabel();
36052             addAntecedent(preWhileLabel, currentFlow);
36053             currentFlow = preWhileLabel;
36054             bindCondition(node.expression, preBodyLabel, postWhileLabel);
36055             currentFlow = finishFlowLabel(preBodyLabel);
36056             bindIterativeStatement(node.statement, postWhileLabel, preWhileLabel);
36057             addAntecedent(preWhileLabel, currentFlow);
36058             currentFlow = finishFlowLabel(postWhileLabel);
36059         }
36060         function bindDoStatement(node) {
36061             var preDoLabel = createLoopLabel();
36062             var preConditionLabel = setContinueTarget(node, createBranchLabel());
36063             var postDoLabel = createBranchLabel();
36064             addAntecedent(preDoLabel, currentFlow);
36065             currentFlow = preDoLabel;
36066             bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);
36067             addAntecedent(preConditionLabel, currentFlow);
36068             currentFlow = finishFlowLabel(preConditionLabel);
36069             bindCondition(node.expression, preDoLabel, postDoLabel);
36070             currentFlow = finishFlowLabel(postDoLabel);
36071         }
36072         function bindForStatement(node) {
36073             var preLoopLabel = setContinueTarget(node, createLoopLabel());
36074             var preBodyLabel = createBranchLabel();
36075             var postLoopLabel = createBranchLabel();
36076             bind(node.initializer);
36077             addAntecedent(preLoopLabel, currentFlow);
36078             currentFlow = preLoopLabel;
36079             bindCondition(node.condition, preBodyLabel, postLoopLabel);
36080             currentFlow = finishFlowLabel(preBodyLabel);
36081             bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
36082             bind(node.incrementor);
36083             addAntecedent(preLoopLabel, currentFlow);
36084             currentFlow = finishFlowLabel(postLoopLabel);
36085         }
36086         function bindForInOrForOfStatement(node) {
36087             var preLoopLabel = setContinueTarget(node, createLoopLabel());
36088             var postLoopLabel = createBranchLabel();
36089             bind(node.expression);
36090             addAntecedent(preLoopLabel, currentFlow);
36091             currentFlow = preLoopLabel;
36092             if (node.kind === 243) {
36093                 bind(node.awaitModifier);
36094             }
36095             addAntecedent(postLoopLabel, currentFlow);
36096             bind(node.initializer);
36097             if (node.initializer.kind !== 254) {
36098                 bindAssignmentTargetFlow(node.initializer);
36099             }
36100             bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
36101             addAntecedent(preLoopLabel, currentFlow);
36102             currentFlow = finishFlowLabel(postLoopLabel);
36103         }
36104         function bindIfStatement(node) {
36105             var thenLabel = createBranchLabel();
36106             var elseLabel = createBranchLabel();
36107             var postIfLabel = createBranchLabel();
36108             bindCondition(node.expression, thenLabel, elseLabel);
36109             currentFlow = finishFlowLabel(thenLabel);
36110             bind(node.thenStatement);
36111             addAntecedent(postIfLabel, currentFlow);
36112             currentFlow = finishFlowLabel(elseLabel);
36113             bind(node.elseStatement);
36114             addAntecedent(postIfLabel, currentFlow);
36115             currentFlow = finishFlowLabel(postIfLabel);
36116         }
36117         function bindReturnOrThrow(node) {
36118             bind(node.expression);
36119             if (node.kind === 246) {
36120                 hasExplicitReturn = true;
36121                 if (currentReturnTarget) {
36122                     addAntecedent(currentReturnTarget, currentFlow);
36123                 }
36124             }
36125             currentFlow = unreachableFlow;
36126         }
36127         function findActiveLabel(name) {
36128             for (var label = activeLabelList; label; label = label.next) {
36129                 if (label.name === name) {
36130                     return label;
36131                 }
36132             }
36133             return undefined;
36134         }
36135         function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
36136             var flowLabel = node.kind === 245 ? breakTarget : continueTarget;
36137             if (flowLabel) {
36138                 addAntecedent(flowLabel, currentFlow);
36139                 currentFlow = unreachableFlow;
36140             }
36141         }
36142         function bindBreakOrContinueStatement(node) {
36143             bind(node.label);
36144             if (node.label) {
36145                 var activeLabel = findActiveLabel(node.label.escapedText);
36146                 if (activeLabel) {
36147                     activeLabel.referenced = true;
36148                     bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget);
36149                 }
36150             }
36151             else {
36152                 bindBreakOrContinueFlow(node, currentBreakTarget, currentContinueTarget);
36153             }
36154         }
36155         function bindTryStatement(node) {
36156             var saveReturnTarget = currentReturnTarget;
36157             var saveExceptionTarget = currentExceptionTarget;
36158             var normalExitLabel = createBranchLabel();
36159             var returnLabel = createBranchLabel();
36160             var exceptionLabel = createBranchLabel();
36161             if (node.finallyBlock) {
36162                 currentReturnTarget = returnLabel;
36163             }
36164             addAntecedent(exceptionLabel, currentFlow);
36165             currentExceptionTarget = exceptionLabel;
36166             bind(node.tryBlock);
36167             addAntecedent(normalExitLabel, currentFlow);
36168             if (node.catchClause) {
36169                 currentFlow = finishFlowLabel(exceptionLabel);
36170                 exceptionLabel = createBranchLabel();
36171                 addAntecedent(exceptionLabel, currentFlow);
36172                 currentExceptionTarget = exceptionLabel;
36173                 bind(node.catchClause);
36174                 addAntecedent(normalExitLabel, currentFlow);
36175             }
36176             currentReturnTarget = saveReturnTarget;
36177             currentExceptionTarget = saveExceptionTarget;
36178             if (node.finallyBlock) {
36179                 var finallyLabel = createBranchLabel();
36180                 finallyLabel.antecedents = ts.concatenate(ts.concatenate(normalExitLabel.antecedents, exceptionLabel.antecedents), returnLabel.antecedents);
36181                 currentFlow = finallyLabel;
36182                 bind(node.finallyBlock);
36183                 if (currentFlow.flags & 1) {
36184                     currentFlow = unreachableFlow;
36185                 }
36186                 else {
36187                     if (currentReturnTarget && returnLabel.antecedents) {
36188                         addAntecedent(currentReturnTarget, createReduceLabel(finallyLabel, returnLabel.antecedents, currentFlow));
36189                     }
36190                     if (currentExceptionTarget && exceptionLabel.antecedents) {
36191                         addAntecedent(currentExceptionTarget, createReduceLabel(finallyLabel, exceptionLabel.antecedents, currentFlow));
36192                     }
36193                     currentFlow = normalExitLabel.antecedents ? createReduceLabel(finallyLabel, normalExitLabel.antecedents, currentFlow) : unreachableFlow;
36194                 }
36195             }
36196             else {
36197                 currentFlow = finishFlowLabel(normalExitLabel);
36198             }
36199         }
36200         function bindSwitchStatement(node) {
36201             var postSwitchLabel = createBranchLabel();
36202             bind(node.expression);
36203             var saveBreakTarget = currentBreakTarget;
36204             var savePreSwitchCaseFlow = preSwitchCaseFlow;
36205             currentBreakTarget = postSwitchLabel;
36206             preSwitchCaseFlow = currentFlow;
36207             bind(node.caseBlock);
36208             addAntecedent(postSwitchLabel, currentFlow);
36209             var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 289; });
36210             node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
36211             if (!hasDefault) {
36212                 addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));
36213             }
36214             currentBreakTarget = saveBreakTarget;
36215             preSwitchCaseFlow = savePreSwitchCaseFlow;
36216             currentFlow = finishFlowLabel(postSwitchLabel);
36217         }
36218         function bindCaseBlock(node) {
36219             var clauses = node.clauses;
36220             var isNarrowingSwitch = isNarrowingExpression(node.parent.expression);
36221             var fallthroughFlow = unreachableFlow;
36222             for (var i = 0; i < clauses.length; i++) {
36223                 var clauseStart = i;
36224                 while (!clauses[i].statements.length && i + 1 < clauses.length) {
36225                     bind(clauses[i]);
36226                     i++;
36227                 }
36228                 var preCaseLabel = createBranchLabel();
36229                 addAntecedent(preCaseLabel, isNarrowingSwitch ? createFlowSwitchClause(preSwitchCaseFlow, node.parent, clauseStart, i + 1) : preSwitchCaseFlow);
36230                 addAntecedent(preCaseLabel, fallthroughFlow);
36231                 currentFlow = finishFlowLabel(preCaseLabel);
36232                 var clause = clauses[i];
36233                 bind(clause);
36234                 fallthroughFlow = currentFlow;
36235                 if (!(currentFlow.flags & 1) && i !== clauses.length - 1 && options.noFallthroughCasesInSwitch) {
36236                     clause.fallthroughFlowNode = currentFlow;
36237                 }
36238             }
36239         }
36240         function bindCaseClause(node) {
36241             var saveCurrentFlow = currentFlow;
36242             currentFlow = preSwitchCaseFlow;
36243             bind(node.expression);
36244             currentFlow = saveCurrentFlow;
36245             bindEach(node.statements);
36246         }
36247         function bindExpressionStatement(node) {
36248             bind(node.expression);
36249             maybeBindExpressionFlowIfCall(node.expression);
36250         }
36251         function maybeBindExpressionFlowIfCall(node) {
36252             if (node.kind === 207) {
36253                 var call = node;
36254                 if (call.expression.kind !== 106 && ts.isDottedName(call.expression)) {
36255                     currentFlow = createFlowCall(currentFlow, call);
36256                 }
36257             }
36258         }
36259         function bindLabeledStatement(node) {
36260             var postStatementLabel = createBranchLabel();
36261             activeLabelList = {
36262                 next: activeLabelList,
36263                 name: node.label.escapedText,
36264                 breakTarget: postStatementLabel,
36265                 continueTarget: undefined,
36266                 referenced: false
36267             };
36268             bind(node.label);
36269             bind(node.statement);
36270             if (!activeLabelList.referenced && !options.allowUnusedLabels) {
36271                 errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
36272             }
36273             activeLabelList = activeLabelList.next;
36274             addAntecedent(postStatementLabel, currentFlow);
36275             currentFlow = finishFlowLabel(postStatementLabel);
36276         }
36277         function bindDestructuringTargetFlow(node) {
36278             if (node.kind === 220 && node.operatorToken.kind === 63) {
36279                 bindAssignmentTargetFlow(node.left);
36280             }
36281             else {
36282                 bindAssignmentTargetFlow(node);
36283             }
36284         }
36285         function bindAssignmentTargetFlow(node) {
36286             if (isNarrowableReference(node)) {
36287                 currentFlow = createFlowMutation(16, currentFlow, node);
36288             }
36289             else if (node.kind === 203) {
36290                 for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
36291                     var e = _a[_i];
36292                     if (e.kind === 224) {
36293                         bindAssignmentTargetFlow(e.expression);
36294                     }
36295                     else {
36296                         bindDestructuringTargetFlow(e);
36297                     }
36298                 }
36299             }
36300             else if (node.kind === 204) {
36301                 for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
36302                     var p = _c[_b];
36303                     if (p.kind === 294) {
36304                         bindDestructuringTargetFlow(p.initializer);
36305                     }
36306                     else if (p.kind === 295) {
36307                         bindAssignmentTargetFlow(p.name);
36308                     }
36309                     else if (p.kind === 296) {
36310                         bindAssignmentTargetFlow(p.expression);
36311                     }
36312                 }
36313             }
36314         }
36315         function bindLogicalLikeExpression(node, trueTarget, falseTarget) {
36316             var preRightLabel = createBranchLabel();
36317             if (node.operatorToken.kind === 55 || node.operatorToken.kind === 76) {
36318                 bindCondition(node.left, preRightLabel, falseTarget);
36319             }
36320             else {
36321                 bindCondition(node.left, trueTarget, preRightLabel);
36322             }
36323             currentFlow = finishFlowLabel(preRightLabel);
36324             bind(node.operatorToken);
36325             if (ts.isLogicalOrCoalescingAssignmentOperator(node.operatorToken.kind)) {
36326                 doWithConditionalBranches(bind, node.right, trueTarget, falseTarget);
36327                 bindAssignmentTargetFlow(node.left);
36328                 addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));
36329                 addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));
36330             }
36331             else {
36332                 bindCondition(node.right, trueTarget, falseTarget);
36333             }
36334         }
36335         function bindPrefixUnaryExpressionFlow(node) {
36336             if (node.operator === 53) {
36337                 var saveTrueTarget = currentTrueTarget;
36338                 currentTrueTarget = currentFalseTarget;
36339                 currentFalseTarget = saveTrueTarget;
36340                 bindEachChild(node);
36341                 currentFalseTarget = currentTrueTarget;
36342                 currentTrueTarget = saveTrueTarget;
36343             }
36344             else {
36345                 bindEachChild(node);
36346                 if (node.operator === 45 || node.operator === 46) {
36347                     bindAssignmentTargetFlow(node.operand);
36348                 }
36349             }
36350         }
36351         function bindPostfixUnaryExpressionFlow(node) {
36352             bindEachChild(node);
36353             if (node.operator === 45 || node.operator === 46) {
36354                 bindAssignmentTargetFlow(node.operand);
36355             }
36356         }
36357         function bindDestructuringAssignmentFlow(node) {
36358             if (inAssignmentPattern) {
36359                 inAssignmentPattern = false;
36360                 bind(node.operatorToken);
36361                 bind(node.right);
36362                 inAssignmentPattern = true;
36363                 bind(node.left);
36364             }
36365             else {
36366                 inAssignmentPattern = true;
36367                 bind(node.left);
36368                 inAssignmentPattern = false;
36369                 bind(node.operatorToken);
36370                 bind(node.right);
36371             }
36372             bindAssignmentTargetFlow(node.left);
36373         }
36374         function createBindBinaryExpressionFlow() {
36375             return ts.createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, undefined);
36376             function onEnter(node, state) {
36377                 if (state) {
36378                     state.stackIndex++;
36379                     ts.setParent(node, parent);
36380                     var saveInStrictMode = inStrictMode;
36381                     bindWorker(node);
36382                     var saveParent = parent;
36383                     parent = node;
36384                     state.skip = false;
36385                     state.inStrictModeStack[state.stackIndex] = saveInStrictMode;
36386                     state.parentStack[state.stackIndex] = saveParent;
36387                 }
36388                 else {
36389                     state = {
36390                         stackIndex: 0,
36391                         skip: false,
36392                         inStrictModeStack: [undefined],
36393                         parentStack: [undefined]
36394                     };
36395                 }
36396                 var operator = node.operatorToken.kind;
36397                 if (operator === 55 ||
36398                     operator === 56 ||
36399                     operator === 60 ||
36400                     ts.isLogicalOrCoalescingAssignmentOperator(operator)) {
36401                     if (isTopLevelLogicalExpression(node)) {
36402                         var postExpressionLabel = createBranchLabel();
36403                         bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel);
36404                         currentFlow = finishFlowLabel(postExpressionLabel);
36405                     }
36406                     else {
36407                         bindLogicalLikeExpression(node, currentTrueTarget, currentFalseTarget);
36408                     }
36409                     state.skip = true;
36410                 }
36411                 return state;
36412             }
36413             function onLeft(left, state, _node) {
36414                 if (!state.skip) {
36415                     return maybeBind(left);
36416                 }
36417             }
36418             function onOperator(operatorToken, state, node) {
36419                 if (!state.skip) {
36420                     if (operatorToken.kind === 27) {
36421                         maybeBindExpressionFlowIfCall(node.left);
36422                     }
36423                     bind(operatorToken);
36424                 }
36425             }
36426             function onRight(right, state, _node) {
36427                 if (!state.skip) {
36428                     return maybeBind(right);
36429                 }
36430             }
36431             function onExit(node, state) {
36432                 if (!state.skip) {
36433                     var operator = node.operatorToken.kind;
36434                     if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
36435                         bindAssignmentTargetFlow(node.left);
36436                         if (operator === 63 && node.left.kind === 206) {
36437                             var elementAccess = node.left;
36438                             if (isNarrowableOperand(elementAccess.expression)) {
36439                                 currentFlow = createFlowMutation(256, currentFlow, node);
36440                             }
36441                         }
36442                     }
36443                 }
36444                 var savedInStrictMode = state.inStrictModeStack[state.stackIndex];
36445                 var savedParent = state.parentStack[state.stackIndex];
36446                 if (savedInStrictMode !== undefined) {
36447                     inStrictMode = savedInStrictMode;
36448                 }
36449                 if (savedParent !== undefined) {
36450                     parent = savedParent;
36451                 }
36452                 state.skip = false;
36453                 state.stackIndex--;
36454             }
36455             function maybeBind(node) {
36456                 if (node && ts.isBinaryExpression(node) && !ts.isDestructuringAssignment(node)) {
36457                     return node;
36458                 }
36459                 bind(node);
36460             }
36461         }
36462         function bindDeleteExpressionFlow(node) {
36463             bindEachChild(node);
36464             if (node.expression.kind === 205) {
36465                 bindAssignmentTargetFlow(node.expression);
36466             }
36467         }
36468         function bindConditionalExpressionFlow(node) {
36469             var trueLabel = createBranchLabel();
36470             var falseLabel = createBranchLabel();
36471             var postExpressionLabel = createBranchLabel();
36472             bindCondition(node.condition, trueLabel, falseLabel);
36473             currentFlow = finishFlowLabel(trueLabel);
36474             bind(node.questionToken);
36475             bind(node.whenTrue);
36476             addAntecedent(postExpressionLabel, currentFlow);
36477             currentFlow = finishFlowLabel(falseLabel);
36478             bind(node.colonToken);
36479             bind(node.whenFalse);
36480             addAntecedent(postExpressionLabel, currentFlow);
36481             currentFlow = finishFlowLabel(postExpressionLabel);
36482         }
36483         function bindInitializedVariableFlow(node) {
36484             var name = !ts.isOmittedExpression(node) ? node.name : undefined;
36485             if (ts.isBindingPattern(name)) {
36486                 for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
36487                     var child = _a[_i];
36488                     bindInitializedVariableFlow(child);
36489                 }
36490             }
36491             else {
36492                 currentFlow = createFlowMutation(16, currentFlow, node);
36493             }
36494         }
36495         function bindVariableDeclarationFlow(node) {
36496             bindEachChild(node);
36497             if (node.initializer || ts.isForInOrOfStatement(node.parent.parent)) {
36498                 bindInitializedVariableFlow(node);
36499             }
36500         }
36501         function bindBindingElementFlow(node) {
36502             if (ts.isBindingPattern(node.name)) {
36503                 bindEach(node.decorators);
36504                 bindEach(node.modifiers);
36505                 bind(node.dotDotDotToken);
36506                 bind(node.propertyName);
36507                 bind(node.initializer);
36508                 bind(node.name);
36509             }
36510             else {
36511                 bindEachChild(node);
36512             }
36513         }
36514         function bindJSDocTypeAlias(node) {
36515             bind(node.tagName);
36516             if (node.kind !== 337 && node.fullName) {
36517                 ts.setParent(node.fullName, node);
36518                 ts.setParentRecursive(node.fullName, false);
36519             }
36520             if (typeof node.comment !== "string") {
36521                 bindEach(node.comment);
36522             }
36523         }
36524         function bindJSDocClassTag(node) {
36525             bindEachChild(node);
36526             var host = ts.getHostSignatureFromJSDoc(node);
36527             if (host && host.kind !== 168) {
36528                 addDeclarationToSymbol(host.symbol, host, 32);
36529             }
36530         }
36531         function bindOptionalExpression(node, trueTarget, falseTarget) {
36532             doWithConditionalBranches(bind, node, trueTarget, falseTarget);
36533             if (!ts.isOptionalChain(node) || ts.isOutermostOptionalChain(node)) {
36534                 addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));
36535                 addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));
36536             }
36537         }
36538         function bindOptionalChainRest(node) {
36539             switch (node.kind) {
36540                 case 205:
36541                     bind(node.questionDotToken);
36542                     bind(node.name);
36543                     break;
36544                 case 206:
36545                     bind(node.questionDotToken);
36546                     bind(node.argumentExpression);
36547                     break;
36548                 case 207:
36549                     bind(node.questionDotToken);
36550                     bindEach(node.typeArguments);
36551                     bindEach(node.arguments);
36552                     break;
36553             }
36554         }
36555         function bindOptionalChain(node, trueTarget, falseTarget) {
36556             var preChainLabel = ts.isOptionalChainRoot(node) ? createBranchLabel() : undefined;
36557             bindOptionalExpression(node.expression, preChainLabel || trueTarget, falseTarget);
36558             if (preChainLabel) {
36559                 currentFlow = finishFlowLabel(preChainLabel);
36560             }
36561             doWithConditionalBranches(bindOptionalChainRest, node, trueTarget, falseTarget);
36562             if (ts.isOutermostOptionalChain(node)) {
36563                 addAntecedent(trueTarget, createFlowCondition(32, currentFlow, node));
36564                 addAntecedent(falseTarget, createFlowCondition(64, currentFlow, node));
36565             }
36566         }
36567         function bindOptionalChainFlow(node) {
36568             if (isTopLevelLogicalExpression(node)) {
36569                 var postExpressionLabel = createBranchLabel();
36570                 bindOptionalChain(node, postExpressionLabel, postExpressionLabel);
36571                 currentFlow = finishFlowLabel(postExpressionLabel);
36572             }
36573             else {
36574                 bindOptionalChain(node, currentTrueTarget, currentFalseTarget);
36575             }
36576         }
36577         function bindNonNullExpressionFlow(node) {
36578             if (ts.isOptionalChain(node)) {
36579                 bindOptionalChainFlow(node);
36580             }
36581             else {
36582                 bindEachChild(node);
36583             }
36584         }
36585         function bindAccessExpressionFlow(node) {
36586             if (ts.isOptionalChain(node)) {
36587                 bindOptionalChainFlow(node);
36588             }
36589             else {
36590                 bindEachChild(node);
36591             }
36592         }
36593         function bindCallExpressionFlow(node) {
36594             if (ts.isOptionalChain(node)) {
36595                 bindOptionalChainFlow(node);
36596             }
36597             else {
36598                 var expr = ts.skipParentheses(node.expression);
36599                 if (expr.kind === 212 || expr.kind === 213) {
36600                     bindEach(node.typeArguments);
36601                     bindEach(node.arguments);
36602                     bind(node.expression);
36603                 }
36604                 else {
36605                     bindEachChild(node);
36606                     if (node.expression.kind === 106) {
36607                         currentFlow = createFlowCall(currentFlow, node);
36608                     }
36609                 }
36610             }
36611             if (node.expression.kind === 205) {
36612                 var propertyAccess = node.expression;
36613                 if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
36614                     currentFlow = createFlowMutation(256, currentFlow, node);
36615                 }
36616             }
36617         }
36618         function getContainerFlags(node) {
36619             switch (node.kind) {
36620                 case 225:
36621                 case 256:
36622                 case 259:
36623                 case 204:
36624                 case 181:
36625                 case 320:
36626                 case 285:
36627                     return 1;
36628                 case 257:
36629                     return 1 | 64;
36630                 case 260:
36631                 case 258:
36632                 case 194:
36633                     return 1 | 32;
36634                 case 303:
36635                     return 1 | 4 | 32;
36636                 case 171:
36637                 case 172:
36638                 case 168:
36639                     if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
36640                         return 1 | 4 | 32 | 8 | 128;
36641                     }
36642                 case 170:
36643                 case 255:
36644                 case 167:
36645                 case 173:
36646                 case 321:
36647                 case 315:
36648                 case 178:
36649                 case 174:
36650                 case 175:
36651                 case 179:
36652                 case 169:
36653                     return 1 | 4 | 32 | 8;
36654                 case 212:
36655                 case 213:
36656                     return 1 | 4 | 32 | 8 | 16;
36657                 case 261:
36658                     return 4;
36659                 case 166:
36660                     return node.initializer ? 4 : 0;
36661                 case 291:
36662                 case 241:
36663                 case 242:
36664                 case 243:
36665                 case 262:
36666                     return 2;
36667                 case 234:
36668                     return ts.isFunctionLike(node.parent) || ts.isClassStaticBlockDeclaration(node.parent) ? 0 : 2;
36669             }
36670             return 0;
36671         }
36672         function addToContainerChain(next) {
36673             if (lastContainer) {
36674                 lastContainer.nextContainer = next;
36675             }
36676             lastContainer = next;
36677         }
36678         function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
36679             switch (container.kind) {
36680                 case 260:
36681                     return declareModuleMember(node, symbolFlags, symbolExcludes);
36682                 case 303:
36683                     return declareSourceFileMember(node, symbolFlags, symbolExcludes);
36684                 case 225:
36685                 case 256:
36686                     return declareClassMember(node, symbolFlags, symbolExcludes);
36687                 case 259:
36688                     return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
36689                 case 181:
36690                 case 320:
36691                 case 204:
36692                 case 257:
36693                 case 285:
36694                     return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
36695                 case 178:
36696                 case 179:
36697                 case 173:
36698                 case 174:
36699                 case 321:
36700                 case 175:
36701                 case 168:
36702                 case 167:
36703                 case 170:
36704                 case 171:
36705                 case 172:
36706                 case 255:
36707                 case 212:
36708                 case 213:
36709                 case 315:
36710                 case 343:
36711                 case 336:
36712                 case 169:
36713                 case 258:
36714                 case 194:
36715                     return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
36716             }
36717         }
36718         function declareClassMember(node, symbolFlags, symbolExcludes) {
36719             return ts.isStatic(node)
36720                 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)
36721                 : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
36722         }
36723         function declareSourceFileMember(node, symbolFlags, symbolExcludes) {
36724             return ts.isExternalModule(file)
36725                 ? declareModuleMember(node, symbolFlags, symbolExcludes)
36726                 : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);
36727         }
36728         function hasExportDeclarations(node) {
36729             var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
36730             return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
36731         }
36732         function setExportContextFlag(node) {
36733             if (node.flags & 8388608 && !hasExportDeclarations(node)) {
36734                 node.flags |= 64;
36735             }
36736             else {
36737                 node.flags &= ~64;
36738             }
36739         }
36740         function bindModuleDeclaration(node) {
36741             setExportContextFlag(node);
36742             if (ts.isAmbientModule(node)) {
36743                 if (ts.hasSyntacticModifier(node, 1)) {
36744                     errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
36745                 }
36746                 if (ts.isModuleAugmentationExternal(node)) {
36747                     declareModuleSymbol(node);
36748                 }
36749                 else {
36750                     var pattern = void 0;
36751                     if (node.name.kind === 10) {
36752                         var text = node.name.text;
36753                         pattern = ts.tryParsePattern(text);
36754                         if (pattern === undefined) {
36755                             errorOnFirstToken(node.name, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, text);
36756                         }
36757                     }
36758                     var symbol = declareSymbolAndAddToSymbolTable(node, 512, 110735);
36759                     file.patternAmbientModules = ts.append(file.patternAmbientModules, pattern && !ts.isString(pattern) ? { pattern: pattern, symbol: symbol } : undefined);
36760                 }
36761             }
36762             else {
36763                 var state = declareModuleSymbol(node);
36764                 if (state !== 0) {
36765                     var symbol = node.symbol;
36766                     symbol.constEnumOnlyModule = (!(symbol.flags & (16 | 32 | 256)))
36767                         && state === 2
36768                         && symbol.constEnumOnlyModule !== false;
36769                 }
36770             }
36771         }
36772         function declareModuleSymbol(node) {
36773             var state = getModuleInstanceState(node);
36774             var instantiated = state !== 0;
36775             declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 110735 : 0);
36776             return state;
36777         }
36778         function bindFunctionOrConstructorType(node) {
36779             var symbol = createSymbol(131072, getDeclarationName(node));
36780             addDeclarationToSymbol(symbol, node, 131072);
36781             var typeLiteralSymbol = createSymbol(2048, "__type");
36782             addDeclarationToSymbol(typeLiteralSymbol, node, 2048);
36783             typeLiteralSymbol.members = ts.createSymbolTable();
36784             typeLiteralSymbol.members.set(symbol.escapedName, symbol);
36785         }
36786         function bindObjectLiteralExpression(node) {
36787             if (inStrictMode && !ts.isAssignmentTarget(node)) {
36788                 var seen = new ts.Map();
36789                 for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
36790                     var prop = _a[_i];
36791                     if (prop.kind === 296 || prop.name.kind !== 79) {
36792                         continue;
36793                     }
36794                     var identifier = prop.name;
36795                     var currentKind = prop.kind === 294 || prop.kind === 295 || prop.kind === 168
36796                         ? 1
36797                         : 2;
36798                     var existingKind = seen.get(identifier.escapedText);
36799                     if (!existingKind) {
36800                         seen.set(identifier.escapedText, currentKind);
36801                         continue;
36802                     }
36803                     if (currentKind === 1 && existingKind === 1) {
36804                         var span = ts.getErrorSpanForNode(file, identifier);
36805                         file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode));
36806                     }
36807                 }
36808             }
36809             return bindAnonymousDeclaration(node, 4096, "__object");
36810         }
36811         function bindJsxAttributes(node) {
36812             return bindAnonymousDeclaration(node, 4096, "__jsxAttributes");
36813         }
36814         function bindJsxAttribute(node, symbolFlags, symbolExcludes) {
36815             return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
36816         }
36817         function bindAnonymousDeclaration(node, symbolFlags, name) {
36818             var symbol = createSymbol(symbolFlags, name);
36819             if (symbolFlags & (8 | 106500)) {
36820                 symbol.parent = container.symbol;
36821             }
36822             addDeclarationToSymbol(symbol, node, symbolFlags);
36823             return symbol;
36824         }
36825         function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
36826             switch (blockScopeContainer.kind) {
36827                 case 260:
36828                     declareModuleMember(node, symbolFlags, symbolExcludes);
36829                     break;
36830                 case 303:
36831                     if (ts.isExternalOrCommonJsModule(container)) {
36832                         declareModuleMember(node, symbolFlags, symbolExcludes);
36833                         break;
36834                     }
36835                 default:
36836                     if (!blockScopeContainer.locals) {
36837                         blockScopeContainer.locals = ts.createSymbolTable();
36838                         addToContainerChain(blockScopeContainer);
36839                     }
36840                     declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes);
36841             }
36842         }
36843         function delayedBindJSDocTypedefTag() {
36844             if (!delayedTypeAliases) {
36845                 return;
36846             }
36847             var saveContainer = container;
36848             var saveLastContainer = lastContainer;
36849             var saveBlockScopeContainer = blockScopeContainer;
36850             var saveParent = parent;
36851             var saveCurrentFlow = currentFlow;
36852             for (var _i = 0, delayedTypeAliases_1 = delayedTypeAliases; _i < delayedTypeAliases_1.length; _i++) {
36853                 var typeAlias = delayedTypeAliases_1[_i];
36854                 var host = typeAlias.parent.parent;
36855                 container = ts.findAncestor(host.parent, function (n) { return !!(getContainerFlags(n) & 1); }) || file;
36856                 blockScopeContainer = ts.getEnclosingBlockScopeContainer(host) || file;
36857                 currentFlow = initFlowNode({ flags: 2 });
36858                 parent = typeAlias;
36859                 bind(typeAlias.typeExpression);
36860                 var declName = ts.getNameOfDeclaration(typeAlias);
36861                 if ((ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName) && declName && ts.isPropertyAccessEntityNameExpression(declName.parent)) {
36862                     var isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
36863                     if (isTopLevel) {
36864                         bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }), false);
36865                         var oldContainer = container;
36866                         switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
36867                             case 1:
36868                             case 2:
36869                                 if (!ts.isExternalOrCommonJsModule(file)) {
36870                                     container = undefined;
36871                                 }
36872                                 else {
36873                                     container = file;
36874                                 }
36875                                 break;
36876                             case 4:
36877                                 container = declName.parent.expression;
36878                                 break;
36879                             case 3:
36880                                 container = declName.parent.expression.name;
36881                                 break;
36882                             case 5:
36883                                 container = isExportsOrModuleExportsOrAlias(file, declName.parent.expression) ? file
36884                                     : ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name
36885                                         : declName.parent.expression;
36886                                 break;
36887                             case 0:
36888                                 return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
36889                         }
36890                         if (container) {
36891                             declareModuleMember(typeAlias, 524288, 788968);
36892                         }
36893                         container = oldContainer;
36894                     }
36895                 }
36896                 else if (ts.isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 79) {
36897                     parent = typeAlias.parent;
36898                     bindBlockScopedDeclaration(typeAlias, 524288, 788968);
36899                 }
36900                 else {
36901                     bind(typeAlias.fullName);
36902                 }
36903             }
36904             container = saveContainer;
36905             lastContainer = saveLastContainer;
36906             blockScopeContainer = saveBlockScopeContainer;
36907             parent = saveParent;
36908             currentFlow = saveCurrentFlow;
36909         }
36910         function checkContextualIdentifier(node) {
36911             if (!file.parseDiagnostics.length &&
36912                 !(node.flags & 8388608) &&
36913                 !(node.flags & 4194304) &&
36914                 !ts.isIdentifierName(node)) {
36915                 if (inStrictMode &&
36916                     node.originalKeywordKind >= 117 &&
36917                     node.originalKeywordKind <= 125) {
36918                     file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
36919                 }
36920                 else if (node.originalKeywordKind === 132) {
36921                     if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) {
36922                         file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node)));
36923                     }
36924                     else if (node.flags & 32768) {
36925                         file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, ts.declarationNameToString(node)));
36926                     }
36927                 }
36928                 else if (node.originalKeywordKind === 125 && node.flags & 8192) {
36929                     file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, ts.declarationNameToString(node)));
36930                 }
36931             }
36932         }
36933         function getStrictModeIdentifierMessage(node) {
36934             if (ts.getContainingClass(node)) {
36935                 return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
36936             }
36937             if (file.externalModuleIndicator) {
36938                 return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode;
36939             }
36940             return ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode;
36941         }
36942         function checkPrivateIdentifier(node) {
36943             if (node.escapedText === "#constructor") {
36944                 if (!file.parseDiagnostics.length) {
36945                     file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.constructor_is_a_reserved_word, ts.declarationNameToString(node)));
36946                 }
36947             }
36948         }
36949         function checkStrictModeBinaryExpression(node) {
36950             if (inStrictMode && ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) {
36951                 checkStrictModeEvalOrArguments(node, node.left);
36952             }
36953         }
36954         function checkStrictModeCatchClause(node) {
36955             if (inStrictMode && node.variableDeclaration) {
36956                 checkStrictModeEvalOrArguments(node, node.variableDeclaration.name);
36957             }
36958         }
36959         function checkStrictModeDeleteExpression(node) {
36960             if (inStrictMode && node.expression.kind === 79) {
36961                 var span = ts.getErrorSpanForNode(file, node.expression);
36962                 file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));
36963             }
36964         }
36965         function isEvalOrArgumentsIdentifier(node) {
36966             return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
36967         }
36968         function checkStrictModeEvalOrArguments(contextNode, name) {
36969             if (name && name.kind === 79) {
36970                 var identifier = name;
36971                 if (isEvalOrArgumentsIdentifier(identifier)) {
36972                     var span = ts.getErrorSpanForNode(file, name);
36973                     file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), ts.idText(identifier)));
36974                 }
36975             }
36976         }
36977         function getStrictModeEvalOrArgumentsMessage(node) {
36978             if (ts.getContainingClass(node)) {
36979                 return ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode;
36980             }
36981             if (file.externalModuleIndicator) {
36982                 return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode;
36983             }
36984             return ts.Diagnostics.Invalid_use_of_0_in_strict_mode;
36985         }
36986         function checkStrictModeFunctionName(node) {
36987             if (inStrictMode) {
36988                 checkStrictModeEvalOrArguments(node, node.name);
36989             }
36990         }
36991         function getStrictModeBlockScopeFunctionDeclarationMessage(node) {
36992             if (ts.getContainingClass(node)) {
36993                 return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode;
36994             }
36995             if (file.externalModuleIndicator) {
36996                 return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode;
36997             }
36998             return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5;
36999         }
37000         function checkStrictModeFunctionDeclaration(node) {
37001             if (languageVersion < 2) {
37002                 if (blockScopeContainer.kind !== 303 &&
37003                     blockScopeContainer.kind !== 260 &&
37004                     !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) {
37005                     var errorSpan = ts.getErrorSpanForNode(file, node);
37006                     file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
37007                 }
37008             }
37009         }
37010         function checkStrictModeNumericLiteral(node) {
37011             if (inStrictMode && node.numericLiteralFlags & 32) {
37012                 file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode));
37013             }
37014         }
37015         function checkStrictModePostfixUnaryExpression(node) {
37016             if (inStrictMode) {
37017                 checkStrictModeEvalOrArguments(node, node.operand);
37018             }
37019         }
37020         function checkStrictModePrefixUnaryExpression(node) {
37021             if (inStrictMode) {
37022                 if (node.operator === 45 || node.operator === 46) {
37023                     checkStrictModeEvalOrArguments(node, node.operand);
37024                 }
37025             }
37026         }
37027         function checkStrictModeWithStatement(node) {
37028             if (inStrictMode) {
37029                 errorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode);
37030             }
37031         }
37032         function checkStrictModeLabeledStatement(node) {
37033             if (inStrictMode && ts.getEmitScriptTarget(options) >= 2) {
37034                 if (ts.isDeclarationStatement(node.statement) || ts.isVariableStatement(node.statement)) {
37035                     errorOnFirstToken(node.label, ts.Diagnostics.A_label_is_not_allowed_here);
37036                 }
37037             }
37038         }
37039         function errorOnFirstToken(node, message, arg0, arg1, arg2) {
37040             var span = ts.getSpanOfTokenAtPosition(file, node.pos);
37041             file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
37042         }
37043         function errorOrSuggestionOnNode(isError, node, message) {
37044             errorOrSuggestionOnRange(isError, node, node, message);
37045         }
37046         function errorOrSuggestionOnRange(isError, startNode, endNode, message) {
37047             addErrorOrSuggestionDiagnostic(isError, { pos: ts.getTokenPosOfNode(startNode, file), end: endNode.end }, message);
37048         }
37049         function addErrorOrSuggestionDiagnostic(isError, range, message) {
37050             var diag = ts.createFileDiagnostic(file, range.pos, range.end - range.pos, message);
37051             if (isError) {
37052                 file.bindDiagnostics.push(diag);
37053             }
37054             else {
37055                 file.bindSuggestionDiagnostics = ts.append(file.bindSuggestionDiagnostics, __assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
37056             }
37057         }
37058         function bind(node) {
37059             if (!node) {
37060                 return;
37061             }
37062             ts.setParent(node, parent);
37063             var saveInStrictMode = inStrictMode;
37064             bindWorker(node);
37065             if (node.kind > 159) {
37066                 var saveParent = parent;
37067                 parent = node;
37068                 var containerFlags = getContainerFlags(node);
37069                 if (containerFlags === 0) {
37070                     bindChildren(node);
37071                 }
37072                 else {
37073                     bindContainer(node, containerFlags);
37074                 }
37075                 parent = saveParent;
37076             }
37077             else {
37078                 var saveParent = parent;
37079                 if (node.kind === 1)
37080                     parent = node;
37081                 bindJSDoc(node);
37082                 parent = saveParent;
37083             }
37084             inStrictMode = saveInStrictMode;
37085         }
37086         function bindJSDoc(node) {
37087             if (ts.hasJSDocNodes(node)) {
37088                 if (ts.isInJSFile(node)) {
37089                     for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
37090                         var j = _a[_i];
37091                         bind(j);
37092                     }
37093                 }
37094                 else {
37095                     for (var _b = 0, _c = node.jsDoc; _b < _c.length; _b++) {
37096                         var j = _c[_b];
37097                         ts.setParent(j, node);
37098                         ts.setParentRecursive(j, false);
37099                     }
37100                 }
37101             }
37102         }
37103         function updateStrictModeStatementList(statements) {
37104             if (!inStrictMode) {
37105                 for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) {
37106                     var statement = statements_3[_i];
37107                     if (!ts.isPrologueDirective(statement)) {
37108                         return;
37109                     }
37110                     if (isUseStrictPrologueDirective(statement)) {
37111                         inStrictMode = true;
37112                         return;
37113                     }
37114                 }
37115             }
37116         }
37117         function isUseStrictPrologueDirective(node) {
37118             var nodeText = ts.getSourceTextOfNodeFromSourceFile(file, node.expression);
37119             return nodeText === '"use strict"' || nodeText === "'use strict'";
37120         }
37121         function bindWorker(node) {
37122             switch (node.kind) {
37123                 case 79:
37124                     if (node.isInJSDocNamespace) {
37125                         var parentNode = node.parent;
37126                         while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
37127                             parentNode = parentNode.parent;
37128                         }
37129                         bindBlockScopedDeclaration(parentNode, 524288, 788968);
37130                         break;
37131                     }
37132                 case 108:
37133                     if (currentFlow && (ts.isExpression(node) || parent.kind === 295)) {
37134                         node.flowNode = currentFlow;
37135                     }
37136                     return checkContextualIdentifier(node);
37137                 case 160:
37138                     if (currentFlow && ts.isPartOfTypeQuery(node)) {
37139                         node.flowNode = currentFlow;
37140                     }
37141                     break;
37142                 case 230:
37143                 case 106:
37144                     node.flowNode = currentFlow;
37145                     break;
37146                 case 80:
37147                     return checkPrivateIdentifier(node);
37148                 case 205:
37149                 case 206:
37150                     var expr = node;
37151                     if (currentFlow && isNarrowableReference(expr)) {
37152                         expr.flowNode = currentFlow;
37153                     }
37154                     if (ts.isSpecialPropertyDeclaration(expr)) {
37155                         bindSpecialPropertyDeclaration(expr);
37156                     }
37157                     if (ts.isInJSFile(expr) &&
37158                         file.commonJsModuleIndicator &&
37159                         ts.isModuleExportsAccessExpression(expr) &&
37160                         !lookupSymbolForName(blockScopeContainer, "module")) {
37161                         declareSymbol(file.locals, undefined, expr.expression, 1 | 134217728, 111550);
37162                     }
37163                     break;
37164                 case 220:
37165                     var specialKind = ts.getAssignmentDeclarationKind(node);
37166                     switch (specialKind) {
37167                         case 1:
37168                             bindExportsPropertyAssignment(node);
37169                             break;
37170                         case 2:
37171                             bindModuleExportsAssignment(node);
37172                             break;
37173                         case 3:
37174                             bindPrototypePropertyAssignment(node.left, node);
37175                             break;
37176                         case 6:
37177                             bindPrototypeAssignment(node);
37178                             break;
37179                         case 4:
37180                             bindThisPropertyAssignment(node);
37181                             break;
37182                         case 5:
37183                             var expression = node.left.expression;
37184                             if (ts.isInJSFile(node) && ts.isIdentifier(expression)) {
37185                                 var symbol = lookupSymbolForName(blockScopeContainer, expression.escapedText);
37186                                 if (ts.isThisInitializedDeclaration(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration)) {
37187                                     bindThisPropertyAssignment(node);
37188                                     break;
37189                                 }
37190                             }
37191                             bindSpecialPropertyAssignment(node);
37192                             break;
37193                         case 0:
37194                             break;
37195                         default:
37196                             ts.Debug.fail("Unknown binary expression special property assignment kind");
37197                     }
37198                     return checkStrictModeBinaryExpression(node);
37199                 case 291:
37200                     return checkStrictModeCatchClause(node);
37201                 case 214:
37202                     return checkStrictModeDeleteExpression(node);
37203                 case 8:
37204                     return checkStrictModeNumericLiteral(node);
37205                 case 219:
37206                     return checkStrictModePostfixUnaryExpression(node);
37207                 case 218:
37208                     return checkStrictModePrefixUnaryExpression(node);
37209                 case 247:
37210                     return checkStrictModeWithStatement(node);
37211                 case 249:
37212                     return checkStrictModeLabeledStatement(node);
37213                 case 191:
37214                     seenThisKeyword = true;
37215                     return;
37216                 case 176:
37217                     break;
37218                 case 162:
37219                     return bindTypeParameter(node);
37220                 case 163:
37221                     return bindParameter(node);
37222                 case 253:
37223                     return bindVariableDeclarationOrBindingElement(node);
37224                 case 202:
37225                     node.flowNode = currentFlow;
37226                     return bindVariableDeclarationOrBindingElement(node);
37227                 case 166:
37228                 case 165:
37229                     return bindPropertyWorker(node);
37230                 case 294:
37231                 case 295:
37232                     return bindPropertyOrMethodOrAccessor(node, 4, 0);
37233                 case 297:
37234                     return bindPropertyOrMethodOrAccessor(node, 8, 900095);
37235                 case 173:
37236                 case 174:
37237                 case 175:
37238                     return declareSymbolAndAddToSymbolTable(node, 131072, 0);
37239                 case 168:
37240                 case 167:
37241                     return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 103359);
37242                 case 255:
37243                     return bindFunctionDeclaration(node);
37244                 case 170:
37245                     return declareSymbolAndAddToSymbolTable(node, 16384, 0);
37246                 case 171:
37247                     return bindPropertyOrMethodOrAccessor(node, 32768, 46015);
37248                 case 172:
37249                     return bindPropertyOrMethodOrAccessor(node, 65536, 78783);
37250                 case 178:
37251                 case 315:
37252                 case 321:
37253                 case 179:
37254                     return bindFunctionOrConstructorType(node);
37255                 case 181:
37256                 case 320:
37257                 case 194:
37258                     return bindAnonymousTypeWorker(node);
37259                 case 330:
37260                     return bindJSDocClassTag(node);
37261                 case 204:
37262                     return bindObjectLiteralExpression(node);
37263                 case 212:
37264                 case 213:
37265                     return bindFunctionExpression(node);
37266                 case 207:
37267                     var assignmentKind = ts.getAssignmentDeclarationKind(node);
37268                     switch (assignmentKind) {
37269                         case 7:
37270                             return bindObjectDefinePropertyAssignment(node);
37271                         case 8:
37272                             return bindObjectDefinePropertyExport(node);
37273                         case 9:
37274                             return bindObjectDefinePrototypeProperty(node);
37275                         case 0:
37276                             break;
37277                         default:
37278                             return ts.Debug.fail("Unknown call expression assignment declaration kind");
37279                     }
37280                     if (ts.isInJSFile(node)) {
37281                         bindCallExpression(node);
37282                     }
37283                     break;
37284                 case 225:
37285                 case 256:
37286                     inStrictMode = true;
37287                     return bindClassLikeDeclaration(node);
37288                 case 257:
37289                     return bindBlockScopedDeclaration(node, 64, 788872);
37290                 case 258:
37291                     return bindBlockScopedDeclaration(node, 524288, 788968);
37292                 case 259:
37293                     return bindEnumDeclaration(node);
37294                 case 260:
37295                     return bindModuleDeclaration(node);
37296                 case 285:
37297                     return bindJsxAttributes(node);
37298                 case 284:
37299                     return bindJsxAttribute(node, 4, 0);
37300                 case 264:
37301                 case 267:
37302                 case 269:
37303                 case 274:
37304                     return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
37305                 case 263:
37306                     return bindNamespaceExportDeclaration(node);
37307                 case 266:
37308                     return bindImportClause(node);
37309                 case 271:
37310                     return bindExportDeclaration(node);
37311                 case 270:
37312                     return bindExportAssignment(node);
37313                 case 303:
37314                     updateStrictModeStatementList(node.statements);
37315                     return bindSourceFileIfExternalModule();
37316                 case 234:
37317                     if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) {
37318                         return;
37319                     }
37320                 case 261:
37321                     return updateStrictModeStatementList(node.statements);
37322                 case 338:
37323                     if (node.parent.kind === 321) {
37324                         return bindParameter(node);
37325                     }
37326                     if (node.parent.kind !== 320) {
37327                         break;
37328                     }
37329                 case 345:
37330                     var propTag = node;
37331                     var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 314 ?
37332                         4 | 16777216 :
37333                         4;
37334                     return declareSymbolAndAddToSymbolTable(propTag, flags, 0);
37335                 case 343:
37336                 case 336:
37337                 case 337:
37338                     return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
37339             }
37340         }
37341         function bindPropertyWorker(node) {
37342             return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 16777216 : 0), 0);
37343         }
37344         function bindAnonymousTypeWorker(node) {
37345             return bindAnonymousDeclaration(node, 2048, "__type");
37346         }
37347         function bindSourceFileIfExternalModule() {
37348             setExportContextFlag(file);
37349             if (ts.isExternalModule(file)) {
37350                 bindSourceFileAsExternalModule();
37351             }
37352             else if (ts.isJsonSourceFile(file)) {
37353                 bindSourceFileAsExternalModule();
37354                 var originalSymbol = file.symbol;
37355                 declareSymbol(file.symbol.exports, file.symbol, file, 4, 67108863);
37356                 file.symbol = originalSymbol;
37357             }
37358         }
37359         function bindSourceFileAsExternalModule() {
37360             bindAnonymousDeclaration(file, 512, "\"".concat(ts.removeFileExtension(file.fileName), "\""));
37361         }
37362         function bindExportAssignment(node) {
37363             if (!container.symbol || !container.symbol.exports) {
37364                 bindAnonymousDeclaration(node, 111551, getDeclarationName(node));
37365             }
37366             else {
37367                 var flags = ts.exportAssignmentIsAlias(node)
37368                     ? 2097152
37369                     : 4;
37370                 var symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863);
37371                 if (node.isExportEquals) {
37372                     ts.setValueDeclaration(symbol, node);
37373                 }
37374             }
37375         }
37376         function bindNamespaceExportDeclaration(node) {
37377             if (node.modifiers && node.modifiers.length) {
37378                 file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here));
37379             }
37380             var diag = !ts.isSourceFile(node.parent) ? ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level
37381                 : !ts.isExternalModule(node.parent) ? ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files
37382                     : !node.parent.isDeclarationFile ? ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files
37383                         : undefined;
37384             if (diag) {
37385                 file.bindDiagnostics.push(createDiagnosticForNode(node, diag));
37386             }
37387             else {
37388                 file.symbol.globalExports = file.symbol.globalExports || ts.createSymbolTable();
37389                 declareSymbol(file.symbol.globalExports, file.symbol, node, 2097152, 2097152);
37390             }
37391         }
37392         function bindExportDeclaration(node) {
37393             if (!container.symbol || !container.symbol.exports) {
37394                 bindAnonymousDeclaration(node, 8388608, getDeclarationName(node));
37395             }
37396             else if (!node.exportClause) {
37397                 declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 0);
37398             }
37399             else if (ts.isNamespaceExport(node.exportClause)) {
37400                 ts.setParent(node.exportClause, node);
37401                 declareSymbol(container.symbol.exports, container.symbol, node.exportClause, 2097152, 2097152);
37402             }
37403         }
37404         function bindImportClause(node) {
37405             if (node.name) {
37406                 declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
37407             }
37408         }
37409         function setCommonJsModuleIndicator(node) {
37410             if (file.externalModuleIndicator) {
37411                 return false;
37412             }
37413             if (!file.commonJsModuleIndicator) {
37414                 file.commonJsModuleIndicator = node;
37415                 bindSourceFileAsExternalModule();
37416             }
37417             return true;
37418         }
37419         function bindObjectDefinePropertyExport(node) {
37420             if (!setCommonJsModuleIndicator(node)) {
37421                 return;
37422             }
37423             var symbol = forEachIdentifierInEntityName(node.arguments[0], undefined, function (id, symbol) {
37424                 if (symbol) {
37425                     addDeclarationToSymbol(symbol, id, 1536 | 67108864);
37426                 }
37427                 return symbol;
37428             });
37429             if (symbol) {
37430                 var flags = 4 | 1048576;
37431                 declareSymbol(symbol.exports, symbol, node, flags, 0);
37432             }
37433         }
37434         function bindExportsPropertyAssignment(node) {
37435             if (!setCommonJsModuleIndicator(node)) {
37436                 return;
37437             }
37438             var symbol = forEachIdentifierInEntityName(node.left.expression, undefined, function (id, symbol) {
37439                 if (symbol) {
37440                     addDeclarationToSymbol(symbol, id, 1536 | 67108864);
37441                 }
37442                 return symbol;
37443             });
37444             if (symbol) {
37445                 var isAlias = ts.isAliasableExpression(node.right) && (ts.isExportsIdentifier(node.left.expression) || ts.isModuleExportsAccessExpression(node.left.expression));
37446                 var flags = isAlias ? 2097152 : 4 | 1048576;
37447                 ts.setParent(node.left, node);
37448                 declareSymbol(symbol.exports, symbol, node.left, flags, 0);
37449             }
37450         }
37451         function bindModuleExportsAssignment(node) {
37452             if (!setCommonJsModuleIndicator(node)) {
37453                 return;
37454             }
37455             var assignedExpression = ts.getRightMostAssignedExpression(node.right);
37456             if (ts.isEmptyObjectLiteral(assignedExpression) || container === file && isExportsOrModuleExportsOrAlias(file, assignedExpression)) {
37457                 return;
37458             }
37459             if (ts.isObjectLiteralExpression(assignedExpression) && ts.every(assignedExpression.properties, ts.isShorthandPropertyAssignment)) {
37460                 ts.forEach(assignedExpression.properties, bindExportAssignedObjectMemberAlias);
37461                 return;
37462             }
37463             var flags = ts.exportAssignmentIsAlias(node)
37464                 ? 2097152
37465                 : 4 | 1048576 | 512;
37466             var symbol = declareSymbol(file.symbol.exports, file.symbol, node, flags | 67108864, 0);
37467             ts.setValueDeclaration(symbol, node);
37468         }
37469         function bindExportAssignedObjectMemberAlias(node) {
37470             declareSymbol(file.symbol.exports, file.symbol, node, 2097152 | 67108864, 0);
37471         }
37472         function bindThisPropertyAssignment(node) {
37473             ts.Debug.assert(ts.isInJSFile(node));
37474             var hasPrivateIdentifier = (ts.isBinaryExpression(node) && ts.isPropertyAccessExpression(node.left) && ts.isPrivateIdentifier(node.left.name))
37475                 || (ts.isPropertyAccessExpression(node) && ts.isPrivateIdentifier(node.name));
37476             if (hasPrivateIdentifier) {
37477                 return;
37478             }
37479             var thisContainer = ts.getThisContainer(node, false);
37480             switch (thisContainer.kind) {
37481                 case 255:
37482                 case 212:
37483                     var constructorSymbol = thisContainer.symbol;
37484                     if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63) {
37485                         var l = thisContainer.parent.left;
37486                         if (ts.isBindableStaticAccessExpression(l) && ts.isPrototypeAccess(l.expression)) {
37487                             constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
37488                         }
37489                     }
37490                     if (constructorSymbol && constructorSymbol.valueDeclaration) {
37491                         constructorSymbol.members = constructorSymbol.members || ts.createSymbolTable();
37492                         if (ts.hasDynamicName(node)) {
37493                             bindDynamicallyNamedThisPropertyAssignment(node, constructorSymbol, constructorSymbol.members);
37494                         }
37495                         else {
37496                             declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 | 67108864, 0 & ~4);
37497                         }
37498                         addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32);
37499                     }
37500                     break;
37501                 case 170:
37502                 case 166:
37503                 case 168:
37504                 case 171:
37505                 case 172:
37506                 case 169:
37507                     var containingClass = thisContainer.parent;
37508                     var symbolTable = ts.isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members;
37509                     if (ts.hasDynamicName(node)) {
37510                         bindDynamicallyNamedThisPropertyAssignment(node, containingClass.symbol, symbolTable);
37511                     }
37512                     else {
37513                         declareSymbol(symbolTable, containingClass.symbol, node, 4 | 67108864, 0, true);
37514                     }
37515                     break;
37516                 case 303:
37517                     if (ts.hasDynamicName(node)) {
37518                         break;
37519                     }
37520                     else if (thisContainer.commonJsModuleIndicator) {
37521                         declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 | 1048576, 0);
37522                     }
37523                     else {
37524                         declareSymbolAndAddToSymbolTable(node, 1, 111550);
37525                     }
37526                     break;
37527                 default:
37528                     ts.Debug.failBadSyntaxKind(thisContainer);
37529             }
37530         }
37531         function bindDynamicallyNamedThisPropertyAssignment(node, symbol, symbolTable) {
37532             declareSymbol(symbolTable, symbol, node, 4, 0, true, true);
37533             addLateBoundAssignmentDeclarationToSymbol(node, symbol);
37534         }
37535         function addLateBoundAssignmentDeclarationToSymbol(node, symbol) {
37536             if (symbol) {
37537                 (symbol.assignmentDeclarationMembers || (symbol.assignmentDeclarationMembers = new ts.Map())).set(ts.getNodeId(node), node);
37538             }
37539         }
37540         function bindSpecialPropertyDeclaration(node) {
37541             if (node.expression.kind === 108) {
37542                 bindThisPropertyAssignment(node);
37543             }
37544             else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 303) {
37545                 if (ts.isPrototypeAccess(node.expression)) {
37546                     bindPrototypePropertyAssignment(node, node.parent);
37547                 }
37548                 else {
37549                     bindStaticPropertyAssignment(node);
37550                 }
37551             }
37552         }
37553         function bindPrototypeAssignment(node) {
37554             ts.setParent(node.left, node);
37555             ts.setParent(node.right, node);
37556             bindPropertyAssignment(node.left.expression, node.left, false, true);
37557         }
37558         function bindObjectDefinePrototypeProperty(node) {
37559             var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0].expression);
37560             if (namespaceSymbol && namespaceSymbol.valueDeclaration) {
37561                 addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, 32);
37562             }
37563             bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, true);
37564         }
37565         function bindPrototypePropertyAssignment(lhs, parent) {
37566             var classPrototype = lhs.expression;
37567             var constructorFunction = classPrototype.expression;
37568             ts.setParent(constructorFunction, classPrototype);
37569             ts.setParent(classPrototype, lhs);
37570             ts.setParent(lhs, parent);
37571             bindPropertyAssignment(constructorFunction, lhs, true, true);
37572         }
37573         function bindObjectDefinePropertyAssignment(node) {
37574             var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
37575             var isToplevel = node.parent.parent.kind === 303;
37576             namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, false, false);
37577             bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, false);
37578         }
37579         function bindSpecialPropertyAssignment(node) {
37580             var _a;
37581             var parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer);
37582             if (!ts.isInJSFile(node) && !ts.isFunctionSymbol(parentSymbol)) {
37583                 return;
37584             }
37585             var rootExpr = ts.getLeftmostAccessExpression(node.left);
37586             if (ts.isIdentifier(rootExpr) && ((_a = lookupSymbolForName(container, rootExpr.escapedText)) === null || _a === void 0 ? void 0 : _a.flags) & 2097152) {
37587                 return;
37588             }
37589             ts.setParent(node.left, node);
37590             ts.setParent(node.right, node);
37591             if (ts.isIdentifier(node.left.expression) && container === file && isExportsOrModuleExportsOrAlias(file, node.left.expression)) {
37592                 bindExportsPropertyAssignment(node);
37593             }
37594             else if (ts.hasDynamicName(node)) {
37595                 bindAnonymousDeclaration(node, 4 | 67108864, "__computed");
37596                 var sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), false, false);
37597                 addLateBoundAssignmentDeclarationToSymbol(node, sym);
37598             }
37599             else {
37600                 bindStaticPropertyAssignment(ts.cast(node.left, ts.isBindableStaticNameExpression));
37601             }
37602         }
37603         function bindStaticPropertyAssignment(node) {
37604             ts.Debug.assert(!ts.isIdentifier(node));
37605             ts.setParent(node.expression, node);
37606             bindPropertyAssignment(node.expression, node, false, false);
37607         }
37608         function bindPotentiallyMissingNamespaces(namespaceSymbol, entityName, isToplevel, isPrototypeProperty, containerIsClass) {
37609             if ((namespaceSymbol === null || namespaceSymbol === void 0 ? void 0 : namespaceSymbol.flags) & 2097152) {
37610                 return namespaceSymbol;
37611             }
37612             if (isToplevel && !isPrototypeProperty) {
37613                 var flags_2 = 1536 | 67108864;
37614                 var excludeFlags_1 = 110735 & ~67108864;
37615                 namespaceSymbol = forEachIdentifierInEntityName(entityName, namespaceSymbol, function (id, symbol, parent) {
37616                     if (symbol) {
37617                         addDeclarationToSymbol(symbol, id, flags_2);
37618                         return symbol;
37619                     }
37620                     else {
37621                         var table = parent ? parent.exports :
37622                             file.jsGlobalAugmentations || (file.jsGlobalAugmentations = ts.createSymbolTable());
37623                         return declareSymbol(table, parent, id, flags_2, excludeFlags_1);
37624                     }
37625                 });
37626             }
37627             if (containerIsClass && namespaceSymbol && namespaceSymbol.valueDeclaration) {
37628                 addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, 32);
37629             }
37630             return namespaceSymbol;
37631         }
37632         function bindPotentiallyNewExpandoMemberToNamespace(declaration, namespaceSymbol, isPrototypeProperty) {
37633             if (!namespaceSymbol || !isExpandoSymbol(namespaceSymbol)) {
37634                 return;
37635             }
37636             var symbolTable = isPrototypeProperty ?
37637                 (namespaceSymbol.members || (namespaceSymbol.members = ts.createSymbolTable())) :
37638                 (namespaceSymbol.exports || (namespaceSymbol.exports = ts.createSymbolTable()));
37639             var includes = 0;
37640             var excludes = 0;
37641             if (ts.isFunctionLikeDeclaration(ts.getAssignedExpandoInitializer(declaration))) {
37642                 includes = 8192;
37643                 excludes = 103359;
37644             }
37645             else if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
37646                 if (ts.some(declaration.arguments[2].properties, function (p) {
37647                     var id = ts.getNameOfDeclaration(p);
37648                     return !!id && ts.isIdentifier(id) && ts.idText(id) === "set";
37649                 })) {
37650                     includes |= 65536 | 4;
37651                     excludes |= 78783;
37652                 }
37653                 if (ts.some(declaration.arguments[2].properties, function (p) {
37654                     var id = ts.getNameOfDeclaration(p);
37655                     return !!id && ts.isIdentifier(id) && ts.idText(id) === "get";
37656                 })) {
37657                     includes |= 32768 | 4;
37658                     excludes |= 46015;
37659                 }
37660             }
37661             if (includes === 0) {
37662                 includes = 4;
37663                 excludes = 0;
37664             }
37665             declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864, excludes & ~67108864);
37666         }
37667         function isTopLevelNamespaceAssignment(propertyAccess) {
37668             return ts.isBinaryExpression(propertyAccess.parent)
37669                 ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 303
37670                 : propertyAccess.parent.parent.kind === 303;
37671         }
37672         function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) {
37673             var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
37674             var isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
37675             namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
37676             bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
37677         }
37678         function isExpandoSymbol(symbol) {
37679             if (symbol.flags & (16 | 32 | 1024)) {
37680                 return true;
37681             }
37682             var node = symbol.valueDeclaration;
37683             if (node && ts.isCallExpression(node)) {
37684                 return !!ts.getAssignedExpandoInitializer(node);
37685             }
37686             var init = !node ? undefined :
37687                 ts.isVariableDeclaration(node) ? node.initializer :
37688                     ts.isBinaryExpression(node) ? node.right :
37689                         ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) ? node.parent.right :
37690                             undefined;
37691             init = init && ts.getRightMostAssignedExpression(init);
37692             if (init) {
37693                 var isPrototypeAssignment = ts.isPrototypeAccess(ts.isVariableDeclaration(node) ? node.name : ts.isBinaryExpression(node) ? node.left : node);
37694                 return !!ts.getExpandoInitializer(ts.isBinaryExpression(init) && (init.operatorToken.kind === 56 || init.operatorToken.kind === 60) ? init.right : init, isPrototypeAssignment);
37695             }
37696             return false;
37697         }
37698         function getParentOfBinaryExpression(expr) {
37699             while (ts.isBinaryExpression(expr.parent)) {
37700                 expr = expr.parent;
37701             }
37702             return expr.parent;
37703         }
37704         function lookupSymbolForPropertyAccess(node, lookupContainer) {
37705             if (lookupContainer === void 0) { lookupContainer = container; }
37706             if (ts.isIdentifier(node)) {
37707                 return lookupSymbolForName(lookupContainer, node.escapedText);
37708             }
37709             else {
37710                 var symbol = lookupSymbolForPropertyAccess(node.expression);
37711                 return symbol && symbol.exports && symbol.exports.get(ts.getElementOrPropertyAccessName(node));
37712             }
37713         }
37714         function forEachIdentifierInEntityName(e, parent, action) {
37715             if (isExportsOrModuleExportsOrAlias(file, e)) {
37716                 return file.symbol;
37717             }
37718             else if (ts.isIdentifier(e)) {
37719                 return action(e, lookupSymbolForPropertyAccess(e), parent);
37720             }
37721             else {
37722                 var s = forEachIdentifierInEntityName(e.expression, parent, action);
37723                 var name = ts.getNameOrArgument(e);
37724                 if (ts.isPrivateIdentifier(name)) {
37725                     ts.Debug.fail("unexpected PrivateIdentifier");
37726                 }
37727                 return action(name, s && s.exports && s.exports.get(ts.getElementOrPropertyAccessName(e)), s);
37728             }
37729         }
37730         function bindCallExpression(node) {
37731             if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) {
37732                 setCommonJsModuleIndicator(node);
37733             }
37734         }
37735         function bindClassLikeDeclaration(node) {
37736             if (node.kind === 256) {
37737                 bindBlockScopedDeclaration(node, 32, 899503);
37738             }
37739             else {
37740                 var bindingName = node.name ? node.name.escapedText : "__class";
37741                 bindAnonymousDeclaration(node, 32, bindingName);
37742                 if (node.name) {
37743                     classifiableNames.add(node.name.escapedText);
37744                 }
37745             }
37746             var symbol = node.symbol;
37747             var prototypeSymbol = createSymbol(4 | 4194304, "prototype");
37748             var symbolExport = symbol.exports.get(prototypeSymbol.escapedName);
37749             if (symbolExport) {
37750                 if (node.name) {
37751                     ts.setParent(node.name, node);
37752                 }
37753                 file.bindDiagnostics.push(createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.symbolName(prototypeSymbol)));
37754             }
37755             symbol.exports.set(prototypeSymbol.escapedName, prototypeSymbol);
37756             prototypeSymbol.parent = symbol;
37757         }
37758         function bindEnumDeclaration(node) {
37759             return ts.isEnumConst(node)
37760                 ? bindBlockScopedDeclaration(node, 128, 899967)
37761                 : bindBlockScopedDeclaration(node, 256, 899327);
37762         }
37763         function bindVariableDeclarationOrBindingElement(node) {
37764             if (inStrictMode) {
37765                 checkStrictModeEvalOrArguments(node, node.name);
37766             }
37767             if (!ts.isBindingPattern(node.name)) {
37768                 if (ts.isInJSFile(node) && ts.isRequireVariableDeclaration(node) && !ts.getJSDocTypeTag(node)) {
37769                     declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
37770                 }
37771                 else if (ts.isBlockOrCatchScoped(node)) {
37772                     bindBlockScopedDeclaration(node, 2, 111551);
37773                 }
37774                 else if (ts.isParameterDeclaration(node)) {
37775                     declareSymbolAndAddToSymbolTable(node, 1, 111551);
37776                 }
37777                 else {
37778                     declareSymbolAndAddToSymbolTable(node, 1, 111550);
37779                 }
37780             }
37781         }
37782         function bindParameter(node) {
37783             if (node.kind === 338 && container.kind !== 321) {
37784                 return;
37785             }
37786             if (inStrictMode && !(node.flags & 8388608)) {
37787                 checkStrictModeEvalOrArguments(node, node.name);
37788             }
37789             if (ts.isBindingPattern(node.name)) {
37790                 bindAnonymousDeclaration(node, 1, "__" + node.parent.parameters.indexOf(node));
37791             }
37792             else {
37793                 declareSymbolAndAddToSymbolTable(node, 1, 111551);
37794             }
37795             if (ts.isParameterPropertyDeclaration(node, node.parent)) {
37796                 var classDeclaration = node.parent.parent;
37797                 declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 16777216 : 0), 0);
37798             }
37799         }
37800         function bindFunctionDeclaration(node) {
37801             if (!file.isDeclarationFile && !(node.flags & 8388608)) {
37802                 if (ts.isAsyncFunction(node)) {
37803                     emitFlags |= 2048;
37804                 }
37805             }
37806             checkStrictModeFunctionName(node);
37807             if (inStrictMode) {
37808                 checkStrictModeFunctionDeclaration(node);
37809                 bindBlockScopedDeclaration(node, 16, 110991);
37810             }
37811             else {
37812                 declareSymbolAndAddToSymbolTable(node, 16, 110991);
37813             }
37814         }
37815         function bindFunctionExpression(node) {
37816             if (!file.isDeclarationFile && !(node.flags & 8388608)) {
37817                 if (ts.isAsyncFunction(node)) {
37818                     emitFlags |= 2048;
37819                 }
37820             }
37821             if (currentFlow) {
37822                 node.flowNode = currentFlow;
37823             }
37824             checkStrictModeFunctionName(node);
37825             var bindingName = node.name ? node.name.escapedText : "__function";
37826             return bindAnonymousDeclaration(node, 16, bindingName);
37827         }
37828         function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
37829             if (!file.isDeclarationFile && !(node.flags & 8388608) && ts.isAsyncFunction(node)) {
37830                 emitFlags |= 2048;
37831             }
37832             if (currentFlow && ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) {
37833                 node.flowNode = currentFlow;
37834             }
37835             return ts.hasDynamicName(node)
37836                 ? bindAnonymousDeclaration(node, symbolFlags, "__computed")
37837                 : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
37838         }
37839         function getInferTypeContainer(node) {
37840             var extendsType = ts.findAncestor(node, function (n) { return n.parent && ts.isConditionalTypeNode(n.parent) && n.parent.extendsType === n; });
37841             return extendsType && extendsType.parent;
37842         }
37843         function bindTypeParameter(node) {
37844             if (ts.isJSDocTemplateTag(node.parent)) {
37845                 var container_1 = ts.getEffectiveContainerForJSDocTemplateTag(node.parent);
37846                 if (container_1) {
37847                     if (!container_1.locals) {
37848                         container_1.locals = ts.createSymbolTable();
37849                     }
37850                     declareSymbol(container_1.locals, undefined, node, 262144, 526824);
37851                 }
37852                 else {
37853                     declareSymbolAndAddToSymbolTable(node, 262144, 526824);
37854                 }
37855             }
37856             else if (node.parent.kind === 189) {
37857                 var container_2 = getInferTypeContainer(node.parent);
37858                 if (container_2) {
37859                     if (!container_2.locals) {
37860                         container_2.locals = ts.createSymbolTable();
37861                     }
37862                     declareSymbol(container_2.locals, undefined, node, 262144, 526824);
37863                 }
37864                 else {
37865                     bindAnonymousDeclaration(node, 262144, getDeclarationName(node));
37866                 }
37867             }
37868             else {
37869                 declareSymbolAndAddToSymbolTable(node, 262144, 526824);
37870             }
37871         }
37872         function shouldReportErrorOnModuleDeclaration(node) {
37873             var instanceState = getModuleInstanceState(node);
37874             return instanceState === 1 || (instanceState === 2 && ts.shouldPreserveConstEnums(options));
37875         }
37876         function checkUnreachable(node) {
37877             if (!(currentFlow.flags & 1)) {
37878                 return false;
37879             }
37880             if (currentFlow === unreachableFlow) {
37881                 var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 235) ||
37882                     node.kind === 256 ||
37883                     (node.kind === 260 && shouldReportErrorOnModuleDeclaration(node));
37884                 if (reportError) {
37885                     currentFlow = reportedUnreachableFlow;
37886                     if (!options.allowUnreachableCode) {
37887                         var isError_1 = ts.unreachableCodeIsError(options) &&
37888                             !(node.flags & 8388608) &&
37889                             (!ts.isVariableStatement(node) ||
37890                                 !!(ts.getCombinedNodeFlags(node.declarationList) & 3) ||
37891                                 node.declarationList.declarations.some(function (d) { return !!d.initializer; }));
37892                         eachUnreachableRange(node, function (start, end) { return errorOrSuggestionOnRange(isError_1, start, end, ts.Diagnostics.Unreachable_code_detected); });
37893                     }
37894                 }
37895             }
37896             return true;
37897         }
37898     }
37899     function eachUnreachableRange(node, cb) {
37900         if (ts.isStatement(node) && isExecutableStatement(node) && ts.isBlock(node.parent)) {
37901             var statements = node.parent.statements;
37902             var slice_1 = ts.sliceAfter(statements, node);
37903             ts.getRangesWhere(slice_1, isExecutableStatement, function (start, afterEnd) { return cb(slice_1[start], slice_1[afterEnd - 1]); });
37904         }
37905         else {
37906             cb(node, node);
37907         }
37908     }
37909     function isExecutableStatement(s) {
37910         return !ts.isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !ts.isEnumDeclaration(s) &&
37911             !(ts.isVariableStatement(s) && !(ts.getCombinedNodeFlags(s) & (1 | 2)) && s.declarationList.declarations.some(function (d) { return !d.initializer; }));
37912     }
37913     function isPurelyTypeDeclaration(s) {
37914         switch (s.kind) {
37915             case 257:
37916             case 258:
37917                 return true;
37918             case 260:
37919                 return getModuleInstanceState(s) !== 1;
37920             case 259:
37921                 return ts.hasSyntacticModifier(s, 2048);
37922             default:
37923                 return false;
37924         }
37925     }
37926     function isExportsOrModuleExportsOrAlias(sourceFile, node) {
37927         var i = 0;
37928         var q = [node];
37929         while (q.length && i < 100) {
37930             i++;
37931             node = q.shift();
37932             if (ts.isExportsIdentifier(node) || ts.isModuleExportsAccessExpression(node)) {
37933                 return true;
37934             }
37935             else if (ts.isIdentifier(node)) {
37936                 var symbol = lookupSymbolForName(sourceFile, node.escapedText);
37937                 if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
37938                     var init = symbol.valueDeclaration.initializer;
37939                     q.push(init);
37940                     if (ts.isAssignmentExpression(init, true)) {
37941                         q.push(init.left);
37942                         q.push(init.right);
37943                     }
37944                 }
37945             }
37946         }
37947         return false;
37948     }
37949     ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
37950     function lookupSymbolForName(container, name) {
37951         var local = container.locals && container.locals.get(name);
37952         if (local) {
37953             return local.exportSymbol || local;
37954         }
37955         if (ts.isSourceFile(container) && container.jsGlobalAugmentations && container.jsGlobalAugmentations.has(name)) {
37956             return container.jsGlobalAugmentations.get(name);
37957         }
37958         return container.symbol && container.symbol.exports && container.symbol.exports.get(name);
37959     }
37960 })(ts || (ts = {}));
37961 var ts;
37962 (function (ts) {
37963     function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, getFirstIdentifier, getTypeArguments) {
37964         return getSymbolWalker;
37965         function getSymbolWalker(accept) {
37966             if (accept === void 0) { accept = function () { return true; }; }
37967             var visitedTypes = [];
37968             var visitedSymbols = [];
37969             return {
37970                 walkType: function (type) {
37971                     try {
37972                         visitType(type);
37973                         return { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) };
37974                     }
37975                     finally {
37976                         ts.clear(visitedTypes);
37977                         ts.clear(visitedSymbols);
37978                     }
37979                 },
37980                 walkSymbol: function (symbol) {
37981                     try {
37982                         visitSymbol(symbol);
37983                         return { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) };
37984                     }
37985                     finally {
37986                         ts.clear(visitedTypes);
37987                         ts.clear(visitedSymbols);
37988                     }
37989                 },
37990             };
37991             function visitType(type) {
37992                 if (!type) {
37993                     return;
37994                 }
37995                 if (visitedTypes[type.id]) {
37996                     return;
37997                 }
37998                 visitedTypes[type.id] = type;
37999                 var shouldBail = visitSymbol(type.symbol);
38000                 if (shouldBail)
38001                     return;
38002                 if (type.flags & 524288) {
38003                     var objectType = type;
38004                     var objectFlags = objectType.objectFlags;
38005                     if (objectFlags & 4) {
38006                         visitTypeReference(type);
38007                     }
38008                     if (objectFlags & 32) {
38009                         visitMappedType(type);
38010                     }
38011                     if (objectFlags & (1 | 2)) {
38012                         visitInterfaceType(type);
38013                     }
38014                     if (objectFlags & (8 | 16)) {
38015                         visitObjectType(objectType);
38016                     }
38017                 }
38018                 if (type.flags & 262144) {
38019                     visitTypeParameter(type);
38020                 }
38021                 if (type.flags & 3145728) {
38022                     visitUnionOrIntersectionType(type);
38023                 }
38024                 if (type.flags & 4194304) {
38025                     visitIndexType(type);
38026                 }
38027                 if (type.flags & 8388608) {
38028                     visitIndexedAccessType(type);
38029                 }
38030             }
38031             function visitTypeReference(type) {
38032                 visitType(type.target);
38033                 ts.forEach(getTypeArguments(type), visitType);
38034             }
38035             function visitTypeParameter(type) {
38036                 visitType(getConstraintOfTypeParameter(type));
38037             }
38038             function visitUnionOrIntersectionType(type) {
38039                 ts.forEach(type.types, visitType);
38040             }
38041             function visitIndexType(type) {
38042                 visitType(type.type);
38043             }
38044             function visitIndexedAccessType(type) {
38045                 visitType(type.objectType);
38046                 visitType(type.indexType);
38047                 visitType(type.constraint);
38048             }
38049             function visitMappedType(type) {
38050                 visitType(type.typeParameter);
38051                 visitType(type.constraintType);
38052                 visitType(type.templateType);
38053                 visitType(type.modifiersType);
38054             }
38055             function visitSignature(signature) {
38056                 var typePredicate = getTypePredicateOfSignature(signature);
38057                 if (typePredicate) {
38058                     visitType(typePredicate.type);
38059                 }
38060                 ts.forEach(signature.typeParameters, visitType);
38061                 for (var _i = 0, _a = signature.parameters; _i < _a.length; _i++) {
38062                     var parameter = _a[_i];
38063                     visitSymbol(parameter);
38064                 }
38065                 visitType(getRestTypeOfSignature(signature));
38066                 visitType(getReturnTypeOfSignature(signature));
38067             }
38068             function visitInterfaceType(interfaceT) {
38069                 visitObjectType(interfaceT);
38070                 ts.forEach(interfaceT.typeParameters, visitType);
38071                 ts.forEach(getBaseTypes(interfaceT), visitType);
38072                 visitType(interfaceT.thisType);
38073             }
38074             function visitObjectType(type) {
38075                 var resolved = resolveStructuredTypeMembers(type);
38076                 for (var _i = 0, _a = resolved.indexInfos; _i < _a.length; _i++) {
38077                     var info = _a[_i];
38078                     visitType(info.keyType);
38079                     visitType(info.type);
38080                 }
38081                 for (var _b = 0, _c = resolved.callSignatures; _b < _c.length; _b++) {
38082                     var signature = _c[_b];
38083                     visitSignature(signature);
38084                 }
38085                 for (var _d = 0, _e = resolved.constructSignatures; _d < _e.length; _d++) {
38086                     var signature = _e[_d];
38087                     visitSignature(signature);
38088                 }
38089                 for (var _f = 0, _g = resolved.properties; _f < _g.length; _f++) {
38090                     var p = _g[_f];
38091                     visitSymbol(p);
38092                 }
38093             }
38094             function visitSymbol(symbol) {
38095                 if (!symbol) {
38096                     return false;
38097                 }
38098                 var symbolId = ts.getSymbolId(symbol);
38099                 if (visitedSymbols[symbolId]) {
38100                     return false;
38101                 }
38102                 visitedSymbols[symbolId] = symbol;
38103                 if (!accept(symbol)) {
38104                     return true;
38105                 }
38106                 var t = getTypeOfSymbol(symbol);
38107                 visitType(t);
38108                 if (symbol.exports) {
38109                     symbol.exports.forEach(visitSymbol);
38110                 }
38111                 ts.forEach(symbol.declarations, function (d) {
38112                     if (d.type && d.type.kind === 180) {
38113                         var query = d.type;
38114                         var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
38115                         visitSymbol(entity);
38116                     }
38117                 });
38118                 return false;
38119             }
38120         }
38121     }
38122     ts.createGetSymbolWalker = createGetSymbolWalker;
38123 })(ts || (ts = {}));
38124 var ts;
38125 (function (ts) {
38126     var ambientModuleSymbolRegex = /^".+"$/;
38127     var anon = "(anonymous)";
38128     var nextSymbolId = 1;
38129     var nextNodeId = 1;
38130     var nextMergeId = 1;
38131     var nextFlowId = 1;
38132     var typeofEQFacts = new ts.Map(ts.getEntries({
38133         string: 1,
38134         number: 2,
38135         bigint: 4,
38136         boolean: 8,
38137         symbol: 16,
38138         undefined: 65536,
38139         object: 32,
38140         function: 64
38141     }));
38142     var typeofNEFacts = new ts.Map(ts.getEntries({
38143         string: 256,
38144         number: 512,
38145         bigint: 1024,
38146         boolean: 2048,
38147         symbol: 4096,
38148         undefined: 524288,
38149         object: 8192,
38150         function: 16384
38151     }));
38152     var isNotOverloadAndNotAccessor = ts.and(isNotOverload, isNotAccessor);
38153     var intrinsicTypeKinds = new ts.Map(ts.getEntries({
38154         Uppercase: 0,
38155         Lowercase: 1,
38156         Capitalize: 2,
38157         Uncapitalize: 3
38158     }));
38159     function SymbolLinks() {
38160     }
38161     function NodeLinks() {
38162         this.flags = 0;
38163     }
38164     function getNodeId(node) {
38165         if (!node.id) {
38166             node.id = nextNodeId;
38167             nextNodeId++;
38168         }
38169         return node.id;
38170     }
38171     ts.getNodeId = getNodeId;
38172     function getSymbolId(symbol) {
38173         if (!symbol.id) {
38174             symbol.id = nextSymbolId;
38175             nextSymbolId++;
38176         }
38177         return symbol.id;
38178     }
38179     ts.getSymbolId = getSymbolId;
38180     function isInstantiatedModule(node, preserveConstEnums) {
38181         var moduleState = ts.getModuleInstanceState(node);
38182         return moduleState === 1 ||
38183             (preserveConstEnums && moduleState === 2);
38184     }
38185     ts.isInstantiatedModule = isInstantiatedModule;
38186     function createTypeChecker(host, produceDiagnostics) {
38187         var getPackagesMap = ts.memoize(function () {
38188             var map = new ts.Map();
38189             host.getSourceFiles().forEach(function (sf) {
38190                 if (!sf.resolvedModules)
38191                     return;
38192                 sf.resolvedModules.forEach(function (r) {
38193                     if (r && r.packageId)
38194                         map.set(r.packageId.name, r.extension === ".d.ts" || !!map.get(r.packageId.name));
38195                 });
38196             });
38197             return map;
38198         });
38199         var cancellationToken;
38200         var requestedExternalEmitHelpers;
38201         var externalHelpersModule;
38202         var Symbol = ts.objectAllocator.getSymbolConstructor();
38203         var Type = ts.objectAllocator.getTypeConstructor();
38204         var Signature = ts.objectAllocator.getSignatureConstructor();
38205         var typeCount = 0;
38206         var symbolCount = 0;
38207         var enumCount = 0;
38208         var totalInstantiationCount = 0;
38209         var instantiationCount = 0;
38210         var instantiationDepth = 0;
38211         var inlineLevel = 0;
38212         var currentNode;
38213         var emptySymbols = ts.createSymbolTable();
38214         var arrayVariances = [1];
38215         var compilerOptions = host.getCompilerOptions();
38216         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
38217         var moduleKind = ts.getEmitModuleKind(compilerOptions);
38218         var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
38219         var allowSyntheticDefaultImports = ts.getAllowSyntheticDefaultImports(compilerOptions);
38220         var strictNullChecks = ts.getStrictOptionValue(compilerOptions, "strictNullChecks");
38221         var strictFunctionTypes = ts.getStrictOptionValue(compilerOptions, "strictFunctionTypes");
38222         var strictBindCallApply = ts.getStrictOptionValue(compilerOptions, "strictBindCallApply");
38223         var strictPropertyInitialization = ts.getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
38224         var noImplicitAny = ts.getStrictOptionValue(compilerOptions, "noImplicitAny");
38225         var noImplicitThis = ts.getStrictOptionValue(compilerOptions, "noImplicitThis");
38226         var useUnknownInCatchVariables = ts.getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
38227         var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
38228         var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 16384;
38229         var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
38230         var checkBinaryExpression = createCheckBinaryExpression();
38231         var emitResolver = createResolver();
38232         var nodeBuilder = createNodeBuilder();
38233         var globals = ts.createSymbolTable();
38234         var undefinedSymbol = createSymbol(4, "undefined");
38235         undefinedSymbol.declarations = [];
38236         var globalThisSymbol = createSymbol(1536, "globalThis", 8);
38237         globalThisSymbol.exports = globals;
38238         globalThisSymbol.declarations = [];
38239         globals.set(globalThisSymbol.escapedName, globalThisSymbol);
38240         var argumentsSymbol = createSymbol(4, "arguments");
38241         var requireSymbol = createSymbol(4, "require");
38242         var apparentArgumentCount;
38243         var checker = {
38244             getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); },
38245             getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
38246             getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
38247             getTypeCount: function () { return typeCount; },
38248             getInstantiationCount: function () { return totalInstantiationCount; },
38249             getRelationCacheSizes: function () { return ({
38250                 assignable: assignableRelation.size,
38251                 identity: identityRelation.size,
38252                 subtype: subtypeRelation.size,
38253                 strictSubtype: strictSubtypeRelation.size,
38254             }); },
38255             isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
38256             isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
38257             isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
38258             getMergedSymbol: getMergedSymbol,
38259             getDiagnostics: getDiagnostics,
38260             getGlobalDiagnostics: getGlobalDiagnostics,
38261             getRecursionIdentity: getRecursionIdentity,
38262             getUnmatchedProperties: getUnmatchedProperties,
38263             getTypeOfSymbolAtLocation: function (symbol, locationIn) {
38264                 var location = ts.getParseTreeNode(locationIn);
38265                 return location ? getTypeOfSymbolAtLocation(symbol, location) : errorType;
38266             },
38267             getSymbolsOfParameterPropertyDeclaration: function (parameterIn, parameterName) {
38268                 var parameter = ts.getParseTreeNode(parameterIn, ts.isParameter);
38269                 if (parameter === undefined)
38270                     return ts.Debug.fail("Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node.");
38271                 return getSymbolsOfParameterPropertyDeclaration(parameter, ts.escapeLeadingUnderscores(parameterName));
38272             },
38273             getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,
38274             getPropertiesOfType: getPropertiesOfType,
38275             getPropertyOfType: function (type, name) { return getPropertyOfType(type, ts.escapeLeadingUnderscores(name)); },
38276             getPrivateIdentifierPropertyOfType: function (leftType, name, location) {
38277                 var node = ts.getParseTreeNode(location);
38278                 if (!node) {
38279                     return undefined;
38280                 }
38281                 var propName = ts.escapeLeadingUnderscores(name);
38282                 var lexicallyScopedIdentifier = lookupSymbolForPrivateIdentifierDeclaration(propName, node);
38283                 return lexicallyScopedIdentifier ? getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) : undefined;
38284             },
38285             getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); },
38286             getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 ? stringType : numberType); },
38287             getIndexInfosOfType: getIndexInfosOfType,
38288             getSignaturesOfType: getSignaturesOfType,
38289             getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 ? stringType : numberType); },
38290             getBaseTypes: getBaseTypes,
38291             getBaseTypeOfLiteralType: getBaseTypeOfLiteralType,
38292             getWidenedType: getWidenedType,
38293             getTypeFromTypeNode: function (nodeIn) {
38294                 var node = ts.getParseTreeNode(nodeIn, ts.isTypeNode);
38295                 return node ? getTypeFromTypeNode(node) : errorType;
38296             },
38297             getParameterType: getTypeAtPosition,
38298             getParameterIdentifierNameAtPosition: getParameterIdentifierNameAtPosition,
38299             getPromisedTypeOfPromise: getPromisedTypeOfPromise,
38300             getAwaitedType: function (type) { return getAwaitedType(type); },
38301             getReturnTypeOfSignature: getReturnTypeOfSignature,
38302             isNullableType: isNullableType,
38303             getNullableType: getNullableType,
38304             getNonNullableType: getNonNullableType,
38305             getNonOptionalType: removeOptionalTypeMarker,
38306             getTypeArguments: getTypeArguments,
38307             typeToTypeNode: nodeBuilder.typeToTypeNode,
38308             indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
38309             signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
38310             symbolToEntityName: nodeBuilder.symbolToEntityName,
38311             symbolToExpression: nodeBuilder.symbolToExpression,
38312             symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations,
38313             symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration,
38314             typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration,
38315             getSymbolsInScope: function (locationIn, meaning) {
38316                 var location = ts.getParseTreeNode(locationIn);
38317                 return location ? getSymbolsInScope(location, meaning) : [];
38318             },
38319             getSymbolAtLocation: function (nodeIn) {
38320                 var node = ts.getParseTreeNode(nodeIn);
38321                 return node ? getSymbolAtLocation(node, true) : undefined;
38322             },
38323             getIndexInfosAtLocation: function (nodeIn) {
38324                 var node = ts.getParseTreeNode(nodeIn);
38325                 return node ? getIndexInfosAtLocation(node) : undefined;
38326             },
38327             getShorthandAssignmentValueSymbol: function (nodeIn) {
38328                 var node = ts.getParseTreeNode(nodeIn);
38329                 return node ? getShorthandAssignmentValueSymbol(node) : undefined;
38330             },
38331             getExportSpecifierLocalTargetSymbol: function (nodeIn) {
38332                 var node = ts.getParseTreeNode(nodeIn, ts.isExportSpecifier);
38333                 return node ? getExportSpecifierLocalTargetSymbol(node) : undefined;
38334             },
38335             getExportSymbolOfSymbol: function (symbol) {
38336                 return getMergedSymbol(symbol.exportSymbol || symbol);
38337             },
38338             getTypeAtLocation: function (nodeIn) {
38339                 var node = ts.getParseTreeNode(nodeIn);
38340                 return node ? getTypeOfNode(node) : errorType;
38341             },
38342             getTypeOfAssignmentPattern: function (nodeIn) {
38343                 var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
38344                 return node && getTypeOfAssignmentPattern(node) || errorType;
38345             },
38346             getPropertySymbolOfDestructuringAssignment: function (locationIn) {
38347                 var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
38348                 return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
38349             },
38350             signatureToString: function (signature, enclosingDeclaration, flags, kind) {
38351                 return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind);
38352             },
38353             typeToString: function (type, enclosingDeclaration, flags) {
38354                 return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags);
38355             },
38356             symbolToString: function (symbol, enclosingDeclaration, meaning, flags) {
38357                 return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning, flags);
38358             },
38359             typePredicateToString: function (predicate, enclosingDeclaration, flags) {
38360                 return typePredicateToString(predicate, ts.getParseTreeNode(enclosingDeclaration), flags);
38361             },
38362             writeSignature: function (signature, enclosingDeclaration, flags, kind, writer) {
38363                 return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind, writer);
38364             },
38365             writeType: function (type, enclosingDeclaration, flags, writer) {
38366                 return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags, writer);
38367             },
38368             writeSymbol: function (symbol, enclosingDeclaration, meaning, flags, writer) {
38369                 return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
38370             },
38371             writeTypePredicate: function (predicate, enclosingDeclaration, flags, writer) {
38372                 return typePredicateToString(predicate, ts.getParseTreeNode(enclosingDeclaration), flags, writer);
38373             },
38374             getAugmentedPropertiesOfType: getAugmentedPropertiesOfType,
38375             getRootSymbols: getRootSymbols,
38376             getSymbolOfExpando: getSymbolOfExpando,
38377             getContextualType: function (nodeIn, contextFlags) {
38378                 var node = ts.getParseTreeNode(nodeIn, ts.isExpression);
38379                 if (!node) {
38380                     return undefined;
38381                 }
38382                 var containingCall = ts.findAncestor(node, ts.isCallLikeExpression);
38383                 var containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
38384                 if (contextFlags & 4 && containingCall) {
38385                     var toMarkSkip = node;
38386                     do {
38387                         getNodeLinks(toMarkSkip).skipDirectInference = true;
38388                         toMarkSkip = toMarkSkip.parent;
38389                     } while (toMarkSkip && toMarkSkip !== containingCall);
38390                     getNodeLinks(containingCall).resolvedSignature = undefined;
38391                 }
38392                 var result = getContextualType(node, contextFlags);
38393                 if (contextFlags & 4 && containingCall) {
38394                     var toMarkSkip = node;
38395                     do {
38396                         getNodeLinks(toMarkSkip).skipDirectInference = undefined;
38397                         toMarkSkip = toMarkSkip.parent;
38398                     } while (toMarkSkip && toMarkSkip !== containingCall);
38399                     getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
38400                 }
38401                 return result;
38402             },
38403             getContextualTypeForObjectLiteralElement: function (nodeIn) {
38404                 var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
38405                 return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
38406             },
38407             getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
38408                 var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
38409                 return node && getContextualTypeForArgumentAtIndex(node, argIndex);
38410             },
38411             getContextualTypeForJsxAttribute: function (nodeIn) {
38412                 var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
38413                 return node && getContextualTypeForJsxAttribute(node);
38414             },
38415             isContextSensitive: isContextSensitive,
38416             getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
38417             getFullyQualifiedName: getFullyQualifiedName,
38418             getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
38419                 return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0);
38420             },
38421             getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
38422                 return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16);
38423             },
38424             getExpandedParameters: getExpandedParameters,
38425             hasEffectiveRestParameter: hasEffectiveRestParameter,
38426             containsArgumentsReference: containsArgumentsReference,
38427             getConstantValue: function (nodeIn) {
38428                 var node = ts.getParseTreeNode(nodeIn, canHaveConstantValue);
38429                 return node ? getConstantValue(node) : undefined;
38430             },
38431             isValidPropertyAccess: function (nodeIn, propertyName) {
38432                 var node = ts.getParseTreeNode(nodeIn, ts.isPropertyAccessOrQualifiedNameOrImportTypeNode);
38433                 return !!node && isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName));
38434             },
38435             isValidPropertyAccessForCompletions: function (nodeIn, type, property) {
38436                 var node = ts.getParseTreeNode(nodeIn, ts.isPropertyAccessExpression);
38437                 return !!node && isValidPropertyAccessForCompletions(node, type, property);
38438             },
38439             getSignatureFromDeclaration: function (declarationIn) {
38440                 var declaration = ts.getParseTreeNode(declarationIn, ts.isFunctionLike);
38441                 return declaration ? getSignatureFromDeclaration(declaration) : undefined;
38442             },
38443             isImplementationOfOverload: function (nodeIn) {
38444                 var node = ts.getParseTreeNode(nodeIn, ts.isFunctionLike);
38445                 return node ? isImplementationOfOverload(node) : undefined;
38446             },
38447             getImmediateAliasedSymbol: getImmediateAliasedSymbol,
38448             getAliasedSymbol: resolveAlias,
38449             getEmitResolver: getEmitResolver,
38450             getExportsOfModule: getExportsOfModuleAsArray,
38451             getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule,
38452             forEachExportAndPropertyOfModule: forEachExportAndPropertyOfModule,
38453             getSymbolWalker: ts.createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, ts.getFirstIdentifier, getTypeArguments),
38454             getAmbientModules: getAmbientModules,
38455             getJsxIntrinsicTagNamesAt: getJsxIntrinsicTagNamesAt,
38456             isOptionalParameter: function (nodeIn) {
38457                 var node = ts.getParseTreeNode(nodeIn, ts.isParameter);
38458                 return node ? isOptionalParameter(node) : false;
38459             },
38460             tryGetMemberInModuleExports: function (name, symbol) { return tryGetMemberInModuleExports(ts.escapeLeadingUnderscores(name), symbol); },
38461             tryGetMemberInModuleExportsAndProperties: function (name, symbol) { return tryGetMemberInModuleExportsAndProperties(ts.escapeLeadingUnderscores(name), symbol); },
38462             tryFindAmbientModule: function (moduleName) { return tryFindAmbientModule(moduleName, true); },
38463             tryFindAmbientModuleWithoutAugmentations: function (moduleName) {
38464                 return tryFindAmbientModule(moduleName, false);
38465             },
38466             getApparentType: getApparentType,
38467             getUnionType: getUnionType,
38468             isTypeAssignableTo: isTypeAssignableTo,
38469             createAnonymousType: createAnonymousType,
38470             createSignature: createSignature,
38471             createSymbol: createSymbol,
38472             createIndexInfo: createIndexInfo,
38473             getAnyType: function () { return anyType; },
38474             getStringType: function () { return stringType; },
38475             getNumberType: function () { return numberType; },
38476             createPromiseType: createPromiseType,
38477             createArrayType: createArrayType,
38478             getElementTypeOfArrayType: getElementTypeOfArrayType,
38479             getBooleanType: function () { return booleanType; },
38480             getFalseType: function (fresh) { return fresh ? falseType : regularFalseType; },
38481             getTrueType: function (fresh) { return fresh ? trueType : regularTrueType; },
38482             getVoidType: function () { return voidType; },
38483             getUndefinedType: function () { return undefinedType; },
38484             getNullType: function () { return nullType; },
38485             getESSymbolType: function () { return esSymbolType; },
38486             getNeverType: function () { return neverType; },
38487             getOptionalType: function () { return optionalType; },
38488             getPromiseType: function () { return getGlobalPromiseType(false); },
38489             getPromiseLikeType: function () { return getGlobalPromiseLikeType(false); },
38490             isSymbolAccessible: isSymbolAccessible,
38491             isArrayType: isArrayType,
38492             isTupleType: isTupleType,
38493             isArrayLikeType: isArrayLikeType,
38494             isTypeInvalidDueToUnionDiscriminant: isTypeInvalidDueToUnionDiscriminant,
38495             getExactOptionalProperties: getExactOptionalProperties,
38496             getAllPossiblePropertiesOfTypes: getAllPossiblePropertiesOfTypes,
38497             getSuggestedSymbolForNonexistentProperty: getSuggestedSymbolForNonexistentProperty,
38498             getSuggestionForNonexistentProperty: getSuggestionForNonexistentProperty,
38499             getSuggestedSymbolForNonexistentJSXAttribute: getSuggestedSymbolForNonexistentJSXAttribute,
38500             getSuggestedSymbolForNonexistentSymbol: function (location, name, meaning) { return getSuggestedSymbolForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); },
38501             getSuggestionForNonexistentSymbol: function (location, name, meaning) { return getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning); },
38502             getSuggestedSymbolForNonexistentModule: getSuggestedSymbolForNonexistentModule,
38503             getSuggestionForNonexistentExport: getSuggestionForNonexistentExport,
38504             getSuggestedSymbolForNonexistentClassMember: getSuggestedSymbolForNonexistentClassMember,
38505             getBaseConstraintOfType: getBaseConstraintOfType,
38506             getDefaultFromTypeParameter: function (type) { return type && type.flags & 262144 ? getDefaultFromTypeParameter(type) : undefined; },
38507             resolveName: function (name, location, meaning, excludeGlobals) {
38508                 return resolveName(location, ts.escapeLeadingUnderscores(name), meaning, undefined, undefined, false, excludeGlobals);
38509             },
38510             getJsxNamespace: function (n) { return ts.unescapeLeadingUnderscores(getJsxNamespace(n)); },
38511             getJsxFragmentFactory: function (n) {
38512                 var jsxFragmentFactory = getJsxFragmentFactoryEntity(n);
38513                 return jsxFragmentFactory && ts.unescapeLeadingUnderscores(ts.getFirstIdentifier(jsxFragmentFactory).escapedText);
38514             },
38515             getAccessibleSymbolChain: getAccessibleSymbolChain,
38516             getTypePredicateOfSignature: getTypePredicateOfSignature,
38517             resolveExternalModuleName: function (moduleSpecifierIn) {
38518                 var moduleSpecifier = ts.getParseTreeNode(moduleSpecifierIn, ts.isExpression);
38519                 return moduleSpecifier && resolveExternalModuleName(moduleSpecifier, moduleSpecifier, true);
38520             },
38521             resolveExternalModuleSymbol: resolveExternalModuleSymbol,
38522             tryGetThisTypeAt: function (nodeIn, includeGlobalThis) {
38523                 var node = ts.getParseTreeNode(nodeIn);
38524                 return node && tryGetThisTypeAt(node, includeGlobalThis);
38525             },
38526             getTypeArgumentConstraint: function (nodeIn) {
38527                 var node = ts.getParseTreeNode(nodeIn, ts.isTypeNode);
38528                 return node && getTypeArgumentConstraint(node);
38529             },
38530             getSuggestionDiagnostics: function (fileIn, ct) {
38531                 var file = ts.getParseTreeNode(fileIn, ts.isSourceFile) || ts.Debug.fail("Could not determine parsed source file.");
38532                 if (ts.skipTypeChecking(file, compilerOptions, host)) {
38533                     return ts.emptyArray;
38534                 }
38535                 var diagnostics;
38536                 try {
38537                     cancellationToken = ct;
38538                     checkSourceFile(file);
38539                     ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
38540                     diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
38541                     checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
38542                         if (!ts.containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 8388608))) {
38543                             (diagnostics || (diagnostics = [])).push(__assign(__assign({}, diag), { category: ts.DiagnosticCategory.Suggestion }));
38544                         }
38545                     });
38546                     return diagnostics || ts.emptyArray;
38547                 }
38548                 finally {
38549                     cancellationToken = undefined;
38550                 }
38551             },
38552             runWithCancellationToken: function (token, callback) {
38553                 try {
38554                     cancellationToken = token;
38555                     return callback(checker);
38556                 }
38557                 finally {
38558                     cancellationToken = undefined;
38559                 }
38560             },
38561             getLocalTypeParametersOfClassOrInterfaceOrTypeAlias: getLocalTypeParametersOfClassOrInterfaceOrTypeAlias,
38562             isDeclarationVisible: isDeclarationVisible,
38563             isPropertyAccessible: isPropertyAccessible,
38564             getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
38565             getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
38566         };
38567         function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
38568             var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
38569             apparentArgumentCount = argumentCount;
38570             var res = node ? getResolvedSignature(node, candidatesOutArray, checkMode) : undefined;
38571             apparentArgumentCount = undefined;
38572             return res;
38573         }
38574         var tupleTypes = new ts.Map();
38575         var unionTypes = new ts.Map();
38576         var intersectionTypes = new ts.Map();
38577         var stringLiteralTypes = new ts.Map();
38578         var numberLiteralTypes = new ts.Map();
38579         var bigIntLiteralTypes = new ts.Map();
38580         var enumLiteralTypes = new ts.Map();
38581         var indexedAccessTypes = new ts.Map();
38582         var templateLiteralTypes = new ts.Map();
38583         var stringMappingTypes = new ts.Map();
38584         var substitutionTypes = new ts.Map();
38585         var subtypeReductionCache = new ts.Map();
38586         var evolvingArrayTypes = [];
38587         var undefinedProperties = new ts.Map();
38588         var unknownSymbol = createSymbol(4, "unknown");
38589         var resolvingSymbol = createSymbol(0, "__resolving__");
38590         var unresolvedSymbols = new ts.Map();
38591         var errorTypes = new ts.Map();
38592         var anyType = createIntrinsicType(1, "any");
38593         var autoType = createIntrinsicType(1, "any");
38594         var wildcardType = createIntrinsicType(1, "any");
38595         var errorType = createIntrinsicType(1, "error");
38596         var unresolvedType = createIntrinsicType(1, "unresolved");
38597         var nonInferrableAnyType = createIntrinsicType(1, "any", 131072);
38598         var intrinsicMarkerType = createIntrinsicType(1, "intrinsic");
38599         var unknownType = createIntrinsicType(2, "unknown");
38600         var nonNullUnknownType = createIntrinsicType(2, "unknown");
38601         var undefinedType = createIntrinsicType(32768, "undefined");
38602         var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768, "undefined", 131072);
38603         var optionalType = createIntrinsicType(32768, "undefined");
38604         var missingType = exactOptionalPropertyTypes ? createIntrinsicType(32768, "undefined") : undefinedType;
38605         var nullType = createIntrinsicType(65536, "null");
38606         var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536, "null", 131072);
38607         var stringType = createIntrinsicType(4, "string");
38608         var numberType = createIntrinsicType(8, "number");
38609         var bigintType = createIntrinsicType(64, "bigint");
38610         var falseType = createIntrinsicType(512, "false");
38611         var regularFalseType = createIntrinsicType(512, "false");
38612         var trueType = createIntrinsicType(512, "true");
38613         var regularTrueType = createIntrinsicType(512, "true");
38614         trueType.regularType = regularTrueType;
38615         trueType.freshType = trueType;
38616         regularTrueType.regularType = regularTrueType;
38617         regularTrueType.freshType = trueType;
38618         falseType.regularType = regularFalseType;
38619         falseType.freshType = falseType;
38620         regularFalseType.regularType = regularFalseType;
38621         regularFalseType.freshType = falseType;
38622         var booleanType = getUnionType([regularFalseType, regularTrueType]);
38623         var esSymbolType = createIntrinsicType(4096, "symbol");
38624         var voidType = createIntrinsicType(16384, "void");
38625         var neverType = createIntrinsicType(131072, "never");
38626         var silentNeverType = createIntrinsicType(131072, "never");
38627         var nonInferrableType = createIntrinsicType(131072, "never", 524288);
38628         var implicitNeverType = createIntrinsicType(131072, "never");
38629         var unreachableNeverType = createIntrinsicType(131072, "never");
38630         var nonPrimitiveType = createIntrinsicType(67108864, "object");
38631         var stringOrNumberType = getUnionType([stringType, numberType]);
38632         var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
38633         var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
38634         var numberOrBigIntType = getUnionType([numberType, bigintType]);
38635         var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
38636         var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; });
38637         var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; });
38638         var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38639         var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38640         emptyJsxObjectType.objectFlags |= 2048;
38641         var emptyTypeLiteralSymbol = createSymbol(2048, "__type");
38642         emptyTypeLiteralSymbol.members = ts.createSymbolTable();
38643         var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38644         var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38645         emptyGenericType.instantiations = new ts.Map();
38646         var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38647         anyFunctionType.objectFlags |= 524288;
38648         var noConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38649         var circularConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38650         var resolvingDefaultType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
38651         var markerSuperType = createTypeParameter();
38652         var markerSubType = createTypeParameter();
38653         markerSubType.constraint = markerSuperType;
38654         var markerOtherType = createTypeParameter();
38655         var noTypePredicate = createTypePredicate(1, "<<unresolved>>", 0, anyType);
38656         var anySignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, 0);
38657         var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, errorType, undefined, 0, 0);
38658         var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, 0);
38659         var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, undefined, 0, 0);
38660         var enumNumberIndexInfo = createIndexInfo(numberType, stringType, true);
38661         var iterationTypesCache = new ts.Map();
38662         var noIterationTypes = {
38663             get yieldType() { return ts.Debug.fail("Not supported"); },
38664             get returnType() { return ts.Debug.fail("Not supported"); },
38665             get nextType() { return ts.Debug.fail("Not supported"); },
38666         };
38667         var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
38668         var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
38669         var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
38670         var asyncIterationTypesResolver = {
38671             iterableCacheKey: "iterationTypesOfAsyncIterable",
38672             iteratorCacheKey: "iterationTypesOfAsyncIterator",
38673             iteratorSymbolName: "asyncIterator",
38674             getGlobalIteratorType: getGlobalAsyncIteratorType,
38675             getGlobalIterableType: getGlobalAsyncIterableType,
38676             getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
38677             getGlobalGeneratorType: getGlobalAsyncGeneratorType,
38678             resolveIterationType: getAwaitedType,
38679             mustHaveANextMethodDiagnostic: ts.Diagnostics.An_async_iterator_must_have_a_next_method,
38680             mustBeAMethodDiagnostic: ts.Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
38681             mustHaveAValueDiagnostic: ts.Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property,
38682         };
38683         var syncIterationTypesResolver = {
38684             iterableCacheKey: "iterationTypesOfIterable",
38685             iteratorCacheKey: "iterationTypesOfIterator",
38686             iteratorSymbolName: "iterator",
38687             getGlobalIteratorType: getGlobalIteratorType,
38688             getGlobalIterableType: getGlobalIterableType,
38689             getGlobalIterableIteratorType: getGlobalIterableIteratorType,
38690             getGlobalGeneratorType: getGlobalGeneratorType,
38691             resolveIterationType: function (type, _errorNode) { return type; },
38692             mustHaveANextMethodDiagnostic: ts.Diagnostics.An_iterator_must_have_a_next_method,
38693             mustBeAMethodDiagnostic: ts.Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
38694             mustHaveAValueDiagnostic: ts.Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property,
38695         };
38696         var amalgamatedDuplicates;
38697         var reverseMappedCache = new ts.Map();
38698         var inInferTypeForHomomorphicMappedType = false;
38699         var ambientModulesCache;
38700         var patternAmbientModules;
38701         var patternAmbientModuleAugmentations;
38702         var globalObjectType;
38703         var globalFunctionType;
38704         var globalCallableFunctionType;
38705         var globalNewableFunctionType;
38706         var globalArrayType;
38707         var globalReadonlyArrayType;
38708         var globalStringType;
38709         var globalNumberType;
38710         var globalBooleanType;
38711         var globalRegExpType;
38712         var globalThisType;
38713         var anyArrayType;
38714         var autoArrayType;
38715         var anyReadonlyArrayType;
38716         var deferredGlobalNonNullableTypeAlias;
38717         var deferredGlobalESSymbolConstructorSymbol;
38718         var deferredGlobalESSymbolConstructorTypeSymbol;
38719         var deferredGlobalESSymbolType;
38720         var deferredGlobalTypedPropertyDescriptorType;
38721         var deferredGlobalPromiseType;
38722         var deferredGlobalPromiseLikeType;
38723         var deferredGlobalPromiseConstructorSymbol;
38724         var deferredGlobalPromiseConstructorLikeType;
38725         var deferredGlobalIterableType;
38726         var deferredGlobalIteratorType;
38727         var deferredGlobalIterableIteratorType;
38728         var deferredGlobalGeneratorType;
38729         var deferredGlobalIteratorYieldResultType;
38730         var deferredGlobalIteratorReturnResultType;
38731         var deferredGlobalAsyncIterableType;
38732         var deferredGlobalAsyncIteratorType;
38733         var deferredGlobalAsyncIterableIteratorType;
38734         var deferredGlobalAsyncGeneratorType;
38735         var deferredGlobalTemplateStringsArrayType;
38736         var deferredGlobalImportMetaType;
38737         var deferredGlobalImportMetaExpressionType;
38738         var deferredGlobalImportCallOptionsType;
38739         var deferredGlobalExtractSymbol;
38740         var deferredGlobalOmitSymbol;
38741         var deferredGlobalAwaitedSymbol;
38742         var deferredGlobalBigIntType;
38743         var allPotentiallyUnusedIdentifiers = new ts.Map();
38744         var flowLoopStart = 0;
38745         var flowLoopCount = 0;
38746         var sharedFlowCount = 0;
38747         var flowAnalysisDisabled = false;
38748         var flowInvocationCount = 0;
38749         var lastFlowNode;
38750         var lastFlowNodeReachable;
38751         var flowTypeCache;
38752         var emptyStringType = getStringLiteralType("");
38753         var zeroType = getNumberLiteralType(0);
38754         var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
38755         var resolutionTargets = [];
38756         var resolutionResults = [];
38757         var resolutionPropertyNames = [];
38758         var suggestionCount = 0;
38759         var maximumSuggestionCount = 10;
38760         var mergedSymbols = [];
38761         var symbolLinks = [];
38762         var nodeLinks = [];
38763         var flowLoopCaches = [];
38764         var flowLoopNodes = [];
38765         var flowLoopKeys = [];
38766         var flowLoopTypes = [];
38767         var sharedFlowNodes = [];
38768         var sharedFlowTypes = [];
38769         var flowNodeReachable = [];
38770         var flowNodePostSuper = [];
38771         var potentialThisCollisions = [];
38772         var potentialNewTargetCollisions = [];
38773         var potentialWeakMapSetCollisions = [];
38774         var potentialReflectCollisions = [];
38775         var awaitedTypeStack = [];
38776         var diagnostics = ts.createDiagnosticCollection();
38777         var suggestionDiagnostics = ts.createDiagnosticCollection();
38778         var typeofTypesByName = new ts.Map(ts.getEntries({
38779             string: stringType,
38780             number: numberType,
38781             bigint: bigintType,
38782             boolean: booleanType,
38783             symbol: esSymbolType,
38784             undefined: undefinedType
38785         }));
38786         var typeofType = createTypeofType();
38787         var _jsxNamespace;
38788         var _jsxFactoryEntity;
38789         var outofbandVarianceMarkerHandler;
38790         var subtypeRelation = new ts.Map();
38791         var strictSubtypeRelation = new ts.Map();
38792         var assignableRelation = new ts.Map();
38793         var comparableRelation = new ts.Map();
38794         var identityRelation = new ts.Map();
38795         var enumRelation = new ts.Map();
38796         var builtinGlobals = ts.createSymbolTable();
38797         builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
38798         var suggestedExtensions = [
38799             [".mts", ".mjs"],
38800             [".ts", ".js"],
38801             [".cts", ".cjs"],
38802             [".mjs", ".mjs"],
38803             [".js", ".js"],
38804             [".cjs", ".cjs"],
38805             [".tsx", compilerOptions.jsx === 1 ? ".jsx" : ".js"],
38806             [".jsx", ".jsx"],
38807             [".json", ".json"],
38808         ];
38809         initializeTypeChecker();
38810         return checker;
38811         function getJsxNamespace(location) {
38812             if (location) {
38813                 var file = ts.getSourceFileOfNode(location);
38814                 if (file) {
38815                     if (ts.isJsxOpeningFragment(location)) {
38816                         if (file.localJsxFragmentNamespace) {
38817                             return file.localJsxFragmentNamespace;
38818                         }
38819                         var jsxFragmentPragma = file.pragmas.get("jsxfrag");
38820                         if (jsxFragmentPragma) {
38821                             var chosenPragma = ts.isArray(jsxFragmentPragma) ? jsxFragmentPragma[0] : jsxFragmentPragma;
38822                             file.localJsxFragmentFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
38823                             ts.visitNode(file.localJsxFragmentFactory, markAsSynthetic);
38824                             if (file.localJsxFragmentFactory) {
38825                                 return file.localJsxFragmentNamespace = ts.getFirstIdentifier(file.localJsxFragmentFactory).escapedText;
38826                             }
38827                         }
38828                         var entity = getJsxFragmentFactoryEntity(location);
38829                         if (entity) {
38830                             file.localJsxFragmentFactory = entity;
38831                             return file.localJsxFragmentNamespace = ts.getFirstIdentifier(entity).escapedText;
38832                         }
38833                     }
38834                     else {
38835                         var localJsxNamespace = getLocalJsxNamespace(file);
38836                         if (localJsxNamespace) {
38837                             return file.localJsxNamespace = localJsxNamespace;
38838                         }
38839                     }
38840                 }
38841             }
38842             if (!_jsxNamespace) {
38843                 _jsxNamespace = "React";
38844                 if (compilerOptions.jsxFactory) {
38845                     _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion);
38846                     ts.visitNode(_jsxFactoryEntity, markAsSynthetic);
38847                     if (_jsxFactoryEntity) {
38848                         _jsxNamespace = ts.getFirstIdentifier(_jsxFactoryEntity).escapedText;
38849                     }
38850                 }
38851                 else if (compilerOptions.reactNamespace) {
38852                     _jsxNamespace = ts.escapeLeadingUnderscores(compilerOptions.reactNamespace);
38853                 }
38854             }
38855             if (!_jsxFactoryEntity) {
38856                 _jsxFactoryEntity = ts.factory.createQualifiedName(ts.factory.createIdentifier(ts.unescapeLeadingUnderscores(_jsxNamespace)), "createElement");
38857             }
38858             return _jsxNamespace;
38859         }
38860         function getLocalJsxNamespace(file) {
38861             if (file.localJsxNamespace) {
38862                 return file.localJsxNamespace;
38863             }
38864             var jsxPragma = file.pragmas.get("jsx");
38865             if (jsxPragma) {
38866                 var chosenPragma = ts.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
38867                 file.localJsxFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
38868                 ts.visitNode(file.localJsxFactory, markAsSynthetic);
38869                 if (file.localJsxFactory) {
38870                     return file.localJsxNamespace = ts.getFirstIdentifier(file.localJsxFactory).escapedText;
38871                 }
38872             }
38873         }
38874         function markAsSynthetic(node) {
38875             ts.setTextRangePosEnd(node, -1, -1);
38876             return ts.visitEachChild(node, markAsSynthetic, ts.nullTransformationContext);
38877         }
38878         function getEmitResolver(sourceFile, cancellationToken) {
38879             getDiagnostics(sourceFile, cancellationToken);
38880             return emitResolver;
38881         }
38882         function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) {
38883             var diagnostic = location
38884                 ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
38885                 : ts.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
38886             var existing = diagnostics.lookup(diagnostic);
38887             if (existing) {
38888                 return existing;
38889             }
38890             else {
38891                 diagnostics.add(diagnostic);
38892                 return diagnostic;
38893             }
38894         }
38895         function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) {
38896             var diagnostic = error(location, message, arg0, arg1, arg2, arg3);
38897             diagnostic.skippedOn = key;
38898             return diagnostic;
38899         }
38900         function createError(location, message, arg0, arg1, arg2, arg3) {
38901             return location
38902                 ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3)
38903                 : ts.createCompilerDiagnostic(message, arg0, arg1, arg2, arg3);
38904         }
38905         function error(location, message, arg0, arg1, arg2, arg3) {
38906             var diagnostic = createError(location, message, arg0, arg1, arg2, arg3);
38907             diagnostics.add(diagnostic);
38908             return diagnostic;
38909         }
38910         function addErrorOrSuggestion(isError, diagnostic) {
38911             if (isError) {
38912                 diagnostics.add(diagnostic);
38913             }
38914             else {
38915                 suggestionDiagnostics.add(__assign(__assign({}, diagnostic), { category: ts.DiagnosticCategory.Suggestion }));
38916             }
38917         }
38918         function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
38919             if (location.pos < 0 || location.end < 0) {
38920                 if (!isError) {
38921                     return;
38922                 }
38923                 var file = ts.getSourceFileOfNode(location);
38924                 addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message));
38925                 return;
38926             }
38927             addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message));
38928         }
38929         function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
38930             var diagnostic = error(location, message, arg0, arg1, arg2, arg3);
38931             if (maybeMissingAwait) {
38932                 var related = ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_forget_to_use_await);
38933                 ts.addRelatedInfo(diagnostic, related);
38934             }
38935             return diagnostic;
38936         }
38937         function addDeprecatedSuggestionWorker(declarations, diagnostic) {
38938             var deprecatedTag = Array.isArray(declarations) ? ts.forEach(declarations, ts.getJSDocDeprecatedTag) : ts.getJSDocDeprecatedTag(declarations);
38939             if (deprecatedTag) {
38940                 ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(deprecatedTag, ts.Diagnostics.The_declaration_was_marked_as_deprecated_here));
38941             }
38942             suggestionDiagnostics.add(diagnostic);
38943             return diagnostic;
38944         }
38945         function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
38946             var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
38947             return addDeprecatedSuggestionWorker(declarations, diagnostic);
38948         }
38949         function addDeprecatedSuggestionWithSignature(location, declaration, deprecatedEntity, signatureString) {
38950             var diagnostic = deprecatedEntity
38951                 ? ts.createDiagnosticForNode(location, ts.Diagnostics.The_signature_0_of_1_is_deprecated, signatureString, deprecatedEntity)
38952                 : ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, signatureString);
38953             return addDeprecatedSuggestionWorker(declaration, diagnostic);
38954         }
38955         function createSymbol(flags, name, checkFlags) {
38956             symbolCount++;
38957             var symbol = new Symbol(flags | 33554432, name);
38958             symbol.checkFlags = checkFlags || 0;
38959             return symbol;
38960         }
38961         function getExcludedSymbolFlags(flags) {
38962             var result = 0;
38963             if (flags & 2)
38964                 result |= 111551;
38965             if (flags & 1)
38966                 result |= 111550;
38967             if (flags & 4)
38968                 result |= 0;
38969             if (flags & 8)
38970                 result |= 900095;
38971             if (flags & 16)
38972                 result |= 110991;
38973             if (flags & 32)
38974                 result |= 899503;
38975             if (flags & 64)
38976                 result |= 788872;
38977             if (flags & 256)
38978                 result |= 899327;
38979             if (flags & 128)
38980                 result |= 899967;
38981             if (flags & 512)
38982                 result |= 110735;
38983             if (flags & 8192)
38984                 result |= 103359;
38985             if (flags & 32768)
38986                 result |= 46015;
38987             if (flags & 65536)
38988                 result |= 78783;
38989             if (flags & 262144)
38990                 result |= 526824;
38991             if (flags & 524288)
38992                 result |= 788968;
38993             if (flags & 2097152)
38994                 result |= 2097152;
38995             return result;
38996         }
38997         function recordMergedSymbol(target, source) {
38998             if (!source.mergeId) {
38999                 source.mergeId = nextMergeId;
39000                 nextMergeId++;
39001             }
39002             mergedSymbols[source.mergeId] = target;
39003         }
39004         function cloneSymbol(symbol) {
39005             var result = createSymbol(symbol.flags, symbol.escapedName);
39006             result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
39007             result.parent = symbol.parent;
39008             if (symbol.valueDeclaration)
39009                 result.valueDeclaration = symbol.valueDeclaration;
39010             if (symbol.constEnumOnlyModule)
39011                 result.constEnumOnlyModule = true;
39012             if (symbol.members)
39013                 result.members = new ts.Map(symbol.members);
39014             if (symbol.exports)
39015                 result.exports = new ts.Map(symbol.exports);
39016             recordMergedSymbol(result, symbol);
39017             return result;
39018         }
39019         function mergeSymbol(target, source, unidirectional) {
39020             if (unidirectional === void 0) { unidirectional = false; }
39021             if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
39022                 (source.flags | target.flags) & 67108864) {
39023                 if (source === target) {
39024                     return target;
39025                 }
39026                 if (!(target.flags & 33554432)) {
39027                     var resolvedTarget = resolveSymbol(target);
39028                     if (resolvedTarget === unknownSymbol) {
39029                         return source;
39030                     }
39031                     target = cloneSymbol(resolvedTarget);
39032                 }
39033                 if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
39034                     target.constEnumOnlyModule = false;
39035                 }
39036                 target.flags |= source.flags;
39037                 if (source.valueDeclaration) {
39038                     ts.setValueDeclaration(target, source.valueDeclaration);
39039                 }
39040                 ts.addRange(target.declarations, source.declarations);
39041                 if (source.members) {
39042                     if (!target.members)
39043                         target.members = ts.createSymbolTable();
39044                     mergeSymbolTable(target.members, source.members, unidirectional);
39045                 }
39046                 if (source.exports) {
39047                     if (!target.exports)
39048                         target.exports = ts.createSymbolTable();
39049                     mergeSymbolTable(target.exports, source.exports, unidirectional);
39050                 }
39051                 if (!unidirectional) {
39052                     recordMergedSymbol(target, source);
39053                 }
39054             }
39055             else if (target.flags & 1024) {
39056                 if (target !== globalThisSymbol) {
39057                     error(source.declarations && ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
39058                 }
39059             }
39060             else {
39061                 var isEitherEnum = !!(target.flags & 384 || source.flags & 384);
39062                 var isEitherBlockScoped_1 = !!(target.flags & 2 || source.flags & 2);
39063                 var message = isEitherEnum
39064                     ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
39065                     : isEitherBlockScoped_1
39066                         ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
39067                         : ts.Diagnostics.Duplicate_identifier_0;
39068                 var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
39069                 var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
39070                 var symbolName_1 = symbolToString(source);
39071                 if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
39072                     var firstFile_1 = ts.comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 ? sourceSymbolFile : targetSymbolFile;
39073                     var secondFile_1 = firstFile_1 === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
39074                     var filesDuplicates = ts.getOrUpdate(amalgamatedDuplicates, "".concat(firstFile_1.path, "|").concat(secondFile_1.path), function () {
39075                         return ({ firstFile: firstFile_1, secondFile: secondFile_1, conflictingSymbols: new ts.Map() });
39076                     });
39077                     var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
39078                         return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
39079                     });
39080                     addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
39081                     addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
39082                 }
39083                 else {
39084                     addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
39085                     addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
39086                 }
39087             }
39088             return target;
39089             function addDuplicateLocations(locs, symbol) {
39090                 if (symbol.declarations) {
39091                     for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
39092                         var decl = _a[_i];
39093                         ts.pushIfUnique(locs, decl);
39094                     }
39095                 }
39096             }
39097         }
39098         function addDuplicateDeclarationErrorsForSymbols(target, message, symbolName, source) {
39099             ts.forEach(target.declarations, function (node) {
39100                 addDuplicateDeclarationError(node, message, symbolName, source.declarations);
39101             });
39102         }
39103         function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
39104             var errorNode = (ts.getExpandoInitializer(node, false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
39105             var err = lookupOrIssueError(errorNode, message, symbolName);
39106             var _loop_7 = function (relatedNode) {
39107                 var adjustedNode = (ts.getExpandoInitializer(relatedNode, false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
39108                 if (adjustedNode === errorNode)
39109                     return "continue";
39110                 err.relatedInformation = err.relatedInformation || [];
39111                 var leadingMessage = ts.createDiagnosticForNode(adjustedNode, ts.Diagnostics._0_was_also_declared_here, symbolName);
39112                 var followOnMessage = ts.createDiagnosticForNode(adjustedNode, ts.Diagnostics.and_here);
39113                 if (ts.length(err.relatedInformation) >= 5 || ts.some(err.relatedInformation, function (r) { return ts.compareDiagnostics(r, followOnMessage) === 0 || ts.compareDiagnostics(r, leadingMessage) === 0; }))
39114                     return "continue";
39115                 ts.addRelatedInfo(err, !ts.length(err.relatedInformation) ? leadingMessage : followOnMessage);
39116             };
39117             for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
39118                 var relatedNode = _a[_i];
39119                 _loop_7(relatedNode);
39120             }
39121         }
39122         function combineSymbolTables(first, second) {
39123             if (!(first === null || first === void 0 ? void 0 : first.size))
39124                 return second;
39125             if (!(second === null || second === void 0 ? void 0 : second.size))
39126                 return first;
39127             var combined = ts.createSymbolTable();
39128             mergeSymbolTable(combined, first);
39129             mergeSymbolTable(combined, second);
39130             return combined;
39131         }
39132         function mergeSymbolTable(target, source, unidirectional) {
39133             if (unidirectional === void 0) { unidirectional = false; }
39134             source.forEach(function (sourceSymbol, id) {
39135                 var targetSymbol = target.get(id);
39136                 target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
39137             });
39138         }
39139         function mergeModuleAugmentation(moduleName) {
39140             var _a, _b, _c;
39141             var moduleAugmentation = moduleName.parent;
39142             if (((_a = moduleAugmentation.symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) !== moduleAugmentation) {
39143                 ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
39144                 return;
39145             }
39146             if (ts.isGlobalScopeAugmentation(moduleAugmentation)) {
39147                 mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
39148             }
39149             else {
39150                 var moduleNotFoundError = !(moduleName.parent.parent.flags & 8388608)
39151                     ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
39152                     : undefined;
39153                 var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
39154                 if (!mainModule_1) {
39155                     return;
39156                 }
39157                 mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
39158                 if (mainModule_1.flags & 1920) {
39159                     if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
39160                         var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, true);
39161                         if (!patternAmbientModuleAugmentations) {
39162                             patternAmbientModuleAugmentations = new ts.Map();
39163                         }
39164                         patternAmbientModuleAugmentations.set(moduleName.text, merged);
39165                     }
39166                     else {
39167                         if (((_b = mainModule_1.exports) === null || _b === void 0 ? void 0 : _b.get("__export")) && ((_c = moduleAugmentation.symbol.exports) === null || _c === void 0 ? void 0 : _c.size)) {
39168                             var resolvedExports = getResolvedMembersOrExportsOfSymbol(mainModule_1, "resolvedExports");
39169                             for (var _i = 0, _d = ts.arrayFrom(moduleAugmentation.symbol.exports.entries()); _i < _d.length; _i++) {
39170                                 var _e = _d[_i], key = _e[0], value = _e[1];
39171                                 if (resolvedExports.has(key) && !mainModule_1.exports.has(key)) {
39172                                     mergeSymbol(resolvedExports.get(key), value);
39173                                 }
39174                             }
39175                         }
39176                         mergeSymbol(mainModule_1, moduleAugmentation.symbol);
39177                     }
39178                 }
39179                 else {
39180                     error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
39181                 }
39182             }
39183         }
39184         function addToSymbolTable(target, source, message) {
39185             source.forEach(function (sourceSymbol, id) {
39186                 var targetSymbol = target.get(id);
39187                 if (targetSymbol) {
39188                     ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(ts.unescapeLeadingUnderscores(id), message));
39189                 }
39190                 else {
39191                     target.set(id, sourceSymbol);
39192                 }
39193             });
39194             function addDeclarationDiagnostic(id, message) {
39195                 return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); };
39196             }
39197         }
39198         function getSymbolLinks(symbol) {
39199             if (symbol.flags & 33554432)
39200                 return symbol;
39201             var id = getSymbolId(symbol);
39202             return symbolLinks[id] || (symbolLinks[id] = new SymbolLinks());
39203         }
39204         function getNodeLinks(node) {
39205             var nodeId = getNodeId(node);
39206             return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
39207         }
39208         function isGlobalSourceFile(node) {
39209             return node.kind === 303 && !ts.isExternalOrCommonJsModule(node);
39210         }
39211         function getSymbol(symbols, name, meaning) {
39212             if (meaning) {
39213                 var symbol = getMergedSymbol(symbols.get(name));
39214                 if (symbol) {
39215                     ts.Debug.assert((ts.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here.");
39216                     if (symbol.flags & meaning) {
39217                         return symbol;
39218                     }
39219                     if (symbol.flags & 2097152) {
39220                         var target = resolveAlias(symbol);
39221                         if (target === unknownSymbol || target.flags & meaning) {
39222                             return symbol;
39223                         }
39224                     }
39225                 }
39226             }
39227         }
39228         function getSymbolsOfParameterPropertyDeclaration(parameter, parameterName) {
39229             var constructorDeclaration = parameter.parent;
39230             var classDeclaration = parameter.parent.parent;
39231             var parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, 111551);
39232             var propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, 111551);
39233             if (parameterSymbol && propertySymbol) {
39234                 return [parameterSymbol, propertySymbol];
39235             }
39236             return ts.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration");
39237         }
39238         function isBlockScopedNameDeclaredBeforeUse(declaration, usage) {
39239             var declarationFile = ts.getSourceFileOfNode(declaration);
39240             var useFile = ts.getSourceFileOfNode(usage);
39241             var declContainer = ts.getEnclosingBlockScopeContainer(declaration);
39242             if (declarationFile !== useFile) {
39243                 if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
39244                     (!ts.outFile(compilerOptions)) ||
39245                     isInTypeQuery(usage) ||
39246                     declaration.flags & 8388608) {
39247                     return true;
39248                 }
39249                 if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
39250                     return true;
39251                 }
39252                 var sourceFiles = host.getSourceFiles();
39253                 return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
39254             }
39255             if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
39256                 if (declaration.kind === 202) {
39257                     var errorBindingElement = ts.getAncestor(usage, 202);
39258                     if (errorBindingElement) {
39259                         return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
39260                             declaration.pos < errorBindingElement.pos;
39261                     }
39262                     return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 253), usage);
39263                 }
39264                 else if (declaration.kind === 253) {
39265                     return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
39266                 }
39267                 else if (ts.isClassDeclaration(declaration)) {
39268                     return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
39269                 }
39270                 else if (ts.isPropertyDeclaration(declaration)) {
39271                     return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, false);
39272                 }
39273                 else if (ts.isParameterPropertyDeclaration(declaration, declaration.parent)) {
39274                     return !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields
39275                         && ts.getContainingClass(declaration) === ts.getContainingClass(usage)
39276                         && isUsedInFunctionOrInstanceProperty(usage, declaration));
39277                 }
39278                 return true;
39279             }
39280             if (usage.parent.kind === 274 || (usage.parent.kind === 270 && usage.parent.isExportEquals)) {
39281                 return true;
39282             }
39283             if (usage.kind === 270 && usage.isExportEquals) {
39284                 return true;
39285             }
39286             if (!!(usage.flags & 4194304) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
39287                 return true;
39288             }
39289             if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
39290                 if (ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields
39291                     && ts.getContainingClass(declaration)
39292                     && (ts.isPropertyDeclaration(declaration) || ts.isParameterPropertyDeclaration(declaration, declaration.parent))) {
39293                     return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, true);
39294                 }
39295                 else {
39296                     return true;
39297                 }
39298             }
39299             return false;
39300             function usageInTypeDeclaration() {
39301                 return !!ts.findAncestor(usage, function (node) { return ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node); });
39302             }
39303             function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
39304                 switch (declaration.parent.parent.kind) {
39305                     case 236:
39306                     case 241:
39307                     case 243:
39308                         if (isSameScopeDescendentOf(usage, declaration, declContainer)) {
39309                             return true;
39310                         }
39311                         break;
39312                 }
39313                 var grandparent = declaration.parent.parent;
39314                 return ts.isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage, grandparent.expression, declContainer);
39315             }
39316             function isUsedInFunctionOrInstanceProperty(usage, declaration) {
39317                 return !!ts.findAncestor(usage, function (current) {
39318                     if (current === declContainer) {
39319                         return "quit";
39320                     }
39321                     if (ts.isFunctionLike(current)) {
39322                         return true;
39323                     }
39324                     if (ts.isClassStaticBlockDeclaration(current)) {
39325                         return declaration.pos < usage.pos;
39326                     }
39327                     var propertyDeclaration = ts.tryCast(current.parent, ts.isPropertyDeclaration);
39328                     if (propertyDeclaration) {
39329                         var initializerOfProperty = propertyDeclaration.initializer === current;
39330                         if (initializerOfProperty) {
39331                             if (ts.isStatic(current.parent)) {
39332                                 if (declaration.kind === 168) {
39333                                     return true;
39334                                 }
39335                                 if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) {
39336                                     var propName = declaration.name;
39337                                     if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
39338                                         var type = getTypeOfSymbol(getSymbolOfNode(declaration));
39339                                         var staticBlocks = ts.filter(declaration.parent.members, ts.isClassStaticBlockDeclaration);
39340                                         if (isPropertyInitializedInStaticBlocks(propName, type, staticBlocks, declaration.parent.pos, current.pos)) {
39341                                             return true;
39342                                         }
39343                                     }
39344                                 }
39345                             }
39346                             else {
39347                                 var isDeclarationInstanceProperty = declaration.kind === 166 && !ts.isStatic(declaration);
39348                                 if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
39349                                     return true;
39350                                 }
39351                             }
39352                         }
39353                     }
39354                     return false;
39355                 });
39356             }
39357             function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, stopAtAnyPropertyDeclaration) {
39358                 if (usage.end > declaration.end) {
39359                     return false;
39360                 }
39361                 var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
39362                     if (node === declaration) {
39363                         return "quit";
39364                     }
39365                     switch (node.kind) {
39366                         case 213:
39367                             return true;
39368                         case 166:
39369                             return stopAtAnyPropertyDeclaration &&
39370                                 (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent
39371                                     || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent)
39372                                 ? "quit" : true;
39373                         case 234:
39374                             switch (node.parent.kind) {
39375                                 case 171:
39376                                 case 168:
39377                                 case 172:
39378                                     return true;
39379                                 default:
39380                                     return false;
39381                             }
39382                         default:
39383                             return false;
39384                     }
39385                 });
39386                 return ancestorChangingReferenceScope === undefined;
39387             }
39388         }
39389         function useOuterVariableScopeInParameter(result, location, lastLocation) {
39390             var target = ts.getEmitScriptTarget(compilerOptions);
39391             var functionLocation = location;
39392             if (ts.isParameter(lastLocation)
39393                 && functionLocation.body
39394                 && result.valueDeclaration
39395                 && result.valueDeclaration.pos >= functionLocation.body.pos
39396                 && result.valueDeclaration.end <= functionLocation.body.end) {
39397                 if (target >= 2) {
39398                     var links = getNodeLinks(functionLocation);
39399                     if (links.declarationRequiresScopeChange === undefined) {
39400                         links.declarationRequiresScopeChange = ts.forEach(functionLocation.parameters, requiresScopeChange) || false;
39401                     }
39402                     return !links.declarationRequiresScopeChange;
39403                 }
39404             }
39405             return false;
39406             function requiresScopeChange(node) {
39407                 return requiresScopeChangeWorker(node.name)
39408                     || !!node.initializer && requiresScopeChangeWorker(node.initializer);
39409             }
39410             function requiresScopeChangeWorker(node) {
39411                 switch (node.kind) {
39412                     case 213:
39413                     case 212:
39414                     case 255:
39415                     case 170:
39416                         return false;
39417                     case 168:
39418                     case 171:
39419                     case 172:
39420                     case 294:
39421                         return requiresScopeChangeWorker(node.name);
39422                     case 166:
39423                         if (ts.hasStaticModifier(node)) {
39424                             return target < 99 || !useDefineForClassFields;
39425                         }
39426                         return requiresScopeChangeWorker(node.name);
39427                     default:
39428                         if (ts.isNullishCoalesce(node) || ts.isOptionalChain(node)) {
39429                             return target < 7;
39430                         }
39431                         if (ts.isBindingElement(node) && node.dotDotDotToken && ts.isObjectBindingPattern(node.parent)) {
39432                             return target < 4;
39433                         }
39434                         if (ts.isTypeNode(node))
39435                             return false;
39436                         return ts.forEachChild(node, requiresScopeChangeWorker) || false;
39437                 }
39438             }
39439         }
39440         function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
39441             if (excludeGlobals === void 0) { excludeGlobals = false; }
39442             return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
39443         }
39444         function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
39445             var _a, _b, _c;
39446             var originalLocation = location;
39447             var result;
39448             var lastLocation;
39449             var lastSelfReferenceLocation;
39450             var propertyWithInvalidInitializer;
39451             var associatedDeclarationForContainingInitializerOrBindingName;
39452             var withinDeferredContext = false;
39453             var errorLocation = location;
39454             var grandparent;
39455             var isInExternalModule = false;
39456             loop: while (location) {
39457                 if (location.locals && !isGlobalSourceFile(location)) {
39458                     if (result = lookup(location.locals, name, meaning)) {
39459                         var useResult = true;
39460                         if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
39461                             if (meaning & result.flags & 788968 && lastLocation.kind !== 318) {
39462                                 useResult = result.flags & 262144
39463                                     ? lastLocation === location.type ||
39464                                         lastLocation.kind === 163 ||
39465                                         lastLocation.kind === 162
39466                                     : false;
39467                             }
39468                             if (meaning & result.flags & 3) {
39469                                 if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
39470                                     useResult = false;
39471                                 }
39472                                 else if (result.flags & 1) {
39473                                     useResult =
39474                                         lastLocation.kind === 163 ||
39475                                             (lastLocation === location.type &&
39476                                                 !!ts.findAncestor(result.valueDeclaration, ts.isParameter));
39477                                 }
39478                             }
39479                         }
39480                         else if (location.kind === 188) {
39481                             useResult = lastLocation === location.trueType;
39482                         }
39483                         if (useResult) {
39484                             break loop;
39485                         }
39486                         else {
39487                             result = undefined;
39488                         }
39489                     }
39490                 }
39491                 withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
39492                 switch (location.kind) {
39493                     case 303:
39494                         if (!ts.isExternalOrCommonJsModule(location))
39495                             break;
39496                         isInExternalModule = true;
39497                     case 260:
39498                         var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
39499                         if (location.kind === 303 || (ts.isModuleDeclaration(location) && location.flags & 8388608 && !ts.isGlobalScopeAugmentation(location))) {
39500                             if (result = moduleExports.get("default")) {
39501                                 var localSymbol = ts.getLocalSymbolForExportDefault(result);
39502                                 if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) {
39503                                     break loop;
39504                                 }
39505                                 result = undefined;
39506                             }
39507                             var moduleExport = moduleExports.get(name);
39508                             if (moduleExport &&
39509                                 moduleExport.flags === 2097152 &&
39510                                 (ts.getDeclarationOfKind(moduleExport, 274) || ts.getDeclarationOfKind(moduleExport, 273))) {
39511                                 break;
39512                             }
39513                         }
39514                         if (name !== "default" && (result = lookup(moduleExports, name, meaning & 2623475))) {
39515                             if (ts.isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) === null || _b === void 0 ? void 0 : _b.some(ts.isJSDocTypeAlias))) {
39516                                 result = undefined;
39517                             }
39518                             else {
39519                                 break loop;
39520                             }
39521                         }
39522                         break;
39523                     case 259:
39524                         if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8)) {
39525                             break loop;
39526                         }
39527                         break;
39528                     case 166:
39529                         if (!ts.isStatic(location)) {
39530                             var ctor = findConstructorDeclaration(location.parent);
39531                             if (ctor && ctor.locals) {
39532                                 if (lookup(ctor.locals, name, meaning & 111551)) {
39533                                     propertyWithInvalidInitializer = location;
39534                                 }
39535                             }
39536                         }
39537                         break;
39538                     case 256:
39539                     case 225:
39540                     case 257:
39541                         if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968)) {
39542                             if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
39543                                 result = undefined;
39544                                 break;
39545                             }
39546                             if (lastLocation && ts.isStatic(lastLocation)) {
39547                                 error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
39548                                 return undefined;
39549                             }
39550                             break loop;
39551                         }
39552                         if (location.kind === 225 && meaning & 32) {
39553                             var className = location.name;
39554                             if (className && name === className.escapedText) {
39555                                 result = location.symbol;
39556                                 break loop;
39557                             }
39558                         }
39559                         break;
39560                     case 227:
39561                         if (lastLocation === location.expression && location.parent.token === 94) {
39562                             var container = location.parent.parent;
39563                             if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968))) {
39564                                 if (nameNotFoundMessage) {
39565                                     error(errorLocation, ts.Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
39566                                 }
39567                                 return undefined;
39568                             }
39569                         }
39570                         break;
39571                     case 161:
39572                         grandparent = location.parent.parent;
39573                         if (ts.isClassLike(grandparent) || grandparent.kind === 257) {
39574                             if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968)) {
39575                                 error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
39576                                 return undefined;
39577                             }
39578                         }
39579                         break;
39580                     case 213:
39581                         if (ts.getEmitScriptTarget(compilerOptions) >= 2) {
39582                             break;
39583                         }
39584                     case 168:
39585                     case 170:
39586                     case 171:
39587                     case 172:
39588                     case 255:
39589                         if (meaning & 3 && name === "arguments") {
39590                             result = argumentsSymbol;
39591                             break loop;
39592                         }
39593                         break;
39594                     case 212:
39595                         if (meaning & 3 && name === "arguments") {
39596                             result = argumentsSymbol;
39597                             break loop;
39598                         }
39599                         if (meaning & 16) {
39600                             var functionName = location.name;
39601                             if (functionName && name === functionName.escapedText) {
39602                                 result = location.symbol;
39603                                 break loop;
39604                             }
39605                         }
39606                         break;
39607                     case 164:
39608                         if (location.parent && location.parent.kind === 163) {
39609                             location = location.parent;
39610                         }
39611                         if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 256)) {
39612                             location = location.parent;
39613                         }
39614                         break;
39615                     case 343:
39616                     case 336:
39617                     case 337:
39618                         var root = ts.getJSDocRoot(location);
39619                         if (root) {
39620                             location = root.parent;
39621                         }
39622                         break;
39623                     case 163:
39624                         if (lastLocation && (lastLocation === location.initializer ||
39625                             lastLocation === location.name && ts.isBindingPattern(lastLocation))) {
39626                             if (!associatedDeclarationForContainingInitializerOrBindingName) {
39627                                 associatedDeclarationForContainingInitializerOrBindingName = location;
39628                             }
39629                         }
39630                         break;
39631                     case 202:
39632                         if (lastLocation && (lastLocation === location.initializer ||
39633                             lastLocation === location.name && ts.isBindingPattern(lastLocation))) {
39634                             if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
39635                                 associatedDeclarationForContainingInitializerOrBindingName = location;
39636                             }
39637                         }
39638                         break;
39639                     case 189:
39640                         if (meaning & 262144) {
39641                             var parameterName = location.typeParameter.name;
39642                             if (parameterName && name === parameterName.escapedText) {
39643                                 result = location.typeParameter.symbol;
39644                                 break loop;
39645                             }
39646                         }
39647                         break;
39648                 }
39649                 if (isSelfReferenceLocation(location)) {
39650                     lastSelfReferenceLocation = location;
39651                 }
39652                 lastLocation = location;
39653                 location = ts.isJSDocTemplateTag(location) ?
39654                     ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
39655                     location.parent;
39656             }
39657             if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
39658                 result.isReferenced |= meaning;
39659             }
39660             if (!result) {
39661                 if (lastLocation) {
39662                     ts.Debug.assert(lastLocation.kind === 303);
39663                     if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
39664                         return lastLocation.symbol;
39665                     }
39666                 }
39667                 if (!excludeGlobals) {
39668                     result = lookup(globals, name, meaning);
39669                 }
39670             }
39671             if (!result) {
39672                 if (originalLocation && ts.isInJSFile(originalLocation) && originalLocation.parent) {
39673                     if (ts.isRequireCall(originalLocation.parent, false)) {
39674                         return requireSymbol;
39675                     }
39676                 }
39677             }
39678             if (!result) {
39679                 if (nameNotFoundMessage) {
39680                     if (!errorLocation ||
39681                         !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
39682                             !checkAndReportErrorForExtendingInterface(errorLocation) &&
39683                             !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
39684                             !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
39685                             !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
39686                             !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
39687                             !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
39688                         var suggestion = void 0;
39689                         if (suggestionCount < maximumSuggestionCount) {
39690                             suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
39691                             var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
39692                             if (isGlobalScopeAugmentationDeclaration) {
39693                                 suggestion = undefined;
39694                             }
39695                             if (suggestion) {
39696                                 var suggestionName = symbolToString(suggestion);
39697                                 var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, false);
39698                                 var message = meaning === 1920 || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
39699                                     : isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
39700                                         : ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
39701                                 var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
39702                                 addErrorOrSuggestion(!isUncheckedJS, diagnostic);
39703                                 if (suggestion.valueDeclaration) {
39704                                     ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
39705                                 }
39706                             }
39707                         }
39708                         if (!suggestion) {
39709                             if (nameArg) {
39710                                 var lib = getSuggestedLibForNonExistentName(nameArg);
39711                                 if (lib) {
39712                                     error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
39713                                 }
39714                                 else {
39715                                     error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
39716                                 }
39717                             }
39718                         }
39719                         suggestionCount++;
39720                     }
39721                 }
39722                 return undefined;
39723             }
39724             if (nameNotFoundMessage) {
39725                 if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
39726                     var propertyName = propertyWithInvalidInitializer.name;
39727                     error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
39728                     return undefined;
39729                 }
39730                 if (errorLocation &&
39731                     (meaning & 2 ||
39732                         ((meaning & 32 || meaning & 384) && (meaning & 111551) === 111551))) {
39733                     var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
39734                     if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) {
39735                         checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
39736                     }
39737                 }
39738                 if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
39739                     var merged = getMergedSymbol(result);
39740                     if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
39741                         errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
39742                     }
39743                 }
39744                 if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551) === 111551) {
39745                     var candidate = getMergedSymbol(getLateBoundSymbol(result));
39746                     var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
39747                     if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) {
39748                         error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_itself, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
39749                     }
39750                     else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
39751                         error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
39752                     }
39753                 }
39754                 if (result && errorLocation && meaning & 111551 && result.flags & 2097152) {
39755                     checkSymbolUsageInExpressionContext(result, name, errorLocation);
39756                 }
39757             }
39758             return result;
39759         }
39760         function checkSymbolUsageInExpressionContext(symbol, name, useSite) {
39761             if (!ts.isValidTypeOnlyAliasUseSite(useSite)) {
39762                 var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(symbol);
39763                 if (typeOnlyDeclaration) {
39764                     var message = typeOnlyDeclaration.kind === 274
39765                         ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
39766                         : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
39767                     var unescapedName = ts.unescapeLeadingUnderscores(name);
39768                     addTypeOnlyDeclarationRelatedInfo(error(useSite, message, unescapedName), typeOnlyDeclaration, unescapedName);
39769                 }
39770             }
39771         }
39772         function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
39773             if (!typeOnlyDeclaration)
39774                 return diagnostic;
39775             return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 274 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName));
39776         }
39777         function getIsDeferredContext(location, lastLocation) {
39778             if (location.kind !== 213 && location.kind !== 212) {
39779                 return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
39780                     (location.kind === 166 && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name));
39781             }
39782             if (lastLocation && lastLocation === location.name) {
39783                 return false;
39784             }
39785             if (location.asteriskToken || ts.hasSyntacticModifier(location, 256)) {
39786                 return true;
39787             }
39788             return !ts.getImmediatelyInvokedFunctionExpression(location);
39789         }
39790         function isSelfReferenceLocation(node) {
39791             switch (node.kind) {
39792                 case 255:
39793                 case 256:
39794                 case 257:
39795                 case 259:
39796                 case 258:
39797                 case 260:
39798                     return true;
39799                 default:
39800                     return false;
39801             }
39802         }
39803         function diagnosticName(nameArg) {
39804             return ts.isString(nameArg) ? ts.unescapeLeadingUnderscores(nameArg) : ts.declarationNameToString(nameArg);
39805         }
39806         function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
39807             if (symbol.declarations) {
39808                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
39809                     var decl = _a[_i];
39810                     if (decl.kind === 162) {
39811                         var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
39812                         if (parent === container) {
39813                             return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias));
39814                         }
39815                     }
39816                 }
39817             }
39818             return false;
39819         }
39820         function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
39821             if (!ts.isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
39822                 return false;
39823             }
39824             var container = ts.getThisContainer(errorLocation, false);
39825             var location = container;
39826             while (location) {
39827                 if (ts.isClassLike(location.parent)) {
39828                     var classSymbol = getSymbolOfNode(location.parent);
39829                     if (!classSymbol) {
39830                         break;
39831                     }
39832                     var constructorType = getTypeOfSymbol(classSymbol);
39833                     if (getPropertyOfType(constructorType, name)) {
39834                         error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
39835                         return true;
39836                     }
39837                     if (location === container && !ts.isStatic(location)) {
39838                         var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType;
39839                         if (getPropertyOfType(instanceType, name)) {
39840                             error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
39841                             return true;
39842                         }
39843                     }
39844                 }
39845                 location = location.parent;
39846             }
39847             return false;
39848         }
39849         function checkAndReportErrorForExtendingInterface(errorLocation) {
39850             var expression = getEntityNameForExtendingInterface(errorLocation);
39851             if (expression && resolveEntityName(expression, 64, true)) {
39852                 error(errorLocation, ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, ts.getTextOfNode(expression));
39853                 return true;
39854             }
39855             return false;
39856         }
39857         function getEntityNameForExtendingInterface(node) {
39858             switch (node.kind) {
39859                 case 79:
39860                 case 205:
39861                     return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
39862                 case 227:
39863                     if (ts.isEntityNameExpression(node.expression)) {
39864                         return node.expression;
39865                     }
39866                 default:
39867                     return undefined;
39868             }
39869         }
39870         function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) {
39871             var namespaceMeaning = 1920 | (ts.isInJSFile(errorLocation) ? 111551 : 0);
39872             if (meaning === namespaceMeaning) {
39873                 var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 & ~namespaceMeaning, undefined, undefined, false));
39874                 var parent = errorLocation.parent;
39875                 if (symbol) {
39876                     if (ts.isQualifiedName(parent)) {
39877                         ts.Debug.assert(parent.left === errorLocation, "Should only be resolving left side of qualified name as a namespace");
39878                         var propName = parent.right.escapedText;
39879                         var propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName);
39880                         if (propType) {
39881                             error(parent, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, ts.unescapeLeadingUnderscores(name), ts.unescapeLeadingUnderscores(propName));
39882                             return true;
39883                         }
39884                     }
39885                     error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, ts.unescapeLeadingUnderscores(name));
39886                     return true;
39887                 }
39888             }
39889             return false;
39890         }
39891         function checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning) {
39892             if (meaning & (788968 & ~1920)) {
39893                 var symbol = resolveSymbol(resolveName(errorLocation, name, ~788968 & 111551, undefined, undefined, false));
39894                 if (symbol && !(symbol.flags & 1920)) {
39895                     error(errorLocation, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.unescapeLeadingUnderscores(name));
39896                     return true;
39897                 }
39898             }
39899             return false;
39900         }
39901         function isPrimitiveTypeName(name) {
39902             return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown";
39903         }
39904         function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) {
39905             if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 274) {
39906                 error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name);
39907                 return true;
39908             }
39909             return false;
39910         }
39911         function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
39912             if (meaning & (111551 & ~1024)) {
39913                 if (isPrimitiveTypeName(name)) {
39914                     error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
39915                     return true;
39916                 }
39917                 var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 & ~111551, undefined, undefined, false));
39918                 if (symbol && !(symbol.flags & 1024)) {
39919                     var rawName = ts.unescapeLeadingUnderscores(name);
39920                     if (isES2015OrLaterConstructorName(name)) {
39921                         error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName);
39922                     }
39923                     else if (maybeMappedType(errorLocation, symbol)) {
39924                         error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K");
39925                     }
39926                     else {
39927                         error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName);
39928                     }
39929                     return true;
39930                 }
39931             }
39932             return false;
39933         }
39934         function maybeMappedType(node, symbol) {
39935             var container = ts.findAncestor(node.parent, function (n) {
39936                 return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
39937             });
39938             if (container && container.members.length === 1) {
39939                 var type = getDeclaredTypeOfSymbol(symbol);
39940                 return !!(type.flags & 1048576) && allTypesAssignableToKind(type, 384, true);
39941             }
39942             return false;
39943         }
39944         function isES2015OrLaterConstructorName(n) {
39945             switch (n) {
39946                 case "Promise":
39947                 case "Symbol":
39948                 case "Map":
39949                 case "WeakMap":
39950                 case "Set":
39951                 case "WeakSet":
39952                     return true;
39953             }
39954             return false;
39955         }
39956         function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
39957             if (meaning & (111551 & ~1024 & ~788968)) {
39958                 var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~111551, undefined, undefined, false));
39959                 if (symbol) {
39960                     error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
39961                     return true;
39962                 }
39963             }
39964             else if (meaning & (788968 & ~1024 & ~111551)) {
39965                 var symbol = resolveSymbol(resolveName(errorLocation, name, (512 | 1024) & ~788968, undefined, undefined, false));
39966                 if (symbol) {
39967                     error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
39968                     return true;
39969                 }
39970             }
39971             return false;
39972         }
39973         function checkResolvedBlockScopedVariable(result, errorLocation) {
39974             var _a;
39975             ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384));
39976             if (result.flags & (16 | 1 | 67108864) && result.flags & 32) {
39977                 return;
39978             }
39979             var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 259); });
39980             if (declaration === undefined)
39981                 return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration");
39982             if (!(declaration.flags & 8388608) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
39983                 var diagnosticMessage = void 0;
39984                 var declarationName = ts.declarationNameToString(ts.getNameOfDeclaration(declaration));
39985                 if (result.flags & 2) {
39986                     diagnosticMessage = error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName);
39987                 }
39988                 else if (result.flags & 32) {
39989                     diagnosticMessage = error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
39990                 }
39991                 else if (result.flags & 256) {
39992                     diagnosticMessage = error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, declarationName);
39993                 }
39994                 else {
39995                     ts.Debug.assert(!!(result.flags & 128));
39996                     if (ts.shouldPreserveConstEnums(compilerOptions)) {
39997                         diagnosticMessage = error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, declarationName);
39998                     }
39999                 }
40000                 if (diagnosticMessage) {
40001                     ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_is_declared_here, declarationName));
40002                 }
40003             }
40004         }
40005         function isSameScopeDescendentOf(initial, parent, stopAt) {
40006             return !!parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; });
40007         }
40008         function getAnyImportSyntax(node) {
40009             switch (node.kind) {
40010                 case 264:
40011                     return node;
40012                 case 266:
40013                     return node.parent;
40014                 case 267:
40015                     return node.parent.parent;
40016                 case 269:
40017                     return node.parent.parent.parent;
40018                 default:
40019                     return undefined;
40020             }
40021         }
40022         function getDeclarationOfAliasSymbol(symbol) {
40023             return symbol.declarations && ts.findLast(symbol.declarations, isAliasSymbolDeclaration);
40024         }
40025         function isAliasSymbolDeclaration(node) {
40026             return node.kind === 264
40027                 || node.kind === 263
40028                 || node.kind === 266 && !!node.name
40029                 || node.kind === 267
40030                 || node.kind === 273
40031                 || node.kind === 269
40032                 || node.kind === 274
40033                 || node.kind === 270 && ts.exportAssignmentIsAlias(node)
40034                 || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 && ts.exportAssignmentIsAlias(node)
40035                 || ts.isAccessExpression(node)
40036                     && ts.isBinaryExpression(node.parent)
40037                     && node.parent.left === node
40038                     && node.parent.operatorToken.kind === 63
40039                     && isAliasableOrJsExpression(node.parent.right)
40040                 || node.kind === 295
40041                 || node.kind === 294 && isAliasableOrJsExpression(node.initializer)
40042                 || ts.isRequireVariableDeclaration(node);
40043         }
40044         function isAliasableOrJsExpression(e) {
40045             return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
40046         }
40047         function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
40048             var commonJSPropertyAccess = getCommonJSPropertyAccess(node);
40049             if (commonJSPropertyAccess) {
40050                 var name = ts.getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0];
40051                 return ts.isIdentifier(commonJSPropertyAccess.name)
40052                     ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText))
40053                     : undefined;
40054             }
40055             if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 276) {
40056                 var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node));
40057                 var resolved_4 = resolveExternalModuleSymbol(immediate);
40058                 markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, false);
40059                 return resolved_4;
40060             }
40061             var resolved = getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
40062             checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved);
40063             return resolved;
40064         }
40065         function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) {
40066             if (markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false) && !node.isTypeOnly) {
40067                 var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node));
40068                 var isExport = typeOnlyDeclaration.kind === 274;
40069                 var message = isExport
40070                     ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type
40071                     : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
40072                 var relatedMessage = isExport
40073                     ? ts.Diagnostics._0_was_exported_here
40074                     : ts.Diagnostics._0_was_imported_here;
40075                 var name = ts.unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
40076                 ts.addRelatedInfo(error(node.moduleReference, message), ts.createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
40077             }
40078         }
40079         function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
40080             var exportValue = moduleSymbol.exports.get("export=");
40081             var exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
40082             var resolved = resolveSymbol(exportSymbol, dontResolveAlias);
40083             markSymbolOfAliasDeclarationIfTypeOnly(sourceNode, exportSymbol, resolved, false);
40084             return resolved;
40085         }
40086         function isSyntacticDefault(node) {
40087             return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node));
40088         }
40089         function getUsageModeForExpression(usage) {
40090             return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined;
40091         }
40092         function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
40093             return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
40094         }
40095         function isOnlyImportedAsDefault(usage) {
40096             var usageMode = getUsageModeForExpression(usage);
40097             return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json");
40098         }
40099         function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
40100             var usageMode = file && getUsageModeForExpression(usage);
40101             if (file && usageMode !== undefined) {
40102                 var result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
40103                 if (usageMode === ts.ModuleKind.ESNext || result) {
40104                     return result;
40105                 }
40106             }
40107             if (!allowSyntheticDefaultImports) {
40108                 return false;
40109             }
40110             if (!file || file.isDeclarationFile) {
40111                 var defaultExportSymbol = resolveExportByName(moduleSymbol, "default", undefined, true);
40112                 if (defaultExportSymbol && ts.some(defaultExportSymbol.declarations, isSyntacticDefault)) {
40113                     return false;
40114                 }
40115                 if (resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias)) {
40116                     return false;
40117                 }
40118                 return true;
40119             }
40120             if (!ts.isSourceFileJS(file)) {
40121                 return hasExportAssignmentSymbol(moduleSymbol);
40122             }
40123             return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
40124         }
40125         function getTargetOfImportClause(node, dontResolveAlias) {
40126             var _a;
40127             var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
40128             if (moduleSymbol) {
40129                 var exportDefaultSymbol = void 0;
40130                 if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
40131                     exportDefaultSymbol = moduleSymbol;
40132                 }
40133                 else {
40134                     exportDefaultSymbol = resolveExportByName(moduleSymbol, "default", node, dontResolveAlias);
40135                 }
40136                 var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
40137                 var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
40138                 var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
40139                 if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
40140                     if (hasExportAssignmentSymbol(moduleSymbol)) {
40141                         var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
40142                         var exportEqualsSymbol = moduleSymbol.exports.get("export=");
40143                         var exportAssignment = exportEqualsSymbol.valueDeclaration;
40144                         var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
40145                         if (exportAssignment) {
40146                             ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
40147                         }
40148                     }
40149                     else {
40150                         reportNonDefaultExport(moduleSymbol, node);
40151                     }
40152                 }
40153                 else if (hasSyntheticDefault || hasDefaultOnly) {
40154                     var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
40155                     markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, false);
40156                     return resolved;
40157                 }
40158                 markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, undefined, false);
40159                 return exportDefaultSymbol;
40160             }
40161         }
40162         function reportNonDefaultExport(moduleSymbol, node) {
40163             var _a, _b, _c;
40164             if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has(node.symbol.escapedName)) {
40165                 error(node.name, ts.Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, symbolToString(moduleSymbol), symbolToString(node.symbol));
40166             }
40167             else {
40168                 var diagnostic = error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
40169                 var exportStar = (_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.get("__export");
40170                 if (exportStar) {
40171                     var defaultExport = (_c = exportStar.declarations) === null || _c === void 0 ? void 0 : _c.find(function (decl) {
40172                         var _a, _b;
40173                         return !!(ts.isExportDeclaration(decl) && decl.moduleSpecifier &&
40174                             ((_b = (_a = resolveExternalModuleName(decl, decl.moduleSpecifier)) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has("default")));
40175                     });
40176                     if (defaultExport) {
40177                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(defaultExport, ts.Diagnostics.export_Asterisk_does_not_re_export_a_default));
40178                     }
40179                 }
40180             }
40181         }
40182         function getTargetOfNamespaceImport(node, dontResolveAlias) {
40183             var moduleSpecifier = node.parent.parent.moduleSpecifier;
40184             var immediate = resolveExternalModuleName(node, moduleSpecifier);
40185             var resolved = resolveESModuleSymbol(immediate, moduleSpecifier, dontResolveAlias, false);
40186             markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false);
40187             return resolved;
40188         }
40189         function getTargetOfNamespaceExport(node, dontResolveAlias) {
40190             var moduleSpecifier = node.parent.moduleSpecifier;
40191             var immediate = moduleSpecifier && resolveExternalModuleName(node, moduleSpecifier);
40192             var resolved = moduleSpecifier && resolveESModuleSymbol(immediate, moduleSpecifier, dontResolveAlias, false);
40193             markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false);
40194             return resolved;
40195         }
40196         function combineValueAndTypeSymbols(valueSymbol, typeSymbol) {
40197             if (valueSymbol === unknownSymbol && typeSymbol === unknownSymbol) {
40198                 return unknownSymbol;
40199             }
40200             if (valueSymbol.flags & (788968 | 1920)) {
40201                 return valueSymbol;
40202             }
40203             var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName);
40204             result.declarations = ts.deduplicate(ts.concatenate(valueSymbol.declarations, typeSymbol.declarations), ts.equateValues);
40205             result.parent = valueSymbol.parent || typeSymbol.parent;
40206             if (valueSymbol.valueDeclaration)
40207                 result.valueDeclaration = valueSymbol.valueDeclaration;
40208             if (typeSymbol.members)
40209                 result.members = new ts.Map(typeSymbol.members);
40210             if (valueSymbol.exports)
40211                 result.exports = new ts.Map(valueSymbol.exports);
40212             return result;
40213         }
40214         function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
40215             if (symbol.flags & 1536) {
40216                 var exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
40217                 var resolved = resolveSymbol(exportSymbol, dontResolveAlias);
40218                 markSymbolOfAliasDeclarationIfTypeOnly(specifier, exportSymbol, resolved, false);
40219                 return resolved;
40220             }
40221         }
40222         function getPropertyOfVariable(symbol, name) {
40223             if (symbol.flags & 3) {
40224                 var typeAnnotation = symbol.valueDeclaration.type;
40225                 if (typeAnnotation) {
40226                     return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
40227                 }
40228             }
40229         }
40230         function getExternalModuleMember(node, specifier, dontResolveAlias) {
40231             var _a, _b;
40232             if (dontResolveAlias === void 0) { dontResolveAlias = false; }
40233             var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
40234             var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
40235             var name = !ts.isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
40236             if (!ts.isIdentifier(name)) {
40237                 return undefined;
40238             }
40239             var suppressInteropError = name.escapedText === "default" && !!(compilerOptions.allowSyntheticDefaultImports || ts.getESModuleInterop(compilerOptions));
40240             var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, false, suppressInteropError);
40241             if (targetSymbol) {
40242                 if (name.escapedText) {
40243                     if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
40244                         return moduleSymbol;
40245                     }
40246                     var symbolFromVariable = void 0;
40247                     if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) {
40248                         symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText, true);
40249                     }
40250                     else {
40251                         symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
40252                     }
40253                     symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
40254                     var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
40255                     if (symbolFromModule === undefined && name.escapedText === "default") {
40256                         var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
40257                         if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
40258                             symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
40259                         }
40260                     }
40261                     var symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ?
40262                         combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
40263                         symbolFromModule || symbolFromVariable;
40264                     if (!symbol) {
40265                         var moduleName = getFullyQualifiedName(moduleSymbol, node);
40266                         var declarationName = ts.declarationNameToString(name);
40267                         var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
40268                         if (suggestion !== undefined) {
40269                             var suggestionName = symbolToString(suggestion);
40270                             var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
40271                             if (suggestion.valueDeclaration) {
40272                                 ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
40273                             }
40274                         }
40275                         else {
40276                             if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default")) {
40277                                 error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
40278                             }
40279                             else {
40280                                 reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
40281                             }
40282                         }
40283                     }
40284                     return symbol;
40285                 }
40286             }
40287         }
40288         function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
40289             var _a, _b;
40290             var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
40291             var exports = moduleSymbol.exports;
40292             if (localSymbol) {
40293                 var exportedEqualsSymbol = exports === null || exports === void 0 ? void 0 : exports.get("export=");
40294                 if (exportedEqualsSymbol) {
40295                     getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
40296                         error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
40297                 }
40298                 else {
40299                     var exportedSymbol = exports ? ts.find(symbolsToArray(exports), function (symbol) { return !!getSymbolIfSameReference(symbol, localSymbol); }) : undefined;
40300                     var diagnostic = exportedSymbol ? error(name, ts.Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) :
40301                         error(name, ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
40302                     if (localSymbol.declarations) {
40303                         ts.addRelatedInfo.apply(void 0, __spreadArray([diagnostic], ts.map(localSymbol.declarations, function (decl, index) {
40304                             return ts.createDiagnosticForNode(decl, index === 0 ? ts.Diagnostics._0_is_declared_here : ts.Diagnostics.and_here, declarationName);
40305                         }), false));
40306                     }
40307                 }
40308             }
40309             else {
40310                 error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
40311             }
40312         }
40313         function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
40314             if (moduleKind >= ts.ModuleKind.ES2015) {
40315                 var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :
40316                     ts.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
40317                 error(name, message, declarationName);
40318             }
40319             else {
40320                 if (ts.isInJSFile(node)) {
40321                     var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import :
40322                         ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
40323                     error(name, message, declarationName);
40324                 }
40325                 else {
40326                     var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import :
40327                         ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
40328                     error(name, message, declarationName, declarationName, moduleName);
40329                 }
40330             }
40331         }
40332         function getTargetOfImportSpecifier(node, dontResolveAlias) {
40333             var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
40334             var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
40335             var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
40336             var name = node.propertyName || node.name;
40337             if (commonJSPropertyAccess && resolved && ts.isIdentifier(name)) {
40338                 return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias);
40339             }
40340             markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false);
40341             return resolved;
40342         }
40343         function getCommonJSPropertyAccess(node) {
40344             if (ts.isVariableDeclaration(node) && node.initializer && ts.isPropertyAccessExpression(node.initializer)) {
40345                 return node.initializer;
40346             }
40347         }
40348         function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) {
40349             var resolved = resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias);
40350             markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false);
40351             return resolved;
40352         }
40353         function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
40354             var resolved = node.parent.parent.moduleSpecifier ?
40355                 getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
40356                 resolveEntityName(node.propertyName || node.name, meaning, false, dontResolveAlias);
40357             markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false);
40358             return resolved;
40359         }
40360         function getTargetOfExportAssignment(node, dontResolveAlias) {
40361             var expression = ts.isExportAssignment(node) ? node.expression : node.right;
40362             var resolved = getTargetOfAliasLikeExpression(expression, dontResolveAlias);
40363             markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false);
40364             return resolved;
40365         }
40366         function getTargetOfAliasLikeExpression(expression, dontResolveAlias) {
40367             if (ts.isClassExpression(expression)) {
40368                 return checkExpressionCached(expression).symbol;
40369             }
40370             if (!ts.isEntityName(expression) && !ts.isEntityNameExpression(expression)) {
40371                 return undefined;
40372             }
40373             var aliasLike = resolveEntityName(expression, 111551 | 788968 | 1920, true, dontResolveAlias);
40374             if (aliasLike) {
40375                 return aliasLike;
40376             }
40377             checkExpressionCached(expression);
40378             return getNodeLinks(expression).resolvedSymbol;
40379         }
40380         function getTargetOfPropertyAssignment(node, dontRecursivelyResolve) {
40381             var expression = node.initializer;
40382             return getTargetOfAliasLikeExpression(expression, dontRecursivelyResolve);
40383         }
40384         function getTargetOfAccessExpression(node, dontRecursivelyResolve) {
40385             if (!(ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63)) {
40386                 return undefined;
40387             }
40388             return getTargetOfAliasLikeExpression(node.parent.right, dontRecursivelyResolve);
40389         }
40390         function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
40391             if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
40392             switch (node.kind) {
40393                 case 264:
40394                 case 253:
40395                     return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
40396                 case 266:
40397                     return getTargetOfImportClause(node, dontRecursivelyResolve);
40398                 case 267:
40399                     return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
40400                 case 273:
40401                     return getTargetOfNamespaceExport(node, dontRecursivelyResolve);
40402                 case 269:
40403                 case 202:
40404                     return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
40405                 case 274:
40406                     return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve);
40407                 case 270:
40408                 case 220:
40409                     return getTargetOfExportAssignment(node, dontRecursivelyResolve);
40410                 case 263:
40411                     return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
40412                 case 295:
40413                     return resolveEntityName(node.name, 111551 | 788968 | 1920, true, dontRecursivelyResolve);
40414                 case 294:
40415                     return getTargetOfPropertyAssignment(node, dontRecursivelyResolve);
40416                 case 206:
40417                 case 205:
40418                     return getTargetOfAccessExpression(node, dontRecursivelyResolve);
40419                 default:
40420                     return ts.Debug.fail();
40421             }
40422         }
40423         function isNonLocalAlias(symbol, excludes) {
40424             if (excludes === void 0) { excludes = 111551 | 788968 | 1920; }
40425             if (!symbol)
40426                 return false;
40427             return (symbol.flags & (2097152 | excludes)) === 2097152 || !!(symbol.flags & 2097152 && symbol.flags & 67108864);
40428         }
40429         function resolveSymbol(symbol, dontResolveAlias) {
40430             return !dontResolveAlias && isNonLocalAlias(symbol) ? resolveAlias(symbol) : symbol;
40431         }
40432         function resolveAlias(symbol) {
40433             ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here.");
40434             var links = getSymbolLinks(symbol);
40435             if (!links.target) {
40436                 links.target = resolvingSymbol;
40437                 var node = getDeclarationOfAliasSymbol(symbol);
40438                 if (!node)
40439                     return ts.Debug.fail();
40440                 var target = getTargetOfAliasDeclaration(node);
40441                 if (links.target === resolvingSymbol) {
40442                     links.target = target || unknownSymbol;
40443                 }
40444                 else {
40445                     error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
40446                 }
40447             }
40448             else if (links.target === resolvingSymbol) {
40449                 links.target = unknownSymbol;
40450             }
40451             return links.target;
40452         }
40453         function tryResolveAlias(symbol) {
40454             var links = getSymbolLinks(symbol);
40455             if (links.target !== resolvingSymbol) {
40456                 return resolveAlias(symbol);
40457             }
40458             return undefined;
40459         }
40460         function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) {
40461             if (!aliasDeclaration || ts.isPropertyAccessExpression(aliasDeclaration))
40462                 return false;
40463             var sourceSymbol = getSymbolOfNode(aliasDeclaration);
40464             if (ts.isTypeOnlyImportOrExportDeclaration(aliasDeclaration)) {
40465                 var links_1 = getSymbolLinks(sourceSymbol);
40466                 links_1.typeOnlyDeclaration = aliasDeclaration;
40467                 return true;
40468             }
40469             var links = getSymbolLinks(sourceSymbol);
40470             return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty)
40471                 || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
40472         }
40473         function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) {
40474             var _a, _b, _c;
40475             if (target && (aliasDeclarationLinks.typeOnlyDeclaration === undefined || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) {
40476                 var exportSymbol = (_b = (_a = target.exports) === null || _a === void 0 ? void 0 : _a.get("export=")) !== null && _b !== void 0 ? _b : target;
40477                 var typeOnly = exportSymbol.declarations && ts.find(exportSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
40478                 aliasDeclarationLinks.typeOnlyDeclaration = (_c = typeOnly !== null && typeOnly !== void 0 ? typeOnly : getSymbolLinks(exportSymbol).typeOnlyDeclaration) !== null && _c !== void 0 ? _c : false;
40479             }
40480             return !!aliasDeclarationLinks.typeOnlyDeclaration;
40481         }
40482         function getTypeOnlyAliasDeclaration(symbol) {
40483             if (!(symbol.flags & 2097152)) {
40484                 return undefined;
40485             }
40486             var links = getSymbolLinks(symbol);
40487             return links.typeOnlyDeclaration || undefined;
40488         }
40489         function markExportAsReferenced(node) {
40490             var symbol = getSymbolOfNode(node);
40491             var target = resolveAlias(symbol);
40492             if (target) {
40493                 var markAlias = target === unknownSymbol ||
40494                     ((target.flags & 111551) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol));
40495                 if (markAlias) {
40496                     markAliasSymbolAsReferenced(symbol);
40497                 }
40498             }
40499         }
40500         function markAliasSymbolAsReferenced(symbol) {
40501             var links = getSymbolLinks(symbol);
40502             if (!links.referenced) {
40503                 links.referenced = true;
40504                 var node = getDeclarationOfAliasSymbol(symbol);
40505                 if (!node)
40506                     return ts.Debug.fail();
40507                 if (ts.isInternalModuleImportEqualsDeclaration(node)) {
40508                     var target = resolveSymbol(symbol);
40509                     if (target === unknownSymbol || target.flags & 111551) {
40510                         checkExpressionCached(node.moduleReference);
40511                     }
40512                 }
40513             }
40514         }
40515         function markConstEnumAliasAsReferenced(symbol) {
40516             var links = getSymbolLinks(symbol);
40517             if (!links.constEnumReferenced) {
40518                 links.constEnumReferenced = true;
40519             }
40520         }
40521         function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
40522             if (entityName.kind === 79 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
40523                 entityName = entityName.parent;
40524             }
40525             if (entityName.kind === 79 || entityName.parent.kind === 160) {
40526                 return resolveEntityName(entityName, 1920, false, dontResolveAlias);
40527             }
40528             else {
40529                 ts.Debug.assert(entityName.parent.kind === 264);
40530                 return resolveEntityName(entityName, 111551 | 788968 | 1920, false, dontResolveAlias);
40531             }
40532         }
40533         function getFullyQualifiedName(symbol, containingLocation) {
40534             return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, undefined, 16 | 4);
40535         }
40536         function getContainingQualifiedNameNode(node) {
40537             while (ts.isQualifiedName(node.parent)) {
40538                 node = node.parent;
40539             }
40540             return node;
40541         }
40542         function tryGetQualifiedNameAsValue(node) {
40543             var left = ts.getFirstIdentifier(node);
40544             var symbol = resolveName(left, left.escapedText, 111551, undefined, left, true);
40545             if (!symbol) {
40546                 return undefined;
40547             }
40548             while (ts.isQualifiedName(left.parent)) {
40549                 var type = getTypeOfSymbol(symbol);
40550                 symbol = getPropertyOfType(type, left.parent.right.escapedText);
40551                 if (!symbol) {
40552                     return undefined;
40553                 }
40554                 left = left.parent;
40555             }
40556             return symbol;
40557         }
40558         function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) {
40559             if (ts.nodeIsMissing(name)) {
40560                 return undefined;
40561             }
40562             var namespaceMeaning = 1920 | (ts.isInJSFile(name) ? meaning & 111551 : 0);
40563             var symbol;
40564             if (name.kind === 79) {
40565                 var message = meaning === namespaceMeaning || ts.nodeIsSynthesized(name) ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(ts.getFirstIdentifier(name));
40566                 var symbolFromJSPrototype = ts.isInJSFile(name) && !ts.nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
40567                 symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, true, false));
40568                 if (!symbol) {
40569                     return getMergedSymbol(symbolFromJSPrototype);
40570                 }
40571             }
40572             else if (name.kind === 160 || name.kind === 205) {
40573                 var left = name.kind === 160 ? name.left : name.expression;
40574                 var right = name.kind === 160 ? name.right : name.name;
40575                 var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location);
40576                 if (!namespace || ts.nodeIsMissing(right)) {
40577                     return undefined;
40578                 }
40579                 else if (namespace === unknownSymbol) {
40580                     return namespace;
40581                 }
40582                 if (namespace.valueDeclaration &&
40583                     ts.isInJSFile(namespace.valueDeclaration) &&
40584                     ts.isVariableDeclaration(namespace.valueDeclaration) &&
40585                     namespace.valueDeclaration.initializer &&
40586                     isCommonJsRequire(namespace.valueDeclaration.initializer)) {
40587                     var moduleName = namespace.valueDeclaration.initializer.arguments[0];
40588                     var moduleSym = resolveExternalModuleName(moduleName, moduleName);
40589                     if (moduleSym) {
40590                         var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);
40591                         if (resolvedModuleSymbol) {
40592                             namespace = resolvedModuleSymbol;
40593                         }
40594                     }
40595                 }
40596                 symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, meaning));
40597                 if (!symbol) {
40598                     if (!ignoreErrors) {
40599                         var namespaceName = getFullyQualifiedName(namespace);
40600                         var declarationName = ts.declarationNameToString(right);
40601                         var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
40602                         if (suggestionForNonexistentModule) {
40603                             error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
40604                             return undefined;
40605                         }
40606                         var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
40607                         var canSuggestTypeof = globalObjectType
40608                             && (meaning & 788968)
40609                             && containingQualifiedName
40610                             && !ts.isTypeOfExpression(containingQualifiedName.parent)
40611                             && tryGetQualifiedNameAsValue(containingQualifiedName);
40612                         if (canSuggestTypeof) {
40613                             error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
40614                             return undefined;
40615                         }
40616                         if (meaning & 1920 && ts.isQualifiedName(name.parent)) {
40617                             var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968));
40618                             if (exportedTypeSymbol) {
40619                                 error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
40620                                 return undefined;
40621                             }
40622                         }
40623                         error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
40624                     }
40625                     return undefined;
40626                 }
40627             }
40628             else {
40629                 throw ts.Debug.assertNever(name, "Unknown entity name kind.");
40630             }
40631             ts.Debug.assert((ts.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here.");
40632             if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 270)) {
40633                 markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, undefined, true);
40634             }
40635             return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);
40636         }
40637         function resolveEntityNameFromAssignmentDeclaration(name, meaning) {
40638             if (isJSDocTypeReference(name.parent)) {
40639                 var secondaryLocation = getAssignmentDeclarationLocation(name.parent);
40640                 if (secondaryLocation) {
40641                     return resolveName(secondaryLocation, name.escapedText, meaning, undefined, name, true);
40642                 }
40643             }
40644         }
40645         function getAssignmentDeclarationLocation(node) {
40646             var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 4194304) ? "quit" : ts.isJSDocTypeAlias(node); });
40647             if (typeAlias) {
40648                 return;
40649             }
40650             var host = ts.getJSDocHost(node);
40651             if (host &&
40652                 ts.isExpressionStatement(host) &&
40653                 ts.isBinaryExpression(host.expression) &&
40654                 ts.getAssignmentDeclarationKind(host.expression) === 3) {
40655                 var symbol = getSymbolOfNode(host.expression.left);
40656                 if (symbol) {
40657                     return getDeclarationOfJSPrototypeContainer(symbol);
40658                 }
40659             }
40660             if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
40661                 ts.isBinaryExpression(host.parent.parent) &&
40662                 ts.getAssignmentDeclarationKind(host.parent.parent) === 6) {
40663                 var symbol = getSymbolOfNode(host.parent.parent.left);
40664                 if (symbol) {
40665                     return getDeclarationOfJSPrototypeContainer(symbol);
40666                 }
40667             }
40668             var sig = ts.getEffectiveJSDocHost(node);
40669             if (sig && ts.isFunctionLike(sig)) {
40670                 var symbol = getSymbolOfNode(sig);
40671                 return symbol && symbol.valueDeclaration;
40672             }
40673         }
40674         function getDeclarationOfJSPrototypeContainer(symbol) {
40675             var decl = symbol.parent.valueDeclaration;
40676             if (!decl) {
40677                 return undefined;
40678             }
40679             var initializer = ts.isAssignmentDeclaration(decl) ? ts.getAssignedExpandoInitializer(decl) :
40680                 ts.hasOnlyExpressionInitializer(decl) ? ts.getDeclaredExpandoInitializer(decl) :
40681                     undefined;
40682             return initializer || decl;
40683         }
40684         function getExpandoSymbol(symbol) {
40685             var decl = symbol.valueDeclaration;
40686             if (!decl || !ts.isInJSFile(decl) || symbol.flags & 524288 || ts.getExpandoInitializer(decl, false)) {
40687                 return undefined;
40688             }
40689             var init = ts.isVariableDeclaration(decl) ? ts.getDeclaredExpandoInitializer(decl) : ts.getAssignedExpandoInitializer(decl);
40690             if (init) {
40691                 var initSymbol = getSymbolOfNode(init);
40692                 if (initSymbol) {
40693                     return mergeJSSymbols(initSymbol, symbol);
40694                 }
40695             }
40696         }
40697         function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
40698             var isClassic = ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Classic;
40699             var errorMessage = isClassic ?
40700                 ts.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option
40701                 : ts.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
40702             return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage);
40703         }
40704         function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) {
40705             if (isForAugmentation === void 0) { isForAugmentation = false; }
40706             return ts.isStringLiteralLike(moduleReferenceExpression)
40707                 ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation)
40708                 : undefined;
40709         }
40710         function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
40711             var _a, _b, _c, _d, _e, _f, _g;
40712             if (isForAugmentation === void 0) { isForAugmentation = false; }
40713             if (ts.startsWith(moduleReference, "@types/")) {
40714                 var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
40715                 var withoutAtTypePrefix = ts.removePrefix(moduleReference, "@types/");
40716                 error(errorNode, diag, withoutAtTypePrefix, moduleReference);
40717             }
40718             var ambientModule = tryFindAmbientModule(moduleReference, true);
40719             if (ambientModule) {
40720                 return ambientModule;
40721             }
40722             var currentSourceFile = ts.getSourceFileOfNode(location);
40723             var contextSpecifier = ts.isStringLiteralLike(location)
40724                 ? location
40725                 : ((_a = ts.findAncestor(location, ts.isImportCall)) === null || _a === void 0 ? void 0 : _a.arguments[0]) ||
40726                     ((_b = ts.findAncestor(location, ts.isImportDeclaration)) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) ||
40727                     ((_c = ts.findAncestor(location, ts.isExternalModuleImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) ||
40728                     ((_d = ts.findAncestor(location, ts.isExportDeclaration)) === null || _d === void 0 ? void 0 : _d.moduleSpecifier) ||
40729                     ((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
40730                     ((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
40731             var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
40732             var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
40733             var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
40734             var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
40735             if (sourceFile) {
40736                 if (sourceFile.symbol) {
40737                     if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
40738                         errorOnImplicitAnyModule(false, errorNode, resolvedModule, moduleReference);
40739                     }
40740                     if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
40741                         var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
40742                         if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
40743                             error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
40744                         }
40745                         if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json") {
40746                             error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
40747                         }
40748                     }
40749                     return getMergedSymbol(sourceFile.symbol);
40750                 }
40751                 if (moduleNotFoundError) {
40752                     error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
40753                 }
40754                 return undefined;
40755             }
40756             if (patternAmbientModules) {
40757                 var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
40758                 if (pattern) {
40759                     var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
40760                     if (augmentation) {
40761                         return getMergedSymbol(augmentation);
40762                     }
40763                     return getMergedSymbol(pattern.symbol);
40764                 }
40765             }
40766             if (resolvedModule && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === undefined || resolutionDiagnostic === ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
40767                 if (isForAugmentation) {
40768                     var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
40769                     error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
40770                 }
40771                 else {
40772                     errorOnImplicitAnyModule(noImplicitAny && !!moduleNotFoundError, errorNode, resolvedModule, moduleReference);
40773                 }
40774                 return undefined;
40775             }
40776             if (moduleNotFoundError) {
40777                 if (resolvedModule) {
40778                     var redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
40779                     if (redirect) {
40780                         error(errorNode, ts.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
40781                         return undefined;
40782                     }
40783                 }
40784                 if (resolutionDiagnostic) {
40785                     error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
40786                 }
40787                 else {
40788                     var tsExtension = ts.tryExtractTSExtension(moduleReference);
40789                     var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
40790                     var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
40791                     var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
40792                         moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
40793                     if (tsExtension) {
40794                         var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
40795                         var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
40796                         var replacedImportSource = importSourceWithoutExtension;
40797                         if (moduleKind >= ts.ModuleKind.ES2015) {
40798                             replacedImportSource += tsExtension === ".mts" ? ".mjs" : tsExtension === ".cts" ? ".cjs" : ".js";
40799                         }
40800                         error(errorNode, diag, tsExtension, replacedImportSource);
40801                     }
40802                     else if (!compilerOptions.resolveJsonModule &&
40803                         ts.fileExtensionIs(moduleReference, ".json") &&
40804                         ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic &&
40805                         ts.hasJsonModuleEmitEnabled(compilerOptions)) {
40806                         error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
40807                     }
40808                     else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
40809                         var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
40810                         var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
40811                             var actualExt = _a[0], _importExt = _a[1];
40812                             return host.fileExists(absoluteRef_1 + actualExt);
40813                         })) === null || _g === void 0 ? void 0 : _g[1];
40814                         if (suggestedExt) {
40815                             error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
40816                         }
40817                         else {
40818                             error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
40819                         }
40820                     }
40821                     else {
40822                         error(errorNode, moduleNotFoundError, moduleReference);
40823                     }
40824                 }
40825             }
40826             return undefined;
40827         }
40828         function errorOnImplicitAnyModule(isError, errorNode, _a, moduleReference) {
40829             var packageId = _a.packageId, resolvedFileName = _a.resolvedFileName;
40830             var errorInfo = !ts.isExternalModuleNameRelative(moduleReference) && packageId
40831                 ? typesPackageExists(packageId.name)
40832                     ? ts.chainDiagnosticMessages(undefined, ts.Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1, packageId.name, ts.mangleScopedPackageName(packageId.name))
40833                     : packageBundlesTypes(packageId.name)
40834                         ? ts.chainDiagnosticMessages(undefined, ts.Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1, packageId.name, moduleReference)
40835                         : ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, moduleReference, ts.mangleScopedPackageName(packageId.name))
40836                 : undefined;
40837             errorOrSuggestion(isError, errorNode, ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedFileName));
40838         }
40839         function typesPackageExists(packageName) {
40840             return getPackagesMap().has(ts.getTypesPackageName(packageName));
40841         }
40842         function packageBundlesTypes(packageName) {
40843             return !!getPackagesMap().get(packageName);
40844         }
40845         function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
40846             if (moduleSymbol === null || moduleSymbol === void 0 ? void 0 : moduleSymbol.exports) {
40847                 var exportEquals = resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias);
40848                 var exported = getCommonJsExportEquals(getMergedSymbol(exportEquals), getMergedSymbol(moduleSymbol));
40849                 return getMergedSymbol(exported) || moduleSymbol;
40850             }
40851             return undefined;
40852         }
40853         function getCommonJsExportEquals(exported, moduleSymbol) {
40854             if (!exported || exported === unknownSymbol || exported === moduleSymbol || moduleSymbol.exports.size === 1 || exported.flags & 2097152) {
40855                 return exported;
40856             }
40857             var links = getSymbolLinks(exported);
40858             if (links.cjsExportMerged) {
40859                 return links.cjsExportMerged;
40860             }
40861             var merged = exported.flags & 33554432 ? exported : cloneSymbol(exported);
40862             merged.flags = merged.flags | 512;
40863             if (merged.exports === undefined) {
40864                 merged.exports = ts.createSymbolTable();
40865             }
40866             moduleSymbol.exports.forEach(function (s, name) {
40867                 if (name === "export=")
40868                     return;
40869                 merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s);
40870             });
40871             getSymbolLinks(merged).cjsExportMerged = merged;
40872             return links.cjsExportMerged = merged;
40873         }
40874         function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) {
40875             var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
40876             if (!dontResolveAlias && symbol) {
40877                 if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 303)) {
40878                     var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
40879                         ? "allowSyntheticDefaultImports"
40880                         : "esModuleInterop";
40881                     error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
40882                     return symbol;
40883                 }
40884                 var referenceParent = referencingLocation.parent;
40885                 if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
40886                     ts.isImportCall(referenceParent)) {
40887                     var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
40888                     var type = getTypeOfSymbol(symbol);
40889                     var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
40890                     if (defaultOnlyType) {
40891                         return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
40892                     }
40893                     if (ts.getESModuleInterop(compilerOptions)) {
40894                         var sigs = getSignaturesOfStructuredType(type, 0);
40895                         if (!sigs || !sigs.length) {
40896                             sigs = getSignaturesOfStructuredType(type, 1);
40897                         }
40898                         if ((sigs && sigs.length) || getPropertyOfType(type, "default")) {
40899                             var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
40900                             return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
40901                         }
40902                     }
40903                 }
40904             }
40905             return symbol;
40906         }
40907         function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
40908             var result = createSymbol(symbol.flags, symbol.escapedName);
40909             result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
40910             result.parent = symbol.parent;
40911             result.target = symbol;
40912             result.originatingImport = referenceParent;
40913             if (symbol.valueDeclaration)
40914                 result.valueDeclaration = symbol.valueDeclaration;
40915             if (symbol.constEnumOnlyModule)
40916                 result.constEnumOnlyModule = true;
40917             if (symbol.members)
40918                 result.members = new ts.Map(symbol.members);
40919             if (symbol.exports)
40920                 result.exports = new ts.Map(symbol.exports);
40921             var resolvedModuleType = resolveStructuredTypeMembers(moduleType);
40922             result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
40923             return result;
40924         }
40925         function hasExportAssignmentSymbol(moduleSymbol) {
40926             return moduleSymbol.exports.get("export=") !== undefined;
40927         }
40928         function getExportsOfModuleAsArray(moduleSymbol) {
40929             return symbolsToArray(getExportsOfModule(moduleSymbol));
40930         }
40931         function getExportsAndPropertiesOfModule(moduleSymbol) {
40932             var exports = getExportsOfModuleAsArray(moduleSymbol);
40933             var exportEquals = resolveExternalModuleSymbol(moduleSymbol);
40934             if (exportEquals !== moduleSymbol) {
40935                 var type = getTypeOfSymbol(exportEquals);
40936                 if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
40937                     ts.addRange(exports, getPropertiesOfType(type));
40938                 }
40939             }
40940             return exports;
40941         }
40942         function forEachExportAndPropertyOfModule(moduleSymbol, cb) {
40943             var exports = getExportsOfModule(moduleSymbol);
40944             exports.forEach(function (symbol, key) {
40945                 if (!isReservedMemberName(key)) {
40946                     cb(symbol, key);
40947                 }
40948             });
40949             var exportEquals = resolveExternalModuleSymbol(moduleSymbol);
40950             if (exportEquals !== moduleSymbol) {
40951                 var type = getTypeOfSymbol(exportEquals);
40952                 if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
40953                     forEachPropertyOfType(type, function (symbol, escapedName) {
40954                         cb(symbol, escapedName);
40955                     });
40956                 }
40957             }
40958         }
40959         function tryGetMemberInModuleExports(memberName, moduleSymbol) {
40960             var symbolTable = getExportsOfModule(moduleSymbol);
40961             if (symbolTable) {
40962                 return symbolTable.get(memberName);
40963             }
40964         }
40965         function tryGetMemberInModuleExportsAndProperties(memberName, moduleSymbol) {
40966             var symbol = tryGetMemberInModuleExports(memberName, moduleSymbol);
40967             if (symbol) {
40968                 return symbol;
40969             }
40970             var exportEquals = resolveExternalModuleSymbol(moduleSymbol);
40971             if (exportEquals === moduleSymbol) {
40972                 return undefined;
40973             }
40974             var type = getTypeOfSymbol(exportEquals);
40975             return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : undefined;
40976         }
40977         function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
40978             return !(resolvedExternalModuleType.flags & 131068 ||
40979                 ts.getObjectFlags(resolvedExternalModuleType) & 1 ||
40980                 isArrayType(resolvedExternalModuleType) ||
40981                 isTupleType(resolvedExternalModuleType));
40982         }
40983         function getExportsOfSymbol(symbol) {
40984             return symbol.flags & 6256 ? getResolvedMembersOrExportsOfSymbol(symbol, "resolvedExports") :
40985                 symbol.flags & 1536 ? getExportsOfModule(symbol) :
40986                     symbol.exports || emptySymbols;
40987         }
40988         function getExportsOfModule(moduleSymbol) {
40989             var links = getSymbolLinks(moduleSymbol);
40990             return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
40991         }
40992         function extendExportSymbols(target, source, lookupTable, exportNode) {
40993             if (!source)
40994                 return;
40995             source.forEach(function (sourceSymbol, id) {
40996                 if (id === "default")
40997                     return;
40998                 var targetSymbol = target.get(id);
40999                 if (!targetSymbol) {
41000                     target.set(id, sourceSymbol);
41001                     if (lookupTable && exportNode) {
41002                         lookupTable.set(id, {
41003                             specifierText: ts.getTextOfNode(exportNode.moduleSpecifier)
41004                         });
41005                     }
41006                 }
41007                 else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) {
41008                     var collisionTracker = lookupTable.get(id);
41009                     if (!collisionTracker.exportsWithDuplicate) {
41010                         collisionTracker.exportsWithDuplicate = [exportNode];
41011                     }
41012                     else {
41013                         collisionTracker.exportsWithDuplicate.push(exportNode);
41014                     }
41015                 }
41016             });
41017         }
41018         function getExportsOfModuleWorker(moduleSymbol) {
41019             var visitedSymbols = [];
41020             moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
41021             return visit(moduleSymbol) || emptySymbols;
41022             function visit(symbol) {
41023                 if (!(symbol && symbol.exports && ts.pushIfUnique(visitedSymbols, symbol))) {
41024                     return;
41025                 }
41026                 var symbols = new ts.Map(symbol.exports);
41027                 var exportStars = symbol.exports.get("__export");
41028                 if (exportStars) {
41029                     var nestedSymbols = ts.createSymbolTable();
41030                     var lookupTable_1 = new ts.Map();
41031                     if (exportStars.declarations) {
41032                         for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) {
41033                             var node = _a[_i];
41034                             var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
41035                             var exportedSymbols = visit(resolvedModule);
41036                             extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node);
41037                         }
41038                     }
41039                     lookupTable_1.forEach(function (_a, id) {
41040                         var exportsWithDuplicate = _a.exportsWithDuplicate;
41041                         if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) {
41042                             return;
41043                         }
41044                         for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) {
41045                             var node = exportsWithDuplicate_1[_i];
41046                             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, ts.unescapeLeadingUnderscores(id)));
41047                         }
41048                     });
41049                     extendExportSymbols(symbols, nestedSymbols);
41050                 }
41051                 return symbols;
41052             }
41053         }
41054         function getMergedSymbol(symbol) {
41055             var merged;
41056             return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol;
41057         }
41058         function getSymbolOfNode(node) {
41059             return getMergedSymbol(node.symbol && getLateBoundSymbol(node.symbol));
41060         }
41061         function getParentOfSymbol(symbol) {
41062             return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
41063         }
41064         function getAlternativeContainingModules(symbol, enclosingDeclaration) {
41065             var containingFile = ts.getSourceFileOfNode(enclosingDeclaration);
41066             var id = getNodeId(containingFile);
41067             var links = getSymbolLinks(symbol);
41068             var results;
41069             if (links.extendedContainersByFile && (results = links.extendedContainersByFile.get(id))) {
41070                 return results;
41071             }
41072             if (containingFile && containingFile.imports) {
41073                 for (var _i = 0, _a = containingFile.imports; _i < _a.length; _i++) {
41074                     var importRef = _a[_i];
41075                     if (ts.nodeIsSynthesized(importRef))
41076                         continue;
41077                     var resolvedModule = resolveExternalModuleName(enclosingDeclaration, importRef, true);
41078                     if (!resolvedModule)
41079                         continue;
41080                     var ref = getAliasForSymbolInContainer(resolvedModule, symbol);
41081                     if (!ref)
41082                         continue;
41083                     results = ts.append(results, resolvedModule);
41084                 }
41085                 if (ts.length(results)) {
41086                     (links.extendedContainersByFile || (links.extendedContainersByFile = new ts.Map())).set(id, results);
41087                     return results;
41088                 }
41089             }
41090             if (links.extendedContainers) {
41091                 return links.extendedContainers;
41092             }
41093             var otherFiles = host.getSourceFiles();
41094             for (var _b = 0, otherFiles_1 = otherFiles; _b < otherFiles_1.length; _b++) {
41095                 var file = otherFiles_1[_b];
41096                 if (!ts.isExternalModule(file))
41097                     continue;
41098                 var sym = getSymbolOfNode(file);
41099                 var ref = getAliasForSymbolInContainer(sym, symbol);
41100                 if (!ref)
41101                     continue;
41102                 results = ts.append(results, sym);
41103             }
41104             return links.extendedContainers = results || ts.emptyArray;
41105         }
41106         function getContainersOfSymbol(symbol, enclosingDeclaration, meaning) {
41107             var container = getParentOfSymbol(symbol);
41108             if (container && !(symbol.flags & 262144)) {
41109                 var additionalContainers = ts.mapDefined(container.declarations, fileSymbolIfFileSymbolExportEqualsContainer);
41110                 var reexportContainers = enclosingDeclaration && getAlternativeContainingModules(symbol, enclosingDeclaration);
41111                 var objectLiteralContainer = getVariableDeclarationOfObjectLiteral(container, meaning);
41112                 if (enclosingDeclaration &&
41113                     container.flags & getQualifiedLeftMeaning(meaning) &&
41114                     getAccessibleSymbolChain(container, enclosingDeclaration, 1920, false)) {
41115                     return ts.append(ts.concatenate(ts.concatenate([container], additionalContainers), reexportContainers), objectLiteralContainer);
41116                 }
41117                 var firstVariableMatch = !(container.flags & getQualifiedLeftMeaning(meaning))
41118                     && container.flags & 788968
41119                     && getDeclaredTypeOfSymbol(container).flags & 524288
41120                     && meaning === 111551
41121                     ? forEachSymbolTableInScope(enclosingDeclaration, function (t) {
41122                         return ts.forEachEntry(t, function (s) {
41123                             if (s.flags & getQualifiedLeftMeaning(meaning) && getTypeOfSymbol(s) === getDeclaredTypeOfSymbol(container)) {
41124                                 return s;
41125                             }
41126                         });
41127                     }) : undefined;
41128                 var res = firstVariableMatch ? __spreadArray(__spreadArray([firstVariableMatch], additionalContainers, true), [container], false) : __spreadArray(__spreadArray([], additionalContainers, true), [container], false);
41129                 res = ts.append(res, objectLiteralContainer);
41130                 res = ts.addRange(res, reexportContainers);
41131                 return res;
41132             }
41133             var candidates = ts.mapDefined(symbol.declarations, function (d) {
41134                 if (!ts.isAmbientModule(d) && d.parent && hasNonGlobalAugmentationExternalModuleSymbol(d.parent)) {
41135                     return getSymbolOfNode(d.parent);
41136                 }
41137                 if (ts.isClassExpression(d) && ts.isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 && ts.isAccessExpression(d.parent.left) && ts.isEntityNameExpression(d.parent.left.expression)) {
41138                     if (ts.isModuleExportsAccessExpression(d.parent.left) || ts.isExportsIdentifier(d.parent.left.expression)) {
41139                         return getSymbolOfNode(ts.getSourceFileOfNode(d));
41140                     }
41141                     checkExpressionCached(d.parent.left.expression);
41142                     return getNodeLinks(d.parent.left.expression).resolvedSymbol;
41143                 }
41144             });
41145             if (!ts.length(candidates)) {
41146                 return undefined;
41147             }
41148             return ts.mapDefined(candidates, function (candidate) { return getAliasForSymbolInContainer(candidate, symbol) ? candidate : undefined; });
41149             function fileSymbolIfFileSymbolExportEqualsContainer(d) {
41150                 return container && getFileSymbolIfFileSymbolExportEqualsContainer(d, container);
41151             }
41152         }
41153         function getVariableDeclarationOfObjectLiteral(symbol, meaning) {
41154             var firstDecl = !!ts.length(symbol.declarations) && ts.first(symbol.declarations);
41155             if (meaning & 111551 && firstDecl && firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent)) {
41156                 if (ts.isObjectLiteralExpression(firstDecl) && firstDecl === firstDecl.parent.initializer || ts.isTypeLiteralNode(firstDecl) && firstDecl === firstDecl.parent.type) {
41157                     return getSymbolOfNode(firstDecl.parent);
41158                 }
41159             }
41160         }
41161         function getFileSymbolIfFileSymbolExportEqualsContainer(d, container) {
41162             var fileSymbol = getExternalModuleContainer(d);
41163             var exported = fileSymbol && fileSymbol.exports && fileSymbol.exports.get("export=");
41164             return exported && getSymbolIfSameReference(exported, container) ? fileSymbol : undefined;
41165         }
41166         function getAliasForSymbolInContainer(container, symbol) {
41167             if (container === getParentOfSymbol(symbol)) {
41168                 return symbol;
41169             }
41170             var exportEquals = container.exports && container.exports.get("export=");
41171             if (exportEquals && getSymbolIfSameReference(exportEquals, symbol)) {
41172                 return container;
41173             }
41174             var exports = getExportsOfSymbol(container);
41175             var quick = exports.get(symbol.escapedName);
41176             if (quick && getSymbolIfSameReference(quick, symbol)) {
41177                 return quick;
41178             }
41179             return ts.forEachEntry(exports, function (exported) {
41180                 if (getSymbolIfSameReference(exported, symbol)) {
41181                     return exported;
41182                 }
41183             });
41184         }
41185         function getSymbolIfSameReference(s1, s2) {
41186             if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
41187                 return s1;
41188             }
41189         }
41190         function getExportSymbolOfValueSymbolIfExported(symbol) {
41191             return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0 ? symbol.exportSymbol : symbol);
41192         }
41193         function symbolIsValue(symbol) {
41194             return !!(symbol.flags & 111551 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 111551 && !getTypeOnlyAliasDeclaration(symbol));
41195         }
41196         function findConstructorDeclaration(node) {
41197             var members = node.members;
41198             for (var _i = 0, members_3 = members; _i < members_3.length; _i++) {
41199                 var member = members_3[_i];
41200                 if (member.kind === 170 && ts.nodeIsPresent(member.body)) {
41201                     return member;
41202                 }
41203             }
41204         }
41205         function createType(flags) {
41206             var result = new Type(checker, flags);
41207             typeCount++;
41208             result.id = typeCount;
41209             if (produceDiagnostics) {
41210                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.recordType(result);
41211             }
41212             return result;
41213         }
41214         function createOriginType(flags) {
41215             return new Type(checker, flags);
41216         }
41217         function createIntrinsicType(kind, intrinsicName, objectFlags) {
41218             if (objectFlags === void 0) { objectFlags = 0; }
41219             var type = createType(kind);
41220             type.intrinsicName = intrinsicName;
41221             type.objectFlags = objectFlags;
41222             return type;
41223         }
41224         function createObjectType(objectFlags, symbol) {
41225             var type = createType(524288);
41226             type.objectFlags = objectFlags;
41227             type.symbol = symbol;
41228             type.members = undefined;
41229             type.properties = undefined;
41230             type.callSignatures = undefined;
41231             type.constructSignatures = undefined;
41232             type.indexInfos = undefined;
41233             return type;
41234         }
41235         function createTypeofType() {
41236             return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getStringLiteralType));
41237         }
41238         function createTypeParameter(symbol) {
41239             var type = createType(262144);
41240             if (symbol)
41241                 type.symbol = symbol;
41242             return type;
41243         }
41244         function isReservedMemberName(name) {
41245             return name.charCodeAt(0) === 95 &&
41246                 name.charCodeAt(1) === 95 &&
41247                 name.charCodeAt(2) !== 95 &&
41248                 name.charCodeAt(2) !== 64 &&
41249                 name.charCodeAt(2) !== 35;
41250         }
41251         function getNamedMembers(members) {
41252             var result;
41253             members.forEach(function (symbol, id) {
41254                 if (isNamedMember(symbol, id)) {
41255                     (result || (result = [])).push(symbol);
41256                 }
41257             });
41258             return result || ts.emptyArray;
41259         }
41260         function isNamedMember(member, escapedName) {
41261             return !isReservedMemberName(escapedName) && symbolIsValue(member);
41262         }
41263         function getNamedOrIndexSignatureMembers(members) {
41264             var result = getNamedMembers(members);
41265             var index = getIndexSymbolFromSymbolTable(members);
41266             return index ? ts.concatenate(result, [index]) : result;
41267         }
41268         function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos) {
41269             var resolved = type;
41270             resolved.members = members;
41271             resolved.properties = ts.emptyArray;
41272             resolved.callSignatures = callSignatures;
41273             resolved.constructSignatures = constructSignatures;
41274             resolved.indexInfos = indexInfos;
41275             if (members !== emptySymbols)
41276                 resolved.properties = getNamedMembers(members);
41277             return resolved;
41278         }
41279         function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) {
41280             return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, indexInfos);
41281         }
41282         function getResolvedTypeWithoutAbstractConstructSignatures(type) {
41283             if (type.constructSignatures.length === 0)
41284                 return type;
41285             if (type.objectTypeWithoutAbstractConstructSignatures)
41286                 return type.objectTypeWithoutAbstractConstructSignatures;
41287             var constructSignatures = ts.filter(type.constructSignatures, function (signature) { return !(signature.flags & 4); });
41288             if (type.constructSignatures === constructSignatures)
41289                 return type;
41290             var typeCopy = createAnonymousType(type.symbol, type.members, type.callSignatures, ts.some(constructSignatures) ? constructSignatures : ts.emptyArray, type.indexInfos);
41291             type.objectTypeWithoutAbstractConstructSignatures = typeCopy;
41292             typeCopy.objectTypeWithoutAbstractConstructSignatures = typeCopy;
41293             return typeCopy;
41294         }
41295         function forEachSymbolTableInScope(enclosingDeclaration, callback) {
41296             var result;
41297             var _loop_8 = function (location) {
41298                 if (location.locals && !isGlobalSourceFile(location)) {
41299                     if (result = callback(location.locals, undefined, true, location)) {
41300                         return { value: result };
41301                     }
41302                 }
41303                 switch (location.kind) {
41304                     case 303:
41305                         if (!ts.isExternalOrCommonJsModule(location)) {
41306                             break;
41307                         }
41308                     case 260:
41309                         var sym = getSymbolOfNode(location);
41310                         if (result = callback((sym === null || sym === void 0 ? void 0 : sym.exports) || emptySymbols, undefined, true, location)) {
41311                             return { value: result };
41312                         }
41313                         break;
41314                     case 256:
41315                     case 225:
41316                     case 257:
41317                         var table_1;
41318                         (getSymbolOfNode(location).members || emptySymbols).forEach(function (memberSymbol, key) {
41319                             if (memberSymbol.flags & (788968 & ~67108864)) {
41320                                 (table_1 || (table_1 = ts.createSymbolTable())).set(key, memberSymbol);
41321                             }
41322                         });
41323                         if (table_1 && (result = callback(table_1, undefined, false, location))) {
41324                             return { value: result };
41325                         }
41326                         break;
41327                 }
41328             };
41329             for (var location = enclosingDeclaration; location; location = location.parent) {
41330                 var state_2 = _loop_8(location);
41331                 if (typeof state_2 === "object")
41332                     return state_2.value;
41333             }
41334             return callback(globals, undefined, true);
41335         }
41336         function getQualifiedLeftMeaning(rightMeaning) {
41337             return rightMeaning === 111551 ? 111551 : 1920;
41338         }
41339         function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) {
41340             if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = new ts.Map(); }
41341             if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) {
41342                 return undefined;
41343             }
41344             var links = getSymbolLinks(symbol);
41345             var cache = (links.accessibleChainCache || (links.accessibleChainCache = new ts.Map()));
41346             var firstRelevantLocation = forEachSymbolTableInScope(enclosingDeclaration, function (_, __, ___, node) { return node; });
41347             var key = "".concat(useOnlyExternalAliasing ? 0 : 1, "|").concat(firstRelevantLocation && getNodeId(firstRelevantLocation), "|").concat(meaning);
41348             if (cache.has(key)) {
41349                 return cache.get(key);
41350             }
41351             var id = getSymbolId(symbol);
41352             var visitedSymbolTables = visitedSymbolTablesMap.get(id);
41353             if (!visitedSymbolTables) {
41354                 visitedSymbolTablesMap.set(id, visitedSymbolTables = []);
41355             }
41356             var result = forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
41357             cache.set(key, result);
41358             return result;
41359             function getAccessibleSymbolChainFromSymbolTable(symbols, ignoreQualification, isLocalNameLookup) {
41360                 if (!ts.pushIfUnique(visitedSymbolTables, symbols)) {
41361                     return undefined;
41362                 }
41363                 var result = trySymbolTable(symbols, ignoreQualification, isLocalNameLookup);
41364                 visitedSymbolTables.pop();
41365                 return result;
41366             }
41367             function canQualifySymbol(symbolFromSymbolTable, meaning) {
41368                 return !needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning) ||
41369                     !!getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing, visitedSymbolTablesMap);
41370             }
41371             function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol, ignoreQualification) {
41372                 return (symbol === (resolvedAliasSymbol || symbolFromSymbolTable) || getMergedSymbol(symbol) === getMergedSymbol(resolvedAliasSymbol || symbolFromSymbolTable)) &&
41373                     !ts.some(symbolFromSymbolTable.declarations, hasNonGlobalAugmentationExternalModuleSymbol) &&
41374                     (ignoreQualification || canQualifySymbol(getMergedSymbol(symbolFromSymbolTable), meaning));
41375             }
41376             function trySymbolTable(symbols, ignoreQualification, isLocalNameLookup) {
41377                 if (isAccessible(symbols.get(symbol.escapedName), undefined, ignoreQualification)) {
41378                     return [symbol];
41379                 }
41380                 var result = ts.forEachEntry(symbols, function (symbolFromSymbolTable) {
41381                     if (symbolFromSymbolTable.flags & 2097152
41382                         && symbolFromSymbolTable.escapedName !== "export="
41383                         && symbolFromSymbolTable.escapedName !== "default"
41384                         && !(ts.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts.isExternalModule(ts.getSourceFileOfNode(enclosingDeclaration)))
41385                         && (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
41386                         && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true)
41387                         && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 274))) {
41388                         var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
41389                         var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification);
41390                         if (candidate) {
41391                             return candidate;
41392                         }
41393                     }
41394                     if (symbolFromSymbolTable.escapedName === symbol.escapedName && symbolFromSymbolTable.exportSymbol) {
41395                         if (isAccessible(getMergedSymbol(symbolFromSymbolTable.exportSymbol), undefined, ignoreQualification)) {
41396                             return [symbol];
41397                         }
41398                     }
41399                 });
41400                 return result || (symbols === globals ? getCandidateListForSymbol(globalThisSymbol, globalThisSymbol, ignoreQualification) : undefined);
41401             }
41402             function getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification) {
41403                 if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
41404                     return [symbolFromSymbolTable];
41405                 }
41406                 var candidateTable = getExportsOfSymbol(resolvedImportedSymbol);
41407                 var accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, true);
41408                 if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
41409                     return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
41410                 }
41411             }
41412         }
41413         function needsQualification(symbol, enclosingDeclaration, meaning) {
41414             var qualify = false;
41415             forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) {
41416                 var symbolFromSymbolTable = getMergedSymbol(symbolTable.get(symbol.escapedName));
41417                 if (!symbolFromSymbolTable) {
41418                     return false;
41419                 }
41420                 if (symbolFromSymbolTable === symbol) {
41421                     return true;
41422                 }
41423                 symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 274)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
41424                 if (symbolFromSymbolTable.flags & meaning) {
41425                     qualify = true;
41426                     return true;
41427                 }
41428                 return false;
41429             });
41430             return qualify;
41431         }
41432         function isPropertyOrMethodDeclarationSymbol(symbol) {
41433             if (symbol.declarations && symbol.declarations.length) {
41434                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
41435                     var declaration = _a[_i];
41436                     switch (declaration.kind) {
41437                         case 166:
41438                         case 168:
41439                         case 171:
41440                         case 172:
41441                             continue;
41442                         default:
41443                             return false;
41444                     }
41445                 }
41446                 return true;
41447             }
41448             return false;
41449         }
41450         function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
41451             var access = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, 788968, false, true);
41452             return access.accessibility === 0;
41453         }
41454         function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
41455             var access = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, 111551, false, true);
41456             return access.accessibility === 0;
41457         }
41458         function isSymbolAccessibleByFlags(typeSymbol, enclosingDeclaration, flags) {
41459             var access = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, flags, false, false);
41460             return access.accessibility === 0;
41461         }
41462         function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible, allowModules) {
41463             if (!ts.length(symbols))
41464                 return;
41465             var hadAccessibleChain;
41466             var earlyModuleBail = false;
41467             for (var _i = 0, _a = symbols; _i < _a.length; _i++) {
41468                 var symbol = _a[_i];
41469                 var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, false);
41470                 if (accessibleSymbolChain) {
41471                     hadAccessibleChain = symbol;
41472                     var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
41473                     if (hasAccessibleDeclarations) {
41474                         return hasAccessibleDeclarations;
41475                     }
41476                 }
41477                 if (allowModules) {
41478                     if (ts.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
41479                         if (shouldComputeAliasesToMakeVisible) {
41480                             earlyModuleBail = true;
41481                             continue;
41482                         }
41483                         return {
41484                             accessibility: 0
41485                         };
41486                     }
41487                 }
41488                 var containers = getContainersOfSymbol(symbol, enclosingDeclaration, meaning);
41489                 var parentResult = isAnySymbolAccessible(containers, enclosingDeclaration, initialSymbol, initialSymbol === symbol ? getQualifiedLeftMeaning(meaning) : meaning, shouldComputeAliasesToMakeVisible, allowModules);
41490                 if (parentResult) {
41491                     return parentResult;
41492                 }
41493             }
41494             if (earlyModuleBail) {
41495                 return {
41496                     accessibility: 0
41497                 };
41498             }
41499             if (hadAccessibleChain) {
41500                 return {
41501                     accessibility: 1,
41502                     errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
41503                     errorModuleName: hadAccessibleChain !== initialSymbol ? symbolToString(hadAccessibleChain, enclosingDeclaration, 1920) : undefined,
41504                 };
41505             }
41506         }
41507         function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
41508             return isSymbolAccessibleWorker(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, true);
41509         }
41510         function isSymbolAccessibleWorker(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, allowModules) {
41511             if (symbol && enclosingDeclaration) {
41512                 var result = isAnySymbolAccessible([symbol], enclosingDeclaration, symbol, meaning, shouldComputeAliasesToMakeVisible, allowModules);
41513                 if (result) {
41514                     return result;
41515                 }
41516                 var symbolExternalModule = ts.forEach(symbol.declarations, getExternalModuleContainer);
41517                 if (symbolExternalModule) {
41518                     var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);
41519                     if (symbolExternalModule !== enclosingExternalModule) {
41520                         return {
41521                             accessibility: 2,
41522                             errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning),
41523                             errorModuleName: symbolToString(symbolExternalModule),
41524                             errorNode: ts.isInJSFile(enclosingDeclaration) ? enclosingDeclaration : undefined,
41525                         };
41526                     }
41527                 }
41528                 return {
41529                     accessibility: 1,
41530                     errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning),
41531                 };
41532             }
41533             return { accessibility: 0 };
41534         }
41535         function getExternalModuleContainer(declaration) {
41536             var node = ts.findAncestor(declaration, hasExternalModuleSymbol);
41537             return node && getSymbolOfNode(node);
41538         }
41539         function hasExternalModuleSymbol(declaration) {
41540             return ts.isAmbientModule(declaration) || (declaration.kind === 303 && ts.isExternalOrCommonJsModule(declaration));
41541         }
41542         function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
41543             return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 303 && ts.isExternalOrCommonJsModule(declaration));
41544         }
41545         function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
41546             var aliasesToMakeVisible;
41547             if (!ts.every(ts.filter(symbol.declarations, function (d) { return d.kind !== 79; }), getIsDeclarationVisible)) {
41548                 return undefined;
41549             }
41550             return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible };
41551             function getIsDeclarationVisible(declaration) {
41552                 var _a, _b;
41553                 if (!isDeclarationVisible(declaration)) {
41554                     var anyImportSyntax = getAnyImportSyntax(declaration);
41555                     if (anyImportSyntax &&
41556                         !ts.hasSyntacticModifier(anyImportSyntax, 1) &&
41557                         isDeclarationVisible(anyImportSyntax.parent)) {
41558                         return addVisibleAlias(declaration, anyImportSyntax);
41559                     }
41560                     else if (ts.isVariableDeclaration(declaration) && ts.isVariableStatement(declaration.parent.parent) &&
41561                         !ts.hasSyntacticModifier(declaration.parent.parent, 1) &&
41562                         isDeclarationVisible(declaration.parent.parent.parent)) {
41563                         return addVisibleAlias(declaration, declaration.parent.parent);
41564                     }
41565                     else if (ts.isLateVisibilityPaintedStatement(declaration)
41566                         && !ts.hasSyntacticModifier(declaration, 1)
41567                         && isDeclarationVisible(declaration.parent)) {
41568                         return addVisibleAlias(declaration, declaration);
41569                     }
41570                     else if (symbol.flags & 2097152 && ts.isBindingElement(declaration) && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
41571                         && ts.isVariableDeclaration(declaration.parent.parent)
41572                         && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
41573                         && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
41574                         && declaration.parent.parent.parent.parent.parent
41575                         && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
41576                         return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
41577                     }
41578                     return false;
41579                 }
41580                 return true;
41581             }
41582             function addVisibleAlias(declaration, aliasingStatement) {
41583                 if (shouldComputeAliasToMakeVisible) {
41584                     getNodeLinks(declaration).isVisible = true;
41585                     aliasesToMakeVisible = ts.appendIfUnique(aliasesToMakeVisible, aliasingStatement);
41586                 }
41587                 return true;
41588             }
41589         }
41590         function isEntityNameVisible(entityName, enclosingDeclaration) {
41591             var meaning;
41592             if (entityName.parent.kind === 180 ||
41593                 ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
41594                 entityName.parent.kind === 161) {
41595                 meaning = 111551 | 1048576;
41596             }
41597             else if (entityName.kind === 160 || entityName.kind === 205 ||
41598                 entityName.parent.kind === 264) {
41599                 meaning = 1920;
41600             }
41601             else {
41602                 meaning = 788968;
41603             }
41604             var firstIdentifier = ts.getFirstIdentifier(entityName);
41605             var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, undefined, undefined, false);
41606             if (symbol && symbol.flags & 262144 && meaning & 788968) {
41607                 return { accessibility: 0 };
41608             }
41609             return (symbol && hasVisibleDeclarations(symbol, true)) || {
41610                 accessibility: 1,
41611                 errorSymbolName: ts.getTextOfNode(firstIdentifier),
41612                 errorNode: firstIdentifier
41613             };
41614         }
41615         function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) {
41616             if (flags === void 0) { flags = 4; }
41617             var nodeFlags = 70221824;
41618             if (flags & 2) {
41619                 nodeFlags |= 128;
41620             }
41621             if (flags & 1) {
41622                 nodeFlags |= 512;
41623             }
41624             if (flags & 8) {
41625                 nodeFlags |= 16384;
41626             }
41627             if (flags & 16) {
41628                 nodeFlags |= 134217728;
41629             }
41630             var builder = flags & 4 ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName;
41631             return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker);
41632             function symbolToStringWorker(writer) {
41633                 var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
41634                 var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 303 ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true });
41635                 var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration);
41636                 printer.writeNode(4, entity, sourceFile, writer);
41637                 return writer;
41638             }
41639         }
41640         function signatureToString(signature, enclosingDeclaration, flags, kind, writer) {
41641             if (flags === void 0) { flags = 0; }
41642             return writer ? signatureToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(signatureToStringWorker);
41643             function signatureToStringWorker(writer) {
41644                 var sigOutput;
41645                 if (flags & 262144) {
41646                     sigOutput = kind === 1 ? 179 : 178;
41647                 }
41648                 else {
41649                     sigOutput = kind === 1 ? 174 : 173;
41650                 }
41651                 var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512);
41652                 var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
41653                 var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration);
41654                 printer.writeNode(4, sig, sourceFile, ts.getTrailingSemicolonDeferringWriter(writer));
41655                 return writer;
41656             }
41657         }
41658         function typeToString(type, enclosingDeclaration, flags, writer) {
41659             if (flags === void 0) { flags = 1048576 | 16384; }
41660             if (writer === void 0) { writer = ts.createTextWriter(""); }
41661             var noTruncation = compilerOptions.noErrorTruncation || flags & 1;
41662             var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | (noTruncation ? 1 : 0), writer);
41663             if (typeNode === undefined)
41664                 return ts.Debug.fail("should always get typenode");
41665             var options = { removeComments: type !== unresolvedType };
41666             var printer = ts.createPrinter(options);
41667             var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration);
41668             printer.writeNode(4, typeNode, sourceFile, writer);
41669             var result = writer.getText();
41670             var maxLength = noTruncation ? ts.noTruncationMaximumTruncationLength * 2 : ts.defaultMaximumTruncationLength * 2;
41671             if (maxLength && result && result.length >= maxLength) {
41672                 return result.substr(0, maxLength - "...".length) + "...";
41673             }
41674             return result;
41675         }
41676         function getTypeNamesForErrorDisplay(left, right) {
41677             var leftStr = symbolValueDeclarationIsContextSensitive(left.symbol) ? typeToString(left, left.symbol.valueDeclaration) : typeToString(left);
41678             var rightStr = symbolValueDeclarationIsContextSensitive(right.symbol) ? typeToString(right, right.symbol.valueDeclaration) : typeToString(right);
41679             if (leftStr === rightStr) {
41680                 leftStr = getTypeNameForErrorDisplay(left);
41681                 rightStr = getTypeNameForErrorDisplay(right);
41682             }
41683             return [leftStr, rightStr];
41684         }
41685         function getTypeNameForErrorDisplay(type) {
41686             return typeToString(type, undefined, 64);
41687         }
41688         function symbolValueDeclarationIsContextSensitive(symbol) {
41689             return symbol && !!symbol.valueDeclaration && ts.isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
41690         }
41691         function toNodeBuilderFlags(flags) {
41692             if (flags === void 0) { flags = 0; }
41693             return flags & 814775659;
41694         }
41695         function isClassInstanceSide(type) {
41696             return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
41697         }
41698         function createNodeBuilder() {
41699             return {
41700                 typeToTypeNode: function (type, enclosingDeclaration, flags, tracker) {
41701                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return typeToTypeNodeHelper(type, context); });
41702                 },
41703                 indexInfoToIndexSignatureDeclaration: function (indexInfo, enclosingDeclaration, flags, tracker) {
41704                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, undefined); });
41705                 },
41706                 signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags, tracker) {
41707                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return signatureToSignatureDeclarationHelper(signature, kind, context); });
41708                 },
41709                 symbolToEntityName: function (symbol, meaning, enclosingDeclaration, flags, tracker) {
41710                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToName(symbol, context, meaning, false); });
41711                 },
41712                 symbolToExpression: function (symbol, meaning, enclosingDeclaration, flags, tracker) {
41713                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToExpression(symbol, context, meaning); });
41714                 },
41715                 symbolToTypeParameterDeclarations: function (symbol, enclosingDeclaration, flags, tracker) {
41716                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return typeParametersToTypeParameterDeclarations(symbol, context); });
41717                 },
41718                 symbolToParameterDeclaration: function (symbol, enclosingDeclaration, flags, tracker) {
41719                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToParameterDeclaration(symbol, context); });
41720                 },
41721                 typeParameterToDeclaration: function (parameter, enclosingDeclaration, flags, tracker) {
41722                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return typeParameterToDeclaration(parameter, context); });
41723                 },
41724                 symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) {
41725                     return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); });
41726                 },
41727             };
41728             function withContext(enclosingDeclaration, flags, tracker, cb) {
41729                 var _a, _b;
41730                 ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8) === 0);
41731                 var context = {
41732                     enclosingDeclaration: enclosingDeclaration,
41733                     flags: flags || 0,
41734                     tracker: tracker && tracker.trackSymbol ? tracker : { trackSymbol: function () { return false; }, moduleResolverHost: flags & 134217728 ? {
41735                             getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
41736                             getCurrentDirectory: function () { return host.getCurrentDirectory(); },
41737                             getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
41738                             useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
41739                             redirectTargetsMap: host.redirectTargetsMap,
41740                             getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
41741                             isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
41742                             fileExists: function (fileName) { return host.fileExists(fileName); },
41743                             getFileIncludeReasons: function () { return host.getFileIncludeReasons(); },
41744                             readFile: host.readFile ? (function (fileName) { return host.readFile(fileName); }) : undefined,
41745                         } : undefined },
41746                     encounteredError: false,
41747                     reportedDiagnostic: false,
41748                     visitedTypes: undefined,
41749                     symbolDepth: undefined,
41750                     inferTypeParameters: undefined,
41751                     approximateLength: 0
41752                 };
41753                 context.tracker = wrapSymbolTrackerToReportForContext(context, context.tracker);
41754                 var resultingNode = cb(context);
41755                 if (context.truncating && context.flags & 1) {
41756                     (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportTruncationError) === null || _b === void 0 ? void 0 : _b.call(_a);
41757                 }
41758                 return context.encounteredError ? undefined : resultingNode;
41759             }
41760             function wrapSymbolTrackerToReportForContext(context, tracker) {
41761                 var oldTrackSymbol = tracker.trackSymbol;
41762                 return __assign(__assign({}, tracker), { reportCyclicStructureError: wrapReportedDiagnostic(tracker.reportCyclicStructureError), reportInaccessibleThisError: wrapReportedDiagnostic(tracker.reportInaccessibleThisError), reportInaccessibleUniqueSymbolError: wrapReportedDiagnostic(tracker.reportInaccessibleUniqueSymbolError), reportLikelyUnsafeImportRequiredError: wrapReportedDiagnostic(tracker.reportLikelyUnsafeImportRequiredError), reportNonlocalAugmentation: wrapReportedDiagnostic(tracker.reportNonlocalAugmentation), reportPrivateInBaseOfClassExpression: wrapReportedDiagnostic(tracker.reportPrivateInBaseOfClassExpression), reportNonSerializableProperty: wrapReportedDiagnostic(tracker.reportNonSerializableProperty), trackSymbol: oldTrackSymbol && (function () {
41763                         var args = [];
41764                         for (var _i = 0; _i < arguments.length; _i++) {
41765                             args[_i] = arguments[_i];
41766                         }
41767                         var result = oldTrackSymbol.apply(void 0, args);
41768                         if (result) {
41769                             context.reportedDiagnostic = true;
41770                         }
41771                         return result;
41772                     }) });
41773                 function wrapReportedDiagnostic(method) {
41774                     if (!method) {
41775                         return method;
41776                     }
41777                     return (function () {
41778                         var args = [];
41779                         for (var _i = 0; _i < arguments.length; _i++) {
41780                             args[_i] = arguments[_i];
41781                         }
41782                         context.reportedDiagnostic = true;
41783                         return method.apply(void 0, args);
41784                     });
41785                 }
41786             }
41787             function checkTruncationLength(context) {
41788                 if (context.truncating)
41789                     return context.truncating;
41790                 return context.truncating = context.approximateLength > ((context.flags & 1) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
41791             }
41792             function typeToTypeNodeHelper(type, context) {
41793                 if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
41794                     cancellationToken.throwIfCancellationRequested();
41795                 }
41796                 var inTypeAlias = context.flags & 8388608;
41797                 context.flags &= ~8388608;
41798                 if (!type) {
41799                     if (!(context.flags & 262144)) {
41800                         context.encounteredError = true;
41801                         return undefined;
41802                     }
41803                     context.approximateLength += 3;
41804                     return ts.factory.createKeywordTypeNode(130);
41805                 }
41806                 if (!(context.flags & 536870912)) {
41807                     type = getReducedType(type);
41808                 }
41809                 if (type.flags & 1) {
41810                     if (type.aliasSymbol) {
41811                         return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context));
41812                     }
41813                     if (type === unresolvedType) {
41814                         return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130), 3, "unresolved");
41815                     }
41816                     context.approximateLength += 3;
41817                     return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 : 130);
41818                 }
41819                 if (type.flags & 2) {
41820                     return ts.factory.createKeywordTypeNode(154);
41821                 }
41822                 if (type.flags & 4) {
41823                     context.approximateLength += 6;
41824                     return ts.factory.createKeywordTypeNode(149);
41825                 }
41826                 if (type.flags & 8) {
41827                     context.approximateLength += 6;
41828                     return ts.factory.createKeywordTypeNode(146);
41829                 }
41830                 if (type.flags & 64) {
41831                     context.approximateLength += 6;
41832                     return ts.factory.createKeywordTypeNode(157);
41833                 }
41834                 if (type.flags & 16 && !type.aliasSymbol) {
41835                     context.approximateLength += 7;
41836                     return ts.factory.createKeywordTypeNode(133);
41837                 }
41838                 if (type.flags & 1024 && !(type.flags & 1048576)) {
41839                     var parentSymbol = getParentOfSymbol(type.symbol);
41840                     var parentName = symbolToTypeNode(parentSymbol, context, 788968);
41841                     if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
41842                         return parentName;
41843                     }
41844                     var memberName = ts.symbolName(type.symbol);
41845                     if (ts.isIdentifierText(memberName, 0)) {
41846                         return appendReferenceToType(parentName, ts.factory.createTypeReferenceNode(memberName, undefined));
41847                     }
41848                     if (ts.isImportTypeNode(parentName)) {
41849                         parentName.isTypeOf = true;
41850                         return ts.factory.createIndexedAccessTypeNode(parentName, ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(memberName)));
41851                     }
41852                     else if (ts.isTypeReferenceNode(parentName)) {
41853                         return ts.factory.createIndexedAccessTypeNode(ts.factory.createTypeQueryNode(parentName.typeName), ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(memberName)));
41854                     }
41855                     else {
41856                         return ts.Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
41857                     }
41858                 }
41859                 if (type.flags & 1056) {
41860                     return symbolToTypeNode(type.symbol, context, 788968);
41861                 }
41862                 if (type.flags & 128) {
41863                     context.approximateLength += (type.value.length + 2);
41864                     return ts.factory.createLiteralTypeNode(ts.setEmitFlags(ts.factory.createStringLiteral(type.value, !!(context.flags & 268435456)), 16777216));
41865                 }
41866                 if (type.flags & 256) {
41867                     var value = type.value;
41868                     context.approximateLength += ("" + value).length;
41869                     return ts.factory.createLiteralTypeNode(value < 0 ? ts.factory.createPrefixUnaryExpression(40, ts.factory.createNumericLiteral(-value)) : ts.factory.createNumericLiteral(value));
41870                 }
41871                 if (type.flags & 2048) {
41872                     context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
41873                     return ts.factory.createLiteralTypeNode((ts.factory.createBigIntLiteral(type.value)));
41874                 }
41875                 if (type.flags & 512) {
41876                     context.approximateLength += type.intrinsicName.length;
41877                     return ts.factory.createLiteralTypeNode(type.intrinsicName === "true" ? ts.factory.createTrue() : ts.factory.createFalse());
41878                 }
41879                 if (type.flags & 8192) {
41880                     if (!(context.flags & 1048576)) {
41881                         if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
41882                             context.approximateLength += 6;
41883                             return symbolToTypeNode(type.symbol, context, 111551);
41884                         }
41885                         if (context.tracker.reportInaccessibleUniqueSymbolError) {
41886                             context.tracker.reportInaccessibleUniqueSymbolError();
41887                         }
41888                     }
41889                     context.approximateLength += 13;
41890                     return ts.factory.createTypeOperatorNode(153, ts.factory.createKeywordTypeNode(150));
41891                 }
41892                 if (type.flags & 16384) {
41893                     context.approximateLength += 4;
41894                     return ts.factory.createKeywordTypeNode(114);
41895                 }
41896                 if (type.flags & 32768) {
41897                     context.approximateLength += 9;
41898                     return ts.factory.createKeywordTypeNode(152);
41899                 }
41900                 if (type.flags & 65536) {
41901                     context.approximateLength += 4;
41902                     return ts.factory.createLiteralTypeNode(ts.factory.createNull());
41903                 }
41904                 if (type.flags & 131072) {
41905                     context.approximateLength += 5;
41906                     return ts.factory.createKeywordTypeNode(143);
41907                 }
41908                 if (type.flags & 4096) {
41909                     context.approximateLength += 6;
41910                     return ts.factory.createKeywordTypeNode(150);
41911                 }
41912                 if (type.flags & 67108864) {
41913                     context.approximateLength += 6;
41914                     return ts.factory.createKeywordTypeNode(147);
41915                 }
41916                 if (isThisTypeParameter(type)) {
41917                     if (context.flags & 4194304) {
41918                         if (!context.encounteredError && !(context.flags & 32768)) {
41919                             context.encounteredError = true;
41920                         }
41921                         if (context.tracker.reportInaccessibleThisError) {
41922                             context.tracker.reportInaccessibleThisError();
41923                         }
41924                     }
41925                     context.approximateLength += 4;
41926                     return ts.factory.createThisTypeNode();
41927                 }
41928                 if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
41929                     var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
41930                     if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32))
41931                         return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""), typeArgumentNodes);
41932                     return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes);
41933                 }
41934                 var objectFlags = ts.getObjectFlags(type);
41935                 if (objectFlags & 4) {
41936                     ts.Debug.assert(!!(type.flags & 524288));
41937                     return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
41938                 }
41939                 if (type.flags & 262144 || objectFlags & 3) {
41940                     if (type.flags & 262144 && ts.contains(context.inferTypeParameters, type)) {
41941                         context.approximateLength += (ts.symbolName(type.symbol).length + 6);
41942                         return ts.factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, undefined));
41943                     }
41944                     if (context.flags & 4 &&
41945                         type.flags & 262144 &&
41946                         !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
41947                         var name = typeParameterToName(type, context);
41948                         context.approximateLength += ts.idText(name).length;
41949                         return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name)), undefined);
41950                     }
41951                     return type.symbol
41952                         ? symbolToTypeNode(type.symbol, context, 788968)
41953                         : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("?"), undefined);
41954                 }
41955                 if (type.flags & 1048576 && type.origin) {
41956                     type = type.origin;
41957                 }
41958                 if (type.flags & (1048576 | 2097152)) {
41959                     var types = type.flags & 1048576 ? formatUnionTypes(type.types) : type.types;
41960                     if (ts.length(types) === 1) {
41961                         return typeToTypeNodeHelper(types[0], context);
41962                     }
41963                     var typeNodes = mapToTypeNodes(types, context, true);
41964                     if (typeNodes && typeNodes.length > 0) {
41965                         return type.flags & 1048576 ? ts.factory.createUnionTypeNode(typeNodes) : ts.factory.createIntersectionTypeNode(typeNodes);
41966                     }
41967                     else {
41968                         if (!context.encounteredError && !(context.flags & 262144)) {
41969                             context.encounteredError = true;
41970                         }
41971                         return undefined;
41972                     }
41973                 }
41974                 if (objectFlags & (16 | 32)) {
41975                     ts.Debug.assert(!!(type.flags & 524288));
41976                     return createAnonymousTypeNode(type);
41977                 }
41978                 if (type.flags & 4194304) {
41979                     var indexedType = type.type;
41980                     context.approximateLength += 6;
41981                     var indexTypeNode = typeToTypeNodeHelper(indexedType, context);
41982                     return ts.factory.createTypeOperatorNode(140, indexTypeNode);
41983                 }
41984                 if (type.flags & 134217728) {
41985                     var texts_1 = type.texts;
41986                     var types_1 = type.types;
41987                     var templateHead = ts.factory.createTemplateHead(texts_1[0]);
41988                     var templateSpans = ts.factory.createNodeArray(ts.map(types_1, function (t, i) { return ts.factory.createTemplateLiteralTypeSpan(typeToTypeNodeHelper(t, context), (i < types_1.length - 1 ? ts.factory.createTemplateMiddle : ts.factory.createTemplateTail)(texts_1[i + 1])); }));
41989                     context.approximateLength += 2;
41990                     return ts.factory.createTemplateLiteralType(templateHead, templateSpans);
41991                 }
41992                 if (type.flags & 268435456) {
41993                     var typeNode = typeToTypeNodeHelper(type.type, context);
41994                     return symbolToTypeNode(type.symbol, context, 788968, [typeNode]);
41995                 }
41996                 if (type.flags & 8388608) {
41997                     var objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
41998                     var indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
41999                     context.approximateLength += 2;
42000                     return ts.factory.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode);
42001                 }
42002                 if (type.flags & 16777216) {
42003                     return visitAndTransformType(type, function (type) { return conditionalTypeToTypeNode(type); });
42004                 }
42005                 if (type.flags & 33554432) {
42006                     return typeToTypeNodeHelper(type.baseType, context);
42007                 }
42008                 return ts.Debug.fail("Should be unreachable.");
42009                 function conditionalTypeToTypeNode(type) {
42010                     var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
42011                     var saveInferTypeParameters = context.inferTypeParameters;
42012                     context.inferTypeParameters = type.root.inferTypeParameters;
42013                     var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
42014                     context.inferTypeParameters = saveInferTypeParameters;
42015                     var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
42016                     var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
42017                     context.approximateLength += 15;
42018                     return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
42019                 }
42020                 function typeToTypeNodeOrCircularityElision(type) {
42021                     var _a, _b, _c;
42022                     if (type.flags & 1048576) {
42023                         if ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(getTypeId(type))) {
42024                             if (!(context.flags & 131072)) {
42025                                 context.encounteredError = true;
42026                                 (_c = (_b = context.tracker) === null || _b === void 0 ? void 0 : _b.reportCyclicStructureError) === null || _c === void 0 ? void 0 : _c.call(_b);
42027                             }
42028                             return createElidedInformationPlaceholder(context);
42029                         }
42030                         return visitAndTransformType(type, function (type) { return typeToTypeNodeHelper(type, context); });
42031                     }
42032                     return typeToTypeNodeHelper(type, context);
42033                 }
42034                 function createMappedTypeNodeFromType(type) {
42035                     ts.Debug.assert(!!(type.flags & 524288));
42036                     var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
42037                     var questionToken = type.declaration.questionToken ? ts.factory.createToken(type.declaration.questionToken.kind) : undefined;
42038                     var appropriateConstraintTypeNode;
42039                     if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
42040                         appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
42041                     }
42042                     else {
42043                         appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context);
42044                     }
42045                     var typeParameterNode = typeParameterToDeclarationWithConstraint(getTypeParameterFromMappedType(type), context, appropriateConstraintTypeNode);
42046                     var nameTypeNode = type.declaration.nameType ? typeToTypeNodeHelper(getNameTypeFromMappedType(type), context) : undefined;
42047                     var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type), !!(getMappedTypeModifiers(type) & 4)), context);
42048                     var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
42049                     context.approximateLength += 10;
42050                     return ts.setEmitFlags(mappedTypeNode, 1);
42051                 }
42052                 function createAnonymousTypeNode(type) {
42053                     var _a;
42054                     var typeId = type.id;
42055                     var symbol = type.symbol;
42056                     if (symbol) {
42057                         var isInstanceType = isClassInstanceSide(type) ? 788968 : 111551;
42058                         if (isJSConstructor(symbol.valueDeclaration)) {
42059                             return symbolToTypeNode(symbol, context, isInstanceType);
42060                         }
42061                         else if (symbol.flags & 32
42062                             && !getBaseTypeVariableOfClass(symbol)
42063                             && !(symbol.valueDeclaration && symbol.valueDeclaration.kind === 225 && context.flags & 2048) ||
42064                             symbol.flags & (384 | 512) ||
42065                             shouldWriteTypeOfFunctionSymbol()) {
42066                             return symbolToTypeNode(symbol, context, isInstanceType);
42067                         }
42068                         else if ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(typeId)) {
42069                             var typeAlias = getTypeAliasForTypeLiteral(type);
42070                             if (typeAlias) {
42071                                 return symbolToTypeNode(typeAlias, context, 788968);
42072                             }
42073                             else {
42074                                 return createElidedInformationPlaceholder(context);
42075                             }
42076                         }
42077                         else {
42078                             return visitAndTransformType(type, createTypeNodeFromObjectType);
42079                         }
42080                     }
42081                     else {
42082                         return createTypeNodeFromObjectType(type);
42083                     }
42084                     function shouldWriteTypeOfFunctionSymbol() {
42085                         var _a;
42086                         var isStaticMethodSymbol = !!(symbol.flags & 8192) &&
42087                             ts.some(symbol.declarations, function (declaration) { return ts.isStatic(declaration); });
42088                         var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&
42089                             (symbol.parent ||
42090                                 ts.forEach(symbol.declarations, function (declaration) {
42091                                     return declaration.parent.kind === 303 || declaration.parent.kind === 261;
42092                                 }));
42093                         if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
42094                             return (!!(context.flags & 4096) || ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(typeId))) &&
42095                                 (!(context.flags & 8) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
42096                         }
42097                     }
42098                 }
42099                 function visitAndTransformType(type, transform) {
42100                     var _a, _b;
42101                     var typeId = type.id;
42102                     var isConstructorObject = ts.getObjectFlags(type) & 16 && type.symbol && type.symbol.flags & 32;
42103                     var id = ts.getObjectFlags(type) & 4 && type.node ? "N" + getNodeId(type.node) :
42104                         type.flags & 16777216 ? "N" + getNodeId(type.root.node) :
42105                             type.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type.symbol) :
42106                                 undefined;
42107                     if (!context.visitedTypes) {
42108                         context.visitedTypes = new ts.Set();
42109                     }
42110                     if (id && !context.symbolDepth) {
42111                         context.symbolDepth = new ts.Map();
42112                     }
42113                     var links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
42114                     var key = "".concat(getTypeId(type), "|").concat(context.flags);
42115                     if (links) {
42116                         links.serializedTypes || (links.serializedTypes = new ts.Map());
42117                     }
42118                     var cachedResult = (_a = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _a === void 0 ? void 0 : _a.get(key);
42119                     if (cachedResult) {
42120                         if (cachedResult.truncating) {
42121                             context.truncating = true;
42122                         }
42123                         context.approximateLength += cachedResult.addedLength;
42124                         return deepCloneOrReuseNode(cachedResult);
42125                     }
42126                     var depth;
42127                     if (id) {
42128                         depth = context.symbolDepth.get(id) || 0;
42129                         if (depth > 10) {
42130                             return createElidedInformationPlaceholder(context);
42131                         }
42132                         context.symbolDepth.set(id, depth + 1);
42133                     }
42134                     context.visitedTypes.add(typeId);
42135                     var startLength = context.approximateLength;
42136                     var result = transform(type);
42137                     var addedLength = context.approximateLength - startLength;
42138                     if (!context.reportedDiagnostic && !context.encounteredError) {
42139                         if (context.truncating) {
42140                             result.truncating = true;
42141                         }
42142                         result.addedLength = addedLength;
42143                         (_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result);
42144                     }
42145                     context.visitedTypes.delete(typeId);
42146                     if (id) {
42147                         context.symbolDepth.set(id, depth);
42148                     }
42149                     return result;
42150                     function deepCloneOrReuseNode(node) {
42151                         if (!ts.nodeIsSynthesized(node) && ts.getParseTreeNode(node) === node) {
42152                             return node;
42153                         }
42154                         return ts.setTextRange(ts.factory.cloneNode(ts.visitEachChild(node, deepCloneOrReuseNode, ts.nullTransformationContext)), node);
42155                     }
42156                 }
42157                 function createTypeNodeFromObjectType(type) {
42158                     if (isGenericMappedType(type) || type.containsError) {
42159                         return createMappedTypeNodeFromType(type);
42160                     }
42161                     var resolved = resolveStructuredTypeMembers(type);
42162                     if (!resolved.properties.length && !resolved.indexInfos.length) {
42163                         if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {
42164                             context.approximateLength += 2;
42165                             return ts.setEmitFlags(ts.factory.createTypeLiteralNode(undefined), 1);
42166                         }
42167                         if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
42168                             var signature = resolved.callSignatures[0];
42169                             var signatureNode = signatureToSignatureDeclarationHelper(signature, 178, context);
42170                             return signatureNode;
42171                         }
42172                         if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
42173                             var signature = resolved.constructSignatures[0];
42174                             var signatureNode = signatureToSignatureDeclarationHelper(signature, 179, context);
42175                             return signatureNode;
42176                         }
42177                     }
42178                     var abstractSignatures = ts.filter(resolved.constructSignatures, function (signature) { return !!(signature.flags & 4); });
42179                     if (ts.some(abstractSignatures)) {
42180                         var types = ts.map(abstractSignatures, getOrCreateTypeFromSignature);
42181                         var typeElementCount = resolved.callSignatures.length +
42182                             (resolved.constructSignatures.length - abstractSignatures.length) +
42183                             resolved.indexInfos.length +
42184                             (context.flags & 2048 ?
42185                                 ts.countWhere(resolved.properties, function (p) { return !(p.flags & 4194304); }) :
42186                                 ts.length(resolved.properties));
42187                         if (typeElementCount) {
42188                             types.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved));
42189                         }
42190                         return typeToTypeNodeHelper(getIntersectionType(types), context);
42191                     }
42192                     var savedFlags = context.flags;
42193                     context.flags |= 4194304;
42194                     var members = createTypeNodesFromResolvedType(resolved);
42195                     context.flags = savedFlags;
42196                     var typeLiteralNode = ts.factory.createTypeLiteralNode(members);
42197                     context.approximateLength += 2;
42198                     ts.setEmitFlags(typeLiteralNode, (context.flags & 1024) ? 0 : 1);
42199                     return typeLiteralNode;
42200                 }
42201                 function typeReferenceToTypeNode(type) {
42202                     var typeArguments = getTypeArguments(type);
42203                     if (type.target === globalArrayType || type.target === globalReadonlyArrayType) {
42204                         if (context.flags & 2) {
42205                             var typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context);
42206                             return ts.factory.createTypeReferenceNode(type.target === globalArrayType ? "Array" : "ReadonlyArray", [typeArgumentNode]);
42207                         }
42208                         var elementType = typeToTypeNodeHelper(typeArguments[0], context);
42209                         var arrayType = ts.factory.createArrayTypeNode(elementType);
42210                         return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(144, arrayType);
42211                     }
42212                     else if (type.target.objectFlags & 8) {
42213                         typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2)); });
42214                         if (typeArguments.length > 0) {
42215                             var arity = getTypeReferenceArity(type);
42216                             var tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
42217                             if (tupleConstituentNodes) {
42218                                 if (type.target.labeledElementDeclarations) {
42219                                     for (var i = 0; i < tupleConstituentNodes.length; i++) {
42220                                         var flags = type.target.elementFlags[i];
42221                                         tupleConstituentNodes[i] = ts.factory.createNamedTupleMember(flags & 12 ? ts.factory.createToken(25) : undefined, ts.factory.createIdentifier(ts.unescapeLeadingUnderscores(getTupleElementLabel(type.target.labeledElementDeclarations[i]))), flags & 2 ? ts.factory.createToken(57) : undefined, flags & 4 ? ts.factory.createArrayTypeNode(tupleConstituentNodes[i]) :
42222                                             tupleConstituentNodes[i]);
42223                                     }
42224                                 }
42225                                 else {
42226                                     for (var i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
42227                                         var flags = type.target.elementFlags[i];
42228                                         tupleConstituentNodes[i] =
42229                                             flags & 12 ? ts.factory.createRestTypeNode(flags & 4 ? ts.factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) :
42230                                                 flags & 2 ? ts.factory.createOptionalTypeNode(tupleConstituentNodes[i]) :
42231                                                     tupleConstituentNodes[i];
42232                                     }
42233                                 }
42234                                 var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1);
42235                                 return type.target.readonly ? ts.factory.createTypeOperatorNode(144, tupleTypeNode) : tupleTypeNode;
42236                             }
42237                         }
42238                         if (context.encounteredError || (context.flags & 524288)) {
42239                             var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1);
42240                             return type.target.readonly ? ts.factory.createTypeOperatorNode(144, tupleTypeNode) : tupleTypeNode;
42241                         }
42242                         context.encounteredError = true;
42243                         return undefined;
42244                     }
42245                     else if (context.flags & 2048 &&
42246                         type.symbol.valueDeclaration &&
42247                         ts.isClassLike(type.symbol.valueDeclaration) &&
42248                         !isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
42249                         return createAnonymousTypeNode(type);
42250                     }
42251                     else {
42252                         var outerTypeParameters = type.target.outerTypeParameters;
42253                         var i = 0;
42254                         var resultType = void 0;
42255                         if (outerTypeParameters) {
42256                             var length_2 = outerTypeParameters.length;
42257                             while (i < length_2) {
42258                                 var start = i;
42259                                 var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]);
42260                                 do {
42261                                     i++;
42262                                 } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent);
42263                                 if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) {
42264                                     var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
42265                                     var flags_3 = context.flags;
42266                                     context.flags |= 16;
42267                                     var ref = symbolToTypeNode(parent, context, 788968, typeArgumentSlice);
42268                                     context.flags = flags_3;
42269                                     resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
42270                                 }
42271                             }
42272                         }
42273                         var typeArgumentNodes = void 0;
42274                         if (typeArguments.length > 0) {
42275                             var typeParameterCount = (type.target.typeParameters || ts.emptyArray).length;
42276                             typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
42277                         }
42278                         var flags = context.flags;
42279                         context.flags |= 16;
42280                         var finalRef = symbolToTypeNode(type.symbol, context, 788968, typeArgumentNodes);
42281                         context.flags = flags;
42282                         return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
42283                     }
42284                 }
42285                 function appendReferenceToType(root, ref) {
42286                     if (ts.isImportTypeNode(root)) {
42287                         var typeArguments = root.typeArguments;
42288                         var qualifier = root.qualifier;
42289                         if (qualifier) {
42290                             if (ts.isIdentifier(qualifier)) {
42291                                 qualifier = ts.factory.updateIdentifier(qualifier, typeArguments);
42292                             }
42293                             else {
42294                                 qualifier = ts.factory.updateQualifiedName(qualifier, qualifier.left, ts.factory.updateIdentifier(qualifier.right, typeArguments));
42295                             }
42296                         }
42297                         typeArguments = ref.typeArguments;
42298                         var ids = getAccessStack(ref);
42299                         for (var _i = 0, ids_1 = ids; _i < ids_1.length; _i++) {
42300                             var id = ids_1[_i];
42301                             qualifier = qualifier ? ts.factory.createQualifiedName(qualifier, id) : id;
42302                         }
42303                         return ts.factory.updateImportTypeNode(root, root.argument, qualifier, typeArguments, root.isTypeOf);
42304                     }
42305                     else {
42306                         var typeArguments = root.typeArguments;
42307                         var typeName = root.typeName;
42308                         if (ts.isIdentifier(typeName)) {
42309                             typeName = ts.factory.updateIdentifier(typeName, typeArguments);
42310                         }
42311                         else {
42312                             typeName = ts.factory.updateQualifiedName(typeName, typeName.left, ts.factory.updateIdentifier(typeName.right, typeArguments));
42313                         }
42314                         typeArguments = ref.typeArguments;
42315                         var ids = getAccessStack(ref);
42316                         for (var _a = 0, ids_2 = ids; _a < ids_2.length; _a++) {
42317                             var id = ids_2[_a];
42318                             typeName = ts.factory.createQualifiedName(typeName, id);
42319                         }
42320                         return ts.factory.updateTypeReferenceNode(root, typeName, typeArguments);
42321                     }
42322                 }
42323                 function getAccessStack(ref) {
42324                     var state = ref.typeName;
42325                     var ids = [];
42326                     while (!ts.isIdentifier(state)) {
42327                         ids.unshift(state.right);
42328                         state = state.left;
42329                     }
42330                     ids.unshift(state);
42331                     return ids;
42332                 }
42333                 function createTypeNodesFromResolvedType(resolvedType) {
42334                     if (checkTruncationLength(context)) {
42335                         return [ts.factory.createPropertySignature(undefined, "...", undefined, undefined)];
42336                     }
42337                     var typeElements = [];
42338                     for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
42339                         var signature = _a[_i];
42340                         typeElements.push(signatureToSignatureDeclarationHelper(signature, 173, context));
42341                     }
42342                     for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
42343                         var signature = _c[_b];
42344                         if (signature.flags & 4)
42345                             continue;
42346                         typeElements.push(signatureToSignatureDeclarationHelper(signature, 174, context));
42347                     }
42348                     for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) {
42349                         var info = _e[_d];
42350                         typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & 1024 ? createElidedInformationPlaceholder(context) : undefined));
42351                     }
42352                     var properties = resolvedType.properties;
42353                     if (!properties) {
42354                         return typeElements;
42355                     }
42356                     var i = 0;
42357                     for (var _f = 0, properties_1 = properties; _f < properties_1.length; _f++) {
42358                         var propertySymbol = properties_1[_f];
42359                         i++;
42360                         if (context.flags & 2048) {
42361                             if (propertySymbol.flags & 4194304) {
42362                                 continue;
42363                             }
42364                             if (ts.getDeclarationModifierFlagsFromSymbol(propertySymbol) & (8 | 16) && context.tracker.reportPrivateInBaseOfClassExpression) {
42365                                 context.tracker.reportPrivateInBaseOfClassExpression(ts.unescapeLeadingUnderscores(propertySymbol.escapedName));
42366                             }
42367                         }
42368                         if (checkTruncationLength(context) && (i + 2 < properties.length - 1)) {
42369                             typeElements.push(ts.factory.createPropertySignature(undefined, "... ".concat(properties.length - i, " more ..."), undefined, undefined));
42370                             addPropertyToElementList(properties[properties.length - 1], context, typeElements);
42371                             break;
42372                         }
42373                         addPropertyToElementList(propertySymbol, context, typeElements);
42374                     }
42375                     return typeElements.length ? typeElements : undefined;
42376                 }
42377             }
42378             function createElidedInformationPlaceholder(context) {
42379                 context.approximateLength += 3;
42380                 if (!(context.flags & 1)) {
42381                     return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), undefined);
42382                 }
42383                 return ts.factory.createKeywordTypeNode(130);
42384             }
42385             function shouldUsePlaceholderForProperty(propertySymbol, context) {
42386                 var _a;
42387                 return !!(ts.getCheckFlags(propertySymbol) & 8192)
42388                     && (ts.contains(context.reverseMappedStack, propertySymbol)
42389                         || (((_a = context.reverseMappedStack) === null || _a === void 0 ? void 0 : _a[0])
42390                             && !(ts.getObjectFlags(ts.last(context.reverseMappedStack).propertyType) & 16)));
42391             }
42392             function addPropertyToElementList(propertySymbol, context, typeElements) {
42393                 var _a, _b;
42394                 var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192);
42395                 var propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ?
42396                     anyType : getNonMissingTypeOfSymbol(propertySymbol);
42397                 var saveEnclosingDeclaration = context.enclosingDeclaration;
42398                 context.enclosingDeclaration = undefined;
42399                 if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 && isLateBoundName(propertySymbol.escapedName)) {
42400                     if (propertySymbol.declarations) {
42401                         var decl = ts.first(propertySymbol.declarations);
42402                         if (hasLateBindableName(decl)) {
42403                             if (ts.isBinaryExpression(decl)) {
42404                                 var name = ts.getNameOfDeclaration(decl);
42405                                 if (name && ts.isElementAccessExpression(name) && ts.isPropertyAccessEntityNameExpression(name.argumentExpression)) {
42406                                     trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context);
42407                                 }
42408                             }
42409                             else {
42410                                 trackComputedName(decl.name.expression, saveEnclosingDeclaration, context);
42411                             }
42412                         }
42413                     }
42414                     else if ((_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportNonSerializableProperty) {
42415                         context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol));
42416                     }
42417                 }
42418                 context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_b = propertySymbol.declarations) === null || _b === void 0 ? void 0 : _b[0]) || saveEnclosingDeclaration;
42419                 var propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
42420                 context.enclosingDeclaration = saveEnclosingDeclaration;
42421                 context.approximateLength += (ts.symbolName(propertySymbol).length + 1);
42422                 var optionalToken = propertySymbol.flags & 16777216 ? ts.factory.createToken(57) : undefined;
42423                 if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) {
42424                     var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768); }), 0);
42425                     for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
42426                         var signature = signatures_1[_i];
42427                         var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 167, context, { name: propertyName, questionToken: optionalToken });
42428                         typeElements.push(preserveCommentsOn(methodDeclaration));
42429                     }
42430                 }
42431                 else {
42432                     var propertyTypeNode = void 0;
42433                     if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
42434                         propertyTypeNode = createElidedInformationPlaceholder(context);
42435                     }
42436                     else {
42437                         if (propertyIsReverseMapped) {
42438                             context.reverseMappedStack || (context.reverseMappedStack = []);
42439                             context.reverseMappedStack.push(propertySymbol);
42440                         }
42441                         propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130);
42442                         if (propertyIsReverseMapped) {
42443                             context.reverseMappedStack.pop();
42444                         }
42445                     }
42446                     var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(144)] : undefined;
42447                     if (modifiers) {
42448                         context.approximateLength += 9;
42449                     }
42450                     var propertySignature = ts.factory.createPropertySignature(modifiers, propertyName, optionalToken, propertyTypeNode);
42451                     typeElements.push(preserveCommentsOn(propertySignature));
42452                 }
42453                 function preserveCommentsOn(node) {
42454                     var _a;
42455                     if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 345; })) {
42456                         var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 345; });
42457                         var commentText = ts.getTextOfJSDocComment(d.comment);
42458                         if (commentText) {
42459                             ts.setSyntheticLeadingComments(node, [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
42460                         }
42461                     }
42462                     else if (propertySymbol.valueDeclaration) {
42463                         ts.setCommentRange(node, propertySymbol.valueDeclaration);
42464                     }
42465                     return node;
42466                 }
42467             }
42468             function mapToTypeNodes(types, context, isBareList) {
42469                 if (ts.some(types)) {
42470                     if (checkTruncationLength(context)) {
42471                         if (!isBareList) {
42472                             return [ts.factory.createTypeReferenceNode("...", undefined)];
42473                         }
42474                         else if (types.length > 2) {
42475                             return [
42476                                 typeToTypeNodeHelper(types[0], context),
42477                                 ts.factory.createTypeReferenceNode("... ".concat(types.length - 2, " more ..."), undefined),
42478                                 typeToTypeNodeHelper(types[types.length - 1], context)
42479                             ];
42480                         }
42481                     }
42482                     var mayHaveNameCollisions = !(context.flags & 64);
42483                     var seenNames = mayHaveNameCollisions ? ts.createUnderscoreEscapedMultiMap() : undefined;
42484                     var result_5 = [];
42485                     var i = 0;
42486                     for (var _i = 0, types_2 = types; _i < types_2.length; _i++) {
42487                         var type = types_2[_i];
42488                         i++;
42489                         if (checkTruncationLength(context) && (i + 2 < types.length - 1)) {
42490                             result_5.push(ts.factory.createTypeReferenceNode("... ".concat(types.length - i, " more ..."), undefined));
42491                             var typeNode_1 = typeToTypeNodeHelper(types[types.length - 1], context);
42492                             if (typeNode_1) {
42493                                 result_5.push(typeNode_1);
42494                             }
42495                             break;
42496                         }
42497                         context.approximateLength += 2;
42498                         var typeNode = typeToTypeNodeHelper(type, context);
42499                         if (typeNode) {
42500                             result_5.push(typeNode);
42501                             if (seenNames && ts.isIdentifierTypeReference(typeNode)) {
42502                                 seenNames.add(typeNode.typeName.escapedText, [type, result_5.length - 1]);
42503                             }
42504                         }
42505                     }
42506                     if (seenNames) {
42507                         var saveContextFlags = context.flags;
42508                         context.flags |= 64;
42509                         seenNames.forEach(function (types) {
42510                             if (!ts.arrayIsHomogeneous(types, function (_a, _b) {
42511                                 var a = _a[0];
42512                                 var b = _b[0];
42513                                 return typesAreSameReference(a, b);
42514                             })) {
42515                                 for (var _i = 0, types_3 = types; _i < types_3.length; _i++) {
42516                                     var _a = types_3[_i], type = _a[0], resultIndex = _a[1];
42517                                     result_5[resultIndex] = typeToTypeNodeHelper(type, context);
42518                                 }
42519                             }
42520                         });
42521                         context.flags = saveContextFlags;
42522                     }
42523                     return result_5;
42524                 }
42525             }
42526             function typesAreSameReference(a, b) {
42527                 return a === b
42528                     || !!a.symbol && a.symbol === b.symbol
42529                     || !!a.aliasSymbol && a.aliasSymbol === b.aliasSymbol;
42530             }
42531             function indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, typeNode) {
42532                 var name = ts.getNameFromIndexInfo(indexInfo) || "x";
42533                 var indexerTypeNode = typeToTypeNodeHelper(indexInfo.keyType, context);
42534                 var indexingParameter = ts.factory.createParameterDeclaration(undefined, undefined, undefined, name, undefined, indexerTypeNode, undefined);
42535                 if (!typeNode) {
42536                     typeNode = typeToTypeNodeHelper(indexInfo.type || anyType, context);
42537                 }
42538                 if (!indexInfo.type && !(context.flags & 2097152)) {
42539                     context.encounteredError = true;
42540                 }
42541                 context.approximateLength += (name.length + 4);
42542                 return ts.factory.createIndexSignature(undefined, indexInfo.isReadonly ? [ts.factory.createToken(144)] : undefined, [indexingParameter], typeNode);
42543             }
42544             function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
42545                 var _a, _b, _c, _d;
42546                 var suppressAny = context.flags & 256;
42547                 if (suppressAny)
42548                     context.flags &= ~256;
42549                 context.approximateLength += 3;
42550                 var typeParameters;
42551                 var typeArguments;
42552                 if (context.flags & 32 && signature.target && signature.mapper && signature.target.typeParameters) {
42553                     typeArguments = signature.target.typeParameters.map(function (parameter) { return typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context); });
42554                 }
42555                 else {
42556                     typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
42557                 }
42558                 var expandedParams = getExpandedParameters(signature, true)[0];
42559                 var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
42560                 if (signature.thisParameter) {
42561                     var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
42562                     parameters.unshift(thisParameter);
42563                 }
42564                 var returnTypeNode;
42565                 var typePredicate = getTypePredicateOfSignature(signature);
42566                 if (typePredicate) {
42567                     var assertsModifier = typePredicate.kind === 2 || typePredicate.kind === 3 ?
42568                         ts.factory.createToken(128) :
42569                         undefined;
42570                     var parameterName = typePredicate.kind === 1 || typePredicate.kind === 3 ?
42571                         ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216) :
42572                         ts.factory.createThisTypeNode();
42573                     var typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context);
42574                     returnTypeNode = ts.factory.createTypePredicateNode(assertsModifier, parameterName, typeNode);
42575                 }
42576                 else {
42577                     var returnType = getReturnTypeOfSignature(signature);
42578                     if (returnType && !(suppressAny && isTypeAny(returnType))) {
42579                         returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports);
42580                     }
42581                     else if (!suppressAny) {
42582                         returnTypeNode = ts.factory.createKeywordTypeNode(130);
42583                     }
42584                 }
42585                 var modifiers = options === null || options === void 0 ? void 0 : options.modifiers;
42586                 if ((kind === 179) && signature.flags & 4) {
42587                     var flags = ts.modifiersToFlags(modifiers);
42588                     modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128);
42589                 }
42590                 var node = kind === 173 ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) :
42591                     kind === 174 ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) :
42592                         kind === 167 ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) :
42593                             kind === 168 ? ts.factory.createMethodDeclaration(undefined, modifiers, undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), undefined, typeParameters, parameters, returnTypeNode, undefined) :
42594                                 kind === 170 ? ts.factory.createConstructorDeclaration(undefined, modifiers, parameters, undefined) :
42595                                     kind === 171 ? ts.factory.createGetAccessorDeclaration(undefined, modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, undefined) :
42596                                         kind === 172 ? ts.factory.createSetAccessorDeclaration(undefined, modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, undefined) :
42597                                             kind === 175 ? ts.factory.createIndexSignature(undefined, modifiers, parameters, returnTypeNode) :
42598                                                 kind === 315 ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) :
42599                                                     kind === 178 ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) :
42600                                                         kind === 179 ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) :
42601                                                             kind === 255 ? ts.factory.createFunctionDeclaration(undefined, modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, undefined) :
42602                                                                 kind === 212 ? ts.factory.createFunctionExpression(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) :
42603                                                                     kind === 213 ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, undefined, ts.factory.createBlock([])) :
42604                                                                         ts.Debug.assertNever(kind);
42605                 if (typeArguments) {
42606                     node.typeArguments = ts.factory.createNodeArray(typeArguments);
42607                 }
42608                 return node;
42609             }
42610             function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
42611                 var savedContextFlags = context.flags;
42612                 context.flags &= ~512;
42613                 var name = typeParameterToName(type, context);
42614                 var defaultParameter = getDefaultFromTypeParameter(type);
42615                 var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
42616                 context.flags = savedContextFlags;
42617                 return ts.factory.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode);
42618             }
42619             function typeParameterToDeclaration(type, context, constraint) {
42620                 if (constraint === void 0) { constraint = getConstraintOfTypeParameter(type); }
42621                 var constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
42622                 return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
42623             }
42624             function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
42625                 var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 163);
42626                 if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) {
42627                     parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 338);
42628                 }
42629                 var parameterType = getTypeOfSymbol(parameterSymbol);
42630                 if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
42631                     parameterType = getOptionalType(parameterType);
42632                 }
42633                 if ((context.flags & 1073741824) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
42634                     parameterType = getTypeWithFacts(parameterType, 524288);
42635                 }
42636                 var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
42637                 var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
42638                 var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768;
42639                 var dotDotDotToken = isRest ? ts.factory.createToken(25) : undefined;
42640                 var name = parameterDeclaration ? parameterDeclaration.name ?
42641                     parameterDeclaration.name.kind === 79 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216) :
42642                         parameterDeclaration.name.kind === 160 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216) :
42643                             cloneBindingName(parameterDeclaration.name) :
42644                     ts.symbolName(parameterSymbol) :
42645                     ts.symbolName(parameterSymbol);
42646                 var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384;
42647                 var questionToken = isOptional ? ts.factory.createToken(57) : undefined;
42648                 var parameterNode = ts.factory.createParameterDeclaration(undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode, undefined);
42649                 context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
42650                 return parameterNode;
42651                 function cloneBindingName(node) {
42652                     return elideInitializerAndSetEmitFlags(node);
42653                     function elideInitializerAndSetEmitFlags(node) {
42654                         if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
42655                             trackComputedName(node.expression, context.enclosingDeclaration, context);
42656                         }
42657                         var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags);
42658                         if (ts.isBindingElement(visited)) {
42659                             visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined);
42660                         }
42661                         if (!ts.nodeIsSynthesized(visited)) {
42662                             visited = ts.factory.cloneNode(visited);
42663                         }
42664                         return ts.setEmitFlags(visited, 1 | 16777216);
42665                     }
42666                 }
42667             }
42668             function trackComputedName(accessExpression, enclosingDeclaration, context) {
42669                 if (!context.tracker.trackSymbol)
42670                     return;
42671                 var firstIdentifier = ts.getFirstIdentifier(accessExpression);
42672                 var name = resolveName(firstIdentifier, firstIdentifier.escapedText, 111551 | 1048576, undefined, undefined, true);
42673                 if (name) {
42674                     context.tracker.trackSymbol(name, enclosingDeclaration, 111551);
42675                 }
42676             }
42677             function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
42678                 context.tracker.trackSymbol(symbol, context.enclosingDeclaration, meaning);
42679                 return lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol);
42680             }
42681             function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
42682                 var chain;
42683                 var isTypeParameter = symbol.flags & 262144;
42684                 if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64) && !(context.flags & 134217728)) {
42685                     chain = ts.Debug.checkDefined(getSymbolChain(symbol, meaning, true));
42686                     ts.Debug.assert(chain && chain.length > 0);
42687                 }
42688                 else {
42689                     chain = [symbol];
42690                 }
42691                 return chain;
42692                 function getSymbolChain(symbol, meaning, endOfChain) {
42693                     var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, !!(context.flags & 128));
42694                     var parentSpecifiers;
42695                     if (!accessibleSymbolChain ||
42696                         needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
42697                         var parents_1 = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol, context.enclosingDeclaration, meaning);
42698                         if (ts.length(parents_1)) {
42699                             parentSpecifiers = parents_1.map(function (symbol) {
42700                                 return ts.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)
42701                                     ? getSpecifierForModuleSymbol(symbol, context)
42702                                     : undefined;
42703                             });
42704                             var indices = parents_1.map(function (_, i) { return i; });
42705                             indices.sort(sortByBestName);
42706                             var sortedParents = indices.map(function (i) { return parents_1[i]; });
42707                             for (var _i = 0, sortedParents_1 = sortedParents; _i < sortedParents_1.length; _i++) {
42708                                 var parent = sortedParents_1[_i];
42709                                 var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), false);
42710                                 if (parentChain) {
42711                                     if (parent.exports && parent.exports.get("export=") &&
42712                                         getSymbolIfSameReference(parent.exports.get("export="), symbol)) {
42713                                         accessibleSymbolChain = parentChain;
42714                                         break;
42715                                     }
42716                                     accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [getAliasForSymbolInContainer(parent, symbol) || symbol]);
42717                                     break;
42718                                 }
42719                             }
42720                         }
42721                     }
42722                     if (accessibleSymbolChain) {
42723                         return accessibleSymbolChain;
42724                     }
42725                     if (endOfChain ||
42726                         !(symbol.flags & (2048 | 4096))) {
42727                         if (!endOfChain && !yieldModuleSymbol && !!ts.forEach(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
42728                             return;
42729                         }
42730                         return [symbol];
42731                     }
42732                     function sortByBestName(a, b) {
42733                         var specifierA = parentSpecifiers[a];
42734                         var specifierB = parentSpecifiers[b];
42735                         if (specifierA && specifierB) {
42736                             var isBRelative = ts.pathIsRelative(specifierB);
42737                             if (ts.pathIsRelative(specifierA) === isBRelative) {
42738                                 return ts.moduleSpecifiers.countPathComponents(specifierA) - ts.moduleSpecifiers.countPathComponents(specifierB);
42739                             }
42740                             if (isBRelative) {
42741                                 return -1;
42742                             }
42743                             return 1;
42744                         }
42745                         return 0;
42746                     }
42747                 }
42748             }
42749             function typeParametersToTypeParameterDeclarations(symbol, context) {
42750                 var typeParameterNodes;
42751                 var targetSymbol = getTargetSymbol(symbol);
42752                 if (targetSymbol.flags & (32 | 64 | 524288)) {
42753                     typeParameterNodes = ts.factory.createNodeArray(ts.map(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol), function (tp) { return typeParameterToDeclaration(tp, context); }));
42754                 }
42755                 return typeParameterNodes;
42756             }
42757             function lookupTypeParameterNodes(chain, index, context) {
42758                 var _a;
42759                 ts.Debug.assert(chain && 0 <= index && index < chain.length);
42760                 var symbol = chain[index];
42761                 var symbolId = getSymbolId(symbol);
42762                 if ((_a = context.typeParameterSymbolList) === null || _a === void 0 ? void 0 : _a.has(symbolId)) {
42763                     return undefined;
42764                 }
42765                 (context.typeParameterSymbolList || (context.typeParameterSymbolList = new ts.Set())).add(symbolId);
42766                 var typeParameterNodes;
42767                 if (context.flags & 512 && index < (chain.length - 1)) {
42768                     var parentSymbol = symbol;
42769                     var nextSymbol_1 = chain[index + 1];
42770                     if (ts.getCheckFlags(nextSymbol_1) & 1) {
42771                         var params = getTypeParametersOfClassOrInterface(parentSymbol.flags & 2097152 ? resolveAlias(parentSymbol) : parentSymbol);
42772                         typeParameterNodes = mapToTypeNodes(ts.map(params, function (t) { return getMappedType(t, nextSymbol_1.mapper); }), context);
42773                     }
42774                     else {
42775                         typeParameterNodes = typeParametersToTypeParameterDeclarations(symbol, context);
42776                     }
42777                 }
42778                 return typeParameterNodes;
42779             }
42780             function getTopmostIndexedAccessType(top) {
42781                 if (ts.isIndexedAccessTypeNode(top.objectType)) {
42782                     return getTopmostIndexedAccessType(top.objectType);
42783                 }
42784                 return top;
42785             }
42786             function getSpecifierForModuleSymbol(symbol, context) {
42787                 var _a;
42788                 var file = ts.getDeclarationOfKind(symbol, 303);
42789                 if (!file) {
42790                     var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); });
42791                     if (equivalentFileSymbol) {
42792                         file = ts.getDeclarationOfKind(equivalentFileSymbol, 303);
42793                     }
42794                 }
42795                 if (file && file.moduleName !== undefined) {
42796                     return file.moduleName;
42797                 }
42798                 if (!file) {
42799                     if (context.tracker.trackReferencedAmbientModule) {
42800                         var ambientDecls = ts.filter(symbol.declarations, ts.isAmbientModule);
42801                         if (ts.length(ambientDecls)) {
42802                             for (var _i = 0, _b = ambientDecls; _i < _b.length; _i++) {
42803                                 var decl = _b[_i];
42804                                 context.tracker.trackReferencedAmbientModule(decl, symbol);
42805                             }
42806                         }
42807                     }
42808                     if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
42809                         return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
42810                     }
42811                 }
42812                 if (!context.enclosingDeclaration || !context.tracker.moduleResolverHost) {
42813                     if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
42814                         return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
42815                     }
42816                     return ts.getSourceFileOfNode(ts.getNonAugmentationDeclaration(symbol)).fileName;
42817                 }
42818                 var contextFile = ts.getSourceFileOfNode(ts.getOriginalNode(context.enclosingDeclaration));
42819                 var links = getSymbolLinks(symbol);
42820                 var specifier = links.specifierCache && links.specifierCache.get(contextFile.path);
42821                 if (!specifier) {
42822                     var isBundle_1 = !!ts.outFile(compilerOptions);
42823                     var moduleResolverHost = context.tracker.moduleResolverHost;
42824                     var specifierCompilerOptions = isBundle_1 ? __assign(__assign({}, compilerOptions), { baseUrl: moduleResolverHost.getCommonSourceDirectory() }) : compilerOptions;
42825                     specifier = ts.first(ts.moduleSpecifiers.getModuleSpecifiers(symbol, checker, specifierCompilerOptions, contextFile, moduleResolverHost, { importModuleSpecifierPreference: isBundle_1 ? "non-relative" : "project-relative", importModuleSpecifierEnding: isBundle_1 ? "minimal" : undefined }));
42826                     (_a = links.specifierCache) !== null && _a !== void 0 ? _a : (links.specifierCache = new ts.Map());
42827                     links.specifierCache.set(contextFile.path, specifier);
42828                 }
42829                 return specifier;
42830             }
42831             function symbolToEntityNameNode(symbol) {
42832                 var identifier = ts.factory.createIdentifier(ts.unescapeLeadingUnderscores(symbol.escapedName));
42833                 return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
42834             }
42835             function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
42836                 var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
42837                 var isTypeOf = meaning === 111551;
42838                 if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
42839                     var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
42840                     var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
42841                     var specifier = getSpecifierForModuleSymbol(chain[0], context);
42842                     if (!(context.flags & 67108864) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
42843                         context.encounteredError = true;
42844                         if (context.tracker.reportLikelyUnsafeImportRequiredError) {
42845                             context.tracker.reportLikelyUnsafeImportRequiredError(specifier);
42846                         }
42847                     }
42848                     var lit = ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(specifier));
42849                     if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
42850                         context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
42851                     context.approximateLength += specifier.length + 10;
42852                     if (!nonRootParts || ts.isEntityName(nonRootParts)) {
42853                         if (nonRootParts) {
42854                             var lastId = ts.isIdentifier(nonRootParts) ? nonRootParts : nonRootParts.right;
42855                             lastId.typeArguments = undefined;
42856                         }
42857                         return ts.factory.createImportTypeNode(lit, nonRootParts, typeParameterNodes, isTypeOf);
42858                     }
42859                     else {
42860                         var splitNode = getTopmostIndexedAccessType(nonRootParts);
42861                         var qualifier = splitNode.objectType.typeName;
42862                         return ts.factory.createIndexedAccessTypeNode(ts.factory.createImportTypeNode(lit, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType);
42863                     }
42864                 }
42865                 var entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0);
42866                 if (ts.isIndexedAccessTypeNode(entityName)) {
42867                     return entityName;
42868                 }
42869                 if (isTypeOf) {
42870                     return ts.factory.createTypeQueryNode(entityName);
42871                 }
42872                 else {
42873                     var lastId = ts.isIdentifier(entityName) ? entityName : entityName.right;
42874                     var lastTypeArgs = lastId.typeArguments;
42875                     lastId.typeArguments = undefined;
42876                     return ts.factory.createTypeReferenceNode(entityName, lastTypeArgs);
42877                 }
42878                 function createAccessFromSymbolChain(chain, index, stopper) {
42879                     var typeParameterNodes = index === (chain.length - 1) ? overrideTypeArguments : lookupTypeParameterNodes(chain, index, context);
42880                     var symbol = chain[index];
42881                     var parent = chain[index - 1];
42882                     var symbolName;
42883                     if (index === 0) {
42884                         context.flags |= 16777216;
42885                         symbolName = getNameOfSymbolAsWritten(symbol, context);
42886                         context.approximateLength += (symbolName ? symbolName.length : 0) + 1;
42887                         context.flags ^= 16777216;
42888                     }
42889                     else {
42890                         if (parent && getExportsOfSymbol(parent)) {
42891                             var exports_1 = getExportsOfSymbol(parent);
42892                             ts.forEachEntry(exports_1, function (ex, name) {
42893                                 if (getSymbolIfSameReference(ex, symbol) && !isLateBoundName(name) && name !== "export=") {
42894                                     symbolName = ts.unescapeLeadingUnderscores(name);
42895                                     return true;
42896                                 }
42897                             });
42898                         }
42899                     }
42900                     if (!symbolName) {
42901                         symbolName = getNameOfSymbolAsWritten(symbol, context);
42902                     }
42903                     context.approximateLength += symbolName.length + 1;
42904                     if (!(context.flags & 16) && parent &&
42905                         getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol.escapedName) &&
42906                         getSymbolIfSameReference(getMembersOfSymbol(parent).get(symbol.escapedName), symbol)) {
42907                         var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
42908                         if (ts.isIndexedAccessTypeNode(LHS)) {
42909                             return ts.factory.createIndexedAccessTypeNode(LHS, ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(symbolName)));
42910                         }
42911                         else {
42912                             return ts.factory.createIndexedAccessTypeNode(ts.factory.createTypeReferenceNode(LHS, typeParameterNodes), ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(symbolName)));
42913                         }
42914                     }
42915                     var identifier = ts.setEmitFlags(ts.factory.createIdentifier(symbolName, typeParameterNodes), 16777216);
42916                     identifier.symbol = symbol;
42917                     if (index > stopper) {
42918                         var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
42919                         if (!ts.isEntityName(LHS)) {
42920                             return ts.Debug.fail("Impossible construct - an export of an indexed access cannot be reachable");
42921                         }
42922                         return ts.factory.createQualifiedName(LHS, identifier);
42923                     }
42924                     return identifier;
42925                 }
42926             }
42927             function typeParameterShadowsNameInScope(escapedName, context, type) {
42928                 var result = resolveName(context.enclosingDeclaration, escapedName, 788968, undefined, escapedName, false);
42929                 if (result) {
42930                     if (result.flags & 262144 && result === type.symbol) {
42931                         return false;
42932                     }
42933                     return true;
42934                 }
42935                 return false;
42936             }
42937             function typeParameterToName(type, context) {
42938                 var _a, _b;
42939                 if (context.flags & 4 && context.typeParameterNames) {
42940                     var cached = context.typeParameterNames.get(getTypeId(type));
42941                     if (cached) {
42942                         return cached;
42943                     }
42944                 }
42945                 var result = symbolToName(type.symbol, context, 788968, true);
42946                 if (!(result.kind & 79)) {
42947                     return ts.factory.createIdentifier("(Missing type parameter)");
42948                 }
42949                 if (context.flags & 4) {
42950                     var rawtext = result.escapedText;
42951                     var i = ((_a = context.typeParameterNamesByTextNextNameCount) === null || _a === void 0 ? void 0 : _a.get(rawtext)) || 0;
42952                     var text = rawtext;
42953                     while (((_b = context.typeParameterNamesByText) === null || _b === void 0 ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
42954                         i++;
42955                         text = "".concat(rawtext, "_").concat(i);
42956                     }
42957                     if (text !== rawtext) {
42958                         result = ts.factory.createIdentifier(text, result.typeArguments);
42959                     }
42960                     (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = new ts.Map())).set(rawtext, i);
42961                     (context.typeParameterNames || (context.typeParameterNames = new ts.Map())).set(getTypeId(type), result);
42962                     (context.typeParameterNamesByText || (context.typeParameterNamesByText = new ts.Set())).add(rawtext);
42963                 }
42964                 return result;
42965             }
42966             function symbolToName(symbol, context, meaning, expectsIdentifier) {
42967                 var chain = lookupSymbolChain(symbol, context, meaning);
42968                 if (expectsIdentifier && chain.length !== 1
42969                     && !context.encounteredError
42970                     && !(context.flags & 65536)) {
42971                     context.encounteredError = true;
42972                 }
42973                 return createEntityNameFromSymbolChain(chain, chain.length - 1);
42974                 function createEntityNameFromSymbolChain(chain, index) {
42975                     var typeParameterNodes = lookupTypeParameterNodes(chain, index, context);
42976                     var symbol = chain[index];
42977                     if (index === 0) {
42978                         context.flags |= 16777216;
42979                     }
42980                     var symbolName = getNameOfSymbolAsWritten(symbol, context);
42981                     if (index === 0) {
42982                         context.flags ^= 16777216;
42983                     }
42984                     var identifier = ts.setEmitFlags(ts.factory.createIdentifier(symbolName, typeParameterNodes), 16777216);
42985                     identifier.symbol = symbol;
42986                     return index > 0 ? ts.factory.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier;
42987                 }
42988             }
42989             function symbolToExpression(symbol, context, meaning) {
42990                 var chain = lookupSymbolChain(symbol, context, meaning);
42991                 return createExpressionFromSymbolChain(chain, chain.length - 1);
42992                 function createExpressionFromSymbolChain(chain, index) {
42993                     var typeParameterNodes = lookupTypeParameterNodes(chain, index, context);
42994                     var symbol = chain[index];
42995                     if (index === 0) {
42996                         context.flags |= 16777216;
42997                     }
42998                     var symbolName = getNameOfSymbolAsWritten(symbol, context);
42999                     if (index === 0) {
43000                         context.flags ^= 16777216;
43001                     }
43002                     var firstChar = symbolName.charCodeAt(0);
43003                     if (ts.isSingleOrDoubleQuote(firstChar) && ts.some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
43004                         return ts.factory.createStringLiteral(getSpecifierForModuleSymbol(symbol, context));
43005                     }
43006                     var canUsePropertyAccess = firstChar === 35 ?
43007                         symbolName.length > 1 && ts.isIdentifierStart(symbolName.charCodeAt(1), languageVersion) :
43008                         ts.isIdentifierStart(firstChar, languageVersion);
43009                     if (index === 0 || canUsePropertyAccess) {
43010                         var identifier = ts.setEmitFlags(ts.factory.createIdentifier(symbolName, typeParameterNodes), 16777216);
43011                         identifier.symbol = symbol;
43012                         return index > 0 ? ts.factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain, index - 1), identifier) : identifier;
43013                     }
43014                     else {
43015                         if (firstChar === 91) {
43016                             symbolName = symbolName.substring(1, symbolName.length - 1);
43017                             firstChar = symbolName.charCodeAt(0);
43018                         }
43019                         var expression = void 0;
43020                         if (ts.isSingleOrDoubleQuote(firstChar)) {
43021                             expression = ts.factory.createStringLiteral(symbolName
43022                                 .substring(1, symbolName.length - 1)
43023                                 .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39);
43024                         }
43025                         else if (("" + +symbolName) === symbolName) {
43026                             expression = ts.factory.createNumericLiteral(+symbolName);
43027                         }
43028                         if (!expression) {
43029                             expression = ts.setEmitFlags(ts.factory.createIdentifier(symbolName, typeParameterNodes), 16777216);
43030                             expression.symbol = symbol;
43031                         }
43032                         return ts.factory.createElementAccessExpression(createExpressionFromSymbolChain(chain, index - 1), expression);
43033                     }
43034                 }
43035             }
43036             function isStringNamed(d) {
43037                 var name = ts.getNameOfDeclaration(d);
43038                 return !!name && ts.isStringLiteral(name);
43039             }
43040             function isSingleQuotedStringNamed(d) {
43041                 var name = ts.getNameOfDeclaration(d);
43042                 return !!(name && ts.isStringLiteral(name) && (name.singleQuote || !ts.nodeIsSynthesized(name) && ts.startsWith(ts.getTextOfNode(name, false), "'")));
43043             }
43044             function getPropertyNameNodeForSymbol(symbol, context) {
43045                 var singleQuote = !!ts.length(symbol.declarations) && ts.every(symbol.declarations, isSingleQuotedStringNamed);
43046                 var fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote);
43047                 if (fromNameType) {
43048                     return fromNameType;
43049                 }
43050                 var rawName = ts.unescapeLeadingUnderscores(symbol.escapedName);
43051                 var stringNamed = !!ts.length(symbol.declarations) && ts.every(symbol.declarations, isStringNamed);
43052                 return createPropertyNameNodeForIdentifierOrLiteral(rawName, stringNamed, singleQuote);
43053             }
43054             function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote) {
43055                 var nameType = getSymbolLinks(symbol).nameType;
43056                 if (nameType) {
43057                     if (nameType.flags & 384) {
43058                         var name = "" + nameType.value;
43059                         if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
43060                             return ts.factory.createStringLiteral(name, !!singleQuote);
43061                         }
43062                         if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
43063                             return ts.factory.createComputedPropertyName(ts.factory.createNumericLiteral(+name));
43064                         }
43065                         return createPropertyNameNodeForIdentifierOrLiteral(name);
43066                     }
43067                     if (nameType.flags & 8192) {
43068                         return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551));
43069                     }
43070                 }
43071             }
43072             function createPropertyNameNodeForIdentifierOrLiteral(name, stringNamed, singleQuote) {
43073                 return ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) ? ts.factory.createIdentifier(name) :
43074                     !stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts.factory.createNumericLiteral(+name) :
43075                         ts.factory.createStringLiteral(name, !!singleQuote);
43076             }
43077             function cloneNodeBuilderContext(context) {
43078                 var initial = __assign({}, context);
43079                 if (initial.typeParameterNames) {
43080                     initial.typeParameterNames = new ts.Map(initial.typeParameterNames);
43081                 }
43082                 if (initial.typeParameterNamesByText) {
43083                     initial.typeParameterNamesByText = new ts.Set(initial.typeParameterNamesByText);
43084                 }
43085                 if (initial.typeParameterSymbolList) {
43086                     initial.typeParameterSymbolList = new ts.Set(initial.typeParameterSymbolList);
43087                 }
43088                 initial.tracker = wrapSymbolTrackerToReportForContext(initial, initial.tracker);
43089                 return initial;
43090             }
43091             function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
43092                 return symbol.declarations && ts.find(symbol.declarations, function (s) { return !!ts.getEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!ts.findAncestor(s, function (n) { return n === enclosingDeclaration; })); });
43093             }
43094             function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
43095                 return !(ts.getObjectFlags(type) & 4) || !ts.isTypeReferenceNode(existing) || ts.length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
43096             }
43097             function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
43098                 if (!isErrorType(type) && enclosingDeclaration) {
43099                     var declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
43100                     if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
43101                         var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
43102                         if (getTypeFromTypeNode(existing) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
43103                             var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
43104                             if (result_6) {
43105                                 return result_6;
43106                             }
43107                         }
43108                     }
43109                 }
43110                 var oldFlags = context.flags;
43111                 if (type.flags & 8192 &&
43112                     type.symbol === symbol && (!context.enclosingDeclaration || ts.some(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(context.enclosingDeclaration); }))) {
43113                     context.flags |= 1048576;
43114                 }
43115                 var result = typeToTypeNodeHelper(type, context);
43116                 context.flags = oldFlags;
43117                 return result;
43118             }
43119             function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
43120                 if (!isErrorType(type) && context.enclosingDeclaration) {
43121                     var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
43122                     if (!!ts.findAncestor(annotation, function (n) { return n === context.enclosingDeclaration; }) && annotation) {
43123                         var annotated = getTypeFromTypeNode(annotation);
43124                         var thisInstantiated = annotated.flags & 262144 && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
43125                         if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
43126                             var result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
43127                             if (result) {
43128                                 return result;
43129                             }
43130                         }
43131                     }
43132                 }
43133                 return typeToTypeNodeHelper(type, context);
43134             }
43135             function trackExistingEntityName(node, context, includePrivateSymbol) {
43136                 var _a, _b;
43137                 var introducesError = false;
43138                 var leftmost = ts.getFirstIdentifier(node);
43139                 if (ts.isInJSFile(node) && (ts.isExportsIdentifier(leftmost) || ts.isModuleExportsAccessExpression(leftmost.parent) || (ts.isQualifiedName(leftmost.parent) && ts.isModuleIdentifier(leftmost.parent.left) && ts.isExportsIdentifier(leftmost.parent.right)))) {
43140                     introducesError = true;
43141                     return { introducesError: introducesError, node: node };
43142                 }
43143                 var sym = resolveEntityName(leftmost, 67108863, true, true);
43144                 if (sym) {
43145                     if (isSymbolAccessible(sym, context.enclosingDeclaration, 67108863, false).accessibility !== 0) {
43146                         introducesError = true;
43147                     }
43148                     else {
43149                         (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.trackSymbol) === null || _b === void 0 ? void 0 : _b.call(_a, sym, context.enclosingDeclaration, 67108863);
43150                         includePrivateSymbol === null || includePrivateSymbol === void 0 ? void 0 : includePrivateSymbol(sym);
43151                     }
43152                     if (ts.isIdentifier(node)) {
43153                         var name = sym.flags & 262144 ? typeParameterToName(getDeclaredTypeOfSymbol(sym), context) : ts.factory.cloneNode(node);
43154                         name.symbol = sym;
43155                         return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216) };
43156                     }
43157                 }
43158                 return { introducesError: introducesError, node: node };
43159             }
43160             function serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled) {
43161                 if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
43162                     cancellationToken.throwIfCancellationRequested();
43163                 }
43164                 var hadError = false;
43165                 var file = ts.getSourceFileOfNode(existing);
43166                 var transformed = ts.visitNode(existing, visitExistingNodeTreeSymbols);
43167                 if (hadError) {
43168                     return undefined;
43169                 }
43170                 return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed;
43171                 function visitExistingNodeTreeSymbols(node) {
43172                     if (ts.isJSDocAllType(node) || node.kind === 317) {
43173                         return ts.factory.createKeywordTypeNode(130);
43174                     }
43175                     if (ts.isJSDocUnknownType(node)) {
43176                         return ts.factory.createKeywordTypeNode(154);
43177                     }
43178                     if (ts.isJSDocNullableType(node)) {
43179                         return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]);
43180                     }
43181                     if (ts.isJSDocOptionalType(node)) {
43182                         return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(152)]);
43183                     }
43184                     if (ts.isJSDocNonNullableType(node)) {
43185                         return ts.visitNode(node.type, visitExistingNodeTreeSymbols);
43186                     }
43187                     if (ts.isJSDocVariadicType(node)) {
43188                         return ts.factory.createArrayTypeNode(ts.visitNode(node.type, visitExistingNodeTreeSymbols));
43189                     }
43190                     if (ts.isJSDocTypeLiteral(node)) {
43191                         return ts.factory.createTypeLiteralNode(ts.map(node.jsDocPropertyTags, function (t) {
43192                             var name = ts.isIdentifier(t.name) ? t.name : t.name.right;
43193                             var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText);
43194                             var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined;
43195                             return ts.factory.createPropertySignature(undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130));
43196                         }));
43197                     }
43198                     if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") {
43199                         return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130), node);
43200                     }
43201                     if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) {
43202                         return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(undefined, undefined, [ts.factory.createParameterDeclaration(undefined, undefined, undefined, "x", undefined, ts.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols))], ts.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols))]);
43203                     }
43204                     if (ts.isJSDocFunctionType(node)) {
43205                         if (ts.isJSDocConstructSignature(node)) {
43206                             var newTypeNode_1;
43207                             return ts.factory.createConstructorTypeNode(node.modifiers, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(undefined, undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130));
43208                         }
43209                         else {
43210                             return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(undefined, undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130));
43211                         }
43212                     }
43213                     if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968, true))) {
43214                         return ts.setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
43215                     }
43216                     if (ts.isLiteralImportTypeNode(node)) {
43217                         var nodeSymbol = getNodeLinks(node).resolvedSymbol;
43218                         if (ts.isInJSDoc(node) &&
43219                             nodeSymbol &&
43220                             ((!node.isTypeOf && !(nodeSymbol.flags & 788968)) ||
43221                                 !(ts.length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
43222                             return ts.setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
43223                         }
43224                         return ts.factory.updateImportTypeNode(node, ts.factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)), node.qualifier, ts.visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, ts.isTypeNode), node.isTypeOf);
43225                     }
43226                     if (ts.isEntityName(node) || ts.isEntityNameExpression(node)) {
43227                         var _a = trackExistingEntityName(node, context, includePrivateSymbol), introducesError = _a.introducesError, result = _a.node;
43228                         hadError = hadError || introducesError;
43229                         if (result !== node) {
43230                             return result;
43231                         }
43232                     }
43233                     if (file && ts.isTupleTypeNode(node) && (ts.getLineAndCharacterOfPosition(file, node.pos).line === ts.getLineAndCharacterOfPosition(file, node.end).line)) {
43234                         ts.setEmitFlags(node, 1);
43235                     }
43236                     return ts.visitEachChild(node, visitExistingNodeTreeSymbols, ts.nullTransformationContext);
43237                     function getEffectiveDotDotDotForParameter(p) {
43238                         return p.dotDotDotToken || (p.type && ts.isJSDocVariadicType(p.type) ? ts.factory.createToken(25) : undefined);
43239                     }
43240                     function getNameForJSDocFunctionParameter(p, index) {
43241                         return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "this" ? "this"
43242                             : getEffectiveDotDotDotForParameter(p) ? "args"
43243                                 : "arg".concat(index);
43244                     }
43245                     function rewriteModuleSpecifier(parent, lit) {
43246                         if (bundled) {
43247                             if (context.tracker && context.tracker.moduleResolverHost) {
43248                                 var targetFile = getExternalModuleFileFromDeclaration(parent);
43249                                 if (targetFile) {
43250                                     var getCanonicalFileName = ts.createGetCanonicalFileName(!!host.useCaseSensitiveFileNames);
43251                                     var resolverHost = {
43252                                         getCanonicalFileName: getCanonicalFileName,
43253                                         getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
43254                                         getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
43255                                     };
43256                                     var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
43257                                     return ts.factory.createStringLiteral(newName);
43258                                 }
43259                             }
43260                         }
43261                         else {
43262                             if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) {
43263                                 var moduleSym = resolveExternalModuleNameWorker(lit, lit, undefined);
43264                                 if (moduleSym) {
43265                                     context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym);
43266                                 }
43267                             }
43268                         }
43269                         return lit;
43270                     }
43271                 }
43272             }
43273             function symbolTableToDeclarationStatements(symbolTable, context, bundled) {
43274                 var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 168, true);
43275                 var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (_decorators, mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 167, false);
43276                 var enclosingDeclaration = context.enclosingDeclaration;
43277                 var results = [];
43278                 var visitedSymbols = new ts.Set();
43279                 var deferredPrivatesStack = [];
43280                 var oldcontext = context;
43281                 context = __assign(__assign({}, oldcontext), { usedSymbolNames: new ts.Set(oldcontext.usedSymbolNames), remappedSymbolNames: new ts.Map(), tracker: __assign(__assign({}, oldcontext.tracker), { trackSymbol: function (sym, decl, meaning) {
43282                             var accessibleResult = isSymbolAccessible(sym, decl, meaning, false);
43283                             if (accessibleResult.accessibility === 0) {
43284                                 var chain = lookupSymbolChainWorker(sym, context, meaning);
43285                                 if (!(sym.flags & 4)) {
43286                                     includePrivateSymbol(chain[0]);
43287                                 }
43288                             }
43289                             else if (oldcontext.tracker && oldcontext.tracker.trackSymbol) {
43290                                 return oldcontext.tracker.trackSymbol(sym, decl, meaning);
43291                             }
43292                             return false;
43293                         } }) });
43294                 context.tracker = wrapSymbolTrackerToReportForContext(context, context.tracker);
43295                 ts.forEachEntry(symbolTable, function (symbol, name) {
43296                     var baseName = ts.unescapeLeadingUnderscores(name);
43297                     void getInternalSymbolName(symbol, baseName);
43298                 });
43299                 var addingDeclare = !bundled;
43300                 var exportEquals = symbolTable.get("export=");
43301                 if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152) {
43302                     symbolTable = ts.createSymbolTable();
43303                     symbolTable.set("export=", exportEquals);
43304                 }
43305                 visitSymbolTable(symbolTable);
43306                 return mergeRedundantStatements(results);
43307                 function isIdentifierAndNotUndefined(node) {
43308                     return !!node && node.kind === 79;
43309                 }
43310                 function getNamesOfDeclaration(statement) {
43311                     if (ts.isVariableStatement(statement)) {
43312                         return ts.filter(ts.map(statement.declarationList.declarations, ts.getNameOfDeclaration), isIdentifierAndNotUndefined);
43313                     }
43314                     return ts.filter([ts.getNameOfDeclaration(statement)], isIdentifierAndNotUndefined);
43315                 }
43316                 function flattenExportAssignedNamespace(statements) {
43317                     var exportAssignment = ts.find(statements, ts.isExportAssignment);
43318                     var nsIndex = ts.findIndex(statements, ts.isModuleDeclaration);
43319                     var ns = nsIndex !== -1 ? statements[nsIndex] : undefined;
43320                     if (ns && exportAssignment && exportAssignment.isExportEquals &&
43321                         ts.isIdentifier(exportAssignment.expression) && ts.isIdentifier(ns.name) && ts.idText(ns.name) === ts.idText(exportAssignment.expression) &&
43322                         ns.body && ts.isModuleBlock(ns.body)) {
43323                         var excessExports = ts.filter(statements, function (s) { return !!(ts.getEffectiveModifierFlags(s) & 1); });
43324                         var name_2 = ns.name;
43325                         var body = ns.body;
43326                         if (ts.length(excessExports)) {
43327                             ns = ts.factory.updateModuleDeclaration(ns, ns.decorators, ns.modifiers, ns.name, body = ts.factory.updateModuleBlock(body, ts.factory.createNodeArray(__spreadArray(__spreadArray([], ns.body.statements, true), [ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.map(ts.flatMap(excessExports, function (e) { return getNamesOfDeclaration(e); }), function (id) { return ts.factory.createExportSpecifier(false, undefined, id); })), undefined)], false))));
43328                             statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, nsIndex), true), [ns], false), statements.slice(nsIndex + 1), true);
43329                         }
43330                         if (!ts.find(statements, function (s) { return s !== ns && ts.nodeHasName(s, name_2); })) {
43331                             results = [];
43332                             var mixinExportFlag_1 = !ts.some(body.statements, function (s) { return ts.hasSyntacticModifier(s, 1) || ts.isExportAssignment(s) || ts.isExportDeclaration(s); });
43333                             ts.forEach(body.statements, function (s) {
43334                                 addResult(s, mixinExportFlag_1 ? 1 : 0);
43335                             });
43336                             statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return s !== ns && s !== exportAssignment; }), true), results, true);
43337                         }
43338                     }
43339                     return statements;
43340                 }
43341                 function mergeExportDeclarations(statements) {
43342                     var exports = ts.filter(statements, function (d) { return ts.isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && ts.isNamedExports(d.exportClause); });
43343                     if (ts.length(exports) > 1) {
43344                         var nonExports = ts.filter(statements, function (d) { return !ts.isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause; });
43345                         statements = __spreadArray(__spreadArray([], nonExports, true), [ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.flatMap(exports, function (e) { return ts.cast(e.exportClause, ts.isNamedExports).elements; })), undefined)], false);
43346                     }
43347                     var reexports = ts.filter(statements, function (d) { return ts.isExportDeclaration(d) && !!d.moduleSpecifier && !!d.exportClause && ts.isNamedExports(d.exportClause); });
43348                     if (ts.length(reexports) > 1) {
43349                         var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
43350                         if (groups.length !== reexports.length) {
43351                             var _loop_9 = function (group_1) {
43352                                 if (group_1.length > 1) {
43353                                     statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
43354                                         ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.flatMap(group_1, function (e) { return ts.cast(e.exportClause, ts.isNamedExports).elements; })), group_1[0].moduleSpecifier)
43355                                     ], false);
43356                                 }
43357                             };
43358                             for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
43359                                 var group_1 = groups_1[_i];
43360                                 _loop_9(group_1);
43361                             }
43362                         }
43363                     }
43364                     return statements;
43365                 }
43366                 function inlineExportModifiers(statements) {
43367                     var index = ts.findIndex(statements, function (d) { return ts.isExportDeclaration(d) && !d.moduleSpecifier && !d.assertClause && !!d.exportClause && ts.isNamedExports(d.exportClause); });
43368                     if (index >= 0) {
43369                         var exportDecl = statements[index];
43370                         var replacements = ts.mapDefined(exportDecl.exportClause.elements, function (e) {
43371                             if (!e.propertyName) {
43372                                 var indices = ts.indicesOf(statements);
43373                                 var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
43374                                 if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
43375                                     for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
43376                                         var index_1 = associatedIndices_1[_i];
43377                                         statements[index_1] = addExportModifier(statements[index_1]);
43378                                     }
43379                                     return undefined;
43380                                 }
43381                             }
43382                             return e;
43383                         });
43384                         if (!ts.length(replacements)) {
43385                             ts.orderedRemoveItemAt(statements, index);
43386                         }
43387                         else {
43388                             statements[index] = ts.factory.updateExportDeclaration(exportDecl, exportDecl.decorators, exportDecl.modifiers, exportDecl.isTypeOnly, ts.factory.updateNamedExports(exportDecl.exportClause, replacements), exportDecl.moduleSpecifier, exportDecl.assertClause);
43389                         }
43390                     }
43391                     return statements;
43392                 }
43393                 function mergeRedundantStatements(statements) {
43394                     statements = flattenExportAssignedNamespace(statements);
43395                     statements = mergeExportDeclarations(statements);
43396                     statements = inlineExportModifiers(statements);
43397                     if (enclosingDeclaration &&
43398                         ((ts.isSourceFile(enclosingDeclaration) && ts.isExternalOrCommonJsModule(enclosingDeclaration)) || ts.isModuleDeclaration(enclosingDeclaration)) &&
43399                         (!ts.some(statements, ts.isExternalModuleIndicator) || (!ts.hasScopeMarker(statements) && ts.some(statements, ts.needsScopeMarker)))) {
43400                         statements.push(ts.createEmptyExports(ts.factory));
43401                     }
43402                     return statements;
43403                 }
43404                 function canHaveExportModifier(node) {
43405                     return ts.isEnumDeclaration(node) ||
43406                         ts.isVariableStatement(node) ||
43407                         ts.isFunctionDeclaration(node) ||
43408                         ts.isClassDeclaration(node) ||
43409                         (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
43410                         ts.isInterfaceDeclaration(node) ||
43411                         isTypeDeclaration(node);
43412                 }
43413                 function addExportModifier(node) {
43414                     var flags = (ts.getEffectiveModifierFlags(node) | 1) & ~2;
43415                     return ts.factory.updateModifiers(node, flags);
43416                 }
43417                 function removeExportModifier(node) {
43418                     var flags = ts.getEffectiveModifierFlags(node) & ~1;
43419                     return ts.factory.updateModifiers(node, flags);
43420                 }
43421                 function visitSymbolTable(symbolTable, suppressNewPrivateContext, propertyAsAlias) {
43422                     if (!suppressNewPrivateContext) {
43423                         deferredPrivatesStack.push(new ts.Map());
43424                     }
43425                     symbolTable.forEach(function (symbol) {
43426                         serializeSymbol(symbol, false, !!propertyAsAlias);
43427                     });
43428                     if (!suppressNewPrivateContext) {
43429                         deferredPrivatesStack[deferredPrivatesStack.length - 1].forEach(function (symbol) {
43430                             serializeSymbol(symbol, true, !!propertyAsAlias);
43431                         });
43432                         deferredPrivatesStack.pop();
43433                     }
43434                 }
43435                 function serializeSymbol(symbol, isPrivate, propertyAsAlias) {
43436                     var visitedSym = getMergedSymbol(symbol);
43437                     if (visitedSymbols.has(getSymbolId(visitedSym))) {
43438                         return;
43439                     }
43440                     visitedSymbols.add(getSymbolId(visitedSym));
43441                     var skipMembershipCheck = !isPrivate;
43442                     if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
43443                         var oldContext = context;
43444                         context = cloneNodeBuilderContext(context);
43445                         var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
43446                         if (context.reportedDiagnostic) {
43447                             oldcontext.reportedDiagnostic = context.reportedDiagnostic;
43448                         }
43449                         context = oldContext;
43450                         return result;
43451                     }
43452                 }
43453                 function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
43454                     var _a, _b;
43455                     var symbolName = ts.unescapeLeadingUnderscores(symbol.escapedName);
43456                     var isDefault = symbol.escapedName === "default";
43457                     if (isPrivate && !(context.flags & 131072) && ts.isStringANonContextualKeyword(symbolName) && !isDefault) {
43458                         context.encounteredError = true;
43459                         return;
43460                     }
43461                     var needsPostExportDefault = isDefault && !!(symbol.flags & -113
43462                         || (symbol.flags & 16 && ts.length(getPropertiesOfType(getTypeOfSymbol(symbol))))) && !(symbol.flags & 2097152);
43463                     var needsExportDeclaration = !needsPostExportDefault && !isPrivate && ts.isStringANonContextualKeyword(symbolName) && !isDefault;
43464                     if (needsPostExportDefault || needsExportDeclaration) {
43465                         isPrivate = true;
43466                     }
43467                     var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 512 : 0);
43468                     var isConstMergedWithNS = symbol.flags & 1536 &&
43469                         symbol.flags & (2 | 1 | 4) &&
43470                         symbol.escapedName !== "export=";
43471                     var isConstMergedWithNSPrintableAsSignatureMerge = isConstMergedWithNS && isTypeRepresentableAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol);
43472                     if (symbol.flags & (16 | 8192) || isConstMergedWithNSPrintableAsSignatureMerge) {
43473                         serializeAsFunctionNamespaceMerge(getTypeOfSymbol(symbol), symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
43474                     }
43475                     if (symbol.flags & 524288) {
43476                         serializeTypeAlias(symbol, symbolName, modifierFlags);
43477                     }
43478                     if (symbol.flags & (2 | 1 | 4)
43479                         && symbol.escapedName !== "export="
43480                         && !(symbol.flags & 4194304)
43481                         && !(symbol.flags & 32)
43482                         && !isConstMergedWithNSPrintableAsSignatureMerge) {
43483                         if (propertyAsAlias) {
43484                             var createdExport = serializeMaybeAliasAssignment(symbol);
43485                             if (createdExport) {
43486                                 needsExportDeclaration = false;
43487                                 needsPostExportDefault = false;
43488                             }
43489                         }
43490                         else {
43491                             var type = getTypeOfSymbol(symbol);
43492                             var localName = getInternalSymbolName(symbol, symbolName);
43493                             if (!(symbol.flags & 16) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) {
43494                                 serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags);
43495                             }
43496                             else {
43497                                 var flags = !(symbol.flags & 2) ? undefined
43498                                     : isConstVariable(symbol) ? 2
43499                                         : 1;
43500                                 var name = (needsPostExportDefault || !(symbol.flags & 4)) ? localName : getUnusedName(localName, symbol);
43501                                 var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); });
43502                                 if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
43503                                     textRange = textRange.parent.parent;
43504                                 }
43505                                 var propertyAccessRequire = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isPropertyAccessExpression);
43506                                 if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
43507                                     && ((_b = type.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
43508                                     var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
43509                                     addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, alias, localName)])), 0);
43510                                     context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551);
43511                                 }
43512                                 else {
43513                                     var statement = ts.setTextRange(ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
43514                                         ts.factory.createVariableDeclaration(name, undefined, serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled))
43515                                     ], flags)), textRange);
43516                                     addResult(statement, name !== localName ? modifierFlags & ~1 : modifierFlags);
43517                                     if (name !== localName && !isPrivate) {
43518                                         addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, name, localName)])), 0);
43519                                         needsExportDeclaration = false;
43520                                         needsPostExportDefault = false;
43521                                     }
43522                                 }
43523                             }
43524                         }
43525                     }
43526                     if (symbol.flags & 384) {
43527                         serializeEnum(symbol, symbolName, modifierFlags);
43528                     }
43529                     if (symbol.flags & 32) {
43530                         if (symbol.flags & 4
43531                             && symbol.valueDeclaration
43532                             && ts.isBinaryExpression(symbol.valueDeclaration.parent)
43533                             && ts.isClassExpression(symbol.valueDeclaration.parent.right)) {
43534                             serializeAsAlias(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
43535                         }
43536                         else {
43537                             serializeAsClass(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
43538                         }
43539                     }
43540                     if ((symbol.flags & (512 | 1024) && (!isConstMergedWithNS || isTypeOnlyNamespace(symbol))) || isConstMergedWithNSPrintableAsSignatureMerge) {
43541                         serializeModule(symbol, symbolName, modifierFlags);
43542                     }
43543                     if (symbol.flags & 64 && !(symbol.flags & 32)) {
43544                         serializeInterface(symbol, symbolName, modifierFlags);
43545                     }
43546                     if (symbol.flags & 2097152) {
43547                         serializeAsAlias(symbol, getInternalSymbolName(symbol, symbolName), modifierFlags);
43548                     }
43549                     if (symbol.flags & 4 && symbol.escapedName === "export=") {
43550                         serializeMaybeAliasAssignment(symbol);
43551                     }
43552                     if (symbol.flags & 8388608) {
43553                         if (symbol.declarations) {
43554                             for (var _i = 0, _c = symbol.declarations; _i < _c.length; _i++) {
43555                                 var node = _c[_i];
43556                                 var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
43557                                 if (!resolvedModule)
43558                                     continue;
43559                                 addResult(ts.factory.createExportDeclaration(undefined, undefined, false, undefined, ts.factory.createStringLiteral(getSpecifierForModuleSymbol(resolvedModule, context))), 0);
43560                             }
43561                         }
43562                     }
43563                     if (needsPostExportDefault) {
43564                         addResult(ts.factory.createExportAssignment(undefined, undefined, false, ts.factory.createIdentifier(getInternalSymbolName(symbol, symbolName))), 0);
43565                     }
43566                     else if (needsExportDeclaration) {
43567                         addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, getInternalSymbolName(symbol, symbolName), symbolName)])), 0);
43568                     }
43569                 }
43570                 function includePrivateSymbol(symbol) {
43571                     if (ts.some(symbol.declarations, ts.isParameterDeclaration))
43572                         return;
43573                     ts.Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
43574                     getUnusedName(ts.unescapeLeadingUnderscores(symbol.escapedName), symbol);
43575                     var isExternalImportAlias = !!(symbol.flags & 2097152) && !ts.some(symbol.declarations, function (d) {
43576                         return !!ts.findAncestor(d, ts.isExportDeclaration) ||
43577                             ts.isNamespaceExport(d) ||
43578                             (ts.isImportEqualsDeclaration(d) && !ts.isExternalModuleReference(d.moduleReference));
43579                     });
43580                     deferredPrivatesStack[isExternalImportAlias ? 0 : (deferredPrivatesStack.length - 1)].set(getSymbolId(symbol), symbol);
43581                 }
43582                 function isExportingScope(enclosingDeclaration) {
43583                     return ((ts.isSourceFile(enclosingDeclaration) && (ts.isExternalOrCommonJsModule(enclosingDeclaration) || ts.isJsonSourceFile(enclosingDeclaration))) ||
43584                         (ts.isAmbientModule(enclosingDeclaration) && !ts.isGlobalScopeAugmentation(enclosingDeclaration)));
43585                 }
43586                 function addResult(node, additionalModifierFlags) {
43587                     if (ts.canHaveModifiers(node)) {
43588                         var newModifierFlags = 0;
43589                         var enclosingDeclaration_1 = context.enclosingDeclaration &&
43590                             (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
43591                         if (additionalModifierFlags & 1 &&
43592                             enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
43593                             canHaveExportModifier(node)) {
43594                             newModifierFlags |= 1;
43595                         }
43596                         if (addingDeclare && !(newModifierFlags & 1) &&
43597                             (!enclosingDeclaration_1 || !(enclosingDeclaration_1.flags & 8388608)) &&
43598                             (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) {
43599                             newModifierFlags |= 2;
43600                         }
43601                         if ((additionalModifierFlags & 512) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) {
43602                             newModifierFlags |= 512;
43603                         }
43604                         if (newModifierFlags) {
43605                             node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node));
43606                         }
43607                     }
43608                     results.push(node);
43609                 }
43610                 function serializeTypeAlias(symbol, symbolName, modifierFlags) {
43611                     var _a;
43612                     var aliasType = getDeclaredTypeOfTypeAlias(symbol);
43613                     var typeParams = getSymbolLinks(symbol).typeParameters;
43614                     var typeParamDecls = ts.map(typeParams, function (p) { return typeParameterToDeclaration(p, context); });
43615                     var jsdocAliasDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isJSDocTypeAlias);
43616                     var commentText = ts.getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : undefined);
43617                     var oldFlags = context.flags;
43618                     context.flags |= 8388608;
43619                     var oldEnclosingDecl = context.enclosingDeclaration;
43620                     context.enclosingDeclaration = jsdocAliasDecl;
43621                     var typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression
43622                         && ts.isJSDocTypeExpression(jsdocAliasDecl.typeExpression)
43623                         && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled)
43624                         || typeToTypeNodeHelper(aliasType, context);
43625                     addResult(ts.setSyntheticLeadingComments(ts.factory.createTypeAliasDeclaration(undefined, undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, typeNode), !commentText ? [] : [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]), modifierFlags);
43626                     context.flags = oldFlags;
43627                     context.enclosingDeclaration = oldEnclosingDecl;
43628                 }
43629                 function serializeInterface(symbol, symbolName, modifierFlags) {
43630                     var interfaceType = getDeclaredTypeOfClassOrInterface(symbol);
43631                     var localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
43632                     var typeParamDecls = ts.map(localParams, function (p) { return typeParameterToDeclaration(p, context); });
43633                     var baseTypes = getBaseTypes(interfaceType);
43634                     var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined;
43635                     var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); });
43636                     var callSignatures = serializeSignatures(0, interfaceType, baseType, 173);
43637                     var constructSignatures = serializeSignatures(1, interfaceType, baseType, 174);
43638                     var indexSignatures = serializeIndexSignatures(interfaceType, baseType);
43639                     var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551); }))];
43640                     addResult(ts.factory.createInterfaceDeclaration(undefined, undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), constructSignatures, true), callSignatures, true), members, true)), modifierFlags);
43641                 }
43642                 function getNamespaceMembersForSerialization(symbol) {
43643                     return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
43644                 }
43645                 function isTypeOnlyNamespace(symbol) {
43646                     return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551); });
43647                 }
43648                 function serializeModule(symbol, symbolName, modifierFlags) {
43649                     var members = getNamespaceMembersForSerialization(symbol);
43650                     var locationMap = ts.arrayToMultiMap(members, function (m) { return m.parent && m.parent === symbol ? "real" : "merged"; });
43651                     var realMembers = locationMap.get("real") || ts.emptyArray;
43652                     var mergedMembers = locationMap.get("merged") || ts.emptyArray;
43653                     if (ts.length(realMembers)) {
43654                         var localName = getInternalSymbolName(symbol, symbolName);
43655                         serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 | 67108864)));
43656                     }
43657                     if (ts.length(mergedMembers)) {
43658                         var containingFile_1 = ts.getSourceFileOfNode(context.enclosingDeclaration);
43659                         var localName = getInternalSymbolName(symbol, symbolName);
43660                         var nsBody = ts.factory.createModuleBlock([ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.mapDefined(ts.filter(mergedMembers, function (n) { return n.escapedName !== "export="; }), function (s) {
43661                                 var _a, _b;
43662                                 var name = ts.unescapeLeadingUnderscores(s.escapedName);
43663                                 var localName = getInternalSymbolName(s, name);
43664                                 var aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
43665                                 if (containingFile_1 && (aliasDecl ? containingFile_1 !== ts.getSourceFileOfNode(aliasDecl) : !ts.some(s.declarations, function (d) { return ts.getSourceFileOfNode(d) === containingFile_1; }))) {
43666                                     (_b = (_a = context.tracker) === null || _a === void 0 ? void 0 : _a.reportNonlocalAugmentation) === null || _b === void 0 ? void 0 : _b.call(_a, containingFile_1, symbol, s);
43667                                     return undefined;
43668                                 }
43669                                 var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, true);
43670                                 includePrivateSymbol(target || s);
43671                                 var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
43672                                 return ts.factory.createExportSpecifier(false, name === targetName ? undefined : targetName, name);
43673                             })))]);
43674                         addResult(ts.factory.createModuleDeclaration(undefined, undefined, ts.factory.createIdentifier(localName), nsBody, 16), 0);
43675                     }
43676                 }
43677                 function serializeEnum(symbol, symbolName, modifierFlags) {
43678                     addResult(ts.factory.createEnumDeclaration(undefined, ts.factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 : 0), getInternalSymbolName(symbol, symbolName), ts.map(ts.filter(getPropertiesOfType(getTypeOfSymbol(symbol)), function (p) { return !!(p.flags & 8); }), function (p) {
43679                         var initializedValue = p.declarations && p.declarations[0] && ts.isEnumMember(p.declarations[0]) ? getConstantValue(p.declarations[0]) : undefined;
43680                         return ts.factory.createEnumMember(ts.unescapeLeadingUnderscores(p.escapedName), initializedValue === undefined ? undefined :
43681                             typeof initializedValue === "string" ? ts.factory.createStringLiteral(initializedValue) :
43682                                 ts.factory.createNumericLiteral(initializedValue));
43683                     })), modifierFlags);
43684                 }
43685                 function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
43686                     var signatures = getSignaturesOfType(type, 0);
43687                     for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
43688                         var sig = signatures_2[_i];
43689                         var decl = signatureToSignatureDeclarationHelper(sig, 255, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled });
43690                         addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
43691                     }
43692                     if (!(symbol.flags & (512 | 1024) && !!symbol.exports && !!symbol.exports.size)) {
43693                         var props = ts.filter(getPropertiesOfType(type), isNamespaceMember);
43694                         serializeAsNamespaceDeclaration(props, localName, modifierFlags, true);
43695                     }
43696                 }
43697                 function getSignatureTextRangeLocation(signature) {
43698                     if (signature.declaration && signature.declaration.parent) {
43699                         if (ts.isBinaryExpression(signature.declaration.parent) && ts.getAssignmentDeclarationKind(signature.declaration.parent) === 5) {
43700                             return signature.declaration.parent;
43701                         }
43702                         if (ts.isVariableDeclaration(signature.declaration.parent) && signature.declaration.parent.parent) {
43703                             return signature.declaration.parent.parent;
43704                         }
43705                     }
43706                     return signature.declaration;
43707                 }
43708                 function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
43709                     if (ts.length(props)) {
43710                         var localVsRemoteMap = ts.arrayToMultiMap(props, function (p) {
43711                             return !ts.length(p.declarations) || ts.some(p.declarations, function (d) {
43712                                 return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(context.enclosingDeclaration);
43713                             }) ? "local" : "remote";
43714                         });
43715                         var localProps = localVsRemoteMap.get("local") || ts.emptyArray;
43716                         var fakespace = ts.parseNodeFactory.createModuleDeclaration(undefined, undefined, ts.factory.createIdentifier(localName), ts.factory.createModuleBlock([]), 16);
43717                         ts.setParent(fakespace, enclosingDeclaration);
43718                         fakespace.locals = ts.createSymbolTable(props);
43719                         fakespace.symbol = props[0].parent;
43720                         var oldResults = results;
43721                         results = [];
43722                         var oldAddingDeclare = addingDeclare;
43723                         addingDeclare = false;
43724                         var subcontext = __assign(__assign({}, context), { enclosingDeclaration: fakespace });
43725                         var oldContext = context;
43726                         context = subcontext;
43727                         visitSymbolTable(ts.createSymbolTable(localProps), suppressNewPrivateContext, true);
43728                         context = oldContext;
43729                         addingDeclare = oldAddingDeclare;
43730                         var declarations = results;
43731                         results = oldResults;
43732                         var defaultReplaced = ts.map(declarations, function (d) { return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, d.expression, ts.factory.createIdentifier("default"))])) : d; });
43733                         var exportModifierStripped = ts.every(defaultReplaced, function (d) { return ts.hasSyntacticModifier(d, 1); }) ? ts.map(defaultReplaced, removeExportModifier) : defaultReplaced;
43734                         fakespace = ts.factory.updateModuleDeclaration(fakespace, fakespace.decorators, fakespace.modifiers, fakespace.name, ts.factory.createModuleBlock(exportModifierStripped));
43735                         addResult(fakespace, modifierFlags);
43736                     }
43737                 }
43738                 function isNamespaceMember(p) {
43739                     return !!(p.flags & (788968 | 1920 | 2097152)) ||
43740                         !(p.flags & 4194304 || p.escapedName === "prototype" || p.valueDeclaration && ts.isStatic(p.valueDeclaration) && ts.isClassLike(p.valueDeclaration.parent));
43741                 }
43742                 function sanitizeJSDocImplements(clauses) {
43743                     var result = ts.mapDefined(clauses, function (e) {
43744                         var _a;
43745                         var oldEnclosing = context.enclosingDeclaration;
43746                         context.enclosingDeclaration = e;
43747                         var expr = e.expression;
43748                         if (ts.isEntityNameExpression(expr)) {
43749                             if (ts.isIdentifier(expr) && ts.idText(expr) === "") {
43750                                 return cleanup(undefined);
43751                             }
43752                             var introducesError = void 0;
43753                             (_a = trackExistingEntityName(expr, context, includePrivateSymbol), introducesError = _a.introducesError, expr = _a.node);
43754                             if (introducesError) {
43755                                 return cleanup(undefined);
43756                             }
43757                         }
43758                         return cleanup(ts.factory.createExpressionWithTypeArguments(expr, ts.map(e.typeArguments, function (a) {
43759                             return serializeExistingTypeNode(context, a, includePrivateSymbol, bundled)
43760                                 || typeToTypeNodeHelper(getTypeFromTypeNode(a), context);
43761                         })));
43762                         function cleanup(result) {
43763                             context.enclosingDeclaration = oldEnclosing;
43764                             return result;
43765                         }
43766                     });
43767                     if (result.length === clauses.length) {
43768                         return result;
43769                     }
43770                     return undefined;
43771                 }
43772                 function serializeAsClass(symbol, localName, modifierFlags) {
43773                     var _a, _b;
43774                     var originalDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isClassLike);
43775                     var oldEnclosing = context.enclosingDeclaration;
43776                     context.enclosingDeclaration = originalDecl || oldEnclosing;
43777                     var localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
43778                     var typeParamDecls = ts.map(localParams, function (p) { return typeParameterToDeclaration(p, context); });
43779                     var classType = getDeclaredTypeOfClassOrInterface(symbol);
43780                     var baseTypes = getBaseTypes(classType);
43781                     var originalImplements = originalDecl && ts.getEffectiveImplementsTypeNodes(originalDecl);
43782                     var implementsExpressions = originalImplements && sanitizeJSDocImplements(originalImplements)
43783                         || ts.mapDefined(getImplementsTypes(classType), serializeImplementedType);
43784                     var staticType = getTypeOfSymbol(symbol);
43785                     var isClass = !!((_b = staticType.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts.isClassLike(staticType.symbol.valueDeclaration);
43786                     var staticBaseType = isClass
43787                         ? getBaseConstructorTypeOfClass(staticType)
43788                         : anyType;
43789                     var heritageClauses = __spreadArray(__spreadArray([], !ts.length(baseTypes) ? [] : [ts.factory.createHeritageClause(94, ts.map(baseTypes, function (b) { return serializeBaseType(b, staticBaseType, localName); }))], true), !ts.length(implementsExpressions) ? [] : [ts.factory.createHeritageClause(117, implementsExpressions)], true);
43790                     var symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
43791                     var publicSymbolProps = ts.filter(symbolProps, function (s) {
43792                         var valueDecl = s.valueDeclaration;
43793                         return !!valueDecl && !(ts.isNamedDeclaration(valueDecl) && ts.isPrivateIdentifier(valueDecl.name));
43794                     });
43795                     var hasPrivateIdentifier = ts.some(symbolProps, function (s) {
43796                         var valueDecl = s.valueDeclaration;
43797                         return !!valueDecl && ts.isNamedDeclaration(valueDecl) && ts.isPrivateIdentifier(valueDecl.name);
43798                     });
43799                     var privateProperties = hasPrivateIdentifier ?
43800                         [ts.factory.createPropertyDeclaration(undefined, undefined, ts.factory.createPrivateIdentifier("#private"), undefined, undefined, undefined)] :
43801                         ts.emptyArray;
43802                     var publicProperties = ts.flatMap(publicSymbolProps, function (p) { return serializePropertySymbolForClass(p, false, baseTypes[0]); });
43803                     var staticMembers = ts.flatMap(ts.filter(getPropertiesOfType(staticType), function (p) { return !(p.flags & 4194304) && p.escapedName !== "prototype" && !isNamespaceMember(p); }), function (p) { return serializePropertySymbolForClass(p, true, staticBaseType); });
43804                     var isNonConstructableClassLikeInJsFile = !isClass &&
43805                         !!symbol.valueDeclaration &&
43806                         ts.isInJSFile(symbol.valueDeclaration) &&
43807                         !ts.some(getSignaturesOfType(staticType, 1));
43808                     var constructors = isNonConstructableClassLikeInJsFile ?
43809                         [ts.factory.createConstructorDeclaration(undefined, ts.factory.createModifiersFromModifierFlags(8), [], undefined)] :
43810                         serializeSignatures(1, staticType, staticBaseType, 170);
43811                     var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
43812                     context.enclosingDeclaration = oldEnclosing;
43813                     addResult(ts.setTextRange(ts.factory.createClassDeclaration(undefined, undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags);
43814                 }
43815                 function getSomeTargetNameFromDeclarations(declarations) {
43816                     return ts.firstDefined(declarations, function (d) {
43817                         if (ts.isImportSpecifier(d) || ts.isExportSpecifier(d)) {
43818                             return ts.idText(d.propertyName || d.name);
43819                         }
43820                         if (ts.isBinaryExpression(d) || ts.isExportAssignment(d)) {
43821                             var expression = ts.isExportAssignment(d) ? d.expression : d.right;
43822                             if (ts.isPropertyAccessExpression(expression)) {
43823                                 return ts.idText(expression.name);
43824                             }
43825                         }
43826                         if (isAliasSymbolDeclaration(d)) {
43827                             var name = ts.getNameOfDeclaration(d);
43828                             if (name && ts.isIdentifier(name)) {
43829                                 return ts.idText(name);
43830                             }
43831                         }
43832                         return undefined;
43833                     });
43834                 }
43835                 function serializeAsAlias(symbol, localName, modifierFlags) {
43836                     var _a, _b, _c, _d, _e;
43837                     var node = getDeclarationOfAliasSymbol(symbol);
43838                     if (!node)
43839                         return ts.Debug.fail();
43840                     var target = getMergedSymbol(getTargetOfAliasDeclaration(node, true));
43841                     if (!target) {
43842                         return;
43843                     }
43844                     var verbatimTargetName = ts.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts.unescapeLeadingUnderscores(target.escapedName);
43845                     if (verbatimTargetName === "export=" && (ts.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
43846                         verbatimTargetName = "default";
43847                     }
43848                     var targetName = getInternalSymbolName(target, verbatimTargetName);
43849                     includePrivateSymbol(target);
43850                     switch (node.kind) {
43851                         case 202:
43852                             if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 253) {
43853                                 var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context);
43854                                 var propertyName = node.propertyName;
43855                                 addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, propertyName && ts.isIdentifier(propertyName) ? ts.factory.createIdentifier(ts.idText(propertyName)) : undefined, ts.factory.createIdentifier(localName))])), ts.factory.createStringLiteral(specifier_1), undefined), 0);
43856                                 break;
43857                             }
43858                             ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization");
43859                             break;
43860                         case 295:
43861                             if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 220) {
43862                                 serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName);
43863                             }
43864                             break;
43865                         case 253:
43866                             if (ts.isPropertyAccessExpression(node.initializer)) {
43867                                 var initializer = node.initializer;
43868                                 var uniqueName = ts.factory.createUniqueName(localName);
43869                                 var specifier_2 = getSpecifierForModuleSymbol(target.parent || target, context);
43870                                 addResult(ts.factory.createImportEqualsDeclaration(undefined, undefined, false, uniqueName, ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(specifier_2))), 0);
43871                                 addResult(ts.factory.createImportEqualsDeclaration(undefined, undefined, false, ts.factory.createIdentifier(localName), ts.factory.createQualifiedName(uniqueName, initializer.name)), modifierFlags);
43872                                 break;
43873                             }
43874                         case 264:
43875                             if (target.escapedName === "export=" && ts.some(target.declarations, ts.isJsonSourceFile)) {
43876                                 serializeMaybeAliasAssignment(symbol);
43877                                 break;
43878                             }
43879                             var isLocalImport = !(target.flags & 512) && !ts.isVariableDeclaration(node);
43880                             addResult(ts.factory.createImportEqualsDeclaration(undefined, undefined, false, ts.factory.createIdentifier(localName), isLocalImport
43881                                 ? symbolToName(target, context, 67108863, false)
43882                                 : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0);
43883                             break;
43884                         case 263:
43885                             addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0);
43886                             break;
43887                         case 266:
43888                             addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, ts.factory.createIdentifier(localName), undefined), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0);
43889                             break;
43890                         case 267:
43891                             addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), undefined), 0);
43892                             break;
43893                         case 273:
43894                             addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0);
43895                             break;
43896                         case 269:
43897                             addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([
43898                                 ts.factory.createImportSpecifier(false, localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
43899                             ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0);
43900                             break;
43901                         case 274:
43902                             var specifier = node.parent.parent.moduleSpecifier;
43903                             serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined);
43904                             break;
43905                         case 270:
43906                             serializeMaybeAliasAssignment(symbol);
43907                             break;
43908                         case 220:
43909                         case 205:
43910                         case 206:
43911                             if (symbol.escapedName === "default" || symbol.escapedName === "export=") {
43912                                 serializeMaybeAliasAssignment(symbol);
43913                             }
43914                             else {
43915                                 serializeExportSpecifier(localName, targetName);
43916                             }
43917                             break;
43918                         default:
43919                             return ts.Debug.failBadSyntaxKind(node, "Unhandled alias declaration kind in symbol serializer!");
43920                     }
43921                 }
43922                 function serializeExportSpecifier(localName, targetName, specifier) {
43923                     addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, localName !== targetName ? targetName : undefined, localName)]), specifier), 0);
43924                 }
43925                 function serializeMaybeAliasAssignment(symbol) {
43926                     if (symbol.flags & 4194304) {
43927                         return false;
43928                     }
43929                     var name = ts.unescapeLeadingUnderscores(symbol.escapedName);
43930                     var isExportEquals = name === "export=";
43931                     var isDefault = name === "default";
43932                     var isExportAssignmentCompatibleSymbolName = isExportEquals || isDefault;
43933                     var aliasDecl = symbol.declarations && getDeclarationOfAliasSymbol(symbol);
43934                     var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, true);
43935                     if (target && ts.length(target.declarations) && ts.some(target.declarations, function (d) { return ts.getSourceFileOfNode(d) === ts.getSourceFileOfNode(enclosingDeclaration); })) {
43936                         var expr = aliasDecl && ((ts.isExportAssignment(aliasDecl) || ts.isBinaryExpression(aliasDecl)) ? ts.getExportAssignmentExpression(aliasDecl) : ts.getPropertyAssignmentAliasLikeExpression(aliasDecl));
43937                         var first_1 = expr && ts.isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : undefined;
43938                         var referenced = first_1 && resolveEntityName(first_1, 67108863, true, true, enclosingDeclaration);
43939                         if (referenced || target) {
43940                             includePrivateSymbol(referenced || target);
43941                         }
43942                         var oldTrack = context.tracker.trackSymbol;
43943                         context.tracker.trackSymbol = function () { return false; };
43944                         if (isExportAssignmentCompatibleSymbolName) {
43945                             results.push(ts.factory.createExportAssignment(undefined, undefined, isExportEquals, symbolToExpression(target, context, 67108863)));
43946                         }
43947                         else {
43948                             if (first_1 === expr && first_1) {
43949                                 serializeExportSpecifier(name, ts.idText(first_1));
43950                             }
43951                             else if (expr && ts.isClassExpression(expr)) {
43952                                 serializeExportSpecifier(name, getInternalSymbolName(target, ts.symbolName(target)));
43953                             }
43954                             else {
43955                                 var varName = getUnusedName(name, symbol);
43956                                 addResult(ts.factory.createImportEqualsDeclaration(undefined, undefined, false, ts.factory.createIdentifier(varName), symbolToName(target, context, 67108863, false)), 0);
43957                                 serializeExportSpecifier(name, varName);
43958                             }
43959                         }
43960                         context.tracker.trackSymbol = oldTrack;
43961                         return true;
43962                     }
43963                     else {
43964                         var varName = getUnusedName(name, symbol);
43965                         var typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol)));
43966                         if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
43967                             serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 : 1);
43968                         }
43969                         else {
43970                             var statement = ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
43971                                 ts.factory.createVariableDeclaration(varName, undefined, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled))
43972                             ], 2));
43973                             addResult(statement, target && target.flags & 4 && target.escapedName === "export=" ? 2
43974                                 : name === varName ? 1
43975                                     : 0);
43976                         }
43977                         if (isExportAssignmentCompatibleSymbolName) {
43978                             results.push(ts.factory.createExportAssignment(undefined, undefined, isExportEquals, ts.factory.createIdentifier(varName)));
43979                             return true;
43980                         }
43981                         else if (name !== varName) {
43982                             serializeExportSpecifier(name, varName);
43983                             return true;
43984                         }
43985                         return false;
43986                     }
43987                 }
43988                 function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
43989                     var ctxSrc = ts.getSourceFileOfNode(context.enclosingDeclaration);
43990                     return ts.getObjectFlags(typeToSerialize) & (16 | 32) &&
43991                         !ts.length(getIndexInfosOfType(typeToSerialize)) &&
43992                         !isClassInstanceSide(typeToSerialize) &&
43993                         !!(ts.length(ts.filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || ts.length(getSignaturesOfType(typeToSerialize, 0))) &&
43994                         !ts.length(getSignaturesOfType(typeToSerialize, 1)) &&
43995                         !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) &&
43996                         !(typeToSerialize.symbol && ts.some(typeToSerialize.symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; })) &&
43997                         !ts.some(getPropertiesOfType(typeToSerialize), function (p) { return isLateBoundName(p.escapedName); }) &&
43998                         !ts.some(getPropertiesOfType(typeToSerialize), function (p) { return ts.some(p.declarations, function (d) { return ts.getSourceFileOfNode(d) !== ctxSrc; }); }) &&
43999                         ts.every(getPropertiesOfType(typeToSerialize), function (p) { return ts.isIdentifierText(ts.symbolName(p), languageVersion); });
44000                 }
44001                 function makeSerializePropertySymbol(createProperty, methodKind, useAccessors) {
44002                     return function serializePropertySymbol(p, isStatic, baseType) {
44003                         var _a, _b, _c, _d, _e;
44004                         var modifierFlags = ts.getDeclarationModifierFlagsFromSymbol(p);
44005                         var isPrivate = !!(modifierFlags & 8);
44006                         if (isStatic && (p.flags & (788968 | 1920 | 2097152))) {
44007                             return [];
44008                         }
44009                         if (p.flags & 4194304 ||
44010                             (baseType && getPropertyOfType(baseType, p.escapedName)
44011                                 && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p)
44012                                 && (p.flags & 16777216) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216)
44013                                 && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) {
44014                             return [];
44015                         }
44016                         var flag = (modifierFlags & ~256) | (isStatic ? 32 : 0);
44017                         var name = getPropertyNameNodeForSymbol(p, context);
44018                         var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression));
44019                         if (p.flags & 98304 && useAccessors) {
44020                             var result = [];
44021                             if (p.flags & 65536) {
44022                                 result.push(ts.setTextRange(ts.factory.createSetAccessorDeclaration(undefined, ts.factory.createModifiersFromModifierFlags(flag), name, [ts.factory.createParameterDeclaration(undefined, undefined, undefined, "arg", undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled))], undefined), ((_b = p.declarations) === null || _b === void 0 ? void 0 : _b.find(ts.isSetAccessor)) || firstPropertyLikeDecl));
44023                             }
44024                             if (p.flags & 32768) {
44025                                 var isPrivate_1 = modifierFlags & 8;
44026                                 result.push(ts.setTextRange(ts.factory.createGetAccessorDeclaration(undefined, ts.factory.createModifiersFromModifierFlags(flag), name, [], isPrivate_1 ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_c = p.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isGetAccessor)) || firstPropertyLikeDecl));
44027                             }
44028                             return result;
44029                         }
44030                         else if (p.flags & (4 | 3 | 98304)) {
44031                             return ts.setTextRange(createProperty(undefined, ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl);
44032                         }
44033                         if (p.flags & (8192 | 16)) {
44034                             var type = getTypeOfSymbol(p);
44035                             var signatures = getSignaturesOfType(type, 0);
44036                             if (flag & 8) {
44037                                 return ts.setTextRange(createProperty(undefined, ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, undefined, undefined), ((_e = p.declarations) === null || _e === void 0 ? void 0 : _e.find(ts.isFunctionLikeDeclaration)) || signatures[0] && signatures[0].declaration || p.declarations && p.declarations[0]);
44038                             }
44039                             var results_1 = [];
44040                             for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) {
44041                                 var sig = signatures_3[_i];
44042                                 var decl = signatureToSignatureDeclarationHelper(sig, methodKind, context, {
44043                                     name: name,
44044                                     questionToken: p.flags & 16777216 ? ts.factory.createToken(57) : undefined,
44045                                     modifiers: flag ? ts.factory.createModifiersFromModifierFlags(flag) : undefined
44046                                 });
44047                                 var location = sig.declaration && ts.isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration;
44048                                 results_1.push(ts.setTextRange(decl, location));
44049                             }
44050                             return results_1;
44051                         }
44052                         return ts.Debug.fail("Unhandled class member kind! ".concat(p.__debugFlags || p.flags));
44053                     };
44054                 }
44055                 function serializePropertySymbolForInterface(p, baseType) {
44056                     return serializePropertySymbolForInterfaceWorker(p, false, baseType);
44057                 }
44058                 function serializeSignatures(kind, input, baseType, outputKind) {
44059                     var signatures = getSignaturesOfType(input, kind);
44060                     if (kind === 1) {
44061                         if (!baseType && ts.every(signatures, function (s) { return ts.length(s.parameters) === 0; })) {
44062                             return [];
44063                         }
44064                         if (baseType) {
44065                             var baseSigs = getSignaturesOfType(baseType, 1);
44066                             if (!ts.length(baseSigs) && ts.every(signatures, function (s) { return ts.length(s.parameters) === 0; })) {
44067                                 return [];
44068                             }
44069                             if (baseSigs.length === signatures.length) {
44070                                 var failed = false;
44071                                 for (var i = 0; i < baseSigs.length; i++) {
44072                                     if (!compareSignaturesIdentical(signatures[i], baseSigs[i], false, false, true, compareTypesIdentical)) {
44073                                         failed = true;
44074                                         break;
44075                                     }
44076                                 }
44077                                 if (!failed) {
44078                                     return [];
44079                                 }
44080                             }
44081                         }
44082                         var privateProtected = 0;
44083                         for (var _i = 0, signatures_4 = signatures; _i < signatures_4.length; _i++) {
44084                             var s = signatures_4[_i];
44085                             if (s.declaration) {
44086                                 privateProtected |= ts.getSelectedEffectiveModifierFlags(s.declaration, 8 | 16);
44087                             }
44088                         }
44089                         if (privateProtected) {
44090                             return [ts.setTextRange(ts.factory.createConstructorDeclaration(undefined, ts.factory.createModifiersFromModifierFlags(privateProtected), [], undefined), signatures[0].declaration)];
44091                         }
44092                     }
44093                     var results = [];
44094                     for (var _a = 0, signatures_5 = signatures; _a < signatures_5.length; _a++) {
44095                         var sig = signatures_5[_a];
44096                         var decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
44097                         results.push(ts.setTextRange(decl, sig.declaration));
44098                     }
44099                     return results;
44100                 }
44101                 function serializeIndexSignatures(input, baseType) {
44102                     var results = [];
44103                     for (var _i = 0, _a = getIndexInfosOfType(input); _i < _a.length; _i++) {
44104                         var info = _a[_i];
44105                         if (baseType) {
44106                             var baseInfo = getIndexInfoOfType(baseType, info.keyType);
44107                             if (baseInfo) {
44108                                 if (isTypeIdenticalTo(info.type, baseInfo.type)) {
44109                                     continue;
44110                                 }
44111                             }
44112                         }
44113                         results.push(indexInfoToIndexSignatureDeclarationHelper(info, context, undefined));
44114                     }
44115                     return results;
44116                 }
44117                 function serializeBaseType(t, staticType, rootName) {
44118                     var ref = trySerializeAsTypeReference(t, 111551);
44119                     if (ref) {
44120                         return ref;
44121                     }
44122                     var tempName = getUnusedName("".concat(rootName, "_base"));
44123                     var statement = ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
44124                         ts.factory.createVariableDeclaration(tempName, undefined, typeToTypeNodeHelper(staticType, context))
44125                     ], 2));
44126                     addResult(statement, 0);
44127                     return ts.factory.createExpressionWithTypeArguments(ts.factory.createIdentifier(tempName), undefined);
44128                 }
44129                 function trySerializeAsTypeReference(t, flags) {
44130                     var typeArgs;
44131                     var reference;
44132                     if (t.target && isSymbolAccessibleByFlags(t.target.symbol, enclosingDeclaration, flags)) {
44133                         typeArgs = ts.map(getTypeArguments(t), function (t) { return typeToTypeNodeHelper(t, context); });
44134                         reference = symbolToExpression(t.target.symbol, context, 788968);
44135                     }
44136                     else if (t.symbol && isSymbolAccessibleByFlags(t.symbol, enclosingDeclaration, flags)) {
44137                         reference = symbolToExpression(t.symbol, context, 788968);
44138                     }
44139                     if (reference) {
44140                         return ts.factory.createExpressionWithTypeArguments(reference, typeArgs);
44141                     }
44142                 }
44143                 function serializeImplementedType(t) {
44144                     var ref = trySerializeAsTypeReference(t, 788968);
44145                     if (ref) {
44146                         return ref;
44147                     }
44148                     if (t.symbol) {
44149                         return ts.factory.createExpressionWithTypeArguments(symbolToExpression(t.symbol, context, 788968), undefined);
44150                     }
44151                 }
44152                 function getUnusedName(input, symbol) {
44153                     var _a, _b;
44154                     var id = symbol ? getSymbolId(symbol) : undefined;
44155                     if (id) {
44156                         if (context.remappedSymbolNames.has(id)) {
44157                             return context.remappedSymbolNames.get(id);
44158                         }
44159                     }
44160                     if (symbol) {
44161                         input = getNameCandidateWorker(symbol, input);
44162                     }
44163                     var i = 0;
44164                     var original = input;
44165                     while ((_a = context.usedSymbolNames) === null || _a === void 0 ? void 0 : _a.has(input)) {
44166                         i++;
44167                         input = "".concat(original, "_").concat(i);
44168                     }
44169                     (_b = context.usedSymbolNames) === null || _b === void 0 ? void 0 : _b.add(input);
44170                     if (id) {
44171                         context.remappedSymbolNames.set(id, input);
44172                     }
44173                     return input;
44174                 }
44175                 function getNameCandidateWorker(symbol, localName) {
44176                     if (localName === "default" || localName === "__class" || localName === "__function") {
44177                         var flags = context.flags;
44178                         context.flags |= 16777216;
44179                         var nameCandidate = getNameOfSymbolAsWritten(symbol, context);
44180                         context.flags = flags;
44181                         localName = nameCandidate.length > 0 && ts.isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? ts.stripQuotes(nameCandidate) : nameCandidate;
44182                     }
44183                     if (localName === "default") {
44184                         localName = "_default";
44185                     }
44186                     else if (localName === "export=") {
44187                         localName = "_exports";
44188                     }
44189                     localName = ts.isIdentifierText(localName, languageVersion) && !ts.isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
44190                     return localName;
44191                 }
44192                 function getInternalSymbolName(symbol, localName) {
44193                     var id = getSymbolId(symbol);
44194                     if (context.remappedSymbolNames.has(id)) {
44195                         return context.remappedSymbolNames.get(id);
44196                     }
44197                     localName = getNameCandidateWorker(symbol, localName);
44198                     context.remappedSymbolNames.set(id, localName);
44199                     return localName;
44200                 }
44201             }
44202         }
44203         function typePredicateToString(typePredicate, enclosingDeclaration, flags, writer) {
44204             if (flags === void 0) { flags = 16384; }
44205             return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker);
44206             function typePredicateToStringWorker(writer) {
44207                 var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 || typePredicate.kind === 3 ? ts.factory.createToken(128) : undefined, typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512));
44208                 var printer = ts.createPrinter({ removeComments: true });
44209                 var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration);
44210                 printer.writeNode(4, predicate, sourceFile, writer);
44211                 return writer;
44212             }
44213         }
44214         function formatUnionTypes(types) {
44215             var result = [];
44216             var flags = 0;
44217             for (var i = 0; i < types.length; i++) {
44218                 var t = types[i];
44219                 flags |= t.flags;
44220                 if (!(t.flags & 98304)) {
44221                     if (t.flags & (512 | 1024)) {
44222                         var baseType = t.flags & 512 ? booleanType : getBaseTypeOfEnumLiteralType(t);
44223                         if (baseType.flags & 1048576) {
44224                             var count = baseType.types.length;
44225                             if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
44226                                 result.push(baseType);
44227                                 i += count - 1;
44228                                 continue;
44229                             }
44230                         }
44231                     }
44232                     result.push(t);
44233                 }
44234             }
44235             if (flags & 65536)
44236                 result.push(nullType);
44237             if (flags & 32768)
44238                 result.push(undefinedType);
44239             return result || types;
44240         }
44241         function visibilityToString(flags) {
44242             if (flags === 8) {
44243                 return "private";
44244             }
44245             if (flags === 16) {
44246                 return "protected";
44247             }
44248             return "public";
44249         }
44250         function getTypeAliasForTypeLiteral(type) {
44251             if (type.symbol && type.symbol.flags & 2048 && type.symbol.declarations) {
44252                 var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent);
44253                 if (node.kind === 258) {
44254                     return getSymbolOfNode(node);
44255                 }
44256             }
44257             return undefined;
44258         }
44259         function isTopLevelInExternalModuleAugmentation(node) {
44260             return node && node.parent &&
44261                 node.parent.kind === 261 &&
44262                 ts.isExternalModuleAugmentation(node.parent.parent);
44263         }
44264         function isDefaultBindingContext(location) {
44265             return location.kind === 303 || ts.isAmbientModule(location);
44266         }
44267         function getNameOfSymbolFromNameType(symbol, context) {
44268             var nameType = getSymbolLinks(symbol).nameType;
44269             if (nameType) {
44270                 if (nameType.flags & 384) {
44271                     var name = "" + nameType.value;
44272                     if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
44273                         return "\"".concat(ts.escapeString(name, 34), "\"");
44274                     }
44275                     if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
44276                         return "[".concat(name, "]");
44277                     }
44278                     return name;
44279                 }
44280                 if (nameType.flags & 8192) {
44281                     return "[".concat(getNameOfSymbolAsWritten(nameType.symbol, context), "]");
44282                 }
44283             }
44284         }
44285         function getNameOfSymbolAsWritten(symbol, context) {
44286             if (context && symbol.escapedName === "default" && !(context.flags & 16384) &&
44287                 (!(context.flags & 16777216) ||
44288                     !symbol.declarations ||
44289                     (context.enclosingDeclaration && ts.findAncestor(symbol.declarations[0], isDefaultBindingContext) !== ts.findAncestor(context.enclosingDeclaration, isDefaultBindingContext)))) {
44290                 return "default";
44291             }
44292             if (symbol.declarations && symbol.declarations.length) {
44293                 var declaration = ts.firstDefined(symbol.declarations, function (d) { return ts.getNameOfDeclaration(d) ? d : undefined; });
44294                 var name_3 = declaration && ts.getNameOfDeclaration(declaration);
44295                 if (declaration && name_3) {
44296                     if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
44297                         return ts.symbolName(symbol);
44298                     }
44299                     if (ts.isComputedPropertyName(name_3) && !(ts.getCheckFlags(symbol) & 4096)) {
44300                         var nameType = getSymbolLinks(symbol).nameType;
44301                         if (nameType && nameType.flags & 384) {
44302                             var result = getNameOfSymbolFromNameType(symbol, context);
44303                             if (result !== undefined) {
44304                                 return result;
44305                             }
44306                         }
44307                     }
44308                     return ts.declarationNameToString(name_3);
44309                 }
44310                 if (!declaration) {
44311                     declaration = symbol.declarations[0];
44312                 }
44313                 if (declaration.parent && declaration.parent.kind === 253) {
44314                     return ts.declarationNameToString(declaration.parent.name);
44315                 }
44316                 switch (declaration.kind) {
44317                     case 225:
44318                     case 212:
44319                     case 213:
44320                         if (context && !context.encounteredError && !(context.flags & 131072)) {
44321                             context.encounteredError = true;
44322                         }
44323                         return declaration.kind === 225 ? "(Anonymous class)" : "(Anonymous function)";
44324                 }
44325             }
44326             var name = getNameOfSymbolFromNameType(symbol, context);
44327             return name !== undefined ? name : ts.symbolName(symbol);
44328         }
44329         function isDeclarationVisible(node) {
44330             if (node) {
44331                 var links = getNodeLinks(node);
44332                 if (links.isVisible === undefined) {
44333                     links.isVisible = !!determineIfDeclarationIsVisible();
44334                 }
44335                 return links.isVisible;
44336             }
44337             return false;
44338             function determineIfDeclarationIsVisible() {
44339                 switch (node.kind) {
44340                     case 336:
44341                     case 343:
44342                     case 337:
44343                         return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
44344                     case 202:
44345                         return isDeclarationVisible(node.parent.parent);
44346                     case 253:
44347                         if (ts.isBindingPattern(node.name) &&
44348                             !node.name.elements.length) {
44349                             return false;
44350                         }
44351                     case 260:
44352                     case 256:
44353                     case 257:
44354                     case 258:
44355                     case 255:
44356                     case 259:
44357                     case 264:
44358                         if (ts.isExternalModuleAugmentation(node)) {
44359                             return true;
44360                         }
44361                         var parent = getDeclarationContainer(node);
44362                         if (!(ts.getCombinedModifierFlags(node) & 1) &&
44363                             !(node.kind !== 264 && parent.kind !== 303 && parent.flags & 8388608)) {
44364                             return isGlobalSourceFile(parent);
44365                         }
44366                         return isDeclarationVisible(parent);
44367                     case 166:
44368                     case 165:
44369                     case 171:
44370                     case 172:
44371                     case 168:
44372                     case 167:
44373                         if (ts.hasEffectiveModifier(node, 8 | 16)) {
44374                             return false;
44375                         }
44376                     case 170:
44377                     case 174:
44378                     case 173:
44379                     case 175:
44380                     case 163:
44381                     case 261:
44382                     case 178:
44383                     case 179:
44384                     case 181:
44385                     case 177:
44386                     case 182:
44387                     case 183:
44388                     case 186:
44389                     case 187:
44390                     case 190:
44391                     case 196:
44392                         return isDeclarationVisible(node.parent);
44393                     case 266:
44394                     case 267:
44395                     case 269:
44396                         return false;
44397                     case 162:
44398                     case 303:
44399                     case 263:
44400                         return true;
44401                     case 270:
44402                         return false;
44403                     default:
44404                         return false;
44405                 }
44406             }
44407         }
44408         function collectLinkedAliases(node, setVisibility) {
44409             var exportSymbol;
44410             if (node.parent && node.parent.kind === 270) {
44411                 exportSymbol = resolveName(node, node.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, node, false);
44412             }
44413             else if (node.parent.kind === 274) {
44414                 exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 | 788968 | 1920 | 2097152);
44415             }
44416             var result;
44417             var visited;
44418             if (exportSymbol) {
44419                 visited = new ts.Set();
44420                 visited.add(getSymbolId(exportSymbol));
44421                 buildVisibleNodeList(exportSymbol.declarations);
44422             }
44423             return result;
44424             function buildVisibleNodeList(declarations) {
44425                 ts.forEach(declarations, function (declaration) {
44426                     var resultNode = getAnyImportSyntax(declaration) || declaration;
44427                     if (setVisibility) {
44428                         getNodeLinks(declaration).isVisible = true;
44429                     }
44430                     else {
44431                         result = result || [];
44432                         ts.pushIfUnique(result, resultNode);
44433                     }
44434                     if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {
44435                         var internalModuleReference = declaration.moduleReference;
44436                         var firstIdentifier = ts.getFirstIdentifier(internalModuleReference);
44437                         var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 | 788968 | 1920, undefined, undefined, false);
44438                         if (importSymbol && visited) {
44439                             if (ts.tryAddToSet(visited, getSymbolId(importSymbol))) {
44440                                 buildVisibleNodeList(importSymbol.declarations);
44441                             }
44442                         }
44443                     }
44444                 });
44445             }
44446         }
44447         function pushTypeResolution(target, propertyName) {
44448             var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName);
44449             if (resolutionCycleStartIndex >= 0) {
44450                 var length_3 = resolutionTargets.length;
44451                 for (var i = resolutionCycleStartIndex; i < length_3; i++) {
44452                     resolutionResults[i] = false;
44453                 }
44454                 return false;
44455             }
44456             resolutionTargets.push(target);
44457             resolutionResults.push(true);
44458             resolutionPropertyNames.push(propertyName);
44459             return true;
44460         }
44461         function findResolutionCycleStartIndex(target, propertyName) {
44462             for (var i = resolutionTargets.length - 1; i >= 0; i--) {
44463                 if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) {
44464                     return -1;
44465                 }
44466                 if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
44467                     return i;
44468                 }
44469             }
44470             return -1;
44471         }
44472         function hasType(target, propertyName) {
44473             switch (propertyName) {
44474                 case 0:
44475                     return !!getSymbolLinks(target).type;
44476                 case 5:
44477                     return !!(getNodeLinks(target).resolvedEnumType);
44478                 case 2:
44479                     return !!getSymbolLinks(target).declaredType;
44480                 case 1:
44481                     return !!target.resolvedBaseConstructorType;
44482                 case 3:
44483                     return !!target.resolvedReturnType;
44484                 case 4:
44485                     return !!target.immediateBaseConstraint;
44486                 case 6:
44487                     return !!target.resolvedTypeArguments;
44488                 case 7:
44489                     return !!target.baseTypesResolved;
44490             }
44491             return ts.Debug.assertNever(propertyName);
44492         }
44493         function popTypeResolution() {
44494             resolutionTargets.pop();
44495             resolutionPropertyNames.pop();
44496             return resolutionResults.pop();
44497         }
44498         function getDeclarationContainer(node) {
44499             return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
44500                 switch (node.kind) {
44501                     case 253:
44502                     case 254:
44503                     case 269:
44504                     case 268:
44505                     case 267:
44506                     case 266:
44507                         return false;
44508                     default:
44509                         return true;
44510                 }
44511             }).parent;
44512         }
44513         function getTypeOfPrototypeProperty(prototype) {
44514             var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
44515             return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType;
44516         }
44517         function getTypeOfPropertyOfType(type, name) {
44518             var prop = getPropertyOfType(type, name);
44519             return prop ? getTypeOfSymbol(prop) : undefined;
44520         }
44521         function getTypeOfPropertyOrIndexSignature(type, name) {
44522             var _a;
44523             return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) === null || _a === void 0 ? void 0 : _a.type) || unknownType;
44524         }
44525         function isTypeAny(type) {
44526             return type && (type.flags & 1) !== 0;
44527         }
44528         function isErrorType(type) {
44529             return type === errorType || !!(type.flags & 1 && type.aliasSymbol);
44530         }
44531         function getTypeForBindingElementParent(node) {
44532             var symbol = getSymbolOfNode(node);
44533             return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
44534         }
44535         function getRestType(source, properties, symbol) {
44536             source = filterType(source, function (t) { return !(t.flags & 98304); });
44537             if (source.flags & 131072) {
44538                 return emptyObjectType;
44539             }
44540             if (source.flags & 1048576) {
44541                 return mapType(source, function (t) { return getRestType(t, properties, symbol); });
44542             }
44543             var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
44544             if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
44545                 if (omitKeyType.flags & 131072) {
44546                     return source;
44547                 }
44548                 var omitTypeAlias = getGlobalOmitSymbol();
44549                 if (!omitTypeAlias) {
44550                     return errorType;
44551                 }
44552                 return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
44553             }
44554             var members = ts.createSymbolTable();
44555             for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
44556                 var prop = _a[_i];
44557                 if (!isTypeAssignableTo(getLiteralTypeFromProperty(prop, 8576), omitKeyType)
44558                     && !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))
44559                     && isSpreadableProperty(prop)) {
44560                     members.set(prop.escapedName, getSpreadSymbol(prop, false));
44561                 }
44562             }
44563             var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
44564             result.objectFlags |= 8388608;
44565             return result;
44566         }
44567         function isGenericTypeWithUndefinedConstraint(type) {
44568             return !!(type.flags & 465829888) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768);
44569         }
44570         function getNonUndefinedType(type) {
44571             var typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
44572             return getTypeWithFacts(typeOrConstraint, 524288);
44573         }
44574         function getFlowTypeOfDestructuring(node, declaredType) {
44575             var reference = getSyntheticElementAccess(node);
44576             return reference ? getFlowTypeOfReference(reference, declaredType) : declaredType;
44577         }
44578         function getSyntheticElementAccess(node) {
44579             var parentAccess = getParentElementAccess(node);
44580             if (parentAccess && parentAccess.flowNode) {
44581                 var propName = getDestructuringPropertyName(node);
44582                 if (propName) {
44583                     var literal = ts.setTextRange(ts.parseNodeFactory.createStringLiteral(propName), node);
44584                     var lhsExpr = ts.isLeftHandSideExpression(parentAccess) ? parentAccess : ts.parseNodeFactory.createParenthesizedExpression(parentAccess);
44585                     var result = ts.setTextRange(ts.parseNodeFactory.createElementAccessExpression(lhsExpr, literal), node);
44586                     ts.setParent(literal, result);
44587                     ts.setParent(result, node);
44588                     if (lhsExpr !== parentAccess) {
44589                         ts.setParent(lhsExpr, result);
44590                     }
44591                     result.flowNode = parentAccess.flowNode;
44592                     return result;
44593                 }
44594             }
44595         }
44596         function getParentElementAccess(node) {
44597             var ancestor = node.parent.parent;
44598             switch (ancestor.kind) {
44599                 case 202:
44600                 case 294:
44601                     return getSyntheticElementAccess(ancestor);
44602                 case 203:
44603                     return getSyntheticElementAccess(node.parent);
44604                 case 253:
44605                     return ancestor.initializer;
44606                 case 220:
44607                     return ancestor.right;
44608             }
44609         }
44610         function getDestructuringPropertyName(node) {
44611             var parent = node.parent;
44612             if (node.kind === 202 && parent.kind === 200) {
44613                 return getLiteralPropertyNameText(node.propertyName || node.name);
44614             }
44615             if (node.kind === 294 || node.kind === 295) {
44616                 return getLiteralPropertyNameText(node.name);
44617             }
44618             return "" + parent.elements.indexOf(node);
44619         }
44620         function getLiteralPropertyNameText(name) {
44621             var type = getLiteralTypeFromPropertyName(name);
44622             return type.flags & (128 | 256) ? "" + type.value : undefined;
44623         }
44624         function getTypeForBindingElement(declaration) {
44625             var pattern = declaration.parent;
44626             var parentType = getTypeForBindingElementParent(pattern.parent);
44627             if (!parentType || isTypeAny(parentType)) {
44628                 return parentType;
44629             }
44630             if (strictNullChecks && declaration.flags & 8388608 && ts.isParameterDeclaration(declaration)) {
44631                 parentType = getNonNullableType(parentType);
44632             }
44633             else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536)) {
44634                 parentType = getTypeWithFacts(parentType, 524288);
44635             }
44636             var type;
44637             if (pattern.kind === 200) {
44638                 if (declaration.dotDotDotToken) {
44639                     parentType = getReducedType(parentType);
44640                     if (parentType.flags & 2 || !isValidSpreadType(parentType)) {
44641                         error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
44642                         return errorType;
44643                     }
44644                     var literalMembers = [];
44645                     for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
44646                         var element = _a[_i];
44647                         if (!element.dotDotDotToken) {
44648                             literalMembers.push(element.propertyName || element.name);
44649                         }
44650                     }
44651                     type = getRestType(parentType, literalMembers, declaration.symbol);
44652                 }
44653                 else {
44654                     var name = declaration.propertyName || declaration.name;
44655                     var indexType = getLiteralTypeFromPropertyName(name);
44656                     var declaredType = getIndexedAccessType(parentType, indexType, 32, name);
44657                     type = getFlowTypeOfDestructuring(declaration, declaredType);
44658                 }
44659             }
44660             else {
44661                 var elementType = checkIteratedTypeOrElementType(65 | (declaration.dotDotDotToken ? 0 : 128), parentType, undefinedType, pattern);
44662                 var index_2 = pattern.elements.indexOf(declaration);
44663                 if (declaration.dotDotDotToken) {
44664                     type = everyType(parentType, isTupleType) ?
44665                         mapType(parentType, function (t) { return sliceTupleType(t, index_2); }) :
44666                         createArrayType(elementType);
44667                 }
44668                 else if (isArrayLikeType(parentType)) {
44669                     var indexType = getNumberLiteralType(index_2);
44670                     var accessFlags = 32 | (hasDefaultValue(declaration) ? 16 : 0);
44671                     var declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
44672                     type = getFlowTypeOfDestructuring(declaration, declaredType);
44673                 }
44674                 else {
44675                     type = elementType;
44676                 }
44677             }
44678             if (!declaration.initializer) {
44679                 return type;
44680             }
44681             if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
44682                 return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768) ? getNonUndefinedType(type) : type;
44683             }
44684             return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2));
44685         }
44686         function getTypeForDeclarationFromJSDocComment(declaration) {
44687             var jsdocType = ts.getJSDocType(declaration);
44688             if (jsdocType) {
44689                 return getTypeFromTypeNode(jsdocType);
44690             }
44691             return undefined;
44692         }
44693         function isNullOrUndefined(node) {
44694             var expr = ts.skipParentheses(node, true);
44695             return expr.kind === 104 || expr.kind === 79 && getResolvedSymbol(expr) === undefinedSymbol;
44696         }
44697         function isEmptyArrayLiteral(node) {
44698             var expr = ts.skipParentheses(node, true);
44699             return expr.kind === 203 && expr.elements.length === 0;
44700         }
44701         function addOptionality(type, isProperty, isOptional) {
44702             if (isProperty === void 0) { isProperty = false; }
44703             if (isOptional === void 0) { isOptional = true; }
44704             return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
44705         }
44706         function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
44707             if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242) {
44708                 var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
44709                 return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType;
44710             }
44711             if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) {
44712                 var forOfStatement = declaration.parent.parent;
44713                 return checkRightHandSideOfForOf(forOfStatement) || anyType;
44714             }
44715             if (ts.isBindingPattern(declaration.parent)) {
44716                 return getTypeForBindingElement(declaration);
44717             }
44718             var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration);
44719             var isOptional = includeOptionality && (isProperty && !!declaration.questionToken ||
44720                 ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) ||
44721                 isOptionalJSDocPropertyLikeTag(declaration));
44722             var declaredType = tryGetTypeFromEffectiveTypeNode(declaration);
44723             if (declaredType) {
44724                 return addOptionality(declaredType, isProperty, isOptional);
44725             }
44726             if ((noImplicitAny || ts.isInJSFile(declaration)) &&
44727                 ts.isVariableDeclaration(declaration) && !ts.isBindingPattern(declaration.name) &&
44728                 !(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 8388608)) {
44729                 if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
44730                     return autoType;
44731                 }
44732                 if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) {
44733                     return autoArrayType;
44734                 }
44735             }
44736             if (ts.isParameter(declaration)) {
44737                 var func = declaration.parent;
44738                 if (func.kind === 172 && hasBindableName(func)) {
44739                     var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 171);
44740                     if (getter) {
44741                         var getterSignature = getSignatureFromDeclaration(getter);
44742                         var thisParameter = getAccessorThisParameter(func);
44743                         if (thisParameter && declaration === thisParameter) {
44744                             ts.Debug.assert(!thisParameter.type);
44745                             return getTypeOfSymbol(getterSignature.thisParameter);
44746                         }
44747                         return getReturnTypeOfSignature(getterSignature);
44748                     }
44749                 }
44750                 if (ts.isInJSFile(declaration)) {
44751                     var typeTag = ts.getJSDocType(func);
44752                     if (typeTag && ts.isFunctionTypeNode(typeTag)) {
44753                         var signature = getSignatureFromDeclaration(typeTag);
44754                         var pos = func.parameters.indexOf(declaration);
44755                         return declaration.dotDotDotToken ? getRestTypeAtPosition(signature, pos) : getTypeAtPosition(signature, pos);
44756                     }
44757                 }
44758                 var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
44759                 if (type) {
44760                     return addOptionality(type, false, isOptional);
44761                 }
44762             }
44763             if (ts.hasOnlyExpressionInitializer(declaration) && !!declaration.initializer) {
44764                 if (ts.isInJSFile(declaration) && !ts.isParameter(declaration)) {
44765                     var containerObjectType = getJSContainerObjectType(declaration, getSymbolOfNode(declaration), ts.getDeclaredExpandoInitializer(declaration));
44766                     if (containerObjectType) {
44767                         return containerObjectType;
44768                     }
44769                 }
44770                 var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
44771                 return addOptionality(type, isProperty, isOptional);
44772             }
44773             if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
44774                 if (!ts.hasStaticModifier(declaration)) {
44775                     var constructor = findConstructorDeclaration(declaration.parent);
44776                     var type = constructor ? getFlowTypeInConstructor(declaration.symbol, constructor) :
44777                         ts.getEffectiveModifierFlags(declaration) & 2 ? getTypeOfPropertyInBaseClass(declaration.symbol) :
44778                             undefined;
44779                     return type && addOptionality(type, true, isOptional);
44780                 }
44781                 else {
44782                     var staticBlocks = ts.filter(declaration.parent.members, ts.isClassStaticBlockDeclaration);
44783                     var type = staticBlocks.length ? getFlowTypeInStaticBlocks(declaration.symbol, staticBlocks) :
44784                         ts.getEffectiveModifierFlags(declaration) & 2 ? getTypeOfPropertyInBaseClass(declaration.symbol) :
44785                             undefined;
44786                     return type && addOptionality(type, true, isOptional);
44787                 }
44788             }
44789             if (ts.isJsxAttribute(declaration)) {
44790                 return trueType;
44791             }
44792             if (ts.isBindingPattern(declaration.name)) {
44793                 return getTypeFromBindingPattern(declaration.name, false, true);
44794             }
44795             return undefined;
44796         }
44797         function isConstructorDeclaredProperty(symbol) {
44798             if (symbol.valueDeclaration && ts.isBinaryExpression(symbol.valueDeclaration)) {
44799                 var links = getSymbolLinks(symbol);
44800                 if (links.isConstructorDeclaredProperty === undefined) {
44801                     links.isConstructorDeclaredProperty = false;
44802                     links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) {
44803                         return ts.isBinaryExpression(declaration) &&
44804                             isPossiblyAliasedThisProperty(declaration) &&
44805                             (declaration.left.kind !== 206 || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) &&
44806                             !getAnnotatedTypeForAssignmentDeclaration(undefined, declaration, symbol, declaration);
44807                     });
44808                 }
44809                 return links.isConstructorDeclaredProperty;
44810             }
44811             return false;
44812         }
44813         function isAutoTypedProperty(symbol) {
44814             var declaration = symbol.valueDeclaration;
44815             return declaration && ts.isPropertyDeclaration(declaration) && !ts.getEffectiveTypeAnnotationNode(declaration) &&
44816                 !declaration.initializer && (noImplicitAny || ts.isInJSFile(declaration));
44817         }
44818         function getDeclaringConstructor(symbol) {
44819             if (!symbol.declarations) {
44820                 return;
44821             }
44822             for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
44823                 var declaration = _a[_i];
44824                 var container = ts.getThisContainer(declaration, false);
44825                 if (container && (container.kind === 170 || isJSConstructor(container))) {
44826                     return container;
44827                 }
44828             }
44829             ;
44830         }
44831         function getFlowTypeFromCommonJSExport(symbol) {
44832             var file = ts.getSourceFileOfNode(symbol.declarations[0]);
44833             var accessName = ts.unescapeLeadingUnderscores(symbol.escapedName);
44834             var areAllModuleExports = symbol.declarations.every(function (d) { return ts.isInJSFile(d) && ts.isAccessExpression(d) && ts.isModuleExportsAccessExpression(d.expression); });
44835             var reference = areAllModuleExports
44836                 ? ts.factory.createPropertyAccessExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("module"), ts.factory.createIdentifier("exports")), accessName)
44837                 : ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("exports"), accessName);
44838             if (areAllModuleExports) {
44839                 ts.setParent(reference.expression.expression, reference.expression);
44840             }
44841             ts.setParent(reference.expression, reference);
44842             ts.setParent(reference, file);
44843             reference.flowNode = file.endFlowNode;
44844             return getFlowTypeOfReference(reference, autoType, undefinedType);
44845         }
44846         function getFlowTypeInStaticBlocks(symbol, staticBlocks) {
44847             var accessName = ts.startsWith(symbol.escapedName, "__#")
44848                 ? ts.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1])
44849                 : ts.unescapeLeadingUnderscores(symbol.escapedName);
44850             for (var _i = 0, staticBlocks_1 = staticBlocks; _i < staticBlocks_1.length; _i++) {
44851                 var staticBlock = staticBlocks_1[_i];
44852                 var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), accessName);
44853                 ts.setParent(reference.expression, reference);
44854                 ts.setParent(reference, staticBlock);
44855                 reference.flowNode = staticBlock.returnFlowNode;
44856                 var flowType = getFlowTypeOfProperty(reference, symbol);
44857                 if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
44858                     error(symbol.valueDeclaration, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
44859                 }
44860                 if (everyType(flowType, isNullableType)) {
44861                     continue;
44862                 }
44863                 return convertAutoToAny(flowType);
44864             }
44865         }
44866         function getFlowTypeInConstructor(symbol, constructor) {
44867             var accessName = ts.startsWith(symbol.escapedName, "__#")
44868                 ? ts.factory.createPrivateIdentifier(symbol.escapedName.split("@")[1])
44869                 : ts.unescapeLeadingUnderscores(symbol.escapedName);
44870             var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), accessName);
44871             ts.setParent(reference.expression, reference);
44872             ts.setParent(reference, constructor);
44873             reference.flowNode = constructor.returnFlowNode;
44874             var flowType = getFlowTypeOfProperty(reference, symbol);
44875             if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) {
44876                 error(symbol.valueDeclaration, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
44877             }
44878             return everyType(flowType, isNullableType) ? undefined : convertAutoToAny(flowType);
44879         }
44880         function getFlowTypeOfProperty(reference, prop) {
44881             var initialType = (prop === null || prop === void 0 ? void 0 : prop.valueDeclaration)
44882                 && (!isAutoTypedProperty(prop) || ts.getEffectiveModifierFlags(prop.valueDeclaration) & 2)
44883                 && getTypeOfPropertyInBaseClass(prop)
44884                 || undefinedType;
44885             return getFlowTypeOfReference(reference, autoType, initialType);
44886         }
44887         function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
44888             var container = ts.getAssignedExpandoInitializer(symbol.valueDeclaration);
44889             if (container) {
44890                 var tag = ts.getJSDocTypeTag(container);
44891                 if (tag && tag.typeExpression) {
44892                     return getTypeFromTypeNode(tag.typeExpression);
44893                 }
44894                 var containerObjectType = symbol.valueDeclaration && getJSContainerObjectType(symbol.valueDeclaration, symbol, container);
44895                 return containerObjectType || getWidenedLiteralType(checkExpressionCached(container));
44896             }
44897             var type;
44898             var definedInConstructor = false;
44899             var definedInMethod = false;
44900             if (isConstructorDeclaredProperty(symbol)) {
44901                 type = getFlowTypeInConstructor(symbol, getDeclaringConstructor(symbol));
44902             }
44903             if (!type) {
44904                 var types = void 0;
44905                 if (symbol.declarations) {
44906                     var jsdocType = void 0;
44907                     for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
44908                         var declaration = _a[_i];
44909                         var expression = (ts.isBinaryExpression(declaration) || ts.isCallExpression(declaration)) ? declaration :
44910                             ts.isAccessExpression(declaration) ? ts.isBinaryExpression(declaration.parent) ? declaration.parent : declaration :
44911                                 undefined;
44912                         if (!expression) {
44913                             continue;
44914                         }
44915                         var kind = ts.isAccessExpression(expression)
44916                             ? ts.getAssignmentDeclarationPropertyAccessKind(expression)
44917                             : ts.getAssignmentDeclarationKind(expression);
44918                         if (kind === 4 || ts.isBinaryExpression(expression) && isPossiblyAliasedThisProperty(expression, kind)) {
44919                             if (isDeclarationInConstructor(expression)) {
44920                                 definedInConstructor = true;
44921                             }
44922                             else {
44923                                 definedInMethod = true;
44924                             }
44925                         }
44926                         if (!ts.isCallExpression(expression)) {
44927                             jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
44928                         }
44929                         if (!jsdocType) {
44930                             (types || (types = [])).push((ts.isBinaryExpression(expression) || ts.isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
44931                         }
44932                     }
44933                     type = jsdocType;
44934                 }
44935                 if (!type) {
44936                     if (!ts.length(types)) {
44937                         return errorType;
44938                     }
44939                     var constructorTypes = definedInConstructor && symbol.declarations ? getConstructorDefinedThisAssignmentTypes(types, symbol.declarations) : undefined;
44940                     if (definedInMethod) {
44941                         var propType = getTypeOfPropertyInBaseClass(symbol);
44942                         if (propType) {
44943                             (constructorTypes || (constructorTypes = [])).push(propType);
44944                             definedInConstructor = true;
44945                         }
44946                     }
44947                     var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304); }) ? constructorTypes : types;
44948                     type = getUnionType(sourceTypes, 2);
44949                 }
44950             }
44951             var widened = getWidenedType(addOptionality(type, false, definedInMethod && !definedInConstructor));
44952             if (symbol.valueDeclaration && filterType(widened, function (t) { return !!(t.flags & ~98304); }) === neverType) {
44953                 reportImplicitAny(symbol.valueDeclaration, anyType);
44954                 return anyType;
44955             }
44956             return widened;
44957         }
44958         function getJSContainerObjectType(decl, symbol, init) {
44959             var _a, _b;
44960             if (!ts.isInJSFile(decl) || !init || !ts.isObjectLiteralExpression(init) || init.properties.length) {
44961                 return undefined;
44962             }
44963             var exports = ts.createSymbolTable();
44964             while (ts.isBinaryExpression(decl) || ts.isPropertyAccessExpression(decl)) {
44965                 var s_2 = getSymbolOfNode(decl);
44966                 if ((_a = s_2 === null || s_2 === void 0 ? void 0 : s_2.exports) === null || _a === void 0 ? void 0 : _a.size) {
44967                     mergeSymbolTable(exports, s_2.exports);
44968                 }
44969                 decl = ts.isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
44970             }
44971             var s = getSymbolOfNode(decl);
44972             if ((_b = s === null || s === void 0 ? void 0 : s.exports) === null || _b === void 0 ? void 0 : _b.size) {
44973                 mergeSymbolTable(exports, s.exports);
44974             }
44975             var type = createAnonymousType(symbol, exports, ts.emptyArray, ts.emptyArray, ts.emptyArray);
44976             type.objectFlags |= 8192;
44977             return type;
44978         }
44979         function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
44980             var _a;
44981             var typeNode = ts.getEffectiveTypeAnnotationNode(expression.parent);
44982             if (typeNode) {
44983                 var type = getWidenedType(getTypeFromTypeNode(typeNode));
44984                 if (!declaredType) {
44985                     return type;
44986                 }
44987                 else if (!isErrorType(declaredType) && !isErrorType(type) && !isTypeIdenticalTo(declaredType, type)) {
44988                     errorNextVariableOrPropertyDeclarationMustHaveSameType(undefined, declaredType, declaration, type);
44989                 }
44990             }
44991             if ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) {
44992                 var typeNode_2 = ts.getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration);
44993                 if (typeNode_2) {
44994                     var annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode_2), symbol.escapedName);
44995                     if (annotationSymbol) {
44996                         return getNonMissingTypeOfSymbol(annotationSymbol);
44997                     }
44998                 }
44999             }
45000             return declaredType;
45001         }
45002         function getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) {
45003             if (ts.isCallExpression(expression)) {
45004                 if (resolvedSymbol) {
45005                     return getTypeOfSymbol(resolvedSymbol);
45006                 }
45007                 var objectLitType = checkExpressionCached(expression.arguments[2]);
45008                 var valueType = getTypeOfPropertyOfType(objectLitType, "value");
45009                 if (valueType) {
45010                     return valueType;
45011                 }
45012                 var getFunc = getTypeOfPropertyOfType(objectLitType, "get");
45013                 if (getFunc) {
45014                     var getSig = getSingleCallSignature(getFunc);
45015                     if (getSig) {
45016                         return getReturnTypeOfSignature(getSig);
45017                     }
45018                 }
45019                 var setFunc = getTypeOfPropertyOfType(objectLitType, "set");
45020                 if (setFunc) {
45021                     var setSig = getSingleCallSignature(setFunc);
45022                     if (setSig) {
45023                         return getTypeOfFirstParameterOfSignature(setSig);
45024                     }
45025                 }
45026                 return anyType;
45027             }
45028             if (containsSameNamedThisProperty(expression.left, expression.right)) {
45029                 return anyType;
45030             }
45031             var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : getWidenedLiteralType(checkExpressionCached(expression.right));
45032             if (type.flags & 524288 &&
45033                 kind === 2 &&
45034                 symbol.escapedName === "export=") {
45035                 var exportedType = resolveStructuredTypeMembers(type);
45036                 var members_4 = ts.createSymbolTable();
45037                 ts.copyEntries(exportedType.members, members_4);
45038                 var initialSize = members_4.size;
45039                 if (resolvedSymbol && !resolvedSymbol.exports) {
45040                     resolvedSymbol.exports = ts.createSymbolTable();
45041                 }
45042                 (resolvedSymbol || symbol).exports.forEach(function (s, name) {
45043                     var _a;
45044                     var exportedMember = members_4.get(name);
45045                     if (exportedMember && exportedMember !== s) {
45046                         if (s.flags & 111551 && exportedMember.flags & 111551) {
45047                             if (s.valueDeclaration && exportedMember.valueDeclaration && ts.getSourceFileOfNode(s.valueDeclaration) !== ts.getSourceFileOfNode(exportedMember.valueDeclaration)) {
45048                                 var unescapedName = ts.unescapeLeadingUnderscores(s.escapedName);
45049                                 var exportedMemberName = ((_a = ts.tryCast(exportedMember.valueDeclaration, ts.isNamedDeclaration)) === null || _a === void 0 ? void 0 : _a.name) || exportedMember.valueDeclaration;
45050                                 ts.addRelatedInfo(error(s.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0, unescapedName), ts.createDiagnosticForNode(exportedMemberName, ts.Diagnostics._0_was_also_declared_here, unescapedName));
45051                                 ts.addRelatedInfo(error(exportedMemberName, ts.Diagnostics.Duplicate_identifier_0, unescapedName), ts.createDiagnosticForNode(s.valueDeclaration, ts.Diagnostics._0_was_also_declared_here, unescapedName));
45052                             }
45053                             var union = createSymbol(s.flags | exportedMember.flags, name);
45054                             union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
45055                             union.valueDeclaration = exportedMember.valueDeclaration;
45056                             union.declarations = ts.concatenate(exportedMember.declarations, s.declarations);
45057                             members_4.set(name, union);
45058                         }
45059                         else {
45060                             members_4.set(name, mergeSymbol(s, exportedMember));
45061                         }
45062                     }
45063                     else {
45064                         members_4.set(name, s);
45065                     }
45066                 });
45067                 var result = createAnonymousType(initialSize !== members_4.size ? undefined : exportedType.symbol, members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
45068                 result.objectFlags |= (ts.getObjectFlags(type) & 8192);
45069                 if (result.symbol && result.symbol.flags & 32 && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
45070                     result.objectFlags |= 16777216;
45071                 }
45072                 return result;
45073             }
45074             if (isEmptyArrayLiteralType(type)) {
45075                 reportImplicitAny(expression, anyArrayType);
45076                 return anyArrayType;
45077             }
45078             return type;
45079         }
45080         function containsSameNamedThisProperty(thisProperty, expression) {
45081             return ts.isPropertyAccessExpression(thisProperty)
45082                 && thisProperty.expression.kind === 108
45083                 && ts.forEachChildRecursively(expression, function (n) { return isMatchingReference(thisProperty, n); });
45084         }
45085         function isDeclarationInConstructor(expression) {
45086             var thisContainer = ts.getThisContainer(expression, false);
45087             return thisContainer.kind === 170 ||
45088                 thisContainer.kind === 255 ||
45089                 (thisContainer.kind === 212 && !ts.isPrototypePropertyAssignment(thisContainer.parent));
45090         }
45091         function getConstructorDefinedThisAssignmentTypes(types, declarations) {
45092             ts.Debug.assert(types.length === declarations.length);
45093             return types.filter(function (_, i) {
45094                 var declaration = declarations[i];
45095                 var expression = ts.isBinaryExpression(declaration) ? declaration :
45096                     ts.isBinaryExpression(declaration.parent) ? declaration.parent : undefined;
45097                 return expression && isDeclarationInConstructor(expression);
45098             });
45099         }
45100         function getTypeFromBindingElement(element, includePatternInType, reportErrors) {
45101             if (element.initializer) {
45102                 var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, true, false) : unknownType;
45103                 return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
45104             }
45105             if (ts.isBindingPattern(element.name)) {
45106                 return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
45107             }
45108             if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
45109                 reportImplicitAny(element, anyType);
45110             }
45111             return includePatternInType ? nonInferrableAnyType : anyType;
45112         }
45113         function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
45114             var members = ts.createSymbolTable();
45115             var stringIndexInfo;
45116             var objectFlags = 128 | 262144;
45117             ts.forEach(pattern.elements, function (e) {
45118                 var name = e.propertyName || e.name;
45119                 if (e.dotDotDotToken) {
45120                     stringIndexInfo = createIndexInfo(stringType, anyType, false);
45121                     return;
45122                 }
45123                 var exprType = getLiteralTypeFromPropertyName(name);
45124                 if (!isTypeUsableAsPropertyName(exprType)) {
45125                     objectFlags |= 512;
45126                     return;
45127                 }
45128                 var text = getPropertyNameFromType(exprType);
45129                 var flags = 4 | (e.initializer ? 16777216 : 0);
45130                 var symbol = createSymbol(flags, text);
45131                 symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors);
45132                 symbol.bindingElement = e;
45133                 members.set(symbol.escapedName, symbol);
45134             });
45135             var result = createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, stringIndexInfo ? [stringIndexInfo] : ts.emptyArray);
45136             result.objectFlags |= objectFlags;
45137             if (includePatternInType) {
45138                 result.pattern = pattern;
45139                 result.objectFlags |= 262144;
45140             }
45141             return result;
45142         }
45143         function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
45144             var elements = pattern.elements;
45145             var lastElement = ts.lastOrUndefined(elements);
45146             var restElement = lastElement && lastElement.kind === 202 && lastElement.dotDotDotToken ? lastElement : undefined;
45147             if (elements.length === 0 || elements.length === 1 && restElement) {
45148                 return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType;
45149             }
45150             var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); });
45151             var minLength = ts.findLastIndex(elements, function (e) { return !(e === restElement || ts.isOmittedExpression(e) || hasDefaultValue(e)); }, elements.length - 1) + 1;
45152             var elementFlags = ts.map(elements, function (e, i) { return e === restElement ? 4 : i >= minLength ? 2 : 1; });
45153             var result = createTupleType(elementTypes, elementFlags);
45154             if (includePatternInType) {
45155                 result = cloneTypeReference(result);
45156                 result.pattern = pattern;
45157                 result.objectFlags |= 262144;
45158             }
45159             return result;
45160         }
45161         function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
45162             if (includePatternInType === void 0) { includePatternInType = false; }
45163             if (reportErrors === void 0) { reportErrors = false; }
45164             return pattern.kind === 200
45165                 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
45166                 : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
45167         }
45168         function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
45169             return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, true), declaration, reportErrors);
45170         }
45171         function isGlobalSymbolConstructor(node) {
45172             var symbol = getSymbolOfNode(node);
45173             var globalSymbol = getGlobalESSymbolConstructorTypeSymbol(false);
45174             return globalSymbol && symbol && symbol === globalSymbol;
45175         }
45176         function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors) {
45177             if (type) {
45178                 if (type.flags & 4096 && isGlobalSymbolConstructor(declaration.parent)) {
45179                     type = getESSymbolLikeTypeForNode(declaration);
45180                 }
45181                 if (reportErrors) {
45182                     reportErrorsFromWidening(declaration, type);
45183                 }
45184                 if (type.flags & 8192 && (ts.isBindingElement(declaration) || !declaration.type) && type.symbol !== getSymbolOfNode(declaration)) {
45185                     type = esSymbolType;
45186                 }
45187                 return getWidenedType(type);
45188             }
45189             type = ts.isParameter(declaration) && declaration.dotDotDotToken ? anyArrayType : anyType;
45190             if (reportErrors) {
45191                 if (!declarationBelongsToPrivateAmbientMember(declaration)) {
45192                     reportImplicitAny(declaration, type);
45193                 }
45194             }
45195             return type;
45196         }
45197         function declarationBelongsToPrivateAmbientMember(declaration) {
45198             var root = ts.getRootDeclaration(declaration);
45199             var memberDeclaration = root.kind === 163 ? root.parent : root;
45200             return isPrivateWithinAmbient(memberDeclaration);
45201         }
45202         function tryGetTypeFromEffectiveTypeNode(declaration) {
45203             var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
45204             if (typeNode) {
45205                 return getTypeFromTypeNode(typeNode);
45206             }
45207         }
45208         function getTypeOfVariableOrParameterOrProperty(symbol) {
45209             var links = getSymbolLinks(symbol);
45210             if (!links.type) {
45211                 var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
45212                 if (!links.type) {
45213                     links.type = type;
45214                 }
45215             }
45216             return links.type;
45217         }
45218         function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
45219             if (symbol.flags & 4194304) {
45220                 return getTypeOfPrototypeProperty(symbol);
45221             }
45222             if (symbol === requireSymbol) {
45223                 return anyType;
45224             }
45225             if (symbol.flags & 134217728 && symbol.valueDeclaration) {
45226                 var fileSymbol = getSymbolOfNode(ts.getSourceFileOfNode(symbol.valueDeclaration));
45227                 var result = createSymbol(fileSymbol.flags, "exports");
45228                 result.declarations = fileSymbol.declarations ? fileSymbol.declarations.slice() : [];
45229                 result.parent = symbol;
45230                 result.target = fileSymbol;
45231                 if (fileSymbol.valueDeclaration)
45232                     result.valueDeclaration = fileSymbol.valueDeclaration;
45233                 if (fileSymbol.members)
45234                     result.members = new ts.Map(fileSymbol.members);
45235                 if (fileSymbol.exports)
45236                     result.exports = new ts.Map(fileSymbol.exports);
45237                 var members = ts.createSymbolTable();
45238                 members.set("exports", result);
45239                 return createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
45240             }
45241             ts.Debug.assertIsDefined(symbol.valueDeclaration);
45242             var declaration = symbol.valueDeclaration;
45243             if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
45244                 var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
45245                 if (typeNode === undefined) {
45246                     return useUnknownInCatchVariables ? unknownType : anyType;
45247                 }
45248                 var type_1 = getTypeOfNode(typeNode);
45249                 return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
45250             }
45251             if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
45252                 if (!declaration.statements.length) {
45253                     return emptyObjectType;
45254                 }
45255                 return getWidenedType(getWidenedLiteralType(checkExpression(declaration.statements[0].expression)));
45256             }
45257             if (!pushTypeResolution(symbol, 0)) {
45258                 if (symbol.flags & 512 && !(symbol.flags & 67108864)) {
45259                     return getTypeOfFuncClassEnumModule(symbol);
45260                 }
45261                 return reportCircularityError(symbol);
45262             }
45263             var type;
45264             if (declaration.kind === 270) {
45265                 type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration);
45266             }
45267             else if (ts.isBinaryExpression(declaration) ||
45268                 (ts.isInJSFile(declaration) &&
45269                     (ts.isCallExpression(declaration) || (ts.isPropertyAccessExpression(declaration) || ts.isBindableStaticElementAccessExpression(declaration)) && ts.isBinaryExpression(declaration.parent)))) {
45270                 type = getWidenedTypeForAssignmentDeclaration(symbol);
45271             }
45272             else if (ts.isPropertyAccessExpression(declaration)
45273                 || ts.isElementAccessExpression(declaration)
45274                 || ts.isIdentifier(declaration)
45275                 || ts.isStringLiteralLike(declaration)
45276                 || ts.isNumericLiteral(declaration)
45277                 || ts.isClassDeclaration(declaration)
45278                 || ts.isFunctionDeclaration(declaration)
45279                 || (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
45280                 || ts.isMethodSignature(declaration)
45281                 || ts.isSourceFile(declaration)) {
45282                 if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
45283                     return getTypeOfFuncClassEnumModule(symbol);
45284                 }
45285                 type = ts.isBinaryExpression(declaration.parent) ?
45286                     getWidenedTypeForAssignmentDeclaration(symbol) :
45287                     tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
45288             }
45289             else if (ts.isPropertyAssignment(declaration)) {
45290                 type = tryGetTypeFromEffectiveTypeNode(declaration) || checkPropertyAssignment(declaration);
45291             }
45292             else if (ts.isJsxAttribute(declaration)) {
45293                 type = tryGetTypeFromEffectiveTypeNode(declaration) || checkJsxAttribute(declaration);
45294             }
45295             else if (ts.isShorthandPropertyAssignment(declaration)) {
45296                 type = tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionForMutableLocation(declaration.name, 0);
45297             }
45298             else if (ts.isObjectLiteralMethod(declaration)) {
45299                 type = tryGetTypeFromEffectiveTypeNode(declaration) || checkObjectLiteralMethod(declaration, 0);
45300             }
45301             else if (ts.isParameter(declaration)
45302                 || ts.isPropertyDeclaration(declaration)
45303                 || ts.isPropertySignature(declaration)
45304                 || ts.isVariableDeclaration(declaration)
45305                 || ts.isBindingElement(declaration)
45306                 || ts.isJSDocPropertyLikeTag(declaration)) {
45307                 type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
45308             }
45309             else if (ts.isEnumDeclaration(declaration)) {
45310                 type = getTypeOfFuncClassEnumModule(symbol);
45311             }
45312             else if (ts.isEnumMember(declaration)) {
45313                 type = getTypeOfEnumMember(symbol);
45314             }
45315             else if (ts.isAccessor(declaration)) {
45316                 type = resolveTypeOfAccessors(symbol) || ts.Debug.fail("Non-write accessor resolution must always produce a type");
45317             }
45318             else {
45319                 return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
45320             }
45321             if (!popTypeResolution()) {
45322                 if (symbol.flags & 512 && !(symbol.flags & 67108864)) {
45323                     return getTypeOfFuncClassEnumModule(symbol);
45324                 }
45325                 return reportCircularityError(symbol);
45326             }
45327             return type;
45328         }
45329         function getAnnotatedAccessorTypeNode(accessor) {
45330             if (accessor) {
45331                 if (accessor.kind === 171) {
45332                     var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
45333                     return getterTypeAnnotation;
45334                 }
45335                 else {
45336                     var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor);
45337                     return setterTypeAnnotation;
45338                 }
45339             }
45340             return undefined;
45341         }
45342         function getAnnotatedAccessorType(accessor) {
45343             var node = getAnnotatedAccessorTypeNode(accessor);
45344             return node && getTypeFromTypeNode(node);
45345         }
45346         function getAnnotatedAccessorThisParameter(accessor) {
45347             var parameter = getAccessorThisParameter(accessor);
45348             return parameter && parameter.symbol;
45349         }
45350         function getThisTypeOfDeclaration(declaration) {
45351             return getThisTypeOfSignature(getSignatureFromDeclaration(declaration));
45352         }
45353         function getTypeOfAccessors(symbol) {
45354             var links = getSymbolLinks(symbol);
45355             return links.type || (links.type = getTypeOfAccessorsWorker(symbol) || ts.Debug.fail("Read type of accessor must always produce a type"));
45356         }
45357         function getTypeOfSetAccessor(symbol) {
45358             var links = getSymbolLinks(symbol);
45359             return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, true));
45360         }
45361         function getTypeOfAccessorsWorker(symbol, writing) {
45362             if (writing === void 0) { writing = false; }
45363             if (!pushTypeResolution(symbol, 0)) {
45364                 return errorType;
45365             }
45366             var type = resolveTypeOfAccessors(symbol, writing);
45367             if (!popTypeResolution()) {
45368                 type = anyType;
45369                 if (noImplicitAny) {
45370                     var getter = ts.getDeclarationOfKind(symbol, 171);
45371                     error(getter, 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));
45372                 }
45373             }
45374             return type;
45375         }
45376         function resolveTypeOfAccessors(symbol, writing) {
45377             if (writing === void 0) { writing = false; }
45378             var getter = ts.getDeclarationOfKind(symbol, 171);
45379             var setter = ts.getDeclarationOfKind(symbol, 172);
45380             var setterType = getAnnotatedAccessorType(setter);
45381             if (writing && setterType) {
45382                 return instantiateTypeIfNeeded(setterType, symbol);
45383             }
45384             if (getter && ts.isInJSFile(getter)) {
45385                 var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
45386                 if (jsDocType) {
45387                     return instantiateTypeIfNeeded(jsDocType, symbol);
45388                 }
45389             }
45390             var getterType = getAnnotatedAccessorType(getter);
45391             if (getterType) {
45392                 return instantiateTypeIfNeeded(getterType, symbol);
45393             }
45394             if (setterType) {
45395                 return setterType;
45396             }
45397             if (getter && getter.body) {
45398                 var returnTypeFromBody = getReturnTypeFromBody(getter);
45399                 return instantiateTypeIfNeeded(returnTypeFromBody, symbol);
45400             }
45401             if (setter) {
45402                 if (!isPrivateWithinAmbient(setter)) {
45403                     errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
45404                 }
45405                 return anyType;
45406             }
45407             else if (getter) {
45408                 ts.Debug.assert(!!getter, "there must exist a getter as we are current checking either setter or getter in this function");
45409                 if (!isPrivateWithinAmbient(getter)) {
45410                     errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
45411                 }
45412                 return anyType;
45413             }
45414             return undefined;
45415             function instantiateTypeIfNeeded(type, symbol) {
45416                 if (ts.getCheckFlags(symbol) & 1) {
45417                     var links = getSymbolLinks(symbol);
45418                     return instantiateType(type, links.mapper);
45419                 }
45420                 return type;
45421             }
45422         }
45423         function getBaseTypeVariableOfClass(symbol) {
45424             var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol));
45425             return baseConstructorType.flags & 8650752 ? baseConstructorType :
45426                 baseConstructorType.flags & 2097152 ? ts.find(baseConstructorType.types, function (t) { return !!(t.flags & 8650752); }) :
45427                     undefined;
45428         }
45429         function getTypeOfFuncClassEnumModule(symbol) {
45430             var links = getSymbolLinks(symbol);
45431             var originalLinks = links;
45432             if (!links.type) {
45433                 var expando = symbol.valueDeclaration && getSymbolOfExpando(symbol.valueDeclaration, false);
45434                 if (expando) {
45435                     var merged = mergeJSSymbols(symbol, expando);
45436                     if (merged) {
45437                         symbol = links = merged;
45438                     }
45439                 }
45440                 originalLinks.type = links.type = getTypeOfFuncClassEnumModuleWorker(symbol);
45441             }
45442             return links.type;
45443         }
45444         function getTypeOfFuncClassEnumModuleWorker(symbol) {
45445             var declaration = symbol.valueDeclaration;
45446             if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) {
45447                 return anyType;
45448             }
45449             else if (declaration && (declaration.kind === 220 ||
45450                 ts.isAccessExpression(declaration) &&
45451                     declaration.parent.kind === 220)) {
45452                 return getWidenedTypeForAssignmentDeclaration(symbol);
45453             }
45454             else if (symbol.flags & 512 && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
45455                 var resolvedModule = resolveExternalModuleSymbol(symbol);
45456                 if (resolvedModule !== symbol) {
45457                     if (!pushTypeResolution(symbol, 0)) {
45458                         return errorType;
45459                     }
45460                     var exportEquals = getMergedSymbol(symbol.exports.get("export="));
45461                     var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
45462                     if (!popTypeResolution()) {
45463                         return reportCircularityError(symbol);
45464                     }
45465                     return type_2;
45466                 }
45467             }
45468             var type = createObjectType(16, symbol);
45469             if (symbol.flags & 32) {
45470                 var baseTypeVariable = getBaseTypeVariableOfClass(symbol);
45471                 return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
45472             }
45473             else {
45474                 return strictNullChecks && symbol.flags & 16777216 ? getOptionalType(type) : type;
45475             }
45476         }
45477         function getTypeOfEnumMember(symbol) {
45478             var links = getSymbolLinks(symbol);
45479             return links.type || (links.type = getDeclaredTypeOfEnumMember(symbol));
45480         }
45481         function getTypeOfAlias(symbol) {
45482             var links = getSymbolLinks(symbol);
45483             if (!links.type) {
45484                 var targetSymbol = resolveAlias(symbol);
45485                 var exportSymbol = symbol.declarations && getTargetOfAliasDeclaration(getDeclarationOfAliasSymbol(symbol), true);
45486                 var declaredType = ts.firstDefined(exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations, function (d) { return ts.isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : undefined; });
45487                 links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
45488                     : isDuplicatedCommonJSExport(symbol.declarations) ? autoType
45489                         : declaredType ? declaredType
45490                             : targetSymbol.flags & 111551 ? getTypeOfSymbol(targetSymbol)
45491                                 : errorType;
45492             }
45493             return links.type;
45494         }
45495         function getTypeOfInstantiatedSymbol(symbol) {
45496             var links = getSymbolLinks(symbol);
45497             if (!links.type) {
45498                 if (!pushTypeResolution(symbol, 0)) {
45499                     return links.type = errorType;
45500                 }
45501                 var type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
45502                 if (!popTypeResolution()) {
45503                     type = reportCircularityError(symbol);
45504                 }
45505                 links.type = type;
45506             }
45507             return links.type;
45508         }
45509         function reportCircularityError(symbol) {
45510             var declaration = symbol.valueDeclaration;
45511             if (ts.getEffectiveTypeAnnotationNode(declaration)) {
45512                 error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
45513                 return errorType;
45514             }
45515             if (noImplicitAny && (declaration.kind !== 163 || declaration.initializer)) {
45516                 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));
45517             }
45518             return anyType;
45519         }
45520         function getTypeOfSymbolWithDeferredType(symbol) {
45521             var links = getSymbolLinks(symbol);
45522             if (!links.type) {
45523                 ts.Debug.assertIsDefined(links.deferralParent);
45524                 ts.Debug.assertIsDefined(links.deferralConstituents);
45525                 links.type = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
45526             }
45527             return links.type;
45528         }
45529         function getSetAccessorTypeOfSymbol(symbol) {
45530             if (symbol.flags & 98304) {
45531                 var type = getTypeOfSetAccessor(symbol);
45532                 if (type) {
45533                     return type;
45534                 }
45535             }
45536             return getTypeOfSymbol(symbol);
45537         }
45538         function getTypeOfSymbol(symbol) {
45539             var checkFlags = ts.getCheckFlags(symbol);
45540             if (checkFlags & 65536) {
45541                 return getTypeOfSymbolWithDeferredType(symbol);
45542             }
45543             if (checkFlags & 1) {
45544                 return getTypeOfInstantiatedSymbol(symbol);
45545             }
45546             if (checkFlags & 262144) {
45547                 return getTypeOfMappedSymbol(symbol);
45548             }
45549             if (checkFlags & 8192) {
45550                 return getTypeOfReverseMappedSymbol(symbol);
45551             }
45552             if (symbol.flags & (3 | 4)) {
45553                 return getTypeOfVariableOrParameterOrProperty(symbol);
45554             }
45555             if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
45556                 return getTypeOfFuncClassEnumModule(symbol);
45557             }
45558             if (symbol.flags & 8) {
45559                 return getTypeOfEnumMember(symbol);
45560             }
45561             if (symbol.flags & 98304) {
45562                 return getTypeOfAccessors(symbol);
45563             }
45564             if (symbol.flags & 2097152) {
45565                 return getTypeOfAlias(symbol);
45566             }
45567             return errorType;
45568         }
45569         function getNonMissingTypeOfSymbol(symbol) {
45570             return removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216));
45571         }
45572         function isReferenceToType(type, target) {
45573             return type !== undefined
45574                 && target !== undefined
45575                 && (ts.getObjectFlags(type) & 4) !== 0
45576                 && type.target === target;
45577         }
45578         function getTargetType(type) {
45579             return ts.getObjectFlags(type) & 4 ? type.target : type;
45580         }
45581         function hasBaseType(type, checkBase) {
45582             return check(type);
45583             function check(type) {
45584                 if (ts.getObjectFlags(type) & (3 | 4)) {
45585                     var target = getTargetType(type);
45586                     return target === checkBase || ts.some(getBaseTypes(target), check);
45587                 }
45588                 else if (type.flags & 2097152) {
45589                     return ts.some(type.types, check);
45590                 }
45591                 return false;
45592             }
45593         }
45594         function appendTypeParameters(typeParameters, declarations) {
45595             for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {
45596                 var declaration = declarations_2[_i];
45597                 typeParameters = ts.appendIfUnique(typeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)));
45598             }
45599             return typeParameters;
45600         }
45601         function getOuterTypeParameters(node, includeThisTypes) {
45602             while (true) {
45603                 node = node.parent;
45604                 if (node && ts.isBinaryExpression(node)) {
45605                     var assignmentKind = ts.getAssignmentDeclarationKind(node);
45606                     if (assignmentKind === 6 || assignmentKind === 3) {
45607                         var symbol = getSymbolOfNode(node.left);
45608                         if (symbol && symbol.parent && !ts.findAncestor(symbol.parent.valueDeclaration, function (d) { return node === d; })) {
45609                             node = symbol.parent.valueDeclaration;
45610                         }
45611                     }
45612                 }
45613                 if (!node) {
45614                     return undefined;
45615                 }
45616                 switch (node.kind) {
45617                     case 256:
45618                     case 225:
45619                     case 257:
45620                     case 173:
45621                     case 174:
45622                     case 167:
45623                     case 178:
45624                     case 179:
45625                     case 315:
45626                     case 255:
45627                     case 168:
45628                     case 212:
45629                     case 213:
45630                     case 258:
45631                     case 342:
45632                     case 343:
45633                     case 337:
45634                     case 336:
45635                     case 194:
45636                     case 188: {
45637                         var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
45638                         if (node.kind === 194) {
45639                             return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
45640                         }
45641                         else if (node.kind === 188) {
45642                             return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
45643                         }
45644                         var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
45645                         var thisType = includeThisTypes &&
45646                             (node.kind === 256 || node.kind === 225 || node.kind === 257 || isJSConstructor(node)) &&
45647                             getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
45648                         return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
45649                     }
45650                     case 338:
45651                         var paramSymbol = ts.getParameterSymbolFromJSDoc(node);
45652                         if (paramSymbol) {
45653                             node = paramSymbol.valueDeclaration;
45654                         }
45655                         break;
45656                     case 318: {
45657                         var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
45658                         return node.tags
45659                             ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; }))
45660                             : outerTypeParameters;
45661                     }
45662                 }
45663             }
45664         }
45665         function getOuterTypeParametersOfClassOrInterface(symbol) {
45666             var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 257);
45667             ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
45668             return getOuterTypeParameters(declaration);
45669         }
45670         function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {
45671             if (!symbol.declarations) {
45672                 return;
45673             }
45674             var result;
45675             for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
45676                 var node = _a[_i];
45677                 if (node.kind === 257 ||
45678                     node.kind === 256 ||
45679                     node.kind === 225 ||
45680                     isJSConstructor(node) ||
45681                     ts.isTypeAlias(node)) {
45682                     var declaration = node;
45683                     result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
45684                 }
45685             }
45686             return result;
45687         }
45688         function getTypeParametersOfClassOrInterface(symbol) {
45689             return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol));
45690         }
45691         function isMixinConstructorType(type) {
45692             var signatures = getSignaturesOfType(type, 1);
45693             if (signatures.length === 1) {
45694                 var s = signatures[0];
45695                 if (!s.typeParameters && s.parameters.length === 1 && signatureHasRestParameter(s)) {
45696                     var paramType = getTypeOfParameter(s.parameters[0]);
45697                     return isTypeAny(paramType) || getElementTypeOfArrayType(paramType) === anyType;
45698                 }
45699             }
45700             return false;
45701         }
45702         function isConstructorType(type) {
45703             if (getSignaturesOfType(type, 1).length > 0) {
45704                 return true;
45705             }
45706             if (type.flags & 8650752) {
45707                 var constraint = getBaseConstraintOfType(type);
45708                 return !!constraint && isMixinConstructorType(constraint);
45709             }
45710             return false;
45711         }
45712         function getBaseTypeNodeOfClass(type) {
45713             return ts.getEffectiveBaseTypeNode(type.symbol.valueDeclaration);
45714         }
45715         function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
45716             var typeArgCount = ts.length(typeArgumentNodes);
45717             var isJavascript = ts.isInJSFile(location);
45718             return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); });
45719         }
45720         function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) {
45721             var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location);
45722             var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode);
45723             return ts.sameMap(signatures, function (sig) { return ts.some(sig.typeParameters) ? getSignatureInstantiation(sig, typeArguments, ts.isInJSFile(location)) : sig; });
45724         }
45725         function getBaseConstructorTypeOfClass(type) {
45726             if (!type.resolvedBaseConstructorType) {
45727                 var decl = type.symbol.valueDeclaration;
45728                 var extended = ts.getEffectiveBaseTypeNode(decl);
45729                 var baseTypeNode = getBaseTypeNodeOfClass(type);
45730                 if (!baseTypeNode) {
45731                     return type.resolvedBaseConstructorType = undefinedType;
45732                 }
45733                 if (!pushTypeResolution(type, 1)) {
45734                     return errorType;
45735                 }
45736                 var baseConstructorType = checkExpression(baseTypeNode.expression);
45737                 if (extended && baseTypeNode !== extended) {
45738                     ts.Debug.assert(!extended.typeArguments);
45739                     checkExpression(extended.expression);
45740                 }
45741                 if (baseConstructorType.flags & (524288 | 2097152)) {
45742                     resolveStructuredTypeMembers(baseConstructorType);
45743                 }
45744                 if (!popTypeResolution()) {
45745                     error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol));
45746                     return type.resolvedBaseConstructorType = errorType;
45747                 }
45748                 if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) {
45749                     var err = error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType));
45750                     if (baseConstructorType.flags & 262144) {
45751                         var constraint = getConstraintFromTypeParameter(baseConstructorType);
45752                         var ctorReturn = unknownType;
45753                         if (constraint) {
45754                             var ctorSig = getSignaturesOfType(constraint, 1);
45755                             if (ctorSig[0]) {
45756                                 ctorReturn = getReturnTypeOfSignature(ctorSig[0]);
45757                             }
45758                         }
45759                         if (baseConstructorType.symbol.declarations) {
45760                             ts.addRelatedInfo(err, ts.createDiagnosticForNode(baseConstructorType.symbol.declarations[0], ts.Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn)));
45761                         }
45762                     }
45763                     return type.resolvedBaseConstructorType = errorType;
45764                 }
45765                 type.resolvedBaseConstructorType = baseConstructorType;
45766             }
45767             return type.resolvedBaseConstructorType;
45768         }
45769         function getImplementsTypes(type) {
45770             var resolvedImplementsTypes = ts.emptyArray;
45771             if (type.symbol.declarations) {
45772                 for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
45773                     var declaration = _a[_i];
45774                     var implementsTypeNodes = ts.getEffectiveImplementsTypeNodes(declaration);
45775                     if (!implementsTypeNodes)
45776                         continue;
45777                     for (var _b = 0, implementsTypeNodes_1 = implementsTypeNodes; _b < implementsTypeNodes_1.length; _b++) {
45778                         var node = implementsTypeNodes_1[_b];
45779                         var implementsType = getTypeFromTypeNode(node);
45780                         if (!isErrorType(implementsType)) {
45781                             if (resolvedImplementsTypes === ts.emptyArray) {
45782                                 resolvedImplementsTypes = [implementsType];
45783                             }
45784                             else {
45785                                 resolvedImplementsTypes.push(implementsType);
45786                             }
45787                         }
45788                     }
45789                 }
45790             }
45791             return resolvedImplementsTypes;
45792         }
45793         function reportCircularBaseType(node, type) {
45794             error(node, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 2));
45795         }
45796         function getBaseTypes(type) {
45797             if (!type.baseTypesResolved) {
45798                 if (pushTypeResolution(type, 7)) {
45799                     if (type.objectFlags & 8) {
45800                         type.resolvedBaseTypes = [getTupleBaseType(type)];
45801                     }
45802                     else if (type.symbol.flags & (32 | 64)) {
45803                         if (type.symbol.flags & 32) {
45804                             resolveBaseTypesOfClass(type);
45805                         }
45806                         if (type.symbol.flags & 64) {
45807                             resolveBaseTypesOfInterface(type);
45808                         }
45809                     }
45810                     else {
45811                         ts.Debug.fail("type must be class or interface");
45812                     }
45813                     if (!popTypeResolution() && type.symbol.declarations) {
45814                         for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
45815                             var declaration = _a[_i];
45816                             if (declaration.kind === 256 || declaration.kind === 257) {
45817                                 reportCircularBaseType(declaration, type);
45818                             }
45819                         }
45820                     }
45821                 }
45822                 type.baseTypesResolved = true;
45823             }
45824             return type.resolvedBaseTypes;
45825         }
45826         function getTupleBaseType(type) {
45827             var elementTypes = ts.sameMap(type.typeParameters, function (t, i) { return type.elementFlags[i] & 8 ? getIndexedAccessType(t, numberType) : t; });
45828             return createArrayType(getUnionType(elementTypes || ts.emptyArray), type.readonly);
45829         }
45830         function resolveBaseTypesOfClass(type) {
45831             type.resolvedBaseTypes = ts.resolvingEmptyArray;
45832             var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type));
45833             if (!(baseConstructorType.flags & (524288 | 2097152 | 1))) {
45834                 return type.resolvedBaseTypes = ts.emptyArray;
45835             }
45836             var baseTypeNode = getBaseTypeNodeOfClass(type);
45837             var baseType;
45838             var originalBaseType = baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;
45839             if (baseConstructorType.symbol && baseConstructorType.symbol.flags & 32 &&
45840                 areAllOuterTypeParametersApplied(originalBaseType)) {
45841                 baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);
45842             }
45843             else if (baseConstructorType.flags & 1) {
45844                 baseType = baseConstructorType;
45845             }
45846             else {
45847                 var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode);
45848                 if (!constructors.length) {
45849                     error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);
45850                     return type.resolvedBaseTypes = ts.emptyArray;
45851                 }
45852                 baseType = getReturnTypeOfSignature(constructors[0]);
45853             }
45854             if (isErrorType(baseType)) {
45855                 return type.resolvedBaseTypes = ts.emptyArray;
45856             }
45857             var reducedBaseType = getReducedType(baseType);
45858             if (!isValidBaseType(reducedBaseType)) {
45859                 var elaboration = elaborateNeverIntersection(undefined, baseType);
45860                 var diagnostic = ts.chainDiagnosticMessages(elaboration, ts.Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(reducedBaseType));
45861                 diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(baseTypeNode.expression, diagnostic));
45862                 return type.resolvedBaseTypes = ts.emptyArray;
45863             }
45864             if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
45865                 error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 2));
45866                 return type.resolvedBaseTypes = ts.emptyArray;
45867             }
45868             if (type.resolvedBaseTypes === ts.resolvingEmptyArray) {
45869                 type.members = undefined;
45870             }
45871             return type.resolvedBaseTypes = [reducedBaseType];
45872         }
45873         function areAllOuterTypeParametersApplied(type) {
45874             var outerTypeParameters = type.outerTypeParameters;
45875             if (outerTypeParameters) {
45876                 var last_1 = outerTypeParameters.length - 1;
45877                 var typeArguments = getTypeArguments(type);
45878                 return outerTypeParameters[last_1].symbol !== typeArguments[last_1].symbol;
45879             }
45880             return true;
45881         }
45882         function isValidBaseType(type) {
45883             if (type.flags & 262144) {
45884                 var constraint = getBaseConstraintOfType(type);
45885                 if (constraint) {
45886                     return isValidBaseType(constraint);
45887                 }
45888             }
45889             return !!(type.flags & (524288 | 67108864 | 1) && !isGenericMappedType(type) ||
45890                 type.flags & 2097152 && ts.every(type.types, isValidBaseType));
45891         }
45892         function resolveBaseTypesOfInterface(type) {
45893             type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
45894             if (type.symbol.declarations) {
45895                 for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
45896                     var declaration = _a[_i];
45897                     if (declaration.kind === 257 && ts.getInterfaceBaseTypeNodes(declaration)) {
45898                         for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
45899                             var node = _c[_b];
45900                             var baseType = getReducedType(getTypeFromTypeNode(node));
45901                             if (!isErrorType(baseType)) {
45902                                 if (isValidBaseType(baseType)) {
45903                                     if (type !== baseType && !hasBaseType(baseType, type)) {
45904                                         if (type.resolvedBaseTypes === ts.emptyArray) {
45905                                             type.resolvedBaseTypes = [baseType];
45906                                         }
45907                                         else {
45908                                             type.resolvedBaseTypes.push(baseType);
45909                                         }
45910                                     }
45911                                     else {
45912                                         reportCircularBaseType(declaration, type);
45913                                     }
45914                                 }
45915                                 else {
45916                                     error(node, ts.Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members);
45917                                 }
45918                             }
45919                         }
45920                     }
45921                 }
45922             }
45923         }
45924         function isThislessInterface(symbol) {
45925             if (!symbol.declarations) {
45926                 return true;
45927             }
45928             for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
45929                 var declaration = _a[_i];
45930                 if (declaration.kind === 257) {
45931                     if (declaration.flags & 128) {
45932                         return false;
45933                     }
45934                     var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration);
45935                     if (baseTypeNodes) {
45936                         for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
45937                             var node = baseTypeNodes_1[_b];
45938                             if (ts.isEntityNameExpression(node.expression)) {
45939                                 var baseSymbol = resolveEntityName(node.expression, 788968, true);
45940                                 if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
45941                                     return false;
45942                                 }
45943                             }
45944                         }
45945                     }
45946                 }
45947             }
45948             return true;
45949         }
45950         function getDeclaredTypeOfClassOrInterface(symbol) {
45951             var links = getSymbolLinks(symbol);
45952             var originalLinks = links;
45953             if (!links.declaredType) {
45954                 var kind = symbol.flags & 32 ? 1 : 2;
45955                 var merged = mergeJSSymbols(symbol, symbol.valueDeclaration && getAssignedClassSymbol(symbol.valueDeclaration));
45956                 if (merged) {
45957                     symbol = links = merged;
45958                 }
45959                 var type = originalLinks.declaredType = links.declaredType = createObjectType(kind, symbol);
45960                 var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol);
45961                 var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
45962                 if (outerTypeParameters || localTypeParameters || kind === 1 || !isThislessInterface(symbol)) {
45963                     type.objectFlags |= 4;
45964                     type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters);
45965                     type.outerTypeParameters = outerTypeParameters;
45966                     type.localTypeParameters = localTypeParameters;
45967                     type.instantiations = new ts.Map();
45968                     type.instantiations.set(getTypeListId(type.typeParameters), type);
45969                     type.target = type;
45970                     type.resolvedTypeArguments = type.typeParameters;
45971                     type.thisType = createTypeParameter(symbol);
45972                     type.thisType.isThisType = true;
45973                     type.thisType.constraint = type;
45974                 }
45975             }
45976             return links.declaredType;
45977         }
45978         function getDeclaredTypeOfTypeAlias(symbol) {
45979             var _a;
45980             var links = getSymbolLinks(symbol);
45981             if (!links.declaredType) {
45982                 if (!pushTypeResolution(symbol, 2)) {
45983                     return errorType;
45984                 }
45985                 var declaration = ts.Debug.checkDefined((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isTypeAlias), "Type alias symbol with no valid declaration found");
45986                 var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
45987                 var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
45988                 if (popTypeResolution()) {
45989                     var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
45990                     if (typeParameters) {
45991                         links.typeParameters = typeParameters;
45992                         links.instantiations = new ts.Map();
45993                         links.instantiations.set(getTypeListId(typeParameters), type);
45994                     }
45995                 }
45996                 else {
45997                     type = errorType;
45998                     if (declaration.kind === 337) {
45999                         error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
46000                     }
46001                     else {
46002                         error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
46003                     }
46004                 }
46005                 links.declaredType = type;
46006             }
46007             return links.declaredType;
46008         }
46009         function isStringConcatExpression(expr) {
46010             if (ts.isStringLiteralLike(expr)) {
46011                 return true;
46012             }
46013             else if (expr.kind === 220) {
46014                 return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
46015             }
46016             return false;
46017         }
46018         function isLiteralEnumMember(member) {
46019             var expr = member.initializer;
46020             if (!expr) {
46021                 return !(member.flags & 8388608);
46022             }
46023             switch (expr.kind) {
46024                 case 10:
46025                 case 8:
46026                 case 14:
46027                     return true;
46028                 case 218:
46029                     return expr.operator === 40 &&
46030                         expr.operand.kind === 8;
46031                 case 79:
46032                     return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
46033                 case 220:
46034                     return isStringConcatExpression(expr);
46035                 default:
46036                     return false;
46037             }
46038         }
46039         function getEnumKind(symbol) {
46040             var links = getSymbolLinks(symbol);
46041             if (links.enumKind !== undefined) {
46042                 return links.enumKind;
46043             }
46044             var hasNonLiteralMember = false;
46045             if (symbol.declarations) {
46046                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
46047                     var declaration = _a[_i];
46048                     if (declaration.kind === 259) {
46049                         for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
46050                             var member = _c[_b];
46051                             if (member.initializer && ts.isStringLiteralLike(member.initializer)) {
46052                                 return links.enumKind = 1;
46053                             }
46054                             if (!isLiteralEnumMember(member)) {
46055                                 hasNonLiteralMember = true;
46056                             }
46057                         }
46058                     }
46059                 }
46060             }
46061             return links.enumKind = hasNonLiteralMember ? 0 : 1;
46062         }
46063         function getBaseTypeOfEnumLiteralType(type) {
46064             return type.flags & 1024 && !(type.flags & 1048576) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
46065         }
46066         function getDeclaredTypeOfEnum(symbol) {
46067             var links = getSymbolLinks(symbol);
46068             if (links.declaredType) {
46069                 return links.declaredType;
46070             }
46071             if (getEnumKind(symbol) === 1) {
46072                 enumCount++;
46073                 var memberTypeList = [];
46074                 if (symbol.declarations) {
46075                     for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
46076                         var declaration = _a[_i];
46077                         if (declaration.kind === 259) {
46078                             for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
46079                                 var member = _c[_b];
46080                                 var value = getEnumMemberValue(member);
46081                                 var memberType = getFreshTypeOfLiteralType(getEnumLiteralType(value !== undefined ? value : 0, enumCount, getSymbolOfNode(member)));
46082                                 getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType;
46083                                 memberTypeList.push(getRegularTypeOfLiteralType(memberType));
46084                             }
46085                         }
46086                     }
46087                 }
46088                 if (memberTypeList.length) {
46089                     var enumType_1 = getUnionType(memberTypeList, 1, symbol, undefined);
46090                     if (enumType_1.flags & 1048576) {
46091                         enumType_1.flags |= 1024;
46092                         enumType_1.symbol = symbol;
46093                     }
46094                     return links.declaredType = enumType_1;
46095                 }
46096             }
46097             var enumType = createType(32);
46098             enumType.symbol = symbol;
46099             return links.declaredType = enumType;
46100         }
46101         function getDeclaredTypeOfEnumMember(symbol) {
46102             var links = getSymbolLinks(symbol);
46103             if (!links.declaredType) {
46104                 var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol));
46105                 if (!links.declaredType) {
46106                     links.declaredType = enumType;
46107                 }
46108             }
46109             return links.declaredType;
46110         }
46111         function getDeclaredTypeOfTypeParameter(symbol) {
46112             var links = getSymbolLinks(symbol);
46113             return links.declaredType || (links.declaredType = createTypeParameter(symbol));
46114         }
46115         function getDeclaredTypeOfAlias(symbol) {
46116             var links = getSymbolLinks(symbol);
46117             return links.declaredType || (links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol)));
46118         }
46119         function getDeclaredTypeOfSymbol(symbol) {
46120             return tryGetDeclaredTypeOfSymbol(symbol) || errorType;
46121         }
46122         function tryGetDeclaredTypeOfSymbol(symbol) {
46123             if (symbol.flags & (32 | 64)) {
46124                 return getDeclaredTypeOfClassOrInterface(symbol);
46125             }
46126             if (symbol.flags & 524288) {
46127                 return getDeclaredTypeOfTypeAlias(symbol);
46128             }
46129             if (symbol.flags & 262144) {
46130                 return getDeclaredTypeOfTypeParameter(symbol);
46131             }
46132             if (symbol.flags & 384) {
46133                 return getDeclaredTypeOfEnum(symbol);
46134             }
46135             if (symbol.flags & 8) {
46136                 return getDeclaredTypeOfEnumMember(symbol);
46137             }
46138             if (symbol.flags & 2097152) {
46139                 return getDeclaredTypeOfAlias(symbol);
46140             }
46141             return undefined;
46142         }
46143         function isThislessType(node) {
46144             switch (node.kind) {
46145                 case 130:
46146                 case 154:
46147                 case 149:
46148                 case 146:
46149                 case 157:
46150                 case 133:
46151                 case 150:
46152                 case 147:
46153                 case 114:
46154                 case 152:
46155                 case 143:
46156                 case 195:
46157                     return true;
46158                 case 182:
46159                     return isThislessType(node.elementType);
46160                 case 177:
46161                     return !node.typeArguments || node.typeArguments.every(isThislessType);
46162             }
46163             return false;
46164         }
46165         function isThislessTypeParameter(node) {
46166             var constraint = ts.getEffectiveConstraintOfTypeParameter(node);
46167             return !constraint || isThislessType(constraint);
46168         }
46169         function isThislessVariableLikeDeclaration(node) {
46170             var typeNode = ts.getEffectiveTypeAnnotationNode(node);
46171             return typeNode ? isThislessType(typeNode) : !ts.hasInitializer(node);
46172         }
46173         function isThislessFunctionLikeDeclaration(node) {
46174             var returnType = ts.getEffectiveReturnTypeNode(node);
46175             var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
46176             return (node.kind === 170 || (!!returnType && isThislessType(returnType))) &&
46177                 node.parameters.every(isThislessVariableLikeDeclaration) &&
46178                 typeParameters.every(isThislessTypeParameter);
46179         }
46180         function isThisless(symbol) {
46181             if (symbol.declarations && symbol.declarations.length === 1) {
46182                 var declaration = symbol.declarations[0];
46183                 if (declaration) {
46184                     switch (declaration.kind) {
46185                         case 166:
46186                         case 165:
46187                             return isThislessVariableLikeDeclaration(declaration);
46188                         case 168:
46189                         case 167:
46190                         case 170:
46191                         case 171:
46192                         case 172:
46193                             return isThislessFunctionLikeDeclaration(declaration);
46194                     }
46195                 }
46196             }
46197             return false;
46198         }
46199         function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) {
46200             var result = ts.createSymbolTable();
46201             for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
46202                 var symbol = symbols_2[_i];
46203                 result.set(symbol.escapedName, mappingThisOnly && isThisless(symbol) ? symbol : instantiateSymbol(symbol, mapper));
46204             }
46205             return result;
46206         }
46207         function addInheritedMembers(symbols, baseSymbols) {
46208             for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) {
46209                 var s = baseSymbols_1[_i];
46210                 if (!symbols.has(s.escapedName) && !isStaticPrivateIdentifierProperty(s)) {
46211                     symbols.set(s.escapedName, s);
46212                 }
46213             }
46214         }
46215         function isStaticPrivateIdentifierProperty(s) {
46216             return !!s.valueDeclaration && ts.isPrivateIdentifierClassElementDeclaration(s.valueDeclaration) && ts.isStatic(s.valueDeclaration);
46217         }
46218         function resolveDeclaredMembers(type) {
46219             if (!type.declaredProperties) {
46220                 var symbol = type.symbol;
46221                 var members = getMembersOfSymbol(symbol);
46222                 type.declaredProperties = getNamedMembers(members);
46223                 type.declaredCallSignatures = ts.emptyArray;
46224                 type.declaredConstructSignatures = ts.emptyArray;
46225                 type.declaredIndexInfos = ts.emptyArray;
46226                 type.declaredCallSignatures = getSignaturesOfSymbol(members.get("__call"));
46227                 type.declaredConstructSignatures = getSignaturesOfSymbol(members.get("__new"));
46228                 type.declaredIndexInfos = getIndexInfosOfSymbol(symbol);
46229             }
46230             return type;
46231         }
46232         function isTypeUsableAsPropertyName(type) {
46233             return !!(type.flags & 8576);
46234         }
46235         function isLateBindableName(node) {
46236             if (!ts.isComputedPropertyName(node) && !ts.isElementAccessExpression(node)) {
46237                 return false;
46238             }
46239             var expr = ts.isComputedPropertyName(node) ? node.expression : node.argumentExpression;
46240             return ts.isEntityNameExpression(expr)
46241                 && isTypeUsableAsPropertyName(ts.isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
46242         }
46243         function isLateBoundName(name) {
46244             return name.charCodeAt(0) === 95 &&
46245                 name.charCodeAt(1) === 95 &&
46246                 name.charCodeAt(2) === 64;
46247         }
46248         function hasLateBindableName(node) {
46249             var name = ts.getNameOfDeclaration(node);
46250             return !!name && isLateBindableName(name);
46251         }
46252         function hasBindableName(node) {
46253             return !ts.hasDynamicName(node) || hasLateBindableName(node);
46254         }
46255         function isNonBindableDynamicName(node) {
46256             return ts.isDynamicName(node) && !isLateBindableName(node);
46257         }
46258         function getPropertyNameFromType(type) {
46259             if (type.flags & 8192) {
46260                 return type.escapedName;
46261             }
46262             if (type.flags & (128 | 256)) {
46263                 return ts.escapeLeadingUnderscores("" + type.value);
46264             }
46265             return ts.Debug.fail();
46266         }
46267         function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
46268             ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096), "Expected a late-bound symbol.");
46269             symbol.flags |= symbolFlags;
46270             getSymbolLinks(member.symbol).lateSymbol = symbol;
46271             if (!symbol.declarations) {
46272                 symbol.declarations = [member];
46273             }
46274             else if (!member.symbol.isReplaceableByMethod) {
46275                 symbol.declarations.push(member);
46276             }
46277             if (symbolFlags & 111551) {
46278                 if (!symbol.valueDeclaration || symbol.valueDeclaration.kind !== member.kind) {
46279                     symbol.valueDeclaration = member;
46280                 }
46281             }
46282         }
46283         function lateBindMember(parent, earlySymbols, lateSymbols, decl) {
46284             ts.Debug.assert(!!decl.symbol, "The member is expected to have a symbol.");
46285             var links = getNodeLinks(decl);
46286             if (!links.resolvedSymbol) {
46287                 links.resolvedSymbol = decl.symbol;
46288                 var declName = ts.isBinaryExpression(decl) ? decl.left : decl.name;
46289                 var type = ts.isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
46290                 if (isTypeUsableAsPropertyName(type)) {
46291                     var memberName = getPropertyNameFromType(type);
46292                     var symbolFlags = decl.symbol.flags;
46293                     var lateSymbol = lateSymbols.get(memberName);
46294                     if (!lateSymbol)
46295                         lateSymbols.set(memberName, lateSymbol = createSymbol(0, memberName, 4096));
46296                     var earlySymbol = earlySymbols && earlySymbols.get(memberName);
46297                     if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
46298                         var declarations = earlySymbol ? ts.concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
46299                         var name_4 = !(type.flags & 8192) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(declName);
46300                         ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_4); });
46301                         error(declName || decl, ts.Diagnostics.Duplicate_property_0, name_4);
46302                         lateSymbol = createSymbol(0, memberName, 4096);
46303                     }
46304                     lateSymbol.nameType = type;
46305                     addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
46306                     if (lateSymbol.parent) {
46307                         ts.Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one");
46308                     }
46309                     else {
46310                         lateSymbol.parent = parent;
46311                     }
46312                     return links.resolvedSymbol = lateSymbol;
46313                 }
46314             }
46315             return links.resolvedSymbol;
46316         }
46317         function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
46318             var links = getSymbolLinks(symbol);
46319             if (!links[resolutionKind]) {
46320                 var isStatic_1 = resolutionKind === "resolvedExports";
46321                 var earlySymbols = !isStatic_1 ? symbol.members :
46322                     symbol.flags & 1536 ? getExportsOfModuleWorker(symbol) :
46323                         symbol.exports;
46324                 links[resolutionKind] = earlySymbols || emptySymbols;
46325                 var lateSymbols = ts.createSymbolTable();
46326                 for (var _i = 0, _a = symbol.declarations || ts.emptyArray; _i < _a.length; _i++) {
46327                     var decl = _a[_i];
46328                     var members = ts.getMembersOfDeclaration(decl);
46329                     if (members) {
46330                         for (var _b = 0, members_5 = members; _b < members_5.length; _b++) {
46331                             var member = members_5[_b];
46332                             if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) {
46333                                 lateBindMember(symbol, earlySymbols, lateSymbols, member);
46334                             }
46335                         }
46336                     }
46337                 }
46338                 var assignments = symbol.assignmentDeclarationMembers;
46339                 if (assignments) {
46340                     var decls = ts.arrayFrom(assignments.values());
46341                     for (var _c = 0, decls_1 = decls; _c < decls_1.length; _c++) {
46342                         var member = decls_1[_c];
46343                         var assignmentKind = ts.getAssignmentDeclarationKind(member);
46344                         var isInstanceMember = assignmentKind === 3
46345                             || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind)
46346                             || assignmentKind === 9
46347                             || assignmentKind === 6;
46348                         if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) {
46349                             lateBindMember(symbol, earlySymbols, lateSymbols, member);
46350                         }
46351                     }
46352                 }
46353                 links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
46354             }
46355             return links[resolutionKind];
46356         }
46357         function getMembersOfSymbol(symbol) {
46358             return symbol.flags & 6256
46359                 ? getResolvedMembersOrExportsOfSymbol(symbol, "resolvedMembers")
46360                 : symbol.members || emptySymbols;
46361         }
46362         function getLateBoundSymbol(symbol) {
46363             if (symbol.flags & 106500 && symbol.escapedName === "__computed") {
46364                 var links = getSymbolLinks(symbol);
46365                 if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
46366                     var parent = getMergedSymbol(symbol.parent);
46367                     if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
46368                         getExportsOfSymbol(parent);
46369                     }
46370                     else {
46371                         getMembersOfSymbol(parent);
46372                     }
46373                 }
46374                 return links.lateSymbol || (links.lateSymbol = symbol);
46375             }
46376             return symbol;
46377         }
46378         function getTypeWithThisArgument(type, thisArgument, needApparentType) {
46379             if (ts.getObjectFlags(type) & 4) {
46380                 var target = type.target;
46381                 var typeArguments = getTypeArguments(type);
46382                 if (ts.length(target.typeParameters) === ts.length(typeArguments)) {
46383                     var ref = createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType]));
46384                     return needApparentType ? getApparentType(ref) : ref;
46385                 }
46386             }
46387             else if (type.flags & 2097152) {
46388                 var types = ts.sameMap(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument, needApparentType); });
46389                 return types !== type.types ? getIntersectionType(types) : type;
46390             }
46391             return needApparentType ? getApparentType(type) : type;
46392         }
46393         function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
46394             var mapper;
46395             var members;
46396             var callSignatures;
46397             var constructSignatures;
46398             var indexInfos;
46399             if (ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) {
46400                 members = source.symbol ? getMembersOfSymbol(source.symbol) : ts.createSymbolTable(source.declaredProperties);
46401                 callSignatures = source.declaredCallSignatures;
46402                 constructSignatures = source.declaredConstructSignatures;
46403                 indexInfos = source.declaredIndexInfos;
46404             }
46405             else {
46406                 mapper = createTypeMapper(typeParameters, typeArguments);
46407                 members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1);
46408                 callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper);
46409                 constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper);
46410                 indexInfos = instantiateIndexInfos(source.declaredIndexInfos, mapper);
46411             }
46412             var baseTypes = getBaseTypes(source);
46413             if (baseTypes.length) {
46414                 if (source.symbol && members === getMembersOfSymbol(source.symbol)) {
46415                     members = ts.createSymbolTable(source.declaredProperties);
46416                 }
46417                 setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
46418                 var thisArgument = ts.lastOrUndefined(typeArguments);
46419                 for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) {
46420                     var baseType = baseTypes_1[_i];
46421                     var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType;
46422                     addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
46423                     callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0));
46424                     constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1));
46425                     var inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo(stringType, anyType, false)];
46426                     indexInfos = ts.concatenate(indexInfos, ts.filter(inheritedIndexInfos, function (info) { return !findIndexInfo(indexInfos, info.keyType); }));
46427                 }
46428             }
46429             setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
46430         }
46431         function resolveClassOrInterfaceMembers(type) {
46432             resolveObjectTypeMembers(type, resolveDeclaredMembers(type), ts.emptyArray, ts.emptyArray);
46433         }
46434         function resolveTypeReferenceMembers(type) {
46435             var source = resolveDeclaredMembers(type.target);
46436             var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]);
46437             var typeArguments = getTypeArguments(type);
46438             var paddedTypeArguments = typeArguments.length === typeParameters.length ? typeArguments : ts.concatenate(typeArguments, [type]);
46439             resolveObjectTypeMembers(type, source, typeParameters, paddedTypeArguments);
46440         }
46441         function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, resolvedTypePredicate, minArgumentCount, flags) {
46442             var sig = new Signature(checker, flags);
46443             sig.declaration = declaration;
46444             sig.typeParameters = typeParameters;
46445             sig.parameters = parameters;
46446             sig.thisParameter = thisParameter;
46447             sig.resolvedReturnType = resolvedReturnType;
46448             sig.resolvedTypePredicate = resolvedTypePredicate;
46449             sig.minArgumentCount = minArgumentCount;
46450             sig.resolvedMinArgumentCount = undefined;
46451             sig.target = undefined;
46452             sig.mapper = undefined;
46453             sig.compositeSignatures = undefined;
46454             sig.compositeKind = undefined;
46455             return sig;
46456         }
46457         function cloneSignature(sig) {
46458             var result = createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, undefined, undefined, sig.minArgumentCount, sig.flags & 39);
46459             result.target = sig.target;
46460             result.mapper = sig.mapper;
46461             result.compositeSignatures = sig.compositeSignatures;
46462             result.compositeKind = sig.compositeKind;
46463             return result;
46464         }
46465         function createUnionSignature(signature, unionSignatures) {
46466             var result = cloneSignature(signature);
46467             result.compositeSignatures = unionSignatures;
46468             result.compositeKind = 1048576;
46469             result.target = undefined;
46470             result.mapper = undefined;
46471             return result;
46472         }
46473         function getOptionalCallSignature(signature, callChainFlags) {
46474             if ((signature.flags & 24) === callChainFlags) {
46475                 return signature;
46476             }
46477             if (!signature.optionalCallSignatureCache) {
46478                 signature.optionalCallSignatureCache = {};
46479             }
46480             var key = callChainFlags === 8 ? "inner" : "outer";
46481             return signature.optionalCallSignatureCache[key]
46482                 || (signature.optionalCallSignatureCache[key] = createOptionalCallSignature(signature, callChainFlags));
46483         }
46484         function createOptionalCallSignature(signature, callChainFlags) {
46485             ts.Debug.assert(callChainFlags === 8 || callChainFlags === 16, "An optional call signature can either be for an inner call chain or an outer call chain, but not both.");
46486             var result = cloneSignature(signature);
46487             result.flags |= callChainFlags;
46488             return result;
46489         }
46490         function getExpandedParameters(sig, skipUnionExpanding) {
46491             if (signatureHasRestParameter(sig)) {
46492                 var restIndex_1 = sig.parameters.length - 1;
46493                 var restType = getTypeOfSymbol(sig.parameters[restIndex_1]);
46494                 if (isTupleType(restType)) {
46495                     return [expandSignatureParametersWithTupleMembers(restType, restIndex_1)];
46496                 }
46497                 else if (!skipUnionExpanding && restType.flags & 1048576 && ts.every(restType.types, isTupleType)) {
46498                     return ts.map(restType.types, function (t) { return expandSignatureParametersWithTupleMembers(t, restIndex_1); });
46499                 }
46500             }
46501             return [sig.parameters];
46502             function expandSignatureParametersWithTupleMembers(restType, restIndex) {
46503                 var elementTypes = getTypeArguments(restType);
46504                 var associatedNames = restType.target.labeledElementDeclarations;
46505                 var restParams = ts.map(elementTypes, function (t, i) {
46506                     var tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
46507                     var name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
46508                     var flags = restType.target.elementFlags[i];
46509                     var checkFlags = flags & 12 ? 32768 :
46510                         flags & 2 ? 16384 : 0;
46511                     var symbol = createSymbol(1, name, checkFlags);
46512                     symbol.type = flags & 4 ? createArrayType(t) : t;
46513                     return symbol;
46514                 });
46515                 return ts.concatenate(sig.parameters.slice(0, restIndex), restParams);
46516             }
46517         }
46518         function getDefaultConstructSignatures(classType) {
46519             var baseConstructorType = getBaseConstructorTypeOfClass(classType);
46520             var baseSignatures = getSignaturesOfType(baseConstructorType, 1);
46521             var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol);
46522             var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128);
46523             if (baseSignatures.length === 0) {
46524                 return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, undefined, 0, isAbstract ? 4 : 0)];
46525             }
46526             var baseTypeNode = getBaseTypeNodeOfClass(classType);
46527             var isJavaScript = ts.isInJSFile(baseTypeNode);
46528             var typeArguments = typeArgumentsFromTypeReferenceNode(baseTypeNode);
46529             var typeArgCount = ts.length(typeArguments);
46530             var result = [];
46531             for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) {
46532                 var baseSig = baseSignatures_1[_i];
46533                 var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters);
46534                 var typeParamCount = ts.length(baseSig.typeParameters);
46535                 if (isJavaScript || typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) {
46536                     var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, isJavaScript)) : cloneSignature(baseSig);
46537                     sig.typeParameters = classType.localTypeParameters;
46538                     sig.resolvedReturnType = classType;
46539                     sig.flags = isAbstract ? sig.flags | 4 : sig.flags & ~4;
46540                     result.push(sig);
46541                 }
46542             }
46543             return result;
46544         }
46545         function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) {
46546             for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) {
46547                 var s = signatureList_1[_i];
46548                 if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, partialMatch ? compareTypesSubtypeOf : compareTypesIdentical)) {
46549                     return s;
46550                 }
46551             }
46552         }
46553         function findMatchingSignatures(signatureLists, signature, listIndex) {
46554             if (signature.typeParameters) {
46555                 if (listIndex > 0) {
46556                     return undefined;
46557                 }
46558                 for (var i = 1; i < signatureLists.length; i++) {
46559                     if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) {
46560                         return undefined;
46561                     }
46562                 }
46563                 return [signature];
46564             }
46565             var result;
46566             for (var i = 0; i < signatureLists.length; i++) {
46567                 var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, false, true);
46568                 if (!match) {
46569                     return undefined;
46570                 }
46571                 result = ts.appendIfUnique(result, match);
46572             }
46573             return result;
46574         }
46575         function getUnionSignatures(signatureLists) {
46576             var result;
46577             var indexWithLengthOverOne;
46578             for (var i = 0; i < signatureLists.length; i++) {
46579                 if (signatureLists[i].length === 0)
46580                     return ts.emptyArray;
46581                 if (signatureLists[i].length > 1) {
46582                     indexWithLengthOverOne = indexWithLengthOverOne === undefined ? i : -1;
46583                 }
46584                 for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) {
46585                     var signature = _a[_i];
46586                     if (!result || !findMatchingSignature(result, signature, false, false, true)) {
46587                         var unionSignatures = findMatchingSignatures(signatureLists, signature, i);
46588                         if (unionSignatures) {
46589                             var s = signature;
46590                             if (unionSignatures.length > 1) {
46591                                 var thisParameter = signature.thisParameter;
46592                                 var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
46593                                 if (firstThisParameterOfUnionSignatures) {
46594                                     var thisType = getIntersectionType(ts.mapDefined(unionSignatures, function (sig) { return sig.thisParameter && getTypeOfSymbol(sig.thisParameter); }));
46595                                     thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
46596                                 }
46597                                 s = createUnionSignature(signature, unionSignatures);
46598                                 s.thisParameter = thisParameter;
46599                             }
46600                             (result || (result = [])).push(s);
46601                         }
46602                     }
46603                 }
46604             }
46605             if (!ts.length(result) && indexWithLengthOverOne !== -1) {
46606                 var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
46607                 var results = masterList.slice();
46608                 var _loop_10 = function (signatures) {
46609                     if (signatures !== masterList) {
46610                         var signature_1 = signatures[0];
46611                         ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
46612                         results = !!signature_1.typeParameters && ts.some(results, function (s) { return !!s.typeParameters && !compareTypeParametersIdentical(signature_1.typeParameters, s.typeParameters); }) ? undefined : ts.map(results, function (sig) { return combineSignaturesOfUnionMembers(sig, signature_1); });
46613                         if (!results) {
46614                             return "break";
46615                         }
46616                     }
46617                 };
46618                 for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
46619                     var signatures = signatureLists_1[_b];
46620                     var state_3 = _loop_10(signatures);
46621                     if (state_3 === "break")
46622                         break;
46623                 }
46624                 result = results;
46625             }
46626             return result || ts.emptyArray;
46627         }
46628         function compareTypeParametersIdentical(sourceParams, targetParams) {
46629             if (ts.length(sourceParams) !== ts.length(targetParams)) {
46630                 return false;
46631             }
46632             if (!sourceParams || !targetParams) {
46633                 return true;
46634             }
46635             var mapper = createTypeMapper(targetParams, sourceParams);
46636             for (var i = 0; i < sourceParams.length; i++) {
46637                 var source = sourceParams[i];
46638                 var target = targetParams[i];
46639                 if (source === target)
46640                     continue;
46641                 if (!isTypeIdenticalTo(getConstraintFromTypeParameter(source) || unknownType, instantiateType(getConstraintFromTypeParameter(target) || unknownType, mapper)))
46642                     return false;
46643             }
46644             return true;
46645         }
46646         function combineUnionThisParam(left, right, mapper) {
46647             if (!left || !right) {
46648                 return left || right;
46649             }
46650             var thisType = getIntersectionType([getTypeOfSymbol(left), instantiateType(getTypeOfSymbol(right), mapper)]);
46651             return createSymbolWithType(left, thisType);
46652         }
46653         function combineUnionParameters(left, right, mapper) {
46654             var leftCount = getParameterCount(left);
46655             var rightCount = getParameterCount(right);
46656             var longest = leftCount >= rightCount ? left : right;
46657             var shorter = longest === left ? right : left;
46658             var longestCount = longest === left ? leftCount : rightCount;
46659             var eitherHasEffectiveRest = (hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right));
46660             var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest);
46661             var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0));
46662             for (var i = 0; i < longestCount; i++) {
46663                 var longestParamType = tryGetTypeAtPosition(longest, i);
46664                 if (longest === right) {
46665                     longestParamType = instantiateType(longestParamType, mapper);
46666                 }
46667                 var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType;
46668                 if (shorter === right) {
46669                     shorterParamType = instantiateType(shorterParamType, mapper);
46670                 }
46671                 var unionParamType = getIntersectionType([longestParamType, shorterParamType]);
46672                 var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === (longestCount - 1);
46673                 var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter);
46674                 var leftName = i >= leftCount ? undefined : getParameterNameAtPosition(left, i);
46675                 var rightName = i >= rightCount ? undefined : getParameterNameAtPosition(right, i);
46676                 var paramName = leftName === rightName ? leftName :
46677                     !leftName ? rightName :
46678                         !rightName ? leftName :
46679                             undefined;
46680                 var paramSymbol = createSymbol(1 | (isOptional && !isRestParam ? 16777216 : 0), paramName || "arg".concat(i));
46681                 paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
46682                 params[i] = paramSymbol;
46683             }
46684             if (needsExtraRestElement) {
46685                 var restParamSymbol = createSymbol(1, "args");
46686                 restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
46687                 if (shorter === right) {
46688                     restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
46689                 }
46690                 params[longestCount] = restParamSymbol;
46691             }
46692             return params;
46693         }
46694         function combineSignaturesOfUnionMembers(left, right) {
46695             var typeParams = left.typeParameters || right.typeParameters;
46696             var paramMapper;
46697             if (left.typeParameters && right.typeParameters) {
46698                 paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
46699             }
46700             var declaration = left.declaration;
46701             var params = combineUnionParameters(left, right, paramMapper);
46702             var thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
46703             var minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
46704             var result = createSignature(declaration, typeParams, thisParam, params, undefined, undefined, minArgCount, (left.flags | right.flags) & 39);
46705             result.compositeKind = 1048576;
46706             result.compositeSignatures = ts.concatenate(left.compositeKind !== 2097152 && left.compositeSignatures || [left], [right]);
46707             if (paramMapper) {
46708                 result.mapper = left.compositeKind !== 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper;
46709             }
46710             return result;
46711         }
46712         function getUnionIndexInfos(types) {
46713             var sourceInfos = getIndexInfosOfType(types[0]);
46714             if (sourceInfos) {
46715                 var result = [];
46716                 var _loop_11 = function (info) {
46717                     var indexType = info.keyType;
46718                     if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
46719                         result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
46720                     }
46721                 };
46722                 for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
46723                     var info = sourceInfos_1[_i];
46724                     _loop_11(info);
46725                 }
46726                 return result;
46727             }
46728             return ts.emptyArray;
46729         }
46730         function resolveUnionTypeMembers(type) {
46731             var callSignatures = getUnionSignatures(ts.map(type.types, function (t) { return t === globalFunctionType ? [unknownSignature] : getSignaturesOfType(t, 0); }));
46732             var constructSignatures = getUnionSignatures(ts.map(type.types, function (t) { return getSignaturesOfType(t, 1); }));
46733             var indexInfos = getUnionIndexInfos(type.types);
46734             setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, indexInfos);
46735         }
46736         function intersectTypes(type1, type2) {
46737             return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]);
46738         }
46739         function findMixins(types) {
46740             var constructorTypeCount = ts.countWhere(types, function (t) { return getSignaturesOfType(t, 1).length > 0; });
46741             var mixinFlags = ts.map(types, isMixinConstructorType);
46742             if (constructorTypeCount > 0 && constructorTypeCount === ts.countWhere(mixinFlags, function (b) { return b; })) {
46743                 var firstMixinIndex = mixinFlags.indexOf(true);
46744                 mixinFlags[firstMixinIndex] = false;
46745             }
46746             return mixinFlags;
46747         }
46748         function includeMixinType(type, types, mixinFlags, index) {
46749             var mixedTypes = [];
46750             for (var i = 0; i < types.length; i++) {
46751                 if (i === index) {
46752                     mixedTypes.push(type);
46753                 }
46754                 else if (mixinFlags[i]) {
46755                     mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0]));
46756                 }
46757             }
46758             return getIntersectionType(mixedTypes);
46759         }
46760         function resolveIntersectionTypeMembers(type) {
46761             var callSignatures;
46762             var constructSignatures;
46763             var indexInfos;
46764             var types = type.types;
46765             var mixinFlags = findMixins(types);
46766             var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
46767             var _loop_12 = function (i) {
46768                 var t = type.types[i];
46769                 if (!mixinFlags[i]) {
46770                     var signatures = getSignaturesOfType(t, 1);
46771                     if (signatures.length && mixinCount > 0) {
46772                         signatures = ts.map(signatures, function (s) {
46773                             var clone = cloneSignature(s);
46774                             clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, mixinFlags, i);
46775                             return clone;
46776                         });
46777                     }
46778                     constructSignatures = appendSignatures(constructSignatures, signatures);
46779                 }
46780                 callSignatures = appendSignatures(callSignatures, getSignaturesOfType(t, 0));
46781                 indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, false); }, indexInfos);
46782             };
46783             for (var i = 0; i < types.length; i++) {
46784                 _loop_12(i);
46785             }
46786             setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
46787         }
46788         function appendSignatures(signatures, newSignatures) {
46789             var _loop_13 = function (sig) {
46790                 if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, false, false, false, compareTypesIdentical); })) {
46791                     signatures = ts.append(signatures, sig);
46792                 }
46793             };
46794             for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
46795                 var sig = newSignatures_1[_i];
46796                 _loop_13(sig);
46797             }
46798             return signatures;
46799         }
46800         function appendIndexInfo(indexInfos, newInfo, union) {
46801             if (indexInfos) {
46802                 for (var i = 0; i < indexInfos.length; i++) {
46803                     var info = indexInfos[i];
46804                     if (info.keyType === newInfo.keyType) {
46805                         indexInfos[i] = createIndexInfo(info.keyType, union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]), union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly);
46806                         return indexInfos;
46807                     }
46808                 }
46809             }
46810             return ts.append(indexInfos, newInfo);
46811         }
46812         function resolveAnonymousTypeMembers(type) {
46813             var symbol = getMergedSymbol(type.symbol);
46814             if (type.target) {
46815                 setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
46816                 var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false);
46817                 var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0), type.mapper);
46818                 var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1), type.mapper);
46819                 var indexInfos = instantiateIndexInfos(getIndexInfosOfType(type.target), type.mapper);
46820                 setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
46821             }
46822             else if (symbol.flags & 2048) {
46823                 setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
46824                 var members = getMembersOfSymbol(symbol);
46825                 var callSignatures = getSignaturesOfSymbol(members.get("__call"));
46826                 var constructSignatures = getSignaturesOfSymbol(members.get("__new"));
46827                 var indexInfos = getIndexInfosOfSymbol(symbol);
46828                 setStructuredTypeMembers(type, members, callSignatures, constructSignatures, indexInfos);
46829             }
46830             else {
46831                 var members = emptySymbols;
46832                 var indexInfos = void 0;
46833                 if (symbol.exports) {
46834                     members = getExportsOfSymbol(symbol);
46835                     if (symbol === globalThisSymbol) {
46836                         var varsOnly_1 = new ts.Map();
46837                         members.forEach(function (p) {
46838                             if (!(p.flags & 418)) {
46839                                 varsOnly_1.set(p.escapedName, p);
46840                             }
46841                         });
46842                         members = varsOnly_1;
46843                     }
46844                 }
46845                 var baseConstructorIndexInfo = void 0;
46846                 setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
46847                 if (symbol.flags & 32) {
46848                     var classType = getDeclaredTypeOfClassOrInterface(symbol);
46849                     var baseConstructorType = getBaseConstructorTypeOfClass(classType);
46850                     if (baseConstructorType.flags & (524288 | 2097152 | 8650752)) {
46851                         members = ts.createSymbolTable(getNamedOrIndexSignatureMembers(members));
46852                         addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
46853                     }
46854                     else if (baseConstructorType === anyType) {
46855                         baseConstructorIndexInfo = createIndexInfo(stringType, anyType, false);
46856                     }
46857                 }
46858                 var indexSymbol = getIndexSymbolFromSymbolTable(members);
46859                 if (indexSymbol) {
46860                     indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
46861                 }
46862                 else {
46863                     if (baseConstructorIndexInfo) {
46864                         indexInfos = ts.append(indexInfos, baseConstructorIndexInfo);
46865                     }
46866                     if (symbol.flags & 384 && (getDeclaredTypeOfSymbol(symbol).flags & 32 ||
46867                         ts.some(type.properties, function (prop) { return !!(getTypeOfSymbol(prop).flags & 296); }))) {
46868                         indexInfos = ts.append(indexInfos, enumNumberIndexInfo);
46869                     }
46870                 }
46871                 setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
46872                 if (symbol.flags & (16 | 8192)) {
46873                     type.callSignatures = getSignaturesOfSymbol(symbol);
46874                 }
46875                 if (symbol.flags & 32) {
46876                     var classType_1 = getDeclaredTypeOfClassOrInterface(symbol);
46877                     var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor")) : ts.emptyArray;
46878                     if (symbol.flags & 16) {
46879                         constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ?
46880                             createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, undefined, sig.minArgumentCount, sig.flags & 39) :
46881                             undefined; }));
46882                     }
46883                     if (!constructSignatures.length) {
46884                         constructSignatures = getDefaultConstructSignatures(classType_1);
46885                     }
46886                     type.constructSignatures = constructSignatures;
46887                 }
46888             }
46889         }
46890         function replaceIndexedAccess(instantiable, type, replacement) {
46891             return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
46892         }
46893         function resolveReverseMappedTypeMembers(type) {
46894             var indexInfo = getIndexInfoOfType(type.source, stringType);
46895             var modifiers = getMappedTypeModifiers(type.mappedType);
46896             var readonlyMask = modifiers & 1 ? false : true;
46897             var optionalMask = modifiers & 4 ? 0 : 16777216;
46898             var indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : ts.emptyArray;
46899             var members = ts.createSymbolTable();
46900             for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
46901                 var prop = _a[_i];
46902                 var checkFlags = 8192 | (readonlyMask && isReadonlySymbol(prop) ? 8 : 0);
46903                 var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.escapedName, checkFlags);
46904                 inferredProp.declarations = prop.declarations;
46905                 inferredProp.nameType = getSymbolLinks(prop).nameType;
46906                 inferredProp.propertyType = getTypeOfSymbol(prop);
46907                 if (type.constraintType.type.flags & 8388608
46908                     && type.constraintType.type.objectType.flags & 262144
46909                     && type.constraintType.type.indexType.flags & 262144) {
46910                     var newTypeParam = type.constraintType.type.objectType;
46911                     var newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam);
46912                     inferredProp.mappedType = newMappedType;
46913                     inferredProp.constraintType = getIndexType(newTypeParam);
46914                 }
46915                 else {
46916                     inferredProp.mappedType = type.mappedType;
46917                     inferredProp.constraintType = type.constraintType;
46918                 }
46919                 members.set(prop.escapedName, inferredProp);
46920             }
46921             setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos);
46922         }
46923         function getLowerBoundOfKeyType(type) {
46924             if (type.flags & 4194304) {
46925                 var t = getApparentType(type.type);
46926                 return isGenericTupleType(t) ? getKnownKeysOfTupleType(t) : getIndexType(t);
46927             }
46928             if (type.flags & 16777216) {
46929                 if (type.root.isDistributive) {
46930                     var checkType = type.checkType;
46931                     var constraint = getLowerBoundOfKeyType(checkType);
46932                     if (constraint !== checkType) {
46933                         return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
46934                     }
46935                 }
46936                 return type;
46937             }
46938             if (type.flags & 1048576) {
46939                 return mapType(type, getLowerBoundOfKeyType);
46940             }
46941             if (type.flags & 2097152) {
46942                 return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
46943             }
46944             return type;
46945         }
46946         function getIsLateCheckFlag(s) {
46947             return ts.getCheckFlags(s) & 4096;
46948         }
46949         function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
46950             for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {
46951                 var prop = _a[_i];
46952                 cb(getLiteralTypeFromProperty(prop, include));
46953             }
46954             if (type.flags & 1) {
46955                 cb(stringType);
46956             }
46957             else {
46958                 for (var _b = 0, _c = getIndexInfosOfType(type); _b < _c.length; _b++) {
46959                     var info = _c[_b];
46960                     if (!stringsOnly || info.keyType.flags & (4 | 134217728)) {
46961                         cb(info.keyType);
46962                     }
46963                 }
46964             }
46965         }
46966         function resolveMappedTypeMembers(type) {
46967             var members = ts.createSymbolTable();
46968             var indexInfos;
46969             setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
46970             var typeParameter = getTypeParameterFromMappedType(type);
46971             var constraintType = getConstraintTypeFromMappedType(type);
46972             var nameType = getNameTypeFromMappedType(type.target || type);
46973             var templateType = getTemplateTypeFromMappedType(type.target || type);
46974             var modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
46975             var templateModifiers = getMappedTypeModifiers(type);
46976             var include = keyofStringsOnly ? 128 : 8576;
46977             if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
46978                 forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, keyofStringsOnly, addMemberForKeyType);
46979             }
46980             else {
46981                 forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
46982             }
46983             setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, indexInfos || ts.emptyArray);
46984             function addMemberForKeyType(keyType) {
46985                 var propNameType = nameType ? instantiateType(nameType, appendTypeMapping(type.mapper, typeParameter, keyType)) : keyType;
46986                 forEachType(propNameType, function (t) { return addMemberForKeyTypeWorker(keyType, t); });
46987             }
46988             function addMemberForKeyTypeWorker(keyType, propNameType) {
46989                 if (isTypeUsableAsPropertyName(propNameType)) {
46990                     var propName = getPropertyNameFromType(propNameType);
46991                     var existingProp = members.get(propName);
46992                     if (existingProp) {
46993                         existingProp.nameType = getUnionType([existingProp.nameType, propNameType]);
46994                         existingProp.keyType = getUnionType([existingProp.keyType, keyType]);
46995                     }
46996                     else {
46997                         var modifiersProp = isTypeUsableAsPropertyName(keyType) ? getPropertyOfType(modifiersType, getPropertyNameFromType(keyType)) : undefined;
46998                         var isOptional = !!(templateModifiers & 4 ||
46999                             !(templateModifiers & 8) && modifiersProp && modifiersProp.flags & 16777216);
47000                         var isReadonly = !!(templateModifiers & 1 ||
47001                             !(templateModifiers & 2) && modifiersProp && isReadonlySymbol(modifiersProp));
47002                         var stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & 16777216;
47003                         var lateFlag = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0;
47004                         var prop = createSymbol(4 | (isOptional ? 16777216 : 0), propName, lateFlag | 262144 | (isReadonly ? 8 : 0) | (stripOptional ? 524288 : 0));
47005                         prop.mappedType = type;
47006                         prop.nameType = propNameType;
47007                         prop.keyType = keyType;
47008                         if (modifiersProp) {
47009                             prop.syntheticOrigin = modifiersProp;
47010                             prop.declarations = nameType ? undefined : modifiersProp.declarations;
47011                         }
47012                         members.set(propName, prop);
47013                     }
47014                 }
47015                 else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 | 32)) {
47016                     var indexKeyType = propNameType.flags & (1 | 4) ? stringType :
47017                         propNameType.flags & (8 | 32) ? numberType :
47018                             propNameType;
47019                     var propType = instantiateType(templateType, appendTypeMapping(type.mapper, typeParameter, keyType));
47020                     var indexInfo = createIndexInfo(indexKeyType, propType, !!(templateModifiers & 1));
47021                     indexInfos = appendIndexInfo(indexInfos, indexInfo, true);
47022                 }
47023             }
47024         }
47025         function getTypeOfMappedSymbol(symbol) {
47026             if (!symbol.type) {
47027                 var mappedType = symbol.mappedType;
47028                 if (!pushTypeResolution(symbol, 0)) {
47029                     mappedType.containsError = true;
47030                     return errorType;
47031                 }
47032                 var templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType);
47033                 var mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.keyType);
47034                 var propType = instantiateType(templateType, mapper);
47035                 var type = strictNullChecks && symbol.flags & 16777216 && !maybeTypeOfKind(propType, 32768 | 16384) ? getOptionalType(propType, true) :
47036                     symbol.checkFlags & 524288 ? removeMissingOrUndefinedType(propType) :
47037                         propType;
47038                 if (!popTypeResolution()) {
47039                     error(currentNode, ts.Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
47040                     type = errorType;
47041                 }
47042                 symbol.type = type;
47043             }
47044             return symbol.type;
47045         }
47046         function getTypeParameterFromMappedType(type) {
47047             return type.typeParameter ||
47048                 (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter)));
47049         }
47050         function getConstraintTypeFromMappedType(type) {
47051             return type.constraintType ||
47052                 (type.constraintType = getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)) || errorType);
47053         }
47054         function getNameTypeFromMappedType(type) {
47055             return type.declaration.nameType ?
47056                 type.nameType || (type.nameType = instantiateType(getTypeFromTypeNode(type.declaration.nameType), type.mapper)) :
47057                 undefined;
47058         }
47059         function getTemplateTypeFromMappedType(type) {
47060             return type.templateType ||
47061                 (type.templateType = type.declaration.type ?
47062                     instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), true, !!(getMappedTypeModifiers(type) & 4)), type.mapper) :
47063                     errorType);
47064         }
47065         function getConstraintDeclarationForMappedType(type) {
47066             return ts.getEffectiveConstraintOfTypeParameter(type.declaration.typeParameter);
47067         }
47068         function isMappedTypeWithKeyofConstraintDeclaration(type) {
47069             var constraintDeclaration = getConstraintDeclarationForMappedType(type);
47070             return constraintDeclaration.kind === 192 &&
47071                 constraintDeclaration.operator === 140;
47072         }
47073         function getModifiersTypeFromMappedType(type) {
47074             if (!type.modifiersType) {
47075                 if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
47076                     type.modifiersType = instantiateType(getTypeFromTypeNode(getConstraintDeclarationForMappedType(type).type), type.mapper);
47077                 }
47078                 else {
47079                     var declaredType = getTypeFromMappedTypeNode(type.declaration);
47080                     var constraint = getConstraintTypeFromMappedType(declaredType);
47081                     var extendedConstraint = constraint && constraint.flags & 262144 ? getConstraintOfTypeParameter(constraint) : constraint;
47082                     type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 ? instantiateType(extendedConstraint.type, type.mapper) : unknownType;
47083                 }
47084             }
47085             return type.modifiersType;
47086         }
47087         function getMappedTypeModifiers(type) {
47088             var declaration = type.declaration;
47089             return (declaration.readonlyToken ? declaration.readonlyToken.kind === 40 ? 2 : 1 : 0) |
47090                 (declaration.questionToken ? declaration.questionToken.kind === 40 ? 8 : 4 : 0);
47091         }
47092         function getMappedTypeOptionality(type) {
47093             var modifiers = getMappedTypeModifiers(type);
47094             return modifiers & 8 ? -1 : modifiers & 4 ? 1 : 0;
47095         }
47096         function getCombinedMappedTypeOptionality(type) {
47097             var optionality = getMappedTypeOptionality(type);
47098             var modifiersType = getModifiersTypeFromMappedType(type);
47099             return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0);
47100         }
47101         function isPartialMappedType(type) {
47102             return !!(ts.getObjectFlags(type) & 32 && getMappedTypeModifiers(type) & 4);
47103         }
47104         function isGenericMappedType(type) {
47105             return !!(ts.getObjectFlags(type) & 32) && isGenericIndexType(getConstraintTypeFromMappedType(type));
47106         }
47107         function resolveStructuredTypeMembers(type) {
47108             if (!type.members) {
47109                 if (type.flags & 524288) {
47110                     if (type.objectFlags & 4) {
47111                         resolveTypeReferenceMembers(type);
47112                     }
47113                     else if (type.objectFlags & 3) {
47114                         resolveClassOrInterfaceMembers(type);
47115                     }
47116                     else if (type.objectFlags & 1024) {
47117                         resolveReverseMappedTypeMembers(type);
47118                     }
47119                     else if (type.objectFlags & 16) {
47120                         resolveAnonymousTypeMembers(type);
47121                     }
47122                     else if (type.objectFlags & 32) {
47123                         resolveMappedTypeMembers(type);
47124                     }
47125                 }
47126                 else if (type.flags & 1048576) {
47127                     resolveUnionTypeMembers(type);
47128                 }
47129                 else if (type.flags & 2097152) {
47130                     resolveIntersectionTypeMembers(type);
47131                 }
47132             }
47133             return type;
47134         }
47135         function getPropertiesOfObjectType(type) {
47136             if (type.flags & 524288) {
47137                 return resolveStructuredTypeMembers(type).properties;
47138             }
47139             return ts.emptyArray;
47140         }
47141         function getPropertyOfObjectType(type, name) {
47142             if (type.flags & 524288) {
47143                 var resolved = resolveStructuredTypeMembers(type);
47144                 var symbol = resolved.members.get(name);
47145                 if (symbol && symbolIsValue(symbol)) {
47146                     return symbol;
47147                 }
47148             }
47149         }
47150         function getPropertiesOfUnionOrIntersectionType(type) {
47151             if (!type.resolvedProperties) {
47152                 var members = ts.createSymbolTable();
47153                 for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
47154                     var current = _a[_i];
47155                     for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) {
47156                         var prop = _c[_b];
47157                         if (!members.has(prop.escapedName)) {
47158                             var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
47159                             if (combinedProp) {
47160                                 members.set(prop.escapedName, combinedProp);
47161                             }
47162                         }
47163                     }
47164                     if (type.flags & 1048576 && getIndexInfosOfType(current).length === 0) {
47165                         break;
47166                     }
47167                 }
47168                 type.resolvedProperties = getNamedMembers(members);
47169             }
47170             return type.resolvedProperties;
47171         }
47172         function getPropertiesOfType(type) {
47173             type = getReducedApparentType(type);
47174             return type.flags & 3145728 ?
47175                 getPropertiesOfUnionOrIntersectionType(type) :
47176                 getPropertiesOfObjectType(type);
47177         }
47178         function forEachPropertyOfType(type, action) {
47179             type = getReducedApparentType(type);
47180             if (type.flags & 3670016) {
47181                 resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
47182                     if (isNamedMember(symbol, escapedName)) {
47183                         action(symbol, escapedName);
47184                     }
47185                 });
47186             }
47187         }
47188         function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
47189             var list = obj.properties;
47190             return list.some(function (property) {
47191                 var nameType = property.name && getLiteralTypeFromPropertyName(property.name);
47192                 var name = nameType && isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : undefined;
47193                 var expected = name === undefined ? undefined : getTypeOfPropertyOfType(contextualType, name);
47194                 return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(property), expected);
47195             });
47196         }
47197         function getAllPossiblePropertiesOfTypes(types) {
47198             var unionType = getUnionType(types);
47199             if (!(unionType.flags & 1048576)) {
47200                 return getAugmentedPropertiesOfType(unionType);
47201             }
47202             var props = ts.createSymbolTable();
47203             for (var _i = 0, types_4 = types; _i < types_4.length; _i++) {
47204                 var memberType = types_4[_i];
47205                 for (var _a = 0, _b = getAugmentedPropertiesOfType(memberType); _a < _b.length; _a++) {
47206                     var escapedName = _b[_a].escapedName;
47207                     if (!props.has(escapedName)) {
47208                         var prop = createUnionOrIntersectionProperty(unionType, escapedName);
47209                         if (prop)
47210                             props.set(escapedName, prop);
47211                     }
47212                 }
47213             }
47214             return ts.arrayFrom(props.values());
47215         }
47216         function getConstraintOfType(type) {
47217             return type.flags & 262144 ? getConstraintOfTypeParameter(type) :
47218                 type.flags & 8388608 ? getConstraintOfIndexedAccess(type) :
47219                     type.flags & 16777216 ? getConstraintOfConditionalType(type) :
47220                         getBaseConstraintOfType(type);
47221         }
47222         function getConstraintOfTypeParameter(typeParameter) {
47223             return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined;
47224         }
47225         function getConstraintOfIndexedAccess(type) {
47226             return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
47227         }
47228         function getSimplifiedTypeOrConstraint(type) {
47229             var simplified = getSimplifiedType(type, false);
47230             return simplified !== type ? simplified : getConstraintOfType(type);
47231         }
47232         function getConstraintFromIndexedAccess(type) {
47233             var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
47234             if (indexConstraint && indexConstraint !== type.indexType) {
47235                 var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint, type.accessFlags);
47236                 if (indexedAccess) {
47237                     return indexedAccess;
47238                 }
47239             }
47240             var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
47241             if (objectConstraint && objectConstraint !== type.objectType) {
47242                 return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType, type.accessFlags);
47243             }
47244             return undefined;
47245         }
47246         function getDefaultConstraintOfConditionalType(type) {
47247             if (!type.resolvedDefaultConstraint) {
47248                 var trueConstraint = getInferredTrueTypeFromConditionalType(type);
47249                 var falseConstraint = getFalseTypeFromConditionalType(type);
47250                 type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
47251             }
47252             return type.resolvedDefaultConstraint;
47253         }
47254         function getConstraintOfDistributiveConditionalType(type) {
47255             if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
47256                 var simplified = getSimplifiedType(type.checkType, false);
47257                 var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
47258                 if (constraint && constraint !== type.checkType) {
47259                     var instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
47260                     if (!(instantiated.flags & 131072)) {
47261                         return instantiated;
47262                     }
47263                 }
47264             }
47265             return undefined;
47266         }
47267         function getConstraintFromConditionalType(type) {
47268             return getConstraintOfDistributiveConditionalType(type) || getDefaultConstraintOfConditionalType(type);
47269         }
47270         function getConstraintOfConditionalType(type) {
47271             return hasNonCircularBaseConstraint(type) ? getConstraintFromConditionalType(type) : undefined;
47272         }
47273         function getEffectiveConstraintOfIntersection(types, targetIsUnion) {
47274             var constraints;
47275             var hasDisjointDomainType = false;
47276             for (var _i = 0, types_5 = types; _i < types_5.length; _i++) {
47277                 var t = types_5[_i];
47278                 if (t.flags & 465829888) {
47279                     var constraint = getConstraintOfType(t);
47280                     while (constraint && constraint.flags & (262144 | 4194304 | 16777216)) {
47281                         constraint = getConstraintOfType(constraint);
47282                     }
47283                     if (constraint) {
47284                         constraints = ts.append(constraints, constraint);
47285                         if (targetIsUnion) {
47286                             constraints = ts.append(constraints, t);
47287                         }
47288                     }
47289                 }
47290                 else if (t.flags & 469892092) {
47291                     hasDisjointDomainType = true;
47292                 }
47293             }
47294             if (constraints && (targetIsUnion || hasDisjointDomainType)) {
47295                 if (hasDisjointDomainType) {
47296                     for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
47297                         var t = types_6[_a];
47298                         if (t.flags & 469892092) {
47299                             constraints = ts.append(constraints, t);
47300                         }
47301                     }
47302                 }
47303                 return getIntersectionType(constraints);
47304             }
47305             return undefined;
47306         }
47307         function getBaseConstraintOfType(type) {
47308             if (type.flags & (58982400 | 3145728 | 134217728 | 268435456)) {
47309                 var constraint = getResolvedBaseConstraint(type);
47310                 return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined;
47311             }
47312             return type.flags & 4194304 ? keyofConstraintType : undefined;
47313         }
47314         function getBaseConstraintOrType(type) {
47315             return getBaseConstraintOfType(type) || type;
47316         }
47317         function hasNonCircularBaseConstraint(type) {
47318             return getResolvedBaseConstraint(type) !== circularConstraintType;
47319         }
47320         function getResolvedBaseConstraint(type) {
47321             if (type.resolvedBaseConstraint) {
47322                 return type.resolvedBaseConstraint;
47323             }
47324             var stack = [];
47325             return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type);
47326             function getImmediateBaseConstraint(t) {
47327                 if (!t.immediateBaseConstraint) {
47328                     if (!pushTypeResolution(t, 4)) {
47329                         return circularConstraintType;
47330                     }
47331                     var result = void 0;
47332                     if (stack.length < 10 || stack.length < 50 && !isDeeplyNestedType(t, stack, stack.length)) {
47333                         stack.push(t);
47334                         result = computeBaseConstraint(getSimplifiedType(t, false));
47335                         stack.pop();
47336                     }
47337                     if (!popTypeResolution()) {
47338                         if (t.flags & 262144) {
47339                             var errorNode = getConstraintDeclaration(t);
47340                             if (errorNode) {
47341                                 var diagnostic = error(errorNode, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t));
47342                                 if (currentNode && !ts.isNodeDescendantOf(errorNode, currentNode) && !ts.isNodeDescendantOf(currentNode, errorNode)) {
47343                                     ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(currentNode, ts.Diagnostics.Circularity_originates_in_type_at_this_location));
47344                                 }
47345                             }
47346                         }
47347                         result = circularConstraintType;
47348                     }
47349                     t.immediateBaseConstraint = result || noConstraintType;
47350                 }
47351                 return t.immediateBaseConstraint;
47352             }
47353             function getBaseConstraint(t) {
47354                 var c = getImmediateBaseConstraint(t);
47355                 return c !== noConstraintType && c !== circularConstraintType ? c : undefined;
47356             }
47357             function computeBaseConstraint(t) {
47358                 if (t.flags & 262144) {
47359                     var constraint = getConstraintFromTypeParameter(t);
47360                     return t.isThisType || !constraint ?
47361                         constraint :
47362                         getBaseConstraint(constraint);
47363                 }
47364                 if (t.flags & 3145728) {
47365                     var types = t.types;
47366                     var baseTypes = [];
47367                     var different = false;
47368                     for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
47369                         var type_3 = types_7[_i];
47370                         var baseType = getBaseConstraint(type_3);
47371                         if (baseType) {
47372                             if (baseType !== type_3) {
47373                                 different = true;
47374                             }
47375                             baseTypes.push(baseType);
47376                         }
47377                         else {
47378                             different = true;
47379                         }
47380                     }
47381                     if (!different) {
47382                         return t;
47383                     }
47384                     return t.flags & 1048576 && baseTypes.length === types.length ? getUnionType(baseTypes) :
47385                         t.flags & 2097152 && baseTypes.length ? getIntersectionType(baseTypes) :
47386                             undefined;
47387                 }
47388                 if (t.flags & 4194304) {
47389                     return keyofConstraintType;
47390                 }
47391                 if (t.flags & 134217728) {
47392                     var types = t.types;
47393                     var constraints = ts.mapDefined(types, getBaseConstraint);
47394                     return constraints.length === types.length ? getTemplateLiteralType(t.texts, constraints) : stringType;
47395                 }
47396                 if (t.flags & 268435456) {
47397                     var constraint = getBaseConstraint(t.type);
47398                     return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
47399                 }
47400                 if (t.flags & 8388608) {
47401                     var baseObjectType = getBaseConstraint(t.objectType);
47402                     var baseIndexType = getBaseConstraint(t.indexType);
47403                     var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags);
47404                     return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
47405                 }
47406                 if (t.flags & 16777216) {
47407                     var constraint = getConstraintFromConditionalType(t);
47408                     return constraint && getBaseConstraint(constraint);
47409                 }
47410                 if (t.flags & 33554432) {
47411                     return getBaseConstraint(t.substitute);
47412                 }
47413                 return t;
47414             }
47415         }
47416         function getApparentTypeOfIntersectionType(type) {
47417             return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type, true));
47418         }
47419         function getResolvedTypeParameterDefault(typeParameter) {
47420             if (!typeParameter.default) {
47421                 if (typeParameter.target) {
47422                     var targetDefault = getResolvedTypeParameterDefault(typeParameter.target);
47423                     typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType;
47424                 }
47425                 else {
47426                     typeParameter.default = resolvingDefaultType;
47427                     var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameterDeclaration(decl) && decl.default; });
47428                     var defaultType = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType;
47429                     if (typeParameter.default === resolvingDefaultType) {
47430                         typeParameter.default = defaultType;
47431                     }
47432                 }
47433             }
47434             else if (typeParameter.default === resolvingDefaultType) {
47435                 typeParameter.default = circularConstraintType;
47436             }
47437             return typeParameter.default;
47438         }
47439         function getDefaultFromTypeParameter(typeParameter) {
47440             var defaultType = getResolvedTypeParameterDefault(typeParameter);
47441             return defaultType !== noConstraintType && defaultType !== circularConstraintType ? defaultType : undefined;
47442         }
47443         function hasNonCircularTypeParameterDefault(typeParameter) {
47444             return getResolvedTypeParameterDefault(typeParameter) !== circularConstraintType;
47445         }
47446         function hasTypeParameterDefault(typeParameter) {
47447             return !!(typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameterDeclaration(decl) && decl.default; }));
47448         }
47449         function getApparentTypeOfMappedType(type) {
47450             return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
47451         }
47452         function getResolvedApparentTypeOfMappedType(type) {
47453             var typeVariable = getHomomorphicTypeVariable(type);
47454             if (typeVariable && !type.declaration.nameType) {
47455                 var constraint = getConstraintOfTypeParameter(typeVariable);
47456                 if (constraint && (isArrayType(constraint) || isTupleType(constraint))) {
47457                     return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
47458                 }
47459             }
47460             return type;
47461         }
47462         function getApparentType(type) {
47463             var t = type.flags & 465829888 ? getBaseConstraintOfType(type) || unknownType : type;
47464             return ts.getObjectFlags(t) & 32 ? getApparentTypeOfMappedType(t) :
47465                 t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
47466                     t.flags & 402653316 ? globalStringType :
47467                         t.flags & 296 ? globalNumberType :
47468                             t.flags & 2112 ? getGlobalBigIntType(languageVersion >= 7) :
47469                                 t.flags & 528 ? globalBooleanType :
47470                                     t.flags & 12288 ? getGlobalESSymbolType(languageVersion >= 2) :
47471                                         t.flags & 67108864 ? emptyObjectType :
47472                                             t.flags & 4194304 ? keyofConstraintType :
47473                                                 t.flags & 2 && !strictNullChecks ? emptyObjectType :
47474                                                     t;
47475         }
47476         function getReducedApparentType(type) {
47477             return getReducedType(getApparentType(getReducedType(type)));
47478         }
47479         function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
47480             var _a, _b;
47481             var singleProp;
47482             var propSet;
47483             var indexTypes;
47484             var isUnion = containingType.flags & 1048576;
47485             var optionalFlag = isUnion ? 0 : 16777216;
47486             var syntheticFlag = 4;
47487             var checkFlags = isUnion ? 0 : 8;
47488             var mergedInstantiations = false;
47489             for (var _i = 0, _c = containingType.types; _i < _c.length; _i++) {
47490                 var current = _c[_i];
47491                 var type = getApparentType(current);
47492                 if (!(isErrorType(type) || type.flags & 131072)) {
47493                     var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
47494                     var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
47495                     if (prop) {
47496                         if (isUnion) {
47497                             optionalFlag |= (prop.flags & 16777216);
47498                         }
47499                         else {
47500                             optionalFlag &= prop.flags;
47501                         }
47502                         if (!singleProp) {
47503                             singleProp = prop;
47504                         }
47505                         else if (prop !== singleProp) {
47506                             var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
47507                             if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 : 0; }) === -1) {
47508                                 mergedInstantiations = !!singleProp.parent && !!ts.length(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(singleProp.parent));
47509                             }
47510                             else {
47511                                 if (!propSet) {
47512                                     propSet = new ts.Map();
47513                                     propSet.set(getSymbolId(singleProp), singleProp);
47514                                 }
47515                                 var id = getSymbolId(prop);
47516                                 if (!propSet.has(id)) {
47517                                     propSet.set(id, prop);
47518                                 }
47519                             }
47520                         }
47521                         if (isUnion && isReadonlySymbol(prop)) {
47522                             checkFlags |= 8;
47523                         }
47524                         else if (!isUnion && !isReadonlySymbol(prop)) {
47525                             checkFlags &= ~8;
47526                         }
47527                         checkFlags |= (!(modifiers & 24) ? 256 : 0) |
47528                             (modifiers & 16 ? 512 : 0) |
47529                             (modifiers & 8 ? 1024 : 0) |
47530                             (modifiers & 32 ? 2048 : 0);
47531                         if (!isPrototypeProperty(prop)) {
47532                             syntheticFlag = 2;
47533                         }
47534                     }
47535                     else if (isUnion) {
47536                         var indexInfo = !isLateBoundName(name) && getApplicableIndexInfoForName(type, name);
47537                         if (indexInfo) {
47538                             checkFlags |= 32 | (indexInfo.isReadonly ? 8 : 0);
47539                             indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
47540                         }
47541                         else if (isObjectLiteralType(type) && !(ts.getObjectFlags(type) & 4194304)) {
47542                             checkFlags |= 32;
47543                             indexTypes = ts.append(indexTypes, undefinedType);
47544                         }
47545                         else {
47546                             checkFlags |= 16;
47547                         }
47548                     }
47549                 }
47550             }
47551             if (!singleProp || isUnion && (propSet || checkFlags & 48) && checkFlags & (1024 | 512)) {
47552                 return undefined;
47553             }
47554             if (!propSet && !(checkFlags & 16) && !indexTypes) {
47555                 if (mergedInstantiations) {
47556                     var clone_1 = createSymbolWithType(singleProp, singleProp.type);
47557                     clone_1.parent = (_b = (_a = singleProp.valueDeclaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.parent;
47558                     clone_1.containingType = containingType;
47559                     clone_1.mapper = singleProp.mapper;
47560                     return clone_1;
47561                 }
47562                 else {
47563                     return singleProp;
47564                 }
47565             }
47566             var props = propSet ? ts.arrayFrom(propSet.values()) : [singleProp];
47567             var declarations;
47568             var firstType;
47569             var nameType;
47570             var propTypes = [];
47571             var firstValueDeclaration;
47572             var hasNonUniformValueDeclaration = false;
47573             for (var _d = 0, props_1 = props; _d < props_1.length; _d++) {
47574                 var prop = props_1[_d];
47575                 if (!firstValueDeclaration) {
47576                     firstValueDeclaration = prop.valueDeclaration;
47577                 }
47578                 else if (prop.valueDeclaration && prop.valueDeclaration !== firstValueDeclaration) {
47579                     hasNonUniformValueDeclaration = true;
47580                 }
47581                 declarations = ts.addRange(declarations, prop.declarations);
47582                 var type = getTypeOfSymbol(prop);
47583                 if (!firstType) {
47584                     firstType = type;
47585                     nameType = getSymbolLinks(prop).nameType;
47586                 }
47587                 else if (type !== firstType) {
47588                     checkFlags |= 64;
47589                 }
47590                 if (isLiteralType(type) || isPatternLiteralType(type)) {
47591                     checkFlags |= 128;
47592                 }
47593                 if (type.flags & 131072) {
47594                     checkFlags |= 131072;
47595                 }
47596                 propTypes.push(type);
47597             }
47598             ts.addRange(propTypes, indexTypes);
47599             var result = createSymbol(4 | optionalFlag, name, syntheticFlag | checkFlags);
47600             result.containingType = containingType;
47601             if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
47602                 result.valueDeclaration = firstValueDeclaration;
47603                 if (firstValueDeclaration.symbol.parent) {
47604                     result.parent = firstValueDeclaration.symbol.parent;
47605                 }
47606             }
47607             result.declarations = declarations;
47608             result.nameType = nameType;
47609             if (propTypes.length > 2) {
47610                 result.checkFlags |= 65536;
47611                 result.deferralParent = containingType;
47612                 result.deferralConstituents = propTypes;
47613             }
47614             else {
47615                 result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
47616             }
47617             return result;
47618         }
47619         function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
47620             var _a, _b;
47621             var property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) === null || _a === void 0 ? void 0 : _a.get(name)) ||
47622                 !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) === null || _b === void 0 ? void 0 : _b.get(name) : undefined;
47623             if (!property) {
47624                 property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
47625                 if (property) {
47626                     var properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = ts.createSymbolTable()) : type.propertyCache || (type.propertyCache = ts.createSymbolTable());
47627                     properties.set(name, property);
47628                 }
47629             }
47630             return property;
47631         }
47632         function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
47633             var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
47634             return property && !(ts.getCheckFlags(property) & 16) ? property : undefined;
47635         }
47636         function getReducedType(type) {
47637             if (type.flags & 1048576 && type.objectFlags & 33554432) {
47638                 return type.resolvedReducedType || (type.resolvedReducedType = getReducedUnionType(type));
47639             }
47640             else if (type.flags & 2097152) {
47641                 if (!(type.objectFlags & 33554432)) {
47642                     type.objectFlags |= 33554432 |
47643                         (ts.some(getPropertiesOfUnionOrIntersectionType(type), isNeverReducedProperty) ? 67108864 : 0);
47644                 }
47645                 return type.objectFlags & 67108864 ? neverType : type;
47646             }
47647             return type;
47648         }
47649         function getReducedUnionType(unionType) {
47650             var reducedTypes = ts.sameMap(unionType.types, getReducedType);
47651             if (reducedTypes === unionType.types) {
47652                 return unionType;
47653             }
47654             var reduced = getUnionType(reducedTypes);
47655             if (reduced.flags & 1048576) {
47656                 reduced.resolvedReducedType = reduced;
47657             }
47658             return reduced;
47659         }
47660         function isNeverReducedProperty(prop) {
47661             return isDiscriminantWithNeverType(prop) || isConflictingPrivateProperty(prop);
47662         }
47663         function isDiscriminantWithNeverType(prop) {
47664             return !(prop.flags & 16777216) &&
47665                 (ts.getCheckFlags(prop) & (192 | 131072)) === 192 &&
47666                 !!(getTypeOfSymbol(prop).flags & 131072);
47667         }
47668         function isConflictingPrivateProperty(prop) {
47669             return !prop.valueDeclaration && !!(ts.getCheckFlags(prop) & 1024);
47670         }
47671         function elaborateNeverIntersection(errorInfo, type) {
47672             if (type.flags & 2097152 && ts.getObjectFlags(type) & 67108864) {
47673                 var neverProp = ts.find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
47674                 if (neverProp) {
47675                     return ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, typeToString(type, undefined, 536870912), symbolToString(neverProp));
47676                 }
47677                 var privateProp = ts.find(getPropertiesOfUnionOrIntersectionType(type), isConflictingPrivateProperty);
47678                 if (privateProp) {
47679                     return ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, typeToString(type, undefined, 536870912), symbolToString(privateProp));
47680                 }
47681             }
47682             return errorInfo;
47683         }
47684         function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
47685             type = getReducedApparentType(type);
47686             if (type.flags & 524288) {
47687                 var resolved = resolveStructuredTypeMembers(type);
47688                 var symbol = resolved.members.get(name);
47689                 if (symbol && symbolIsValue(symbol)) {
47690                     return symbol;
47691                 }
47692                 if (skipObjectFunctionPropertyAugment)
47693                     return undefined;
47694                 var functionType = resolved === anyFunctionType ? globalFunctionType :
47695                     resolved.callSignatures.length ? globalCallableFunctionType :
47696                         resolved.constructSignatures.length ? globalNewableFunctionType :
47697                             undefined;
47698                 if (functionType) {
47699                     var symbol_1 = getPropertyOfObjectType(functionType, name);
47700                     if (symbol_1) {
47701                         return symbol_1;
47702                     }
47703                 }
47704                 return getPropertyOfObjectType(globalObjectType, name);
47705             }
47706             if (type.flags & 3145728) {
47707                 return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
47708             }
47709             return undefined;
47710         }
47711         function getSignaturesOfStructuredType(type, kind) {
47712             if (type.flags & 3670016) {
47713                 var resolved = resolveStructuredTypeMembers(type);
47714                 return kind === 0 ? resolved.callSignatures : resolved.constructSignatures;
47715             }
47716             return ts.emptyArray;
47717         }
47718         function getSignaturesOfType(type, kind) {
47719             return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
47720         }
47721         function findIndexInfo(indexInfos, keyType) {
47722             return ts.find(indexInfos, function (info) { return info.keyType === keyType; });
47723         }
47724         function findApplicableIndexInfo(indexInfos, keyType) {
47725             var stringIndexInfo;
47726             var applicableInfo;
47727             var applicableInfos;
47728             for (var _i = 0, indexInfos_1 = indexInfos; _i < indexInfos_1.length; _i++) {
47729                 var info = indexInfos_1[_i];
47730                 if (info.keyType === stringType) {
47731                     stringIndexInfo = info;
47732                 }
47733                 else if (isApplicableIndexType(keyType, info.keyType)) {
47734                     if (!applicableInfo) {
47735                         applicableInfo = info;
47736                     }
47737                     else {
47738                         (applicableInfos || (applicableInfos = [applicableInfo])).push(info);
47739                     }
47740                 }
47741             }
47742             return applicableInfos ? createIndexInfo(unknownType, getIntersectionType(ts.map(applicableInfos, function (info) { return info.type; })), ts.reduceLeft(applicableInfos, function (isReadonly, info) { return isReadonly && info.isReadonly; }, true)) :
47743                 applicableInfo ? applicableInfo :
47744                     stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo :
47745                         undefined;
47746         }
47747         function isApplicableIndexType(source, target) {
47748             return isTypeAssignableTo(source, target) ||
47749                 target === stringType && isTypeAssignableTo(source, numberType) ||
47750                 target === numberType && !!(source.flags & 128) && isNumericLiteralName(source.value);
47751         }
47752         function getIndexInfosOfStructuredType(type) {
47753             if (type.flags & 3670016) {
47754                 var resolved = resolveStructuredTypeMembers(type);
47755                 return resolved.indexInfos;
47756             }
47757             return ts.emptyArray;
47758         }
47759         function getIndexInfosOfType(type) {
47760             return getIndexInfosOfStructuredType(getReducedApparentType(type));
47761         }
47762         function getIndexInfoOfType(type, keyType) {
47763             return findIndexInfo(getIndexInfosOfType(type), keyType);
47764         }
47765         function getIndexTypeOfType(type, keyType) {
47766             var _a;
47767             return (_a = getIndexInfoOfType(type, keyType)) === null || _a === void 0 ? void 0 : _a.type;
47768         }
47769         function getApplicableIndexInfos(type, keyType) {
47770             return getIndexInfosOfType(type).filter(function (info) { return isApplicableIndexType(keyType, info.keyType); });
47771         }
47772         function getApplicableIndexInfo(type, keyType) {
47773             return findApplicableIndexInfo(getIndexInfosOfType(type), keyType);
47774         }
47775         function getApplicableIndexInfoForName(type, name) {
47776             return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts.unescapeLeadingUnderscores(name)));
47777         }
47778         function getTypeParametersFromDeclaration(declaration) {
47779             var result;
47780             for (var _i = 0, _a = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _a.length; _i++) {
47781                 var node = _a[_i];
47782                 result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
47783             }
47784             return result;
47785         }
47786         function symbolsToArray(symbols) {
47787             var result = [];
47788             symbols.forEach(function (symbol, id) {
47789                 if (!isReservedMemberName(id)) {
47790                     result.push(symbol);
47791                 }
47792             });
47793             return result;
47794         }
47795         function isJSDocOptionalParameter(node) {
47796             return ts.isInJSFile(node) && (node.type && node.type.kind === 314
47797                 || ts.getJSDocParameterTags(node).some(function (_a) {
47798                     var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
47799                     return isBracketed || !!typeExpression && typeExpression.type.kind === 314;
47800                 }));
47801         }
47802         function tryFindAmbientModule(moduleName, withAugmentations) {
47803             if (ts.isExternalModuleNameRelative(moduleName)) {
47804                 return undefined;
47805             }
47806             var symbol = getSymbol(globals, '"' + moduleName + '"', 512);
47807             return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
47808         }
47809         function isOptionalParameter(node) {
47810             if (ts.hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isJSDocOptionalParameter(node)) {
47811                 return true;
47812             }
47813             if (node.initializer) {
47814                 var signature = getSignatureFromDeclaration(node.parent);
47815                 var parameterIndex = node.parent.parameters.indexOf(node);
47816                 ts.Debug.assert(parameterIndex >= 0);
47817                 return parameterIndex >= getMinArgumentCount(signature, 1 | 2);
47818             }
47819             var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent);
47820             if (iife) {
47821                 return !node.type &&
47822                     !node.dotDotDotToken &&
47823                     node.parent.parameters.indexOf(node) >= iife.arguments.length;
47824             }
47825             return false;
47826         }
47827         function isOptionalPropertyDeclaration(node) {
47828             return ts.isPropertyDeclaration(node) && node.questionToken;
47829         }
47830         function isOptionalJSDocPropertyLikeTag(node) {
47831             if (!ts.isJSDocPropertyLikeTag(node)) {
47832                 return false;
47833             }
47834             var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
47835             return isBracketed || !!typeExpression && typeExpression.type.kind === 314;
47836         }
47837         function createTypePredicate(kind, parameterName, parameterIndex, type) {
47838             return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
47839         }
47840         function getMinTypeArgumentCount(typeParameters) {
47841             var minTypeArgumentCount = 0;
47842             if (typeParameters) {
47843                 for (var i = 0; i < typeParameters.length; i++) {
47844                     if (!hasTypeParameterDefault(typeParameters[i])) {
47845                         minTypeArgumentCount = i + 1;
47846                     }
47847                 }
47848             }
47849             return minTypeArgumentCount;
47850         }
47851         function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, isJavaScriptImplicitAny) {
47852             var numTypeParameters = ts.length(typeParameters);
47853             if (!numTypeParameters) {
47854                 return [];
47855             }
47856             var numTypeArguments = ts.length(typeArguments);
47857             if (isJavaScriptImplicitAny || (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters)) {
47858                 var result = typeArguments ? typeArguments.slice() : [];
47859                 for (var i = numTypeArguments; i < numTypeParameters; i++) {
47860                     result[i] = errorType;
47861                 }
47862                 var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
47863                 for (var i = numTypeArguments; i < numTypeParameters; i++) {
47864                     var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
47865                     if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
47866                         defaultType = anyType;
47867                     }
47868                     result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
47869                 }
47870                 result.length = typeParameters.length;
47871                 return result;
47872             }
47873             return typeArguments && typeArguments.slice();
47874         }
47875         function getSignatureFromDeclaration(declaration) {
47876             var links = getNodeLinks(declaration);
47877             if (!links.resolvedSignature) {
47878                 var parameters = [];
47879                 var flags = 0;
47880                 var minArgumentCount = 0;
47881                 var thisParameter = void 0;
47882                 var hasThisParameter = false;
47883                 var iife = ts.getImmediatelyInvokedFunctionExpression(declaration);
47884                 var isJSConstructSignature = ts.isJSDocConstructSignature(declaration);
47885                 var isUntypedSignatureInJSFile = !iife &&
47886                     ts.isInJSFile(declaration) &&
47887                     ts.isValueSignatureDeclaration(declaration) &&
47888                     !ts.hasJSDocParameterTags(declaration) &&
47889                     !ts.getJSDocType(declaration);
47890                 if (isUntypedSignatureInJSFile) {
47891                     flags |= 32;
47892                 }
47893                 for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
47894                     var param = declaration.parameters[i];
47895                     var paramSymbol = param.symbol;
47896                     var type = ts.isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type;
47897                     if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) {
47898                         var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 111551, undefined, undefined, false);
47899                         paramSymbol = resolvedSymbol;
47900                     }
47901                     if (i === 0 && paramSymbol.escapedName === "this") {
47902                         hasThisParameter = true;
47903                         thisParameter = param.symbol;
47904                     }
47905                     else {
47906                         parameters.push(paramSymbol);
47907                     }
47908                     if (type && type.kind === 195) {
47909                         flags |= 2;
47910                     }
47911                     var isOptionalParameter_1 = isOptionalJSDocPropertyLikeTag(param) ||
47912                         param.initializer || param.questionToken || ts.isRestParameter(param) ||
47913                         iife && parameters.length > iife.arguments.length && !type ||
47914                         isJSDocOptionalParameter(param);
47915                     if (!isOptionalParameter_1) {
47916                         minArgumentCount = parameters.length;
47917                     }
47918                 }
47919                 if ((declaration.kind === 171 || declaration.kind === 172) &&
47920                     hasBindableName(declaration) &&
47921                     (!hasThisParameter || !thisParameter)) {
47922                     var otherKind = declaration.kind === 171 ? 172 : 171;
47923                     var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
47924                     if (other) {
47925                         thisParameter = getAnnotatedAccessorThisParameter(other);
47926                     }
47927                 }
47928                 var classType = declaration.kind === 170 ?
47929                     getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
47930                     : undefined;
47931                 var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
47932                 if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
47933                     flags |= 1;
47934                 }
47935                 if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128) ||
47936                     ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128)) {
47937                     flags |= 4;
47938                 }
47939                 links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, undefined, undefined, minArgumentCount, flags);
47940             }
47941             return links.resolvedSignature;
47942         }
47943         function maybeAddJsSyntheticRestParameter(declaration, parameters) {
47944             if (ts.isJSDocSignature(declaration) || !containsArgumentsReference(declaration)) {
47945                 return false;
47946             }
47947             var lastParam = ts.lastOrUndefined(declaration.parameters);
47948             var lastParamTags = lastParam ? ts.getJSDocParameterTags(lastParam) : ts.getJSDocTags(declaration).filter(ts.isJSDocParameterTag);
47949             var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
47950                 return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
47951             });
47952             var syntheticArgsSymbol = createSymbol(3, "args", 32768);
47953             syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
47954             if (lastParamVariadicType) {
47955                 parameters.pop();
47956             }
47957             parameters.push(syntheticArgsSymbol);
47958             return true;
47959         }
47960         function getSignatureOfTypeTag(node) {
47961             if (!(ts.isInJSFile(node) && ts.isFunctionLikeDeclaration(node)))
47962                 return undefined;
47963             var typeTag = ts.getJSDocTypeTag(node);
47964             return (typeTag === null || typeTag === void 0 ? void 0 : typeTag.typeExpression) && getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression));
47965         }
47966         function getReturnTypeOfTypeTag(node) {
47967             var signature = getSignatureOfTypeTag(node);
47968             return signature && getReturnTypeOfSignature(signature);
47969         }
47970         function containsArgumentsReference(declaration) {
47971             var links = getNodeLinks(declaration);
47972             if (links.containsArgumentsReference === undefined) {
47973                 if (links.flags & 8192) {
47974                     links.containsArgumentsReference = true;
47975                 }
47976                 else {
47977                     links.containsArgumentsReference = traverse(declaration.body);
47978                 }
47979             }
47980             return links.containsArgumentsReference;
47981             function traverse(node) {
47982                 if (!node)
47983                     return false;
47984                 switch (node.kind) {
47985                     case 79:
47986                         return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol;
47987                     case 166:
47988                     case 168:
47989                     case 171:
47990                     case 172:
47991                         return node.name.kind === 161
47992                             && traverse(node.name);
47993                     case 205:
47994                     case 206:
47995                         return traverse(node.expression);
47996                     default:
47997                         return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
47998                 }
47999             }
48000         }
48001         function getSignaturesOfSymbol(symbol) {
48002             if (!symbol || !symbol.declarations)
48003                 return ts.emptyArray;
48004             var result = [];
48005             for (var i = 0; i < symbol.declarations.length; i++) {
48006                 var decl = symbol.declarations[i];
48007                 if (!ts.isFunctionLike(decl))
48008                     continue;
48009                 if (i > 0 && decl.body) {
48010                     var previous = symbol.declarations[i - 1];
48011                     if (decl.parent === previous.parent && decl.kind === previous.kind && decl.pos === previous.end) {
48012                         continue;
48013                     }
48014                 }
48015                 result.push(getSignatureFromDeclaration(decl));
48016             }
48017             return result;
48018         }
48019         function resolveExternalModuleTypeByLiteral(name) {
48020             var moduleSym = resolveExternalModuleName(name, name);
48021             if (moduleSym) {
48022                 var resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);
48023                 if (resolvedModuleSymbol) {
48024                     return getTypeOfSymbol(resolvedModuleSymbol);
48025                 }
48026             }
48027             return anyType;
48028         }
48029         function getThisTypeOfSignature(signature) {
48030             if (signature.thisParameter) {
48031                 return getTypeOfSymbol(signature.thisParameter);
48032             }
48033         }
48034         function getTypePredicateOfSignature(signature) {
48035             if (!signature.resolvedTypePredicate) {
48036                 if (signature.target) {
48037                     var targetTypePredicate = getTypePredicateOfSignature(signature.target);
48038                     signature.resolvedTypePredicate = targetTypePredicate ? instantiateTypePredicate(targetTypePredicate, signature.mapper) : noTypePredicate;
48039                 }
48040                 else if (signature.compositeSignatures) {
48041                     signature.resolvedTypePredicate = getUnionOrIntersectionTypePredicate(signature.compositeSignatures, signature.compositeKind) || noTypePredicate;
48042                 }
48043                 else {
48044                     var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
48045                     var jsdocPredicate = void 0;
48046                     if (!type && ts.isInJSFile(signature.declaration)) {
48047                         var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
48048                         if (jsdocSignature && signature !== jsdocSignature) {
48049                             jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
48050                         }
48051                     }
48052                     signature.resolvedTypePredicate = type && ts.isTypePredicateNode(type) ?
48053                         createTypePredicateFromTypePredicateNode(type, signature) :
48054                         jsdocPredicate || noTypePredicate;
48055                 }
48056                 ts.Debug.assert(!!signature.resolvedTypePredicate);
48057             }
48058             return signature.resolvedTypePredicate === noTypePredicate ? undefined : signature.resolvedTypePredicate;
48059         }
48060         function createTypePredicateFromTypePredicateNode(node, signature) {
48061             var parameterName = node.parameterName;
48062             var type = node.type && getTypeFromTypeNode(node.type);
48063             return parameterName.kind === 191 ?
48064                 createTypePredicate(node.assertsModifier ? 2 : 0, undefined, undefined, type) :
48065                 createTypePredicate(node.assertsModifier ? 3 : 1, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
48066         }
48067         function getUnionOrIntersectionType(types, kind, unionReduction) {
48068             return kind !== 2097152 ? getUnionType(types, unionReduction) : getIntersectionType(types);
48069         }
48070         function getReturnTypeOfSignature(signature) {
48071             if (!signature.resolvedReturnType) {
48072                 if (!pushTypeResolution(signature, 3)) {
48073                     return errorType;
48074                 }
48075                 var type = signature.target ? instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper) :
48076                     signature.compositeSignatures ? instantiateType(getUnionOrIntersectionType(ts.map(signature.compositeSignatures, getReturnTypeOfSignature), signature.compositeKind, 2), signature.mapper) :
48077                         getReturnTypeFromAnnotation(signature.declaration) ||
48078                             (ts.nodeIsMissing(signature.declaration.body) ? anyType : getReturnTypeFromBody(signature.declaration));
48079                 if (signature.flags & 8) {
48080                     type = addOptionalTypeMarker(type);
48081                 }
48082                 else if (signature.flags & 16) {
48083                     type = getOptionalType(type);
48084                 }
48085                 if (!popTypeResolution()) {
48086                     if (signature.declaration) {
48087                         var typeNode = ts.getEffectiveReturnTypeNode(signature.declaration);
48088                         if (typeNode) {
48089                             error(typeNode, ts.Diagnostics.Return_type_annotation_circularly_references_itself);
48090                         }
48091                         else if (noImplicitAny) {
48092                             var declaration = signature.declaration;
48093                             var name = ts.getNameOfDeclaration(declaration);
48094                             if (name) {
48095                                 error(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(name));
48096                             }
48097                             else {
48098                                 error(declaration, ts.Diagnostics.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);
48099                             }
48100                         }
48101                     }
48102                     type = anyType;
48103                 }
48104                 signature.resolvedReturnType = type;
48105             }
48106             return signature.resolvedReturnType;
48107         }
48108         function getReturnTypeFromAnnotation(declaration) {
48109             if (declaration.kind === 170) {
48110                 return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
48111             }
48112             if (ts.isJSDocConstructSignature(declaration)) {
48113                 return getTypeFromTypeNode(declaration.parameters[0].type);
48114             }
48115             var typeNode = ts.getEffectiveReturnTypeNode(declaration);
48116             if (typeNode) {
48117                 return getTypeFromTypeNode(typeNode);
48118             }
48119             if (declaration.kind === 171 && hasBindableName(declaration)) {
48120                 var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
48121                 if (jsDocType) {
48122                     return jsDocType;
48123                 }
48124                 var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 172);
48125                 var setterType = getAnnotatedAccessorType(setter);
48126                 if (setterType) {
48127                     return setterType;
48128                 }
48129             }
48130             return getReturnTypeOfTypeTag(declaration);
48131         }
48132         function isResolvingReturnTypeOfSignature(signature) {
48133             return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, 3) >= 0;
48134         }
48135         function getRestTypeOfSignature(signature) {
48136             return tryGetRestTypeOfSignature(signature) || anyType;
48137         }
48138         function tryGetRestTypeOfSignature(signature) {
48139             if (signatureHasRestParameter(signature)) {
48140                 var sigRestType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
48141                 var restType = isTupleType(sigRestType) ? getRestTypeOfTupleType(sigRestType) : sigRestType;
48142                 return restType && getIndexTypeOfType(restType, numberType);
48143             }
48144             return undefined;
48145         }
48146         function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
48147             var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
48148             if (inferredTypeParameters) {
48149                 var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
48150                 if (returnSignature) {
48151                     var newReturnSignature = cloneSignature(returnSignature);
48152                     newReturnSignature.typeParameters = inferredTypeParameters;
48153                     var newInstantiatedSignature = cloneSignature(instantiatedSignature);
48154                     newInstantiatedSignature.resolvedReturnType = getOrCreateTypeFromSignature(newReturnSignature);
48155                     return newInstantiatedSignature;
48156                 }
48157             }
48158             return instantiatedSignature;
48159         }
48160         function getSignatureInstantiationWithoutFillingInTypeArguments(signature, typeArguments) {
48161             var instantiations = signature.instantiations || (signature.instantiations = new ts.Map());
48162             var id = getTypeListId(typeArguments);
48163             var instantiation = instantiations.get(id);
48164             if (!instantiation) {
48165                 instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments));
48166             }
48167             return instantiation;
48168         }
48169         function createSignatureInstantiation(signature, typeArguments) {
48170             return instantiateSignature(signature, createSignatureTypeMapper(signature, typeArguments), true);
48171         }
48172         function createSignatureTypeMapper(signature, typeArguments) {
48173             return createTypeMapper(signature.typeParameters, typeArguments);
48174         }
48175         function getErasedSignature(signature) {
48176             return signature.typeParameters ?
48177                 signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) :
48178                 signature;
48179         }
48180         function createErasedSignature(signature) {
48181             return instantiateSignature(signature, createTypeEraser(signature.typeParameters), true);
48182         }
48183         function getCanonicalSignature(signature) {
48184             return signature.typeParameters ?
48185                 signature.canonicalSignatureCache || (signature.canonicalSignatureCache = createCanonicalSignature(signature)) :
48186                 signature;
48187         }
48188         function createCanonicalSignature(signature) {
48189             return getSignatureInstantiation(signature, ts.map(signature.typeParameters, function (tp) { return tp.target && !getConstraintOfTypeParameter(tp.target) ? tp.target : tp; }), ts.isInJSFile(signature.declaration));
48190         }
48191         function getBaseSignature(signature) {
48192             var typeParameters = signature.typeParameters;
48193             if (typeParameters) {
48194                 if (signature.baseSignatureCache) {
48195                     return signature.baseSignatureCache;
48196                 }
48197                 var typeEraser = createTypeEraser(typeParameters);
48198                 var baseConstraintMapper_1 = createTypeMapper(typeParameters, ts.map(typeParameters, function (tp) { return getConstraintOfTypeParameter(tp) || unknownType; }));
48199                 var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(tp, baseConstraintMapper_1) || unknownType; });
48200                 for (var i = 0; i < typeParameters.length - 1; i++) {
48201                     baseConstraints = instantiateTypes(baseConstraints, baseConstraintMapper_1);
48202                 }
48203                 baseConstraints = instantiateTypes(baseConstraints, typeEraser);
48204                 return signature.baseSignatureCache = instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), true);
48205             }
48206             return signature;
48207         }
48208         function getOrCreateTypeFromSignature(signature) {
48209             if (!signature.isolatedSignatureType) {
48210                 var kind = signature.declaration ? signature.declaration.kind : 0;
48211                 var isConstructor = kind === 170 || kind === 174 || kind === 179;
48212                 var type = createObjectType(16);
48213                 type.members = emptySymbols;
48214                 type.properties = ts.emptyArray;
48215                 type.callSignatures = !isConstructor ? [signature] : ts.emptyArray;
48216                 type.constructSignatures = isConstructor ? [signature] : ts.emptyArray;
48217                 type.indexInfos = ts.emptyArray;
48218                 signature.isolatedSignatureType = type;
48219             }
48220             return signature.isolatedSignatureType;
48221         }
48222         function getIndexSymbol(symbol) {
48223             return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : undefined;
48224         }
48225         function getIndexSymbolFromSymbolTable(symbolTable) {
48226             return symbolTable.get("__index");
48227         }
48228         function createIndexInfo(keyType, type, isReadonly, declaration) {
48229             return { keyType: keyType, type: type, isReadonly: isReadonly, declaration: declaration };
48230         }
48231         function getIndexInfosOfSymbol(symbol) {
48232             var indexSymbol = getIndexSymbol(symbol);
48233             return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol) : ts.emptyArray;
48234         }
48235         function getIndexInfosOfIndexSymbol(indexSymbol) {
48236             if (indexSymbol.declarations) {
48237                 var indexInfos_2 = [];
48238                 var _loop_14 = function (declaration) {
48239                     if (declaration.parameters.length === 1) {
48240                         var parameter = declaration.parameters[0];
48241                         if (parameter.type) {
48242                             forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
48243                                 if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_2, keyType)) {
48244                                     indexInfos_2.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64), declaration));
48245                                 }
48246                             });
48247                         }
48248                     }
48249                 };
48250                 for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
48251                     var declaration = _a[_i];
48252                     _loop_14(declaration);
48253                 }
48254                 return indexInfos_2;
48255             }
48256             return ts.emptyArray;
48257         }
48258         function isValidIndexKeyType(type) {
48259             return !!(type.flags & (4 | 8 | 4096)) || isPatternLiteralType(type) ||
48260                 !!(type.flags & 2097152) && !isGenericType(type) && ts.some(type.types, isValidIndexKeyType);
48261         }
48262         function getConstraintDeclaration(type) {
48263             return ts.mapDefined(ts.filter(type.symbol && type.symbol.declarations, ts.isTypeParameterDeclaration), ts.getEffectiveConstraintOfTypeParameter)[0];
48264         }
48265         function getInferredTypeParameterConstraint(typeParameter) {
48266             var _a;
48267             var inferences;
48268             if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
48269                 for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
48270                     var declaration = _b[_i];
48271                     if (declaration.parent.kind === 189) {
48272                         var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
48273                         if (grandParent.kind === 177) {
48274                             var typeReference = grandParent;
48275                             var typeParameters = getTypeParametersForTypeReference(typeReference);
48276                             if (typeParameters) {
48277                                 var index = typeReference.typeArguments.indexOf(childTypeParameter);
48278                                 if (index < typeParameters.length) {
48279                                     var declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]);
48280                                     if (declaredConstraint) {
48281                                         var mapper = createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReference, typeParameters));
48282                                         var constraint = instantiateType(declaredConstraint, mapper);
48283                                         if (constraint !== typeParameter) {
48284                                             inferences = ts.append(inferences, constraint);
48285                                         }
48286                                     }
48287                                 }
48288                             }
48289                         }
48290                         else if (grandParent.kind === 163 && grandParent.dotDotDotToken ||
48291                             grandParent.kind === 185 ||
48292                             grandParent.kind === 196 && grandParent.dotDotDotToken) {
48293                             inferences = ts.append(inferences, createArrayType(unknownType));
48294                         }
48295                         else if (grandParent.kind === 198) {
48296                             inferences = ts.append(inferences, stringType);
48297                         }
48298                         else if (grandParent.kind === 162 && grandParent.parent.kind === 194) {
48299                             inferences = ts.append(inferences, keyofConstraintType);
48300                         }
48301                         else if (grandParent.kind === 194 && grandParent.type &&
48302                             ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 188 &&
48303                             grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 194 &&
48304                             grandParent.parent.checkType.type) {
48305                             var checkMappedType_1 = grandParent.parent.checkType;
48306                             var nodeType = getTypeFromTypeNode(checkMappedType_1.type);
48307                             inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
48308                         }
48309                     }
48310                 }
48311             }
48312             return inferences && getIntersectionType(inferences);
48313         }
48314         function getConstraintFromTypeParameter(typeParameter) {
48315             if (!typeParameter.constraint) {
48316                 if (typeParameter.target) {
48317                     var targetConstraint = getConstraintOfTypeParameter(typeParameter.target);
48318                     typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType;
48319                 }
48320                 else {
48321                     var constraintDeclaration = getConstraintDeclaration(typeParameter);
48322                     if (!constraintDeclaration) {
48323                         typeParameter.constraint = getInferredTypeParameterConstraint(typeParameter) || noConstraintType;
48324                     }
48325                     else {
48326                         var type = getTypeFromTypeNode(constraintDeclaration);
48327                         if (type.flags & 1 && !isErrorType(type)) {
48328                             type = constraintDeclaration.parent.parent.kind === 194 ? keyofConstraintType : unknownType;
48329                         }
48330                         typeParameter.constraint = type;
48331                     }
48332                 }
48333             }
48334             return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
48335         }
48336         function getParentSymbolOfTypeParameter(typeParameter) {
48337             var tp = ts.getDeclarationOfKind(typeParameter.symbol, 162);
48338             var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent;
48339             return host && getSymbolOfNode(host);
48340         }
48341         function getTypeListId(types) {
48342             var result = "";
48343             if (types) {
48344                 var length_4 = types.length;
48345                 var i = 0;
48346                 while (i < length_4) {
48347                     var startId = types[i].id;
48348                     var count = 1;
48349                     while (i + count < length_4 && types[i + count].id === startId + count) {
48350                         count++;
48351                     }
48352                     if (result.length) {
48353                         result += ",";
48354                     }
48355                     result += startId;
48356                     if (count > 1) {
48357                         result += ":" + count;
48358                     }
48359                     i += count;
48360                 }
48361             }
48362             return result;
48363         }
48364         function getAliasId(aliasSymbol, aliasTypeArguments) {
48365             return aliasSymbol ? "@".concat(getSymbolId(aliasSymbol)) + (aliasTypeArguments ? ":".concat(getTypeListId(aliasTypeArguments)) : "") : "";
48366         }
48367         function getPropagatingFlagsOfTypes(types, excludeKinds) {
48368             var result = 0;
48369             for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
48370                 var type = types_8[_i];
48371                 if (!(type.flags & excludeKinds)) {
48372                     result |= ts.getObjectFlags(type);
48373                 }
48374             }
48375             return result & 917504;
48376         }
48377         function createTypeReference(target, typeArguments) {
48378             var id = getTypeListId(typeArguments);
48379             var type = target.instantiations.get(id);
48380             if (!type) {
48381                 type = createObjectType(4, target.symbol);
48382                 target.instantiations.set(id, type);
48383                 type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0;
48384                 type.target = target;
48385                 type.resolvedTypeArguments = typeArguments;
48386             }
48387             return type;
48388         }
48389         function cloneTypeReference(source) {
48390             var type = createType(source.flags);
48391             type.symbol = source.symbol;
48392             type.objectFlags = source.objectFlags;
48393             type.target = source.target;
48394             type.resolvedTypeArguments = source.resolvedTypeArguments;
48395             return type;
48396         }
48397         function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) {
48398             if (!aliasSymbol) {
48399                 aliasSymbol = getAliasSymbolForTypeNode(node);
48400                 var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
48401                 aliasTypeArguments = mapper ? instantiateTypes(localAliasTypeArguments, mapper) : localAliasTypeArguments;
48402             }
48403             var type = createObjectType(4, target.symbol);
48404             type.target = target;
48405             type.node = node;
48406             type.mapper = mapper;
48407             type.aliasSymbol = aliasSymbol;
48408             type.aliasTypeArguments = aliasTypeArguments;
48409             return type;
48410         }
48411         function getTypeArguments(type) {
48412             var _a, _b;
48413             if (!type.resolvedTypeArguments) {
48414                 if (!pushTypeResolution(type, 6)) {
48415                     return ((_a = type.target.localTypeParameters) === null || _a === void 0 ? void 0 : _a.map(function () { return errorType; })) || ts.emptyArray;
48416                 }
48417                 var node = type.node;
48418                 var typeArguments = !node ? ts.emptyArray :
48419                     node.kind === 177 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) :
48420                         node.kind === 182 ? [getTypeFromTypeNode(node.elementType)] :
48421                             ts.map(node.elements, getTypeFromTypeNode);
48422                 if (popTypeResolution()) {
48423                     type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
48424                 }
48425                 else {
48426                     type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) === null || _b === void 0 ? void 0 : _b.map(function () { return errorType; })) || ts.emptyArray;
48427                     error(type.node || currentNode, type.target.symbol ? ts.Diagnostics.Type_arguments_for_0_circularly_reference_themselves : ts.Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol));
48428                 }
48429             }
48430             return type.resolvedTypeArguments;
48431         }
48432         function getTypeReferenceArity(type) {
48433             return ts.length(type.target.typeParameters);
48434         }
48435         function getTypeFromClassOrInterfaceReference(node, symbol) {
48436             var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol));
48437             var typeParameters = type.localTypeParameters;
48438             if (typeParameters) {
48439                 var numTypeArguments = ts.length(node.typeArguments);
48440                 var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
48441                 var isJs = ts.isInJSFile(node);
48442                 var isJsImplicitAny = !noImplicitAny && isJs;
48443                 if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) {
48444                     var missingAugmentsTag = isJs && ts.isExpressionWithTypeArguments(node) && !ts.isJSDocAugmentsTag(node.parent);
48445                     var diag = minTypeArgumentCount === typeParameters.length ?
48446                         missingAugmentsTag ?
48447                             ts.Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag :
48448                             ts.Diagnostics.Generic_type_0_requires_1_type_argument_s :
48449                         missingAugmentsTag ?
48450                             ts.Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag :
48451                             ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments;
48452                     var typeStr = typeToString(type, undefined, 2);
48453                     error(node, diag, typeStr, minTypeArgumentCount, typeParameters.length);
48454                     if (!isJs) {
48455                         return errorType;
48456                     }
48457                 }
48458                 if (node.kind === 177 && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) {
48459                     return createDeferredTypeReference(type, node, undefined);
48460                 }
48461                 var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgumentsFromTypeReferenceNode(node), typeParameters, minTypeArgumentCount, isJs));
48462                 return createTypeReference(type, typeArguments);
48463             }
48464             return checkNoTypeArguments(node, symbol) ? type : errorType;
48465         }
48466         function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
48467             var type = getDeclaredTypeOfSymbol(symbol);
48468             if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
48469                 return getStringMappingType(symbol, typeArguments[0]);
48470             }
48471             var links = getSymbolLinks(symbol);
48472             var typeParameters = links.typeParameters;
48473             var id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
48474             var instantiation = links.instantiations.get(id);
48475             if (!instantiation) {
48476                 links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(symbol.valueDeclaration))), aliasSymbol, aliasTypeArguments));
48477             }
48478             return instantiation;
48479         }
48480         function getTypeFromTypeAliasReference(node, symbol) {
48481             if (ts.getCheckFlags(symbol) & 1048576) {
48482                 var typeArguments = typeArgumentsFromTypeReferenceNode(node);
48483                 var id = getAliasId(symbol, typeArguments);
48484                 var errorType_1 = errorTypes.get(id);
48485                 if (!errorType_1) {
48486                     errorType_1 = createIntrinsicType(1, "error");
48487                     errorType_1.aliasSymbol = symbol;
48488                     errorType_1.aliasTypeArguments = typeArguments;
48489                     errorTypes.set(id, errorType_1);
48490                 }
48491                 return errorType_1;
48492             }
48493             var type = getDeclaredTypeOfSymbol(symbol);
48494             var typeParameters = getSymbolLinks(symbol).typeParameters;
48495             if (typeParameters) {
48496                 var numTypeArguments = ts.length(node.typeArguments);
48497                 var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
48498                 if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
48499                     error(node, minTypeArgumentCount === typeParameters.length ?
48500                         ts.Diagnostics.Generic_type_0_requires_1_type_argument_s :
48501                         ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length);
48502                     return errorType;
48503                 }
48504                 var aliasSymbol = getAliasSymbolForTypeNode(node);
48505                 var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : undefined;
48506                 return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
48507             }
48508             return checkNoTypeArguments(node, symbol) ? type : errorType;
48509         }
48510         function isLocalTypeAlias(symbol) {
48511             var _a;
48512             var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isTypeAlias);
48513             return !!(declaration && ts.getContainingFunction(declaration));
48514         }
48515         function getTypeReferenceName(node) {
48516             switch (node.kind) {
48517                 case 177:
48518                     return node.typeName;
48519                 case 227:
48520                     var expr = node.expression;
48521                     if (ts.isEntityNameExpression(expr)) {
48522                         return expr;
48523                     }
48524             }
48525             return undefined;
48526         }
48527         function getSymbolPath(symbol) {
48528             return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName;
48529         }
48530         function getUnresolvedSymbolForEntityName(name) {
48531             var identifier = name.kind === 160 ? name.right :
48532                 name.kind === 205 ? name.name :
48533                     name;
48534             var text = identifier.escapedText;
48535             if (text) {
48536                 var parentSymbol = name.kind === 160 ? getUnresolvedSymbolForEntityName(name.left) :
48537                     name.kind === 205 ? getUnresolvedSymbolForEntityName(name.expression) :
48538                         undefined;
48539                 var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text;
48540                 var result = unresolvedSymbols.get(path);
48541                 if (!result) {
48542                     unresolvedSymbols.set(path, result = createSymbol(524288, text, 1048576));
48543                     result.parent = parentSymbol;
48544                     result.declaredType = unresolvedType;
48545                 }
48546                 return result;
48547             }
48548             return unknownSymbol;
48549         }
48550         function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) {
48551             var name = getTypeReferenceName(typeReference);
48552             if (!name) {
48553                 return unknownSymbol;
48554             }
48555             var symbol = resolveEntityName(name, meaning, ignoreErrors);
48556             return symbol && symbol !== unknownSymbol ? symbol :
48557                 ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name);
48558         }
48559         function getTypeReferenceType(node, symbol) {
48560             if (symbol === unknownSymbol) {
48561                 return errorType;
48562             }
48563             symbol = getExpandoSymbol(symbol) || symbol;
48564             if (symbol.flags & (32 | 64)) {
48565                 return getTypeFromClassOrInterfaceReference(node, symbol);
48566             }
48567             if (symbol.flags & 524288) {
48568                 return getTypeFromTypeAliasReference(node, symbol);
48569             }
48570             var res = tryGetDeclaredTypeOfSymbol(symbol);
48571             if (res) {
48572                 return checkNoTypeArguments(node, symbol) ? getRegularTypeOfLiteralType(res) : errorType;
48573             }
48574             if (symbol.flags & 111551 && isJSDocTypeReference(node)) {
48575                 var jsdocType = getTypeFromJSDocValueReference(node, symbol);
48576                 if (jsdocType) {
48577                     return jsdocType;
48578                 }
48579                 else {
48580                     resolveTypeReferenceName(node, 788968);
48581                     return getTypeOfSymbol(symbol);
48582                 }
48583             }
48584             return errorType;
48585         }
48586         function getTypeFromJSDocValueReference(node, symbol) {
48587             var links = getNodeLinks(node);
48588             if (!links.resolvedJSDocType) {
48589                 var valueType = getTypeOfSymbol(symbol);
48590                 var typeType = valueType;
48591                 if (symbol.valueDeclaration) {
48592                     var isImportTypeWithQualifier = node.kind === 199 && node.qualifier;
48593                     if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) {
48594                         typeType = getTypeReferenceType(node, valueType.symbol);
48595                     }
48596                 }
48597                 links.resolvedJSDocType = typeType;
48598             }
48599             return links.resolvedJSDocType;
48600         }
48601         function getSubstitutionType(baseType, substitute) {
48602             if (substitute.flags & 3 || substitute === baseType) {
48603                 return baseType;
48604             }
48605             var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute));
48606             var cached = substitutionTypes.get(id);
48607             if (cached) {
48608                 return cached;
48609             }
48610             var result = createType(33554432);
48611             result.baseType = baseType;
48612             result.substitute = substitute;
48613             substitutionTypes.set(id, result);
48614             return result;
48615         }
48616         function isUnaryTupleTypeNode(node) {
48617             return node.kind === 183 && node.elements.length === 1;
48618         }
48619         function getImpliedConstraint(type, checkNode, extendsNode) {
48620             return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) :
48621                 getActualTypeVariable(getTypeFromTypeNode(checkNode)) === type ? getTypeFromTypeNode(extendsNode) :
48622                     undefined;
48623         }
48624         function getConditionalFlowTypeOfType(type, node) {
48625             var constraints;
48626             var covariant = true;
48627             while (node && !ts.isStatement(node) && node.kind !== 318) {
48628                 var parent = node.parent;
48629                 if (parent.kind === 163) {
48630                     covariant = !covariant;
48631                 }
48632                 if ((covariant || type.flags & 8650752) && parent.kind === 188 && node === parent.trueType) {
48633                     var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType);
48634                     if (constraint) {
48635                         constraints = ts.append(constraints, constraint);
48636                     }
48637                 }
48638                 node = parent;
48639             }
48640             return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
48641         }
48642         function isJSDocTypeReference(node) {
48643             return !!(node.flags & 4194304) && (node.kind === 177 || node.kind === 199);
48644         }
48645         function checkNoTypeArguments(node, symbol) {
48646             if (node.typeArguments) {
48647                 error(node, ts.Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? ts.declarationNameToString(node.typeName) : anon);
48648                 return false;
48649             }
48650             return true;
48651         }
48652         function getIntendedTypeFromJSDocTypeReference(node) {
48653             if (ts.isIdentifier(node.typeName)) {
48654                 var typeArgs = node.typeArguments;
48655                 switch (node.typeName.escapedText) {
48656                     case "String":
48657                         checkNoTypeArguments(node);
48658                         return stringType;
48659                     case "Number":
48660                         checkNoTypeArguments(node);
48661                         return numberType;
48662                     case "Boolean":
48663                         checkNoTypeArguments(node);
48664                         return booleanType;
48665                     case "Void":
48666                         checkNoTypeArguments(node);
48667                         return voidType;
48668                     case "Undefined":
48669                         checkNoTypeArguments(node);
48670                         return undefinedType;
48671                     case "Null":
48672                         checkNoTypeArguments(node);
48673                         return nullType;
48674                     case "Function":
48675                     case "function":
48676                         checkNoTypeArguments(node);
48677                         return globalFunctionType;
48678                     case "array":
48679                         return (!typeArgs || !typeArgs.length) && !noImplicitAny ? anyArrayType : undefined;
48680                     case "promise":
48681                         return (!typeArgs || !typeArgs.length) && !noImplicitAny ? createPromiseType(anyType) : undefined;
48682                     case "Object":
48683                         if (typeArgs && typeArgs.length === 2) {
48684                             if (ts.isJSDocIndexSignature(node)) {
48685                                 var indexed = getTypeFromTypeNode(typeArgs[0]);
48686                                 var target = getTypeFromTypeNode(typeArgs[1]);
48687                                 var indexInfo = indexed === stringType || indexed === numberType ? [createIndexInfo(indexed, target, false)] : ts.emptyArray;
48688                                 return createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, indexInfo);
48689                             }
48690                             return anyType;
48691                         }
48692                         checkNoTypeArguments(node);
48693                         return !noImplicitAny ? anyType : undefined;
48694                 }
48695             }
48696         }
48697         function getTypeFromJSDocNullableTypeNode(node) {
48698             var type = getTypeFromTypeNode(node.type);
48699             return strictNullChecks ? getNullableType(type, 65536) : type;
48700         }
48701         function getTypeFromTypeReference(node) {
48702             var links = getNodeLinks(node);
48703             if (!links.resolvedType) {
48704                 if (ts.isConstTypeReference(node) && ts.isAssertionExpression(node.parent)) {
48705                     links.resolvedSymbol = unknownSymbol;
48706                     return links.resolvedType = checkExpressionCached(node.parent.expression);
48707                 }
48708                 var symbol = void 0;
48709                 var type = void 0;
48710                 var meaning = 788968;
48711                 if (isJSDocTypeReference(node)) {
48712                     type = getIntendedTypeFromJSDocTypeReference(node);
48713                     if (!type) {
48714                         symbol = resolveTypeReferenceName(node, meaning, true);
48715                         if (symbol === unknownSymbol) {
48716                             symbol = resolveTypeReferenceName(node, meaning | 111551);
48717                         }
48718                         else {
48719                             resolveTypeReferenceName(node, meaning);
48720                         }
48721                         type = getTypeReferenceType(node, symbol);
48722                     }
48723                 }
48724                 if (!type) {
48725                     symbol = resolveTypeReferenceName(node, meaning);
48726                     type = getTypeReferenceType(node, symbol);
48727                 }
48728                 links.resolvedSymbol = symbol;
48729                 links.resolvedType = type;
48730             }
48731             return links.resolvedType;
48732         }
48733         function typeArgumentsFromTypeReferenceNode(node) {
48734             return ts.map(node.typeArguments, getTypeFromTypeNode);
48735         }
48736         function getTypeFromTypeQueryNode(node) {
48737             var links = getNodeLinks(node);
48738             if (!links.resolvedType) {
48739                 var type = ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
48740                 links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
48741             }
48742             return links.resolvedType;
48743         }
48744         function getTypeOfGlobalSymbol(symbol, arity) {
48745             function getTypeDeclaration(symbol) {
48746                 var declarations = symbol.declarations;
48747                 if (declarations) {
48748                     for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
48749                         var declaration = declarations_3[_i];
48750                         switch (declaration.kind) {
48751                             case 256:
48752                             case 257:
48753                             case 259:
48754                                 return declaration;
48755                         }
48756                     }
48757                 }
48758             }
48759             if (!symbol) {
48760                 return arity ? emptyGenericType : emptyObjectType;
48761             }
48762             var type = getDeclaredTypeOfSymbol(symbol);
48763             if (!(type.flags & 524288)) {
48764                 error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, ts.symbolName(symbol));
48765                 return arity ? emptyGenericType : emptyObjectType;
48766             }
48767             if (ts.length(type.typeParameters) !== arity) {
48768                 error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts.symbolName(symbol), arity);
48769                 return arity ? emptyGenericType : emptyObjectType;
48770             }
48771             return type;
48772         }
48773         function getGlobalValueSymbol(name, reportErrors) {
48774             return getGlobalSymbol(name, 111551, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined);
48775         }
48776         function getGlobalTypeSymbol(name, reportErrors) {
48777             return getGlobalSymbol(name, 788968, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
48778         }
48779         function getGlobalTypeAliasSymbol(name, arity, reportErrors) {
48780             var symbol = getGlobalSymbol(name, 788968, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined);
48781             if (symbol) {
48782                 getDeclaredTypeOfSymbol(symbol);
48783                 if (ts.length(getSymbolLinks(symbol).typeParameters) !== arity) {
48784                     var decl = symbol.declarations && ts.find(symbol.declarations, ts.isTypeAliasDeclaration);
48785                     error(decl, ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts.symbolName(symbol), arity);
48786                     return undefined;
48787                 }
48788             }
48789             return symbol;
48790         }
48791         function getGlobalSymbol(name, meaning, diagnostic) {
48792             return resolveName(undefined, name, meaning, diagnostic, name, false);
48793         }
48794         function getGlobalType(name, arity, reportErrors) {
48795             var symbol = getGlobalTypeSymbol(name, reportErrors);
48796             return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined;
48797         }
48798         function getGlobalTypedPropertyDescriptorType() {
48799             return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", 1, true) || emptyGenericType);
48800         }
48801         function getGlobalTemplateStringsArrayType() {
48802             return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", 0, true) || emptyObjectType);
48803         }
48804         function getGlobalImportMetaType() {
48805             return deferredGlobalImportMetaType || (deferredGlobalImportMetaType = getGlobalType("ImportMeta", 0, true) || emptyObjectType);
48806         }
48807         function getGlobalImportMetaExpressionType() {
48808             if (!deferredGlobalImportMetaExpressionType) {
48809                 var symbol = createSymbol(0, "ImportMetaExpression");
48810                 var importMetaType = getGlobalImportMetaType();
48811                 var metaPropertySymbol = createSymbol(4, "meta", 8);
48812                 metaPropertySymbol.parent = symbol;
48813                 metaPropertySymbol.type = importMetaType;
48814                 var members = ts.createSymbolTable([metaPropertySymbol]);
48815                 symbol.members = members;
48816                 deferredGlobalImportMetaExpressionType = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48817             }
48818             return deferredGlobalImportMetaExpressionType;
48819         }
48820         function getGlobalImportCallOptionsType(reportErrors) {
48821             return (deferredGlobalImportCallOptionsType || (deferredGlobalImportCallOptionsType = getGlobalType("ImportCallOptions", 0, reportErrors))) || emptyObjectType;
48822         }
48823         function getGlobalESSymbolConstructorSymbol(reportErrors) {
48824             return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors));
48825         }
48826         function getGlobalESSymbolConstructorTypeSymbol(reportErrors) {
48827             return deferredGlobalESSymbolConstructorTypeSymbol || (deferredGlobalESSymbolConstructorTypeSymbol = getGlobalTypeSymbol("SymbolConstructor", reportErrors));
48828         }
48829         function getGlobalESSymbolType(reportErrors) {
48830             return (deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, reportErrors))) || emptyObjectType;
48831         }
48832         function getGlobalPromiseType(reportErrors) {
48833             return (deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors))) || emptyGenericType;
48834         }
48835         function getGlobalPromiseLikeType(reportErrors) {
48836             return (deferredGlobalPromiseLikeType || (deferredGlobalPromiseLikeType = getGlobalType("PromiseLike", 1, reportErrors))) || emptyGenericType;
48837         }
48838         function getGlobalPromiseConstructorSymbol(reportErrors) {
48839             return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors));
48840         }
48841         function getGlobalPromiseConstructorLikeType(reportErrors) {
48842             return (deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", 0, reportErrors))) || emptyObjectType;
48843         }
48844         function getGlobalAsyncIterableType(reportErrors) {
48845             return (deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", 1, reportErrors))) || emptyGenericType;
48846         }
48847         function getGlobalAsyncIteratorType(reportErrors) {
48848             return (deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", 3, reportErrors))) || emptyGenericType;
48849         }
48850         function getGlobalAsyncIterableIteratorType(reportErrors) {
48851             return (deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", 1, reportErrors))) || emptyGenericType;
48852         }
48853         function getGlobalAsyncGeneratorType(reportErrors) {
48854             return (deferredGlobalAsyncGeneratorType || (deferredGlobalAsyncGeneratorType = getGlobalType("AsyncGenerator", 3, reportErrors))) || emptyGenericType;
48855         }
48856         function getGlobalIterableType(reportErrors) {
48857             return (deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", 1, reportErrors))) || emptyGenericType;
48858         }
48859         function getGlobalIteratorType(reportErrors) {
48860             return (deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", 3, reportErrors))) || emptyGenericType;
48861         }
48862         function getGlobalIterableIteratorType(reportErrors) {
48863             return (deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", 1, reportErrors))) || emptyGenericType;
48864         }
48865         function getGlobalGeneratorType(reportErrors) {
48866             return (deferredGlobalGeneratorType || (deferredGlobalGeneratorType = getGlobalType("Generator", 3, reportErrors))) || emptyGenericType;
48867         }
48868         function getGlobalIteratorYieldResultType(reportErrors) {
48869             return (deferredGlobalIteratorYieldResultType || (deferredGlobalIteratorYieldResultType = getGlobalType("IteratorYieldResult", 1, reportErrors))) || emptyGenericType;
48870         }
48871         function getGlobalIteratorReturnResultType(reportErrors) {
48872             return (deferredGlobalIteratorReturnResultType || (deferredGlobalIteratorReturnResultType = getGlobalType("IteratorReturnResult", 1, reportErrors))) || emptyGenericType;
48873         }
48874         function getGlobalTypeOrUndefined(name, arity) {
48875             if (arity === void 0) { arity = 0; }
48876             var symbol = getGlobalSymbol(name, 788968, undefined);
48877             return symbol && getTypeOfGlobalSymbol(symbol, arity);
48878         }
48879         function getGlobalExtractSymbol() {
48880             deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalTypeAliasSymbol("Extract", 2, true) || unknownSymbol);
48881             return deferredGlobalExtractSymbol === unknownSymbol ? undefined : deferredGlobalExtractSymbol;
48882         }
48883         function getGlobalOmitSymbol() {
48884             deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalTypeAliasSymbol("Omit", 2, true) || unknownSymbol);
48885             return deferredGlobalOmitSymbol === unknownSymbol ? undefined : deferredGlobalOmitSymbol;
48886         }
48887         function getGlobalAwaitedSymbol(reportErrors) {
48888             deferredGlobalAwaitedSymbol || (deferredGlobalAwaitedSymbol = getGlobalTypeAliasSymbol("Awaited", 1, reportErrors) || (reportErrors ? unknownSymbol : undefined));
48889             return deferredGlobalAwaitedSymbol === unknownSymbol ? undefined : deferredGlobalAwaitedSymbol;
48890         }
48891         function getGlobalBigIntType(reportErrors) {
48892             return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, reportErrors))) || emptyObjectType;
48893         }
48894         function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
48895             return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
48896         }
48897         function createTypedPropertyDescriptorType(propertyType) {
48898             return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]);
48899         }
48900         function createIterableType(iteratedType) {
48901             return createTypeFromGenericGlobalType(getGlobalIterableType(true), [iteratedType]);
48902         }
48903         function createArrayType(elementType, readonly) {
48904             return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
48905         }
48906         function getTupleElementFlags(node) {
48907             switch (node.kind) {
48908                 case 184:
48909                     return 2;
48910                 case 185:
48911                     return getRestTypeElementFlags(node);
48912                 case 196:
48913                     return node.questionToken ? 2 :
48914                         node.dotDotDotToken ? getRestTypeElementFlags(node) :
48915                             1;
48916                 default:
48917                     return 1;
48918             }
48919         }
48920         function getRestTypeElementFlags(node) {
48921             return getArrayElementTypeNode(node.type) ? 4 : 8;
48922         }
48923         function getArrayOrTupleTargetType(node) {
48924             var readonly = isReadonlyTypeOperator(node.parent);
48925             var elementType = getArrayElementTypeNode(node);
48926             if (elementType) {
48927                 return readonly ? globalReadonlyArrayType : globalArrayType;
48928             }
48929             var elementFlags = ts.map(node.elements, getTupleElementFlags);
48930             var missingName = ts.some(node.elements, function (e) { return e.kind !== 196; });
48931             return getTupleTargetType(elementFlags, readonly, missingName ? undefined : node.elements);
48932         }
48933         function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
48934             return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 182 ? mayResolveTypeAlias(node.elementType) :
48935                 node.kind === 183 ? ts.some(node.elements, mayResolveTypeAlias) :
48936                     hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias));
48937         }
48938         function isResolvedByTypeAlias(node) {
48939             var parent = node.parent;
48940             switch (parent.kind) {
48941                 case 190:
48942                 case 196:
48943                 case 177:
48944                 case 186:
48945                 case 187:
48946                 case 193:
48947                 case 188:
48948                 case 192:
48949                 case 182:
48950                 case 183:
48951                     return isResolvedByTypeAlias(parent);
48952                 case 258:
48953                     return true;
48954             }
48955             return false;
48956         }
48957         function mayResolveTypeAlias(node) {
48958             switch (node.kind) {
48959                 case 177:
48960                     return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968).flags & 524288);
48961                 case 180:
48962                     return true;
48963                 case 192:
48964                     return node.operator !== 153 && mayResolveTypeAlias(node.type);
48965                 case 190:
48966                 case 184:
48967                 case 196:
48968                 case 314:
48969                 case 312:
48970                 case 313:
48971                 case 307:
48972                     return mayResolveTypeAlias(node.type);
48973                 case 185:
48974                     return node.type.kind !== 182 || mayResolveTypeAlias(node.type.elementType);
48975                 case 186:
48976                 case 187:
48977                     return ts.some(node.types, mayResolveTypeAlias);
48978                 case 193:
48979                     return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType);
48980                 case 188:
48981                     return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) ||
48982                         mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType);
48983             }
48984             return false;
48985         }
48986         function getTypeFromArrayOrTupleTypeNode(node) {
48987             var links = getNodeLinks(node);
48988             if (!links.resolvedType) {
48989                 var target = getArrayOrTupleTargetType(node);
48990                 if (target === emptyGenericType) {
48991                     links.resolvedType = emptyObjectType;
48992                 }
48993                 else if (!(node.kind === 183 && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8); })) && isDeferredTypeReferenceNode(node)) {
48994                     links.resolvedType = node.kind === 183 && node.elements.length === 0 ? target :
48995                         createDeferredTypeReference(target, node, undefined);
48996                 }
48997                 else {
48998                     var elementTypes = node.kind === 182 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode);
48999                     links.resolvedType = createNormalizedTypeReference(target, elementTypes);
49000                 }
49001             }
49002             return links.resolvedType;
49003         }
49004         function isReadonlyTypeOperator(node) {
49005             return ts.isTypeOperatorNode(node) && node.operator === 144;
49006         }
49007         function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) {
49008             if (readonly === void 0) { readonly = false; }
49009             var tupleTarget = getTupleTargetType(elementFlags || ts.map(elementTypes, function (_) { return 1; }), readonly, namedMemberDeclarations);
49010             return tupleTarget === emptyGenericType ? emptyObjectType :
49011                 elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) :
49012                     tupleTarget;
49013         }
49014         function getTupleTargetType(elementFlags, readonly, namedMemberDeclarations) {
49015             if (elementFlags.length === 1 && elementFlags[0] & 4) {
49016                 return readonly ? globalReadonlyArrayType : globalArrayType;
49017             }
49018             var key = ts.map(elementFlags, function (f) { return f & 1 ? "#" : f & 2 ? "?" : f & 4 ? "." : "*"; }).join() +
49019                 (readonly ? "R" : "") +
49020                 (namedMemberDeclarations && namedMemberDeclarations.length ? "," + ts.map(namedMemberDeclarations, getNodeId).join(",") : "");
49021             var type = tupleTypes.get(key);
49022             if (!type) {
49023                 tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
49024             }
49025             return type;
49026         }
49027         function createTupleTargetType(elementFlags, readonly, namedMemberDeclarations) {
49028             var arity = elementFlags.length;
49029             var minLength = ts.countWhere(elementFlags, function (f) { return !!(f & (1 | 8)); });
49030             var typeParameters;
49031             var properties = [];
49032             var combinedFlags = 0;
49033             if (arity) {
49034                 typeParameters = new Array(arity);
49035                 for (var i = 0; i < arity; i++) {
49036                     var typeParameter = typeParameters[i] = createTypeParameter();
49037                     var flags = elementFlags[i];
49038                     combinedFlags |= flags;
49039                     if (!(combinedFlags & 12)) {
49040                         var property = createSymbol(4 | (flags & 2 ? 16777216 : 0), "" + i, readonly ? 8 : 0);
49041                         property.tupleLabelDeclaration = namedMemberDeclarations === null || namedMemberDeclarations === void 0 ? void 0 : namedMemberDeclarations[i];
49042                         property.type = typeParameter;
49043                         properties.push(property);
49044                     }
49045                 }
49046             }
49047             var fixedLength = properties.length;
49048             var lengthSymbol = createSymbol(4, "length");
49049             if (combinedFlags & 12) {
49050                 lengthSymbol.type = numberType;
49051             }
49052             else {
49053                 var literalTypes = [];
49054                 for (var i = minLength; i <= arity; i++)
49055                     literalTypes.push(getNumberLiteralType(i));
49056                 lengthSymbol.type = getUnionType(literalTypes);
49057             }
49058             properties.push(lengthSymbol);
49059             var type = createObjectType(8 | 4);
49060             type.typeParameters = typeParameters;
49061             type.outerTypeParameters = undefined;
49062             type.localTypeParameters = typeParameters;
49063             type.instantiations = new ts.Map();
49064             type.instantiations.set(getTypeListId(type.typeParameters), type);
49065             type.target = type;
49066             type.resolvedTypeArguments = type.typeParameters;
49067             type.thisType = createTypeParameter();
49068             type.thisType.isThisType = true;
49069             type.thisType.constraint = type;
49070             type.declaredProperties = properties;
49071             type.declaredCallSignatures = ts.emptyArray;
49072             type.declaredConstructSignatures = ts.emptyArray;
49073             type.declaredIndexInfos = ts.emptyArray;
49074             type.elementFlags = elementFlags;
49075             type.minLength = minLength;
49076             type.fixedLength = fixedLength;
49077             type.hasRestElement = !!(combinedFlags & 12);
49078             type.combinedFlags = combinedFlags;
49079             type.readonly = readonly;
49080             type.labeledElementDeclarations = namedMemberDeclarations;
49081             return type;
49082         }
49083         function createNormalizedTypeReference(target, typeArguments) {
49084             return target.objectFlags & 8 ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
49085         }
49086         function createNormalizedTupleType(target, elementTypes) {
49087             var _a, _b, _c;
49088             if (!(target.combinedFlags & 14)) {
49089                 return createTypeReference(target, elementTypes);
49090             }
49091             if (target.combinedFlags & 8) {
49092                 var unionIndex_1 = ts.findIndex(elementTypes, function (t, i) { return !!(target.elementFlags[i] & 8 && t.flags & (131072 | 1048576)); });
49093                 if (unionIndex_1 >= 0) {
49094                     return checkCrossProductUnion(ts.map(elementTypes, function (t, i) { return target.elementFlags[i] & 8 ? t : unknownType; })) ?
49095                         mapType(elementTypes[unionIndex_1], function (t) { return createNormalizedTupleType(target, ts.replaceElement(elementTypes, unionIndex_1, t)); }) :
49096                         errorType;
49097                 }
49098             }
49099             var expandedTypes = [];
49100             var expandedFlags = [];
49101             var expandedDeclarations = [];
49102             var lastRequiredIndex = -1;
49103             var firstRestIndex = -1;
49104             var lastOptionalOrRestIndex = -1;
49105             var _loop_15 = function (i) {
49106                 var type = elementTypes[i];
49107                 var flags = target.elementFlags[i];
49108                 if (flags & 8) {
49109                     if (type.flags & 58982400 || isGenericMappedType(type)) {
49110                         addElement(type, 8, (_a = target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[i]);
49111                     }
49112                     else if (isTupleType(type)) {
49113                         var elements = getTypeArguments(type);
49114                         if (elements.length + expandedTypes.length >= 10000) {
49115                             error(currentNode, ts.isPartOfTypeNode(currentNode)
49116                                 ? ts.Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent
49117                                 : ts.Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent);
49118                             return { value: errorType };
49119                         }
49120                         ts.forEach(elements, function (t, n) { var _a; return addElement(t, type.target.elementFlags[n], (_a = type.target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[n]); });
49121                     }
49122                     else {
49123                         addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4, (_b = target.labeledElementDeclarations) === null || _b === void 0 ? void 0 : _b[i]);
49124                     }
49125                 }
49126                 else {
49127                     addElement(type, flags, (_c = target.labeledElementDeclarations) === null || _c === void 0 ? void 0 : _c[i]);
49128                 }
49129             };
49130             for (var i = 0; i < elementTypes.length; i++) {
49131                 var state_4 = _loop_15(i);
49132                 if (typeof state_4 === "object")
49133                     return state_4.value;
49134             }
49135             for (var i = 0; i < lastRequiredIndex; i++) {
49136                 if (expandedFlags[i] & 2)
49137                     expandedFlags[i] = 1;
49138             }
49139             if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) {
49140                 expandedTypes[firstRestIndex] = getUnionType(ts.sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1), function (t, i) { return expandedFlags[firstRestIndex + i] & 8 ? getIndexedAccessType(t, numberType) : t; }));
49141                 expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
49142                 expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
49143                 expandedDeclarations === null || expandedDeclarations === void 0 ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
49144             }
49145             var tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
49146             return tupleTarget === emptyGenericType ? emptyObjectType :
49147                 expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) :
49148                     tupleTarget;
49149             function addElement(type, flags, declaration) {
49150                 if (flags & 1) {
49151                     lastRequiredIndex = expandedFlags.length;
49152                 }
49153                 if (flags & 4 && firstRestIndex < 0) {
49154                     firstRestIndex = expandedFlags.length;
49155                 }
49156                 if (flags & (2 | 4)) {
49157                     lastOptionalOrRestIndex = expandedFlags.length;
49158                 }
49159                 expandedTypes.push(type);
49160                 expandedFlags.push(flags);
49161                 if (expandedDeclarations && declaration) {
49162                     expandedDeclarations.push(declaration);
49163                 }
49164                 else {
49165                     expandedDeclarations = undefined;
49166                 }
49167             }
49168         }
49169         function sliceTupleType(type, index, endSkipCount) {
49170             if (endSkipCount === void 0) { endSkipCount = 0; }
49171             var target = type.target;
49172             var endIndex = getTypeReferenceArity(type) - endSkipCount;
49173             return index > target.fixedLength ? getRestArrayTypeOfTupleType(type) || createTupleType(ts.emptyArray) :
49174                 createTupleType(getTypeArguments(type).slice(index, endIndex), target.elementFlags.slice(index, endIndex), false, target.labeledElementDeclarations && target.labeledElementDeclarations.slice(index, endIndex));
49175         }
49176         function getKnownKeysOfTupleType(type) {
49177             return getUnionType(ts.append(ts.arrayOf(type.target.fixedLength, function (i) { return getStringLiteralType("" + i); }), getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)));
49178         }
49179         function getStartElementCount(type, flags) {
49180             var index = ts.findIndex(type.elementFlags, function (f) { return !(f & flags); });
49181             return index >= 0 ? index : type.elementFlags.length;
49182         }
49183         function getEndElementCount(type, flags) {
49184             return type.elementFlags.length - ts.findLastIndex(type.elementFlags, function (f) { return !(f & flags); }) - 1;
49185         }
49186         function getTypeFromOptionalTypeNode(node) {
49187             return addOptionality(getTypeFromTypeNode(node.type), true);
49188         }
49189         function getTypeId(type) {
49190             return type.id;
49191         }
49192         function containsType(types, type) {
49193             return ts.binarySearch(types, type, getTypeId, ts.compareValues) >= 0;
49194         }
49195         function insertType(types, type) {
49196             var index = ts.binarySearch(types, type, getTypeId, ts.compareValues);
49197             if (index < 0) {
49198                 types.splice(~index, 0, type);
49199                 return true;
49200             }
49201             return false;
49202         }
49203         function addTypeToUnion(typeSet, includes, type) {
49204             var flags = type.flags;
49205             if (flags & 1048576) {
49206                 return addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 : 0), type.types);
49207             }
49208             if (!(flags & 131072)) {
49209                 includes |= flags & 205258751;
49210                 if (flags & 465829888)
49211                     includes |= 33554432;
49212                 if (type === wildcardType)
49213                     includes |= 8388608;
49214                 if (!strictNullChecks && flags & 98304) {
49215                     if (!(ts.getObjectFlags(type) & 131072))
49216                         includes |= 4194304;
49217                 }
49218                 else {
49219                     var len = typeSet.length;
49220                     var index = len && type.id > typeSet[len - 1].id ? ~len : ts.binarySearch(typeSet, type, getTypeId, ts.compareValues);
49221                     if (index < 0) {
49222                         typeSet.splice(~index, 0, type);
49223                     }
49224                 }
49225             }
49226             return includes;
49227         }
49228         function addTypesToUnion(typeSet, includes, types) {
49229             for (var _i = 0, types_9 = types; _i < types_9.length; _i++) {
49230                 var type = types_9[_i];
49231                 includes = addTypeToUnion(typeSet, includes, type);
49232             }
49233             return includes;
49234         }
49235         function removeSubtypes(types, hasObjectTypes) {
49236             var id = getTypeListId(types);
49237             var match = subtypeReductionCache.get(id);
49238             if (match) {
49239                 return match;
49240             }
49241             var hasEmptyObject = hasObjectTypes && ts.some(types, function (t) { return !!(t.flags & 524288) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(t)); });
49242             var len = types.length;
49243             var i = len;
49244             var count = 0;
49245             while (i > 0) {
49246                 i--;
49247                 var source = types[i];
49248                 if (hasEmptyObject || source.flags & 469499904) {
49249                     var keyProperty = source.flags & (524288 | 2097152 | 58982400) ?
49250                         ts.find(getPropertiesOfType(source), function (p) { return isUnitType(getTypeOfSymbol(p)); }) :
49251                         undefined;
49252                     var keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
49253                     for (var _i = 0, types_10 = types; _i < types_10.length; _i++) {
49254                         var target = types_10[_i];
49255                         if (source !== target) {
49256                             if (count === 100000) {
49257                                 var estimatedCount = (count / (len - i)) * len;
49258                                 if (estimatedCount > 1000000) {
49259                                     ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "removeSubtypes_DepthLimit", { typeIds: types.map(function (t) { return t.id; }) });
49260                                     error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
49261                                     return undefined;
49262                                 }
49263                             }
49264                             count++;
49265                             if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) {
49266                                 var t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
49267                                 if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
49268                                     continue;
49269                                 }
49270                             }
49271                             if (isTypeRelatedTo(source, target, strictSubtypeRelation) && (!(ts.getObjectFlags(getTargetType(source)) & 1) ||
49272                                 !(ts.getObjectFlags(getTargetType(target)) & 1) ||
49273                                 isTypeDerivedFrom(source, target))) {
49274                                 ts.orderedRemoveItemAt(types, i);
49275                                 break;
49276                             }
49277                         }
49278                     }
49279                 }
49280             }
49281             subtypeReductionCache.set(id, types);
49282             return types;
49283         }
49284         function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
49285             var i = types.length;
49286             while (i > 0) {
49287                 i--;
49288                 var t = types[i];
49289                 var flags = t.flags;
49290                 var remove = flags & (128 | 134217728 | 268435456) && includes & 4 ||
49291                     flags & 256 && includes & 8 ||
49292                     flags & 2048 && includes & 64 ||
49293                     flags & 8192 && includes & 4096 ||
49294                     reduceVoidUndefined && flags & 32768 && includes & 16384 ||
49295                     isFreshLiteralType(t) && containsType(types, t.regularType);
49296                 if (remove) {
49297                     ts.orderedRemoveItemAt(types, i);
49298                 }
49299             }
49300         }
49301         function removeStringLiteralsMatchedByTemplateLiterals(types) {
49302             var templates = ts.filter(types, isPatternLiteralType);
49303             if (templates.length) {
49304                 var i = types.length;
49305                 var _loop_16 = function () {
49306                     i--;
49307                     var t = types[i];
49308                     if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
49309                         ts.orderedRemoveItemAt(types, i);
49310                     }
49311                 };
49312                 while (i > 0) {
49313                     _loop_16();
49314                 }
49315             }
49316         }
49317         function isNamedUnionType(type) {
49318             return !!(type.flags & 1048576 && (type.aliasSymbol || type.origin));
49319         }
49320         function addNamedUnions(namedUnions, types) {
49321             for (var _i = 0, types_11 = types; _i < types_11.length; _i++) {
49322                 var t = types_11[_i];
49323                 if (t.flags & 1048576) {
49324                     var origin = t.origin;
49325                     if (t.aliasSymbol || origin && !(origin.flags & 1048576)) {
49326                         ts.pushIfUnique(namedUnions, t);
49327                     }
49328                     else if (origin && origin.flags & 1048576) {
49329                         addNamedUnions(namedUnions, origin.types);
49330                     }
49331                 }
49332             }
49333         }
49334         function createOriginUnionOrIntersectionType(flags, types) {
49335             var result = createOriginType(flags);
49336             result.types = types;
49337             return result;
49338         }
49339         function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) {
49340             if (unionReduction === void 0) { unionReduction = 1; }
49341             if (types.length === 0) {
49342                 return neverType;
49343             }
49344             if (types.length === 1) {
49345                 return types[0];
49346             }
49347             var typeSet = [];
49348             var includes = addTypesToUnion(typeSet, 0, types);
49349             if (unionReduction !== 0) {
49350                 if (includes & 3) {
49351                     return includes & 1 ?
49352                         includes & 8388608 ? wildcardType : anyType :
49353                         includes & 65536 || containsType(typeSet, unknownType) ? unknownType : nonNullUnknownType;
49354                 }
49355                 if (exactOptionalPropertyTypes && includes & 32768) {
49356                     var missingIndex = ts.binarySearch(typeSet, missingType, getTypeId, ts.compareValues);
49357                     if (missingIndex >= 0 && containsType(typeSet, undefinedType)) {
49358                         ts.orderedRemoveItemAt(typeSet, missingIndex);
49359                     }
49360                 }
49361                 if (includes & (2944 | 8192 | 134217728 | 268435456) || includes & 16384 && includes & 32768) {
49362                     removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2));
49363                 }
49364                 if (includes & 128 && includes & 134217728) {
49365                     removeStringLiteralsMatchedByTemplateLiterals(typeSet);
49366                 }
49367                 if (unionReduction === 2) {
49368                     typeSet = removeSubtypes(typeSet, !!(includes & 524288));
49369                     if (!typeSet) {
49370                         return errorType;
49371                     }
49372                 }
49373                 if (typeSet.length === 0) {
49374                     return includes & 65536 ? includes & 4194304 ? nullType : nullWideningType :
49375                         includes & 32768 ? includes & 4194304 ? undefinedType : undefinedWideningType :
49376                             neverType;
49377                 }
49378             }
49379             if (!origin && includes & 1048576) {
49380                 var namedUnions = [];
49381                 addNamedUnions(namedUnions, types);
49382                 var reducedTypes = [];
49383                 var _loop_17 = function (t) {
49384                     if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
49385                         reducedTypes.push(t);
49386                     }
49387                 };
49388                 for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
49389                     var t = typeSet_1[_i];
49390                     _loop_17(t);
49391                 }
49392                 if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
49393                     return namedUnions[0];
49394                 }
49395                 var namedTypesCount = ts.reduceLeft(namedUnions, function (sum, union) { return sum + union.types.length; }, 0);
49396                 if (namedTypesCount + reducedTypes.length === typeSet.length) {
49397                     for (var _a = 0, namedUnions_1 = namedUnions; _a < namedUnions_1.length; _a++) {
49398                         var t = namedUnions_1[_a];
49399                         insertType(reducedTypes, t);
49400                     }
49401                     origin = createOriginUnionOrIntersectionType(1048576, reducedTypes);
49402                 }
49403             }
49404             var objectFlags = (includes & 36323363 ? 0 : 65536) |
49405                 (includes & 2097152 ? 33554432 : 0);
49406             return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
49407         }
49408         function getUnionOrIntersectionTypePredicate(signatures, kind) {
49409             var first;
49410             var types = [];
49411             for (var _i = 0, signatures_6 = signatures; _i < signatures_6.length; _i++) {
49412                 var sig = signatures_6[_i];
49413                 var pred = getTypePredicateOfSignature(sig);
49414                 if (!pred || pred.kind === 2 || pred.kind === 3) {
49415                     if (kind !== 2097152) {
49416                         continue;
49417                     }
49418                     else {
49419                         return;
49420                     }
49421                 }
49422                 if (first) {
49423                     if (!typePredicateKindsMatch(first, pred)) {
49424                         return undefined;
49425                     }
49426                 }
49427                 else {
49428                     first = pred;
49429                 }
49430                 types.push(pred.type);
49431             }
49432             if (!first) {
49433                 return undefined;
49434             }
49435             var compositeType = getUnionOrIntersectionType(types, kind);
49436             return createTypePredicate(first.kind, first.parameterName, first.parameterIndex, compositeType);
49437         }
49438         function typePredicateKindsMatch(a, b) {
49439             return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
49440         }
49441         function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
49442             if (types.length === 0) {
49443                 return neverType;
49444             }
49445             if (types.length === 1) {
49446                 return types[0];
49447             }
49448             var typeKey = !origin ? getTypeListId(types) :
49449                 origin.flags & 1048576 ? "|".concat(getTypeListId(origin.types)) :
49450                     origin.flags & 2097152 ? "&".concat(getTypeListId(origin.types)) :
49451                         "#".concat(origin.type.id, "|").concat(getTypeListId(types));
49452             var id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments);
49453             var type = unionTypes.get(id);
49454             if (!type) {
49455                 type = createType(1048576);
49456                 type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(types, 98304);
49457                 type.types = types;
49458                 type.origin = origin;
49459                 type.aliasSymbol = aliasSymbol;
49460                 type.aliasTypeArguments = aliasTypeArguments;
49461                 if (types.length === 2 && types[0].flags & 512 && types[1].flags & 512) {
49462                     type.flags |= 16;
49463                     type.intrinsicName = "boolean";
49464                 }
49465                 unionTypes.set(id, type);
49466             }
49467             return type;
49468         }
49469         function getTypeFromUnionTypeNode(node) {
49470             var links = getNodeLinks(node);
49471             if (!links.resolvedType) {
49472                 var aliasSymbol = getAliasSymbolForTypeNode(node);
49473                 links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
49474             }
49475             return links.resolvedType;
49476         }
49477         function addTypeToIntersection(typeSet, includes, type) {
49478             var flags = type.flags;
49479             if (flags & 2097152) {
49480                 return addTypesToIntersection(typeSet, includes, type.types);
49481             }
49482             if (isEmptyAnonymousObjectType(type)) {
49483                 if (!(includes & 16777216)) {
49484                     includes |= 16777216;
49485                     typeSet.set(type.id.toString(), type);
49486                 }
49487             }
49488             else {
49489                 if (flags & 3) {
49490                     if (type === wildcardType)
49491                         includes |= 8388608;
49492                 }
49493                 else if (strictNullChecks || !(flags & 98304)) {
49494                     if (exactOptionalPropertyTypes && type === missingType) {
49495                         includes |= 262144;
49496                         type = undefinedType;
49497                     }
49498                     if (!typeSet.has(type.id.toString())) {
49499                         if (type.flags & 109440 && includes & 109440) {
49500                             includes |= 67108864;
49501                         }
49502                         typeSet.set(type.id.toString(), type);
49503                     }
49504                 }
49505                 includes |= flags & 205258751;
49506             }
49507             return includes;
49508         }
49509         function addTypesToIntersection(typeSet, includes, types) {
49510             for (var _i = 0, types_12 = types; _i < types_12.length; _i++) {
49511                 var type = types_12[_i];
49512                 includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type));
49513             }
49514             return includes;
49515         }
49516         function removeRedundantPrimitiveTypes(types, includes) {
49517             var i = types.length;
49518             while (i > 0) {
49519                 i--;
49520                 var t = types[i];
49521                 var remove = t.flags & 4 && includes & 128 ||
49522                     t.flags & 8 && includes & 256 ||
49523                     t.flags & 64 && includes & 2048 ||
49524                     t.flags & 4096 && includes & 8192;
49525                 if (remove) {
49526                     ts.orderedRemoveItemAt(types, i);
49527                 }
49528             }
49529         }
49530         function eachUnionContains(unionTypes, type) {
49531             for (var _i = 0, unionTypes_1 = unionTypes; _i < unionTypes_1.length; _i++) {
49532                 var u = unionTypes_1[_i];
49533                 if (!containsType(u.types, type)) {
49534                     var primitive = type.flags & 128 ? stringType :
49535                         type.flags & 256 ? numberType :
49536                             type.flags & 2048 ? bigintType :
49537                                 type.flags & 8192 ? esSymbolType :
49538                                     undefined;
49539                     if (!primitive || !containsType(u.types, primitive)) {
49540                         return false;
49541                     }
49542                 }
49543             }
49544             return true;
49545         }
49546         function extractRedundantTemplateLiterals(types) {
49547             var i = types.length;
49548             var literals = ts.filter(types, function (t) { return !!(t.flags & 128); });
49549             while (i > 0) {
49550                 i--;
49551                 var t = types[i];
49552                 if (!(t.flags & 134217728))
49553                     continue;
49554                 for (var _i = 0, literals_1 = literals; _i < literals_1.length; _i++) {
49555                     var t2 = literals_1[_i];
49556                     if (isTypeSubtypeOf(t2, t)) {
49557                         ts.orderedRemoveItemAt(types, i);
49558                         break;
49559                     }
49560                     else if (isPatternLiteralType(t)) {
49561                         return true;
49562                     }
49563                 }
49564             }
49565             return false;
49566         }
49567         function eachIsUnionContaining(types, flag) {
49568             return ts.every(types, function (t) { return !!(t.flags & 1048576) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); });
49569         }
49570         function removeFromEach(types, flag) {
49571             for (var i = 0; i < types.length; i++) {
49572                 types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
49573             }
49574         }
49575         function intersectUnionsOfPrimitiveTypes(types) {
49576             var unionTypes;
49577             var index = ts.findIndex(types, function (t) { return !!(ts.getObjectFlags(t) & 65536); });
49578             if (index < 0) {
49579                 return false;
49580             }
49581             var i = index + 1;
49582             while (i < types.length) {
49583                 var t = types[i];
49584                 if (ts.getObjectFlags(t) & 65536) {
49585                     (unionTypes || (unionTypes = [types[index]])).push(t);
49586                     ts.orderedRemoveItemAt(types, i);
49587                 }
49588                 else {
49589                     i++;
49590                 }
49591             }
49592             if (!unionTypes) {
49593                 return false;
49594             }
49595             var checked = [];
49596             var result = [];
49597             for (var _i = 0, unionTypes_2 = unionTypes; _i < unionTypes_2.length; _i++) {
49598                 var u = unionTypes_2[_i];
49599                 for (var _a = 0, _b = u.types; _a < _b.length; _a++) {
49600                     var t = _b[_a];
49601                     if (insertType(checked, t)) {
49602                         if (eachUnionContains(unionTypes, t)) {
49603                             insertType(result, t);
49604                         }
49605                     }
49606                 }
49607             }
49608             types[index] = getUnionTypeFromSortedList(result, 65536);
49609             return true;
49610         }
49611         function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
49612             var result = createType(2097152);
49613             result.objectFlags = getPropagatingFlagsOfTypes(types, 98304);
49614             result.types = types;
49615             result.aliasSymbol = aliasSymbol;
49616             result.aliasTypeArguments = aliasTypeArguments;
49617             return result;
49618         }
49619         function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
49620             var typeMembershipMap = new ts.Map();
49621             var includes = addTypesToIntersection(typeMembershipMap, 0, types);
49622             var typeSet = ts.arrayFrom(typeMembershipMap.values());
49623             if (includes & 131072) {
49624                 return ts.contains(typeSet, silentNeverType) ? silentNeverType : neverType;
49625             }
49626             if (strictNullChecks && includes & 98304 && includes & (524288 | 67108864 | 16777216) ||
49627                 includes & 67108864 && includes & (469892092 & ~67108864) ||
49628                 includes & 402653316 && includes & (469892092 & ~402653316) ||
49629                 includes & 296 && includes & (469892092 & ~296) ||
49630                 includes & 2112 && includes & (469892092 & ~2112) ||
49631                 includes & 12288 && includes & (469892092 & ~12288) ||
49632                 includes & 49152 && includes & (469892092 & ~49152)) {
49633                 return neverType;
49634             }
49635             if (includes & 134217728 && includes & 128 && extractRedundantTemplateLiterals(typeSet)) {
49636                 return neverType;
49637             }
49638             if (includes & 1) {
49639                 return includes & 8388608 ? wildcardType : anyType;
49640             }
49641             if (!strictNullChecks && includes & 98304) {
49642                 return includes & 32768 ? undefinedType : nullType;
49643             }
49644             if (includes & 4 && includes & 128 ||
49645                 includes & 8 && includes & 256 ||
49646                 includes & 64 && includes & 2048 ||
49647                 includes & 4096 && includes & 8192) {
49648                 removeRedundantPrimitiveTypes(typeSet, includes);
49649             }
49650             if (includes & 16777216 && includes & 524288) {
49651                 ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
49652             }
49653             if (includes & 262144) {
49654                 typeSet[typeSet.indexOf(undefinedType)] = missingType;
49655             }
49656             if (typeSet.length === 0) {
49657                 return unknownType;
49658             }
49659             if (typeSet.length === 1) {
49660                 return typeSet[0];
49661             }
49662             var id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
49663             var result = intersectionTypes.get(id);
49664             if (!result) {
49665                 if (includes & 1048576) {
49666                     if (intersectUnionsOfPrimitiveTypes(typeSet)) {
49667                         result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
49668                     }
49669                     else if (eachIsUnionContaining(typeSet, 32768)) {
49670                         var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
49671                         removeFromEach(typeSet, 32768);
49672                         result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1, aliasSymbol, aliasTypeArguments);
49673                     }
49674                     else if (eachIsUnionContaining(typeSet, 65536)) {
49675                         removeFromEach(typeSet, 65536);
49676                         result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments);
49677                     }
49678                     else {
49679                         if (!checkCrossProductUnion(typeSet)) {
49680                             return errorType;
49681                         }
49682                         var constituents = getCrossProductIntersections(typeSet);
49683                         var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); }) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined;
49684                         result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin);
49685                     }
49686                 }
49687                 else {
49688                     result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
49689                 }
49690                 intersectionTypes.set(id, result);
49691             }
49692             return result;
49693         }
49694         function getCrossProductUnionSize(types) {
49695             return ts.reduceLeft(types, function (n, t) { return t.flags & 1048576 ? n * t.types.length : t.flags & 131072 ? 0 : n; }, 1);
49696         }
49697         function checkCrossProductUnion(types) {
49698             var size = getCrossProductUnionSize(types);
49699             if (size >= 100000) {
49700                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "checkCrossProductUnion_DepthLimit", { typeIds: types.map(function (t) { return t.id; }), size: size });
49701                 error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
49702                 return false;
49703             }
49704             return true;
49705         }
49706         function getCrossProductIntersections(types) {
49707             var count = getCrossProductUnionSize(types);
49708             var intersections = [];
49709             for (var i = 0; i < count; i++) {
49710                 var constituents = types.slice();
49711                 var n = i;
49712                 for (var j = types.length - 1; j >= 0; j--) {
49713                     if (types[j].flags & 1048576) {
49714                         var sourceTypes = types[j].types;
49715                         var length_5 = sourceTypes.length;
49716                         constituents[j] = sourceTypes[n % length_5];
49717                         n = Math.floor(n / length_5);
49718                     }
49719                 }
49720                 var t = getIntersectionType(constituents);
49721                 if (!(t.flags & 131072))
49722                     intersections.push(t);
49723             }
49724             return intersections;
49725         }
49726         function getTypeFromIntersectionTypeNode(node) {
49727             var links = getNodeLinks(node);
49728             if (!links.resolvedType) {
49729                 var aliasSymbol = getAliasSymbolForTypeNode(node);
49730                 links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
49731             }
49732             return links.resolvedType;
49733         }
49734         function createIndexType(type, stringsOnly) {
49735             var result = createType(4194304);
49736             result.type = type;
49737             result.stringsOnly = stringsOnly;
49738             return result;
49739         }
49740         function createOriginIndexType(type) {
49741             var result = createOriginType(4194304);
49742             result.type = type;
49743             return result;
49744         }
49745         function getIndexTypeForGenericType(type, stringsOnly) {
49746             return stringsOnly ?
49747                 type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, true)) :
49748                 type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, false));
49749         }
49750         function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
49751             var typeParameter = getTypeParameterFromMappedType(type);
49752             var constraintType = getConstraintTypeFromMappedType(type);
49753             var nameType = getNameTypeFromMappedType(type.target || type);
49754             if (!nameType && !noIndexSignatures) {
49755                 return constraintType;
49756             }
49757             var keyTypes = [];
49758             if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
49759                 if (!isGenericIndexType(constraintType)) {
49760                     var modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
49761                     forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, stringsOnly, addMemberForKeyType);
49762                 }
49763                 else {
49764                     return getIndexTypeForGenericType(type, stringsOnly);
49765                 }
49766             }
49767             else {
49768                 forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
49769             }
49770             if (isGenericIndexType(constraintType)) {
49771                 forEachType(constraintType, addMemberForKeyType);
49772             }
49773             var result = noIndexSignatures ? filterType(getUnionType(keyTypes), function (t) { return !(t.flags & (1 | 4)); }) : getUnionType(keyTypes);
49774             if (result.flags & 1048576 && constraintType.flags & 1048576 && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
49775                 return constraintType;
49776             }
49777             return result;
49778             function addMemberForKeyType(keyType) {
49779                 var propNameType = nameType ? instantiateType(nameType, appendTypeMapping(type.mapper, typeParameter, keyType)) : keyType;
49780                 keyTypes.push(propNameType === stringType ? stringOrNumberType : propNameType);
49781             }
49782         }
49783         function hasDistributiveNameType(mappedType) {
49784             var typeVariable = getTypeParameterFromMappedType(mappedType);
49785             return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
49786             function isDistributive(type) {
49787                 return type.flags & (3 | 131068 | 131072 | 262144 | 524288 | 67108864) ? true :
49788                     type.flags & 16777216 ? type.root.isDistributive && type.checkType === typeVariable :
49789                         type.flags & (3145728 | 134217728) ? ts.every(type.types, isDistributive) :
49790                             type.flags & 8388608 ? isDistributive(type.objectType) && isDistributive(type.indexType) :
49791                                 type.flags & 33554432 ? isDistributive(type.substitute) :
49792                                     type.flags & 268435456 ? isDistributive(type.type) :
49793                                         false;
49794             }
49795         }
49796         function getLiteralTypeFromPropertyName(name) {
49797             if (ts.isPrivateIdentifier(name)) {
49798                 return neverType;
49799             }
49800             return ts.isIdentifier(name) ? getStringLiteralType(ts.unescapeLeadingUnderscores(name.escapedText)) :
49801                 getRegularTypeOfLiteralType(ts.isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name));
49802         }
49803         function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
49804             if (includeNonPublic || !(ts.getDeclarationModifierFlagsFromSymbol(prop) & 24)) {
49805                 var type = getSymbolLinks(getLateBoundSymbol(prop)).nameType;
49806                 if (!type) {
49807                     var name = ts.getNameOfDeclaration(prop.valueDeclaration);
49808                     type = prop.escapedName === "default" ? getStringLiteralType("default") :
49809                         name && getLiteralTypeFromPropertyName(name) || (!ts.isKnownSymbol(prop) ? getStringLiteralType(ts.symbolName(prop)) : undefined);
49810                 }
49811                 if (type && type.flags & include) {
49812                     return type;
49813                 }
49814             }
49815             return neverType;
49816         }
49817         function isKeyTypeIncluded(keyType, include) {
49818             return !!(keyType.flags & include || keyType.flags & 2097152 && ts.some(keyType.types, function (t) { return isKeyTypeIncluded(t, include); }));
49819         }
49820         function getLiteralTypeFromProperties(type, include, includeOrigin) {
49821             var origin = includeOrigin && (ts.getObjectFlags(type) & (3 | 4) || type.aliasSymbol) ? createOriginIndexType(type) : undefined;
49822             var propertyTypes = ts.map(getPropertiesOfType(type), function (prop) { return getLiteralTypeFromProperty(prop, include); });
49823             var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
49824                 info.keyType === stringType && include & 8 ? stringOrNumberType : info.keyType : neverType; });
49825             return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
49826         }
49827         function getIndexType(type, stringsOnly, noIndexSignatures) {
49828             if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
49829             type = getReducedType(type);
49830             return type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
49831                 type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
49832                     type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
49833                         ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
49834                             type === wildcardType ? wildcardType :
49835                                 type.flags & 2 ? neverType :
49836                                     type.flags & (1 | 131072) ? keyofConstraintType :
49837                                         getLiteralTypeFromProperties(type, (noIndexSignatures ? 128 : 402653316) | (stringsOnly ? 0 : 296 | 12288), stringsOnly === keyofStringsOnly && !noIndexSignatures);
49838         }
49839         function getExtractStringType(type) {
49840             if (keyofStringsOnly) {
49841                 return type;
49842             }
49843             var extractTypeAlias = getGlobalExtractSymbol();
49844             return extractTypeAlias ? getTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
49845         }
49846         function getIndexTypeOrString(type) {
49847             var indexType = getExtractStringType(getIndexType(type));
49848             return indexType.flags & 131072 ? stringType : indexType;
49849         }
49850         function getTypeFromTypeOperatorNode(node) {
49851             var links = getNodeLinks(node);
49852             if (!links.resolvedType) {
49853                 switch (node.operator) {
49854                     case 140:
49855                         links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
49856                         break;
49857                     case 153:
49858                         links.resolvedType = node.type.kind === 150
49859                             ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
49860                             : errorType;
49861                         break;
49862                     case 144:
49863                         links.resolvedType = getTypeFromTypeNode(node.type);
49864                         break;
49865                     default:
49866                         throw ts.Debug.assertNever(node.operator);
49867                 }
49868             }
49869             return links.resolvedType;
49870         }
49871         function getTypeFromTemplateTypeNode(node) {
49872             var links = getNodeLinks(node);
49873             if (!links.resolvedType) {
49874                 links.resolvedType = getTemplateLiteralType(__spreadArray([node.head.text], ts.map(node.templateSpans, function (span) { return span.literal.text; }), true), ts.map(node.templateSpans, function (span) { return getTypeFromTypeNode(span.type); }));
49875             }
49876             return links.resolvedType;
49877         }
49878         function getTemplateLiteralType(texts, types) {
49879             var unionIndex = ts.findIndex(types, function (t) { return !!(t.flags & (131072 | 1048576)); });
49880             if (unionIndex >= 0) {
49881                 return checkCrossProductUnion(types) ?
49882                     mapType(types[unionIndex], function (t) { return getTemplateLiteralType(texts, ts.replaceElement(types, unionIndex, t)); }) :
49883                     errorType;
49884             }
49885             if (ts.contains(types, wildcardType)) {
49886                 return wildcardType;
49887             }
49888             var newTypes = [];
49889             var newTexts = [];
49890             var text = texts[0];
49891             if (!addSpans(texts, types)) {
49892                 return stringType;
49893             }
49894             if (newTypes.length === 0) {
49895                 return getStringLiteralType(text);
49896             }
49897             newTexts.push(text);
49898             if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4); })) {
49899                 return stringType;
49900             }
49901             var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
49902             var type = templateLiteralTypes.get(id);
49903             if (!type) {
49904                 templateLiteralTypes.set(id, type = createTemplateLiteralType(newTexts, newTypes));
49905             }
49906             return type;
49907             function addSpans(texts, types) {
49908                 for (var i = 0; i < types.length; i++) {
49909                     var t = types[i];
49910                     if (t.flags & (2944 | 65536 | 32768)) {
49911                         text += getTemplateStringForType(t) || "";
49912                         text += texts[i + 1];
49913                     }
49914                     else if (t.flags & 134217728) {
49915                         text += t.texts[0];
49916                         if (!addSpans(t.texts, t.types))
49917                             return false;
49918                         text += texts[i + 1];
49919                     }
49920                     else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
49921                         newTypes.push(t);
49922                         newTexts.push(text);
49923                         text = texts[i + 1];
49924                     }
49925                     else {
49926                         return false;
49927                     }
49928                 }
49929                 return true;
49930             }
49931         }
49932         function getTemplateStringForType(type) {
49933             return type.flags & 128 ? type.value :
49934                 type.flags & 256 ? "" + type.value :
49935                     type.flags & 2048 ? ts.pseudoBigIntToString(type.value) :
49936                         type.flags & (512 | 98304) ? type.intrinsicName :
49937                             undefined;
49938         }
49939         function createTemplateLiteralType(texts, types) {
49940             var type = createType(134217728);
49941             type.texts = texts;
49942             type.types = types;
49943             return type;
49944         }
49945         function getStringMappingType(symbol, type) {
49946             return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
49947                 isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
49948                     type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
49949                         type;
49950         }
49951         function applyStringMapping(symbol, str) {
49952             switch (intrinsicTypeKinds.get(symbol.escapedName)) {
49953                 case 0: return str.toUpperCase();
49954                 case 1: return str.toLowerCase();
49955                 case 2: return str.charAt(0).toUpperCase() + str.slice(1);
49956                 case 3: return str.charAt(0).toLowerCase() + str.slice(1);
49957             }
49958             return str;
49959         }
49960         function getStringMappingTypeForGenericType(symbol, type) {
49961             var id = "".concat(getSymbolId(symbol), ",").concat(getTypeId(type));
49962             var result = stringMappingTypes.get(id);
49963             if (!result) {
49964                 stringMappingTypes.set(id, result = createStringMappingType(symbol, type));
49965             }
49966             return result;
49967         }
49968         function createStringMappingType(symbol, type) {
49969             var result = createType(268435456);
49970             result.symbol = symbol;
49971             result.type = type;
49972             return result;
49973         }
49974         function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
49975             var type = createType(8388608);
49976             type.objectType = objectType;
49977             type.indexType = indexType;
49978             type.accessFlags = accessFlags;
49979             type.aliasSymbol = aliasSymbol;
49980             type.aliasTypeArguments = aliasTypeArguments;
49981             return type;
49982         }
49983         function isJSLiteralType(type) {
49984             if (noImplicitAny) {
49985                 return false;
49986             }
49987             if (ts.getObjectFlags(type) & 8192) {
49988                 return true;
49989             }
49990             if (type.flags & 1048576) {
49991                 return ts.every(type.types, isJSLiteralType);
49992             }
49993             if (type.flags & 2097152) {
49994                 return ts.some(type.types, isJSLiteralType);
49995             }
49996             if (type.flags & 465829888) {
49997                 var constraint = getResolvedBaseConstraint(type);
49998                 return constraint !== type && isJSLiteralType(constraint);
49999             }
50000             return false;
50001         }
50002         function getPropertyNameFromIndex(indexType, accessNode) {
50003             return isTypeUsableAsPropertyName(indexType) ?
50004                 getPropertyNameFromType(indexType) :
50005                 accessNode && ts.isPropertyName(accessNode) ?
50006                     ts.getPropertyNameForPropertyNameNode(accessNode) :
50007                     undefined;
50008         }
50009         function isUncalledFunctionReference(node, symbol) {
50010             if (symbol.flags & (16 | 8192)) {
50011                 var parent = ts.findAncestor(node.parent, function (n) { return !ts.isAccessExpression(n); }) || node.parent;
50012                 if (ts.isCallLikeExpression(parent)) {
50013                     return ts.isCallOrNewExpression(parent) && ts.isIdentifier(node) && hasMatchingArgument(parent, node);
50014                 }
50015                 return ts.every(symbol.declarations, function (d) { return !ts.isFunctionLike(d) || !!(ts.getCombinedNodeFlags(d) & 134217728); });
50016             }
50017             return true;
50018         }
50019         function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) {
50020             var _a;
50021             var accessExpression = accessNode && accessNode.kind === 206 ? accessNode : undefined;
50022             var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode);
50023             if (propName !== undefined) {
50024                 if (accessFlags & 256) {
50025                     return getTypeOfPropertyOfContextualType(objectType, propName) || anyType;
50026                 }
50027                 var prop = getPropertyOfType(objectType, propName);
50028                 if (prop) {
50029                     if (accessFlags & 64 && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(accessNode, prop)) {
50030                         var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
50031                         addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
50032                     }
50033                     if (accessExpression) {
50034                         markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol));
50035                         if (isAssignmentToReadonlyEntity(accessExpression, prop, ts.getAssignmentTargetKind(accessExpression))) {
50036                             error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
50037                             return undefined;
50038                         }
50039                         if (accessFlags & 8) {
50040                             getNodeLinks(accessNode).resolvedSymbol = prop;
50041                         }
50042                         if (isThisPropertyAccessInConstructor(accessExpression, prop)) {
50043                             return autoType;
50044                         }
50045                     }
50046                     var propType = getTypeOfSymbol(prop);
50047                     return accessExpression && ts.getAssignmentTargetKind(accessExpression) !== 1 ?
50048                         getFlowTypeOfReference(accessExpression, propType) :
50049                         propType;
50050                 }
50051                 if (everyType(objectType, isTupleType) && isNumericLiteralName(propName) && +propName >= 0) {
50052                     if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16)) {
50053                         var indexNode = getIndexNodeForAccessExpression(accessNode);
50054                         if (isTupleType(objectType)) {
50055                             error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
50056                         }
50057                         else {
50058                             error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
50059                         }
50060                     }
50061                     errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
50062                     return mapType(objectType, function (t) {
50063                         var restType = getRestTypeOfTupleType(t) || undefinedType;
50064                         return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
50065                     });
50066                 }
50067             }
50068             if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) {
50069                 if (objectType.flags & (1 | 131072)) {
50070                     return objectType;
50071                 }
50072                 var indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
50073                 if (indexInfo) {
50074                     if (accessFlags & 2 && indexInfo.keyType !== numberType) {
50075                         if (accessExpression) {
50076                             error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
50077                         }
50078                         return undefined;
50079                     }
50080                     if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 | 8)) {
50081                         var indexNode = getIndexNodeForAccessExpression(accessNode);
50082                         error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
50083                         return accessFlags & 1 ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
50084                     }
50085                     errorIfWritingToReadonlyIndex(indexInfo);
50086                     return accessFlags & 1 ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
50087                 }
50088                 if (indexType.flags & 131072) {
50089                     return neverType;
50090                 }
50091                 if (isJSLiteralType(objectType)) {
50092                     return anyType;
50093                 }
50094                 if (accessExpression && !isConstEnumObjectType(objectType)) {
50095                     if (isObjectLiteralType(objectType)) {
50096                         if (noImplicitAny && indexType.flags & (128 | 256)) {
50097                             diagnostics.add(ts.createDiagnosticForNode(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)));
50098                             return undefinedType;
50099                         }
50100                         else if (indexType.flags & (8 | 4)) {
50101                             var types = ts.map(objectType.properties, function (property) {
50102                                 return getTypeOfSymbol(property);
50103                             });
50104                             return getUnionType(ts.append(types, undefinedType));
50105                         }
50106                     }
50107                     if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418)) {
50108                         error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
50109                     }
50110                     else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128)) {
50111                         if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
50112                             var typeName = typeToString(objectType);
50113                             error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + ts.getTextOfNode(accessExpression.argumentExpression) + "]");
50114                         }
50115                         else if (getIndexTypeOfType(objectType, numberType)) {
50116                             error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
50117                         }
50118                         else {
50119                             var suggestion = void 0;
50120                             if (propName !== undefined && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) {
50121                                 if (suggestion !== undefined) {
50122                                     error(accessExpression.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion);
50123                                 }
50124                             }
50125                             else {
50126                                 var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType);
50127                                 if (suggestion_1 !== undefined) {
50128                                     error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
50129                                 }
50130                                 else {
50131                                     var errorInfo = void 0;
50132                                     if (indexType.flags & 1024) {
50133                                         errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
50134                                     }
50135                                     else if (indexType.flags & 8192) {
50136                                         var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
50137                                         errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
50138                                     }
50139                                     else if (indexType.flags & 128) {
50140                                         errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
50141                                     }
50142                                     else if (indexType.flags & 256) {
50143                                         errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
50144                                     }
50145                                     else if (indexType.flags & (8 | 4)) {
50146                                         errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
50147                                     }
50148                                     errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
50149                                     diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
50150                                 }
50151                             }
50152                         }
50153                     }
50154                     return undefined;
50155                 }
50156             }
50157             if (isJSLiteralType(objectType)) {
50158                 return anyType;
50159             }
50160             if (accessNode) {
50161                 var indexNode = getIndexNodeForAccessExpression(accessNode);
50162                 if (indexType.flags & (128 | 256)) {
50163                     error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
50164                 }
50165                 else if (indexType.flags & (4 | 8)) {
50166                     error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
50167                 }
50168                 else {
50169                     error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
50170                 }
50171             }
50172             if (isTypeAny(indexType)) {
50173                 return indexType;
50174             }
50175             return undefined;
50176             function errorIfWritingToReadonlyIndex(indexInfo) {
50177                 if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
50178                     error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
50179                 }
50180             }
50181         }
50182         function getIndexNodeForAccessExpression(accessNode) {
50183             return accessNode.kind === 206 ? accessNode.argumentExpression :
50184                 accessNode.kind === 193 ? accessNode.indexType :
50185                     accessNode.kind === 161 ? accessNode.expression :
50186                         accessNode;
50187         }
50188         function isPatternLiteralPlaceholderType(type) {
50189             return !!(type.flags & (1 | 4 | 8 | 64));
50190         }
50191         function isPatternLiteralType(type) {
50192             return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
50193         }
50194         function isGenericType(type) {
50195             return !!getGenericObjectFlags(type);
50196         }
50197         function isGenericObjectType(type) {
50198             return !!(getGenericObjectFlags(type) & 8388608);
50199         }
50200         function isGenericIndexType(type) {
50201             return !!(getGenericObjectFlags(type) & 16777216);
50202         }
50203         function getGenericObjectFlags(type) {
50204             if (type.flags & 3145728) {
50205                 if (!(type.objectFlags & 4194304)) {
50206                     type.objectFlags |= 4194304 |
50207                         ts.reduceLeft(type.types, function (flags, t) { return flags | getGenericObjectFlags(t); }, 0);
50208                 }
50209                 return type.objectFlags & 25165824;
50210             }
50211             if (type.flags & 33554432) {
50212                 if (!(type.objectFlags & 4194304)) {
50213                     type.objectFlags |= 4194304 |
50214                         getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType);
50215                 }
50216                 return type.objectFlags & 25165824;
50217             }
50218             return (type.flags & 58982400 || isGenericMappedType(type) || isGenericTupleType(type) ? 8388608 : 0) |
50219                 (type.flags & (58982400 | 4194304 | 134217728 | 268435456) && !isPatternLiteralType(type) ? 16777216 : 0);
50220         }
50221         function isThisTypeParameter(type) {
50222             return !!(type.flags & 262144 && type.isThisType);
50223         }
50224         function getSimplifiedType(type, writing) {
50225             return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type, writing) :
50226                 type.flags & 16777216 ? getSimplifiedConditionalType(type, writing) :
50227                     type;
50228         }
50229         function distributeIndexOverObjectType(objectType, indexType, writing) {
50230             if (objectType.flags & 3145728) {
50231                 var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
50232                 return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types);
50233             }
50234         }
50235         function distributeObjectOverIndexType(objectType, indexType, writing) {
50236             if (indexType.flags & 1048576) {
50237                 var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
50238                 return writing ? getIntersectionType(types) : getUnionType(types);
50239             }
50240         }
50241         function getSimplifiedIndexedAccessType(type, writing) {
50242             var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
50243             if (type[cache]) {
50244                 return type[cache] === circularConstraintType ? type : type[cache];
50245             }
50246             type[cache] = circularConstraintType;
50247             var objectType = getSimplifiedType(type.objectType, writing);
50248             var indexType = getSimplifiedType(type.indexType, writing);
50249             var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
50250             if (distributedOverIndex) {
50251                 return type[cache] = distributedOverIndex;
50252             }
50253             if (!(indexType.flags & 465829888)) {
50254                 var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
50255                 if (distributedOverObject) {
50256                     return type[cache] = distributedOverObject;
50257                 }
50258             }
50259             if (isGenericTupleType(objectType) && indexType.flags & 296) {
50260                 var elementType = getElementTypeOfSliceOfTupleType(objectType, indexType.flags & 8 ? 0 : objectType.target.fixedLength, 0, writing);
50261                 if (elementType) {
50262                     return type[cache] = elementType;
50263                 }
50264             }
50265             if (isGenericMappedType(objectType)) {
50266                 return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
50267             }
50268             return type[cache] = type;
50269         }
50270         function getSimplifiedConditionalType(type, writing) {
50271             var checkType = type.checkType;
50272             var extendsType = type.extendsType;
50273             var trueType = getTrueTypeFromConditionalType(type);
50274             var falseType = getFalseTypeFromConditionalType(type);
50275             if (falseType.flags & 131072 && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
50276                 if (checkType.flags & 1 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
50277                     return getSimplifiedType(trueType, writing);
50278                 }
50279                 else if (isIntersectionEmpty(checkType, extendsType)) {
50280                     return neverType;
50281                 }
50282             }
50283             else if (trueType.flags & 131072 && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
50284                 if (!(checkType.flags & 1) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
50285                     return neverType;
50286                 }
50287                 else if (checkType.flags & 1 || isIntersectionEmpty(checkType, extendsType)) {
50288                     return getSimplifiedType(falseType, writing);
50289                 }
50290             }
50291             return type;
50292         }
50293         function isIntersectionEmpty(type1, type2) {
50294             return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072);
50295         }
50296         function substituteIndexedMappedType(objectType, index) {
50297             var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
50298             var templateMapper = combineTypeMappers(objectType.mapper, mapper);
50299             return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
50300         }
50301         function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
50302             if (accessFlags === void 0) { accessFlags = 0; }
50303             return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
50304         }
50305         function indexTypeLessThan(indexType, limit) {
50306             return everyType(indexType, function (t) {
50307                 if (t.flags & 384) {
50308                     var propName = getPropertyNameFromType(t);
50309                     if (isNumericLiteralName(propName)) {
50310                         var index = +propName;
50311                         return index >= 0 && index < limit;
50312                     }
50313                 }
50314                 return false;
50315             });
50316         }
50317         function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
50318             if (accessFlags === void 0) { accessFlags = 0; }
50319             if (objectType === wildcardType || indexType === wildcardType) {
50320                 return wildcardType;
50321             }
50322             if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 4 | 8)) {
50323                 indexType = stringType;
50324             }
50325             if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32)
50326                 accessFlags |= 1;
50327             if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 193 ?
50328                 isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) :
50329                 isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
50330                 if (objectType.flags & 3) {
50331                     return objectType;
50332                 }
50333                 var persistentAccessFlags = accessFlags & 1;
50334                 var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
50335                 var type = indexedAccessTypes.get(id);
50336                 if (!type) {
50337                     indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments));
50338                 }
50339                 return type;
50340             }
50341             var apparentObjectType = getReducedApparentType(objectType);
50342             if (indexType.flags & 1048576 && !(indexType.flags & 16)) {
50343                 var propTypes = [];
50344                 var wasMissingProp = false;
50345                 for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
50346                     var t = _a[_i];
50347                     var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, accessNode, accessFlags | (wasMissingProp ? 128 : 0));
50348                     if (propType) {
50349                         propTypes.push(propType);
50350                     }
50351                     else if (!accessNode) {
50352                         return undefined;
50353                     }
50354                     else {
50355                         wasMissingProp = true;
50356                     }
50357                 }
50358                 if (wasMissingProp) {
50359                     return undefined;
50360                 }
50361                 return accessFlags & 4
50362                     ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments)
50363                     : getUnionType(propTypes, 1, aliasSymbol, aliasTypeArguments);
50364             }
50365             return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 | 64);
50366         }
50367         function getTypeFromIndexedAccessTypeNode(node) {
50368             var links = getNodeLinks(node);
50369             if (!links.resolvedType) {
50370                 var objectType = getTypeFromTypeNode(node.objectType);
50371                 var indexType = getTypeFromTypeNode(node.indexType);
50372                 var potentialAlias = getAliasSymbolForTypeNode(node);
50373                 var resolved = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
50374                 links.resolvedType = resolved.flags & 8388608 &&
50375                     resolved.objectType === objectType &&
50376                     resolved.indexType === indexType ?
50377                     getConditionalFlowTypeOfType(resolved, node) : resolved;
50378             }
50379             return links.resolvedType;
50380         }
50381         function getTypeFromMappedTypeNode(node) {
50382             var links = getNodeLinks(node);
50383             if (!links.resolvedType) {
50384                 var type = createObjectType(32, node.symbol);
50385                 type.declaration = node;
50386                 type.aliasSymbol = getAliasSymbolForTypeNode(node);
50387                 type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(type.aliasSymbol);
50388                 links.resolvedType = type;
50389                 getConstraintTypeFromMappedType(type);
50390             }
50391             return links.resolvedType;
50392         }
50393         function getActualTypeVariable(type) {
50394             if (type.flags & 33554432) {
50395                 return type.baseType;
50396             }
50397             if (type.flags & 8388608 && (type.objectType.flags & 33554432 ||
50398                 type.indexType.flags & 33554432)) {
50399                 return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
50400             }
50401             return type;
50402         }
50403         function isTypicalNondistributiveConditional(root) {
50404             return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
50405         }
50406         function isSingletonTupleType(node) {
50407             return ts.isTupleTypeNode(node) && ts.length(node.elements) === 1 && !ts.isOptionalTypeNode(node.elements[0]) && !ts.isRestTypeNode(node.elements[0]);
50408         }
50409         function unwrapNondistributiveConditionalTuple(root, type) {
50410             return isTypicalNondistributiveConditional(root) && isTupleType(type) ? getTypeArguments(type)[0] : type;
50411         }
50412         function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
50413             var result;
50414             var extraTypes;
50415             var tailCount = 0;
50416             while (true) {
50417                 if (tailCount === 1000) {
50418                     error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
50419                     result = errorType;
50420                     break;
50421                 }
50422                 var isUnwrapped = isTypicalNondistributiveConditional(root);
50423                 var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
50424                 var checkTypeInstantiable = isGenericType(checkType);
50425                 var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
50426                 if (checkType === wildcardType || extendsType === wildcardType) {
50427                     return wildcardType;
50428                 }
50429                 var combinedMapper = void 0;
50430                 if (root.inferTypeParameters) {
50431                     var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
50432                     if (!checkTypeInstantiable) {
50433                         inferTypes(context.inferences, checkType, extendsType, 512 | 1024);
50434                     }
50435                     combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
50436                 }
50437                 var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
50438                 if (!checkTypeInstantiable && !isGenericType(inferredExtendsType)) {
50439                     if (!(inferredExtendsType.flags & 3) && ((checkType.flags & 1 && !isUnwrapped) || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
50440                         if (checkType.flags & 1 && !isUnwrapped) {
50441                             (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
50442                         }
50443                         var falseType_1 = getTypeFromTypeNode(root.node.falseType);
50444                         if (falseType_1.flags & 16777216) {
50445                             var newRoot = falseType_1.root;
50446                             if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
50447                                 root = newRoot;
50448                                 continue;
50449                             }
50450                             if (canTailRecurse(falseType_1, mapper)) {
50451                                 continue;
50452                             }
50453                         }
50454                         result = instantiateType(falseType_1, mapper);
50455                         break;
50456                     }
50457                     if (inferredExtendsType.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
50458                         var trueType_1 = getTypeFromTypeNode(root.node.trueType);
50459                         var trueMapper = combinedMapper || mapper;
50460                         if (canTailRecurse(trueType_1, trueMapper)) {
50461                             continue;
50462                         }
50463                         result = instantiateType(trueType_1, trueMapper);
50464                         break;
50465                     }
50466                 }
50467                 result = createType(16777216);
50468                 result.root = root;
50469                 result.checkType = instantiateType(root.checkType, mapper);
50470                 result.extendsType = instantiateType(root.extendsType, mapper);
50471                 result.mapper = mapper;
50472                 result.combinedMapper = combinedMapper;
50473                 result.aliasSymbol = aliasSymbol || root.aliasSymbol;
50474                 result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper);
50475                 break;
50476             }
50477             return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
50478             function canTailRecurse(newType, newMapper) {
50479                 if (newType.flags & 16777216 && newMapper) {
50480                     var newRoot = newType.root;
50481                     if (newRoot.outerTypeParameters) {
50482                         var typeParamMapper_1 = combineTypeMappers(newType.mapper, newMapper);
50483                         var typeArguments = ts.map(newRoot.outerTypeParameters, function (t) { return getMappedType(t, typeParamMapper_1); });
50484                         var newRootMapper = createTypeMapper(newRoot.outerTypeParameters, typeArguments);
50485                         var newCheckType = newRoot.isDistributive ? getMappedType(newRoot.checkType, newRootMapper) : undefined;
50486                         if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (1048576 | 131072))) {
50487                             root = newRoot;
50488                             mapper = newRootMapper;
50489                             aliasSymbol = undefined;
50490                             aliasTypeArguments = undefined;
50491                             if (newRoot.aliasSymbol) {
50492                                 tailCount++;
50493                             }
50494                             return true;
50495                         }
50496                     }
50497                 }
50498                 return false;
50499             }
50500         }
50501         function getTrueTypeFromConditionalType(type) {
50502             return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(getTypeFromTypeNode(type.root.node.trueType), type.mapper));
50503         }
50504         function getFalseTypeFromConditionalType(type) {
50505             return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(getTypeFromTypeNode(type.root.node.falseType), type.mapper));
50506         }
50507         function getInferredTrueTypeFromConditionalType(type) {
50508             return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(getTypeFromTypeNode(type.root.node.trueType), type.combinedMapper) : getTrueTypeFromConditionalType(type));
50509         }
50510         function getInferTypeParameters(node) {
50511             var result;
50512             if (node.locals) {
50513                 node.locals.forEach(function (symbol) {
50514                     if (symbol.flags & 262144) {
50515                         result = ts.append(result, getDeclaredTypeOfSymbol(symbol));
50516                     }
50517                 });
50518             }
50519             return result;
50520         }
50521         function isDistributionDependent(root) {
50522             return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
50523                 isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
50524         }
50525         function getTypeFromConditionalTypeNode(node) {
50526             var links = getNodeLinks(node);
50527             if (!links.resolvedType) {
50528                 var checkType = getTypeFromTypeNode(node.checkType);
50529                 var aliasSymbol = getAliasSymbolForTypeNode(node);
50530                 var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
50531                 var allOuterTypeParameters = getOuterTypeParameters(node, true);
50532                 var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
50533                 var root = {
50534                     node: node,
50535                     checkType: checkType,
50536                     extendsType: getTypeFromTypeNode(node.extendsType),
50537                     isDistributive: !!(checkType.flags & 262144),
50538                     inferTypeParameters: getInferTypeParameters(node),
50539                     outerTypeParameters: outerTypeParameters,
50540                     instantiations: undefined,
50541                     aliasSymbol: aliasSymbol,
50542                     aliasTypeArguments: aliasTypeArguments
50543                 };
50544                 links.resolvedType = getConditionalType(root, undefined);
50545                 if (outerTypeParameters) {
50546                     root.instantiations = new ts.Map();
50547                     root.instantiations.set(getTypeListId(outerTypeParameters), links.resolvedType);
50548                 }
50549             }
50550             return links.resolvedType;
50551         }
50552         function getTypeFromInferTypeNode(node) {
50553             var links = getNodeLinks(node);
50554             if (!links.resolvedType) {
50555                 links.resolvedType = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter));
50556             }
50557             return links.resolvedType;
50558         }
50559         function getIdentifierChain(node) {
50560             if (ts.isIdentifier(node)) {
50561                 return [node];
50562             }
50563             else {
50564                 return ts.append(getIdentifierChain(node.left), node.right);
50565             }
50566         }
50567         function getTypeFromImportTypeNode(node) {
50568             var links = getNodeLinks(node);
50569             if (!links.resolvedType) {
50570                 if (node.isTypeOf && node.typeArguments) {
50571                     error(node, ts.Diagnostics.Type_arguments_cannot_be_used_here);
50572                     links.resolvedSymbol = unknownSymbol;
50573                     return links.resolvedType = errorType;
50574                 }
50575                 if (!ts.isLiteralImportTypeNode(node)) {
50576                     error(node.argument, ts.Diagnostics.String_literal_expected);
50577                     links.resolvedSymbol = unknownSymbol;
50578                     return links.resolvedType = errorType;
50579                 }
50580                 var targetMeaning = node.isTypeOf ? 111551 : node.flags & 4194304 ? 111551 | 788968 : 788968;
50581                 var innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
50582                 if (!innerModuleSymbol) {
50583                     links.resolvedSymbol = unknownSymbol;
50584                     return links.resolvedType = errorType;
50585                 }
50586                 var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, false);
50587                 if (!ts.nodeIsMissing(node.qualifier)) {
50588                     var nameStack = getIdentifierChain(node.qualifier);
50589                     var currentNamespace = moduleSymbol;
50590                     var current = void 0;
50591                     while (current = nameStack.shift()) {
50592                         var meaning = nameStack.length ? 1920 : targetMeaning;
50593                         var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
50594                         var next = node.isTypeOf
50595                             ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText)
50596                             : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
50597                         if (!next) {
50598                             error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
50599                             return links.resolvedType = errorType;
50600                         }
50601                         getNodeLinks(current).resolvedSymbol = next;
50602                         getNodeLinks(current.parent).resolvedSymbol = next;
50603                         currentNamespace = next;
50604                     }
50605                     links.resolvedType = resolveImportSymbolType(node, links, currentNamespace, targetMeaning);
50606                 }
50607                 else {
50608                     if (moduleSymbol.flags & targetMeaning) {
50609                         links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
50610                     }
50611                     else {
50612                         var errorMessage = targetMeaning === 111551
50613                             ? ts.Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
50614                             : ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
50615                         error(node, errorMessage, node.argument.literal.text);
50616                         links.resolvedSymbol = unknownSymbol;
50617                         links.resolvedType = errorType;
50618                     }
50619                 }
50620             }
50621             return links.resolvedType;
50622         }
50623         function resolveImportSymbolType(node, links, symbol, meaning) {
50624             var resolvedSymbol = resolveSymbol(symbol);
50625             links.resolvedSymbol = resolvedSymbol;
50626             if (meaning === 111551) {
50627                 return getTypeOfSymbol(symbol);
50628             }
50629             else {
50630                 return getTypeReferenceType(node, resolvedSymbol);
50631             }
50632         }
50633         function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) {
50634             var links = getNodeLinks(node);
50635             if (!links.resolvedType) {
50636                 var aliasSymbol = getAliasSymbolForTypeNode(node);
50637                 if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
50638                     links.resolvedType = emptyTypeLiteralType;
50639                 }
50640                 else {
50641                     var type = createObjectType(16, node.symbol);
50642                     type.aliasSymbol = aliasSymbol;
50643                     type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
50644                     if (ts.isJSDocTypeLiteral(node) && node.isArrayType) {
50645                         type = createArrayType(type);
50646                     }
50647                     links.resolvedType = type;
50648                 }
50649             }
50650             return links.resolvedType;
50651         }
50652         function getAliasSymbolForTypeNode(node) {
50653             var host = node.parent;
50654             while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 144) {
50655                 host = host.parent;
50656             }
50657             return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined;
50658         }
50659         function getTypeArgumentsForAliasSymbol(symbol) {
50660             return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined;
50661         }
50662         function isNonGenericObjectType(type) {
50663             return !!(type.flags & 524288) && !isGenericMappedType(type);
50664         }
50665         function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type) {
50666             return isEmptyObjectType(type) || !!(type.flags & (65536 | 32768 | 528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304));
50667         }
50668         function tryMergeUnionOfObjectTypeAndEmptyObject(type, readonly) {
50669             if (!(type.flags & 1048576)) {
50670                 return type;
50671             }
50672             if (ts.every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) {
50673                 return ts.find(type.types, isEmptyObjectType) || emptyObjectType;
50674             }
50675             var firstType = ts.find(type.types, function (t) { return !isEmptyObjectTypeOrSpreadsIntoEmptyObject(t); });
50676             if (!firstType) {
50677                 return type;
50678             }
50679             var secondType = ts.find(type.types, function (t) { return t !== firstType && !isEmptyObjectTypeOrSpreadsIntoEmptyObject(t); });
50680             if (secondType) {
50681                 return type;
50682             }
50683             return getAnonymousPartialType(firstType);
50684             function getAnonymousPartialType(type) {
50685                 var members = ts.createSymbolTable();
50686                 for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {
50687                     var prop = _a[_i];
50688                     if (ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16)) {
50689                     }
50690                     else if (isSpreadableProperty(prop)) {
50691                         var isSetonlyAccessor = prop.flags & 65536 && !(prop.flags & 32768);
50692                         var flags = 4 | 16777216;
50693                         var result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 : 0));
50694                         result.type = isSetonlyAccessor ? undefinedType : addOptionality(getTypeOfSymbol(prop), true);
50695                         result.declarations = prop.declarations;
50696                         result.nameType = getSymbolLinks(prop).nameType;
50697                         result.syntheticOrigin = prop;
50698                         members.set(prop.escapedName, result);
50699                     }
50700                 }
50701                 var spread = createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(type));
50702                 spread.objectFlags |= 128 | 262144;
50703                 return spread;
50704             }
50705         }
50706         function getSpreadType(left, right, symbol, objectFlags, readonly) {
50707             if (left.flags & 1 || right.flags & 1) {
50708                 return anyType;
50709             }
50710             if (left.flags & 2 || right.flags & 2) {
50711                 return unknownType;
50712             }
50713             if (left.flags & 131072) {
50714                 return right;
50715             }
50716             if (right.flags & 131072) {
50717                 return left;
50718             }
50719             left = tryMergeUnionOfObjectTypeAndEmptyObject(left, readonly);
50720             if (left.flags & 1048576) {
50721                 return checkCrossProductUnion([left, right])
50722                     ? mapType(left, function (t) { return getSpreadType(t, right, symbol, objectFlags, readonly); })
50723                     : errorType;
50724             }
50725             right = tryMergeUnionOfObjectTypeAndEmptyObject(right, readonly);
50726             if (right.flags & 1048576) {
50727                 return checkCrossProductUnion([left, right])
50728                     ? mapType(right, function (t) { return getSpreadType(left, t, symbol, objectFlags, readonly); })
50729                     : errorType;
50730             }
50731             if (right.flags & (528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304)) {
50732                 return left;
50733             }
50734             if (isGenericObjectType(left) || isGenericObjectType(right)) {
50735                 if (isEmptyObjectType(left)) {
50736                     return right;
50737                 }
50738                 if (left.flags & 2097152) {
50739                     var types = left.types;
50740                     var lastLeft = types[types.length - 1];
50741                     if (isNonGenericObjectType(lastLeft) && isNonGenericObjectType(right)) {
50742                         return getIntersectionType(ts.concatenate(types.slice(0, types.length - 1), [getSpreadType(lastLeft, right, symbol, objectFlags, readonly)]));
50743                     }
50744                 }
50745                 return getIntersectionType([left, right]);
50746             }
50747             var members = ts.createSymbolTable();
50748             var skippedPrivateMembers = new ts.Set();
50749             var indexInfos = left === emptyObjectType ? getIndexInfosOfType(right) : getUnionIndexInfos([left, right]);
50750             for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) {
50751                 var rightProp = _a[_i];
50752                 if (ts.getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) {
50753                     skippedPrivateMembers.add(rightProp.escapedName);
50754                 }
50755                 else if (isSpreadableProperty(rightProp)) {
50756                     members.set(rightProp.escapedName, getSpreadSymbol(rightProp, readonly));
50757                 }
50758             }
50759             for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) {
50760                 var leftProp = _c[_b];
50761                 if (skippedPrivateMembers.has(leftProp.escapedName) || !isSpreadableProperty(leftProp)) {
50762                     continue;
50763                 }
50764                 if (members.has(leftProp.escapedName)) {
50765                     var rightProp = members.get(leftProp.escapedName);
50766                     var rightType = getTypeOfSymbol(rightProp);
50767                     if (rightProp.flags & 16777216) {
50768                         var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations);
50769                         var flags = 4 | (leftProp.flags & 16777216);
50770                         var result = createSymbol(flags, leftProp.escapedName);
50771                         result.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)]);
50772                         result.leftSpread = leftProp;
50773                         result.rightSpread = rightProp;
50774                         result.declarations = declarations;
50775                         result.nameType = getSymbolLinks(leftProp).nameType;
50776                         members.set(leftProp.escapedName, result);
50777                     }
50778                 }
50779                 else {
50780                     members.set(leftProp.escapedName, getSpreadSymbol(leftProp, readonly));
50781                 }
50782             }
50783             var spread = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, ts.sameMap(indexInfos, function (info) { return getIndexInfoWithReadonly(info, readonly); }));
50784             spread.objectFlags |= 128 | 262144 | 4194304 | objectFlags;
50785             return spread;
50786         }
50787         function isSpreadableProperty(prop) {
50788             var _a;
50789             return !ts.some(prop.declarations, ts.isPrivateIdentifierClassElementDeclaration) &&
50790                 (!(prop.flags & (8192 | 32768 | 65536)) ||
50791                     !((_a = prop.declarations) === null || _a === void 0 ? void 0 : _a.some(function (decl) { return ts.isClassLike(decl.parent); })));
50792         }
50793         function getSpreadSymbol(prop, readonly) {
50794             var isSetonlyAccessor = prop.flags & 65536 && !(prop.flags & 32768);
50795             if (!isSetonlyAccessor && readonly === isReadonlySymbol(prop)) {
50796                 return prop;
50797             }
50798             var flags = 4 | (prop.flags & 16777216);
50799             var result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? 8 : 0));
50800             result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
50801             result.declarations = prop.declarations;
50802             result.nameType = getSymbolLinks(prop).nameType;
50803             result.syntheticOrigin = prop;
50804             return result;
50805         }
50806         function getIndexInfoWithReadonly(info, readonly) {
50807             return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
50808         }
50809         function createLiteralType(flags, value, symbol, regularType) {
50810             var type = createType(flags);
50811             type.symbol = symbol;
50812             type.value = value;
50813             type.regularType = regularType || type;
50814             return type;
50815         }
50816         function getFreshTypeOfLiteralType(type) {
50817             if (type.flags & 2944) {
50818                 if (!type.freshType) {
50819                     var freshType = createLiteralType(type.flags, type.value, type.symbol, type);
50820                     freshType.freshType = freshType;
50821                     type.freshType = freshType;
50822                 }
50823                 return type.freshType;
50824             }
50825             return type;
50826         }
50827         function getRegularTypeOfLiteralType(type) {
50828             return type.flags & 2944 ? type.regularType :
50829                 type.flags & 1048576 ? (type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType))) :
50830                     type;
50831         }
50832         function isFreshLiteralType(type) {
50833             return !!(type.flags & 2944) && type.freshType === type;
50834         }
50835         function getStringLiteralType(value) {
50836             var type;
50837             return stringLiteralTypes.get(value) ||
50838                 (stringLiteralTypes.set(value, type = createLiteralType(128, value)), type);
50839         }
50840         function getNumberLiteralType(value) {
50841             var type;
50842             return numberLiteralTypes.get(value) ||
50843                 (numberLiteralTypes.set(value, type = createLiteralType(256, value)), type);
50844         }
50845         function getBigIntLiteralType(value) {
50846             var type;
50847             var key = ts.pseudoBigIntToString(value);
50848             return bigIntLiteralTypes.get(key) ||
50849                 (bigIntLiteralTypes.set(key, type = createLiteralType(2048, value)), type);
50850         }
50851         function getEnumLiteralType(value, enumId, symbol) {
50852             var type;
50853             var qualifier = typeof value === "string" ? "@" : "#";
50854             var key = enumId + qualifier + value;
50855             var flags = 1024 | (typeof value === "string" ? 128 : 256);
50856             return enumLiteralTypes.get(key) ||
50857                 (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type);
50858         }
50859         function getTypeFromLiteralTypeNode(node) {
50860             if (node.literal.kind === 104) {
50861                 return nullType;
50862             }
50863             var links = getNodeLinks(node);
50864             if (!links.resolvedType) {
50865                 links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));
50866             }
50867             return links.resolvedType;
50868         }
50869         function createUniqueESSymbolType(symbol) {
50870             var type = createType(8192);
50871             type.symbol = symbol;
50872             type.escapedName = "__@".concat(type.symbol.escapedName, "@").concat(getSymbolId(type.symbol));
50873             return type;
50874         }
50875         function getESSymbolLikeTypeForNode(node) {
50876             if (ts.isValidESSymbolDeclaration(node)) {
50877                 var symbol = getSymbolOfNode(node);
50878                 var links = getSymbolLinks(symbol);
50879                 return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
50880             }
50881             return esSymbolType;
50882         }
50883         function getThisType(node) {
50884             var container = ts.getThisContainer(node, false);
50885             var parent = container && container.parent;
50886             if (parent && (ts.isClassLike(parent) || parent.kind === 257)) {
50887                 if (!ts.isStatic(container) &&
50888                     (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) {
50889                     return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
50890                 }
50891             }
50892             if (parent && ts.isObjectLiteralExpression(parent) && ts.isBinaryExpression(parent.parent) && ts.getAssignmentDeclarationKind(parent.parent) === 6) {
50893                 return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent.parent.left).parent).thisType;
50894             }
50895             var host = node.flags & 4194304 ? ts.getHostSignatureFromJSDoc(node) : undefined;
50896             if (host && ts.isFunctionExpression(host) && ts.isBinaryExpression(host.parent) && ts.getAssignmentDeclarationKind(host.parent) === 3) {
50897                 return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host.parent.left).parent).thisType;
50898             }
50899             if (isJSConstructor(container) && ts.isNodeDescendantOf(node, container.body)) {
50900                 return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(container)).thisType;
50901             }
50902             error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
50903             return errorType;
50904         }
50905         function getTypeFromThisTypeNode(node) {
50906             var links = getNodeLinks(node);
50907             if (!links.resolvedType) {
50908                 links.resolvedType = getThisType(node);
50909             }
50910             return links.resolvedType;
50911         }
50912         function getTypeFromRestTypeNode(node) {
50913             return getTypeFromTypeNode(getArrayElementTypeNode(node.type) || node.type);
50914         }
50915         function getArrayElementTypeNode(node) {
50916             switch (node.kind) {
50917                 case 190:
50918                     return getArrayElementTypeNode(node.type);
50919                 case 183:
50920                     if (node.elements.length === 1) {
50921                         node = node.elements[0];
50922                         if (node.kind === 185 || node.kind === 196 && node.dotDotDotToken) {
50923                             return getArrayElementTypeNode(node.type);
50924                         }
50925                     }
50926                     break;
50927                 case 182:
50928                     return node.elementType;
50929             }
50930             return undefined;
50931         }
50932         function getTypeFromNamedTupleTypeNode(node) {
50933             var links = getNodeLinks(node);
50934             return links.resolvedType || (links.resolvedType =
50935                 node.dotDotDotToken ? getTypeFromRestTypeNode(node) :
50936                     addOptionality(getTypeFromTypeNode(node.type), true, !!node.questionToken));
50937         }
50938         function getTypeFromTypeNode(node) {
50939             return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node);
50940         }
50941         function getTypeFromTypeNodeWorker(node) {
50942             switch (node.kind) {
50943                 case 130:
50944                 case 310:
50945                 case 311:
50946                     return anyType;
50947                 case 154:
50948                     return unknownType;
50949                 case 149:
50950                     return stringType;
50951                 case 146:
50952                     return numberType;
50953                 case 157:
50954                     return bigintType;
50955                 case 133:
50956                     return booleanType;
50957                 case 150:
50958                     return esSymbolType;
50959                 case 114:
50960                     return voidType;
50961                 case 152:
50962                     return undefinedType;
50963                 case 104:
50964                     return nullType;
50965                 case 143:
50966                     return neverType;
50967                 case 147:
50968                     return node.flags & 131072 && !noImplicitAny ? anyType : nonPrimitiveType;
50969                 case 138:
50970                     return intrinsicMarkerType;
50971                 case 191:
50972                 case 108:
50973                     return getTypeFromThisTypeNode(node);
50974                 case 195:
50975                     return getTypeFromLiteralTypeNode(node);
50976                 case 177:
50977                     return getTypeFromTypeReference(node);
50978                 case 176:
50979                     return node.assertsModifier ? voidType : booleanType;
50980                 case 227:
50981                     return getTypeFromTypeReference(node);
50982                 case 180:
50983                     return getTypeFromTypeQueryNode(node);
50984                 case 182:
50985                 case 183:
50986                     return getTypeFromArrayOrTupleTypeNode(node);
50987                 case 184:
50988                     return getTypeFromOptionalTypeNode(node);
50989                 case 186:
50990                     return getTypeFromUnionTypeNode(node);
50991                 case 187:
50992                     return getTypeFromIntersectionTypeNode(node);
50993                 case 312:
50994                     return getTypeFromJSDocNullableTypeNode(node);
50995                 case 314:
50996                     return addOptionality(getTypeFromTypeNode(node.type));
50997                 case 196:
50998                     return getTypeFromNamedTupleTypeNode(node);
50999                 case 190:
51000                 case 313:
51001                 case 307:
51002                     return getTypeFromTypeNode(node.type);
51003                 case 185:
51004                     return getTypeFromRestTypeNode(node);
51005                 case 316:
51006                     return getTypeFromJSDocVariadicType(node);
51007                 case 178:
51008                 case 179:
51009                 case 181:
51010                 case 320:
51011                 case 315:
51012                 case 321:
51013                     return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
51014                 case 192:
51015                     return getTypeFromTypeOperatorNode(node);
51016                 case 193:
51017                     return getTypeFromIndexedAccessTypeNode(node);
51018                 case 194:
51019                     return getTypeFromMappedTypeNode(node);
51020                 case 188:
51021                     return getTypeFromConditionalTypeNode(node);
51022                 case 189:
51023                     return getTypeFromInferTypeNode(node);
51024                 case 197:
51025                     return getTypeFromTemplateTypeNode(node);
51026                 case 199:
51027                     return getTypeFromImportTypeNode(node);
51028                 case 79:
51029                 case 160:
51030                 case 205:
51031                     var symbol = getSymbolAtLocation(node);
51032                     return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
51033                 default:
51034                     return errorType;
51035             }
51036         }
51037         function instantiateList(items, mapper, instantiator) {
51038             if (items && items.length) {
51039                 for (var i = 0; i < items.length; i++) {
51040                     var item = items[i];
51041                     var mapped = instantiator(item, mapper);
51042                     if (item !== mapped) {
51043                         var result = i === 0 ? [] : items.slice(0, i);
51044                         result.push(mapped);
51045                         for (i++; i < items.length; i++) {
51046                             result.push(instantiator(items[i], mapper));
51047                         }
51048                         return result;
51049                     }
51050                 }
51051             }
51052             return items;
51053         }
51054         function instantiateTypes(types, mapper) {
51055             return instantiateList(types, mapper, instantiateType);
51056         }
51057         function instantiateSignatures(signatures, mapper) {
51058             return instantiateList(signatures, mapper, instantiateSignature);
51059         }
51060         function instantiateIndexInfos(indexInfos, mapper) {
51061             return instantiateList(indexInfos, mapper, instantiateIndexInfo);
51062         }
51063         function createTypeMapper(sources, targets) {
51064             return sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : makeArrayTypeMapper(sources, targets);
51065         }
51066         function getMappedType(type, mapper) {
51067             switch (mapper.kind) {
51068                 case 0:
51069                     return type === mapper.source ? mapper.target : type;
51070                 case 1:
51071                     var sources = mapper.sources;
51072                     var targets = mapper.targets;
51073                     for (var i = 0; i < sources.length; i++) {
51074                         if (type === sources[i]) {
51075                             return targets ? targets[i] : anyType;
51076                         }
51077                     }
51078                     return type;
51079                 case 2:
51080                     return mapper.func(type);
51081                 case 3:
51082                 case 4:
51083                     var t1 = getMappedType(type, mapper.mapper1);
51084                     return t1 !== type && mapper.kind === 3 ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
51085             }
51086         }
51087         function makeUnaryTypeMapper(source, target) {
51088             return { kind: 0, source: source, target: target };
51089         }
51090         function makeArrayTypeMapper(sources, targets) {
51091             return { kind: 1, sources: sources, targets: targets };
51092         }
51093         function makeFunctionTypeMapper(func) {
51094             return { kind: 2, func: func };
51095         }
51096         function makeCompositeTypeMapper(kind, mapper1, mapper2) {
51097             return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
51098         }
51099         function createTypeEraser(sources) {
51100             return createTypeMapper(sources, undefined);
51101         }
51102         function createBackreferenceMapper(context, index) {
51103             return makeFunctionTypeMapper(function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; });
51104         }
51105         function combineTypeMappers(mapper1, mapper2) {
51106             return mapper1 ? makeCompositeTypeMapper(3, mapper1, mapper2) : mapper2;
51107         }
51108         function mergeTypeMappers(mapper1, mapper2) {
51109             return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2;
51110         }
51111         function prependTypeMapping(source, target, mapper) {
51112             return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, makeUnaryTypeMapper(source, target), mapper);
51113         }
51114         function appendTypeMapping(mapper, source, target) {
51115             return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, mapper, makeUnaryTypeMapper(source, target));
51116         }
51117         function getRestrictiveTypeParameter(tp) {
51118             return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
51119                 tp.restrictiveInstantiation.constraint = unknownType,
51120                 tp.restrictiveInstantiation);
51121         }
51122         function cloneTypeParameter(typeParameter) {
51123             var result = createTypeParameter(typeParameter.symbol);
51124             result.target = typeParameter;
51125             return result;
51126         }
51127         function instantiateTypePredicate(predicate, mapper) {
51128             return createTypePredicate(predicate.kind, predicate.parameterName, predicate.parameterIndex, instantiateType(predicate.type, mapper));
51129         }
51130         function instantiateSignature(signature, mapper, eraseTypeParameters) {
51131             var freshTypeParameters;
51132             if (signature.typeParameters && !eraseTypeParameters) {
51133                 freshTypeParameters = ts.map(signature.typeParameters, cloneTypeParameter);
51134                 mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper);
51135                 for (var _i = 0, freshTypeParameters_1 = freshTypeParameters; _i < freshTypeParameters_1.length; _i++) {
51136                     var tp = freshTypeParameters_1[_i];
51137                     tp.mapper = mapper;
51138                 }
51139             }
51140             var result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), undefined, undefined, signature.minArgumentCount, signature.flags & 39);
51141             result.target = signature;
51142             result.mapper = mapper;
51143             return result;
51144         }
51145         function instantiateSymbol(symbol, mapper) {
51146             var links = getSymbolLinks(symbol);
51147             if (links.type && !couldContainTypeVariables(links.type)) {
51148                 return symbol;
51149             }
51150             if (ts.getCheckFlags(symbol) & 1) {
51151                 symbol = links.target;
51152                 mapper = combineTypeMappers(links.mapper, mapper);
51153             }
51154             var result = createSymbol(symbol.flags, symbol.escapedName, 1 | ts.getCheckFlags(symbol) & (8 | 4096 | 16384 | 32768));
51155             result.declarations = symbol.declarations;
51156             result.parent = symbol.parent;
51157             result.target = symbol;
51158             result.mapper = mapper;
51159             if (symbol.valueDeclaration) {
51160                 result.valueDeclaration = symbol.valueDeclaration;
51161             }
51162             if (links.nameType) {
51163                 result.nameType = links.nameType;
51164             }
51165             return result;
51166         }
51167         function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
51168             var declaration = type.objectFlags & 4 ? type.node : type.symbol.declarations[0];
51169             var links = getNodeLinks(declaration);
51170             var target = type.objectFlags & 4 ? links.resolvedType :
51171                 type.objectFlags & 64 ? type.target : type;
51172             var typeParameters = links.outerTypeParameters;
51173             if (!typeParameters) {
51174                 var outerTypeParameters = getOuterTypeParameters(declaration, true);
51175                 if (isJSConstructor(declaration)) {
51176                     var templateTagParameters = getTypeParametersFromDeclaration(declaration);
51177                     outerTypeParameters = ts.addRange(outerTypeParameters, templateTagParameters);
51178                 }
51179                 typeParameters = outerTypeParameters || ts.emptyArray;
51180                 var allDeclarations_1 = type.objectFlags & 4 ? [declaration] : type.symbol.declarations;
51181                 typeParameters = (target.objectFlags & 4 || target.symbol.flags & 8192 || target.symbol.flags & 2048) && !target.aliasTypeArguments ?
51182                     ts.filter(typeParameters, function (tp) { return ts.some(allDeclarations_1, function (d) { return isTypeParameterPossiblyReferenced(tp, d); }); }) :
51183                     typeParameters;
51184                 links.outerTypeParameters = typeParameters;
51185             }
51186             if (typeParameters.length) {
51187                 var combinedMapper_1 = combineTypeMappers(type.mapper, mapper);
51188                 var typeArguments = ts.map(typeParameters, function (t) { return getMappedType(t, combinedMapper_1); });
51189                 var newAliasSymbol = aliasSymbol || type.aliasSymbol;
51190                 var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
51191                 var id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
51192                 if (!target.instantiations) {
51193                     target.instantiations = new ts.Map();
51194                     target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
51195                 }
51196                 var result = target.instantiations.get(id);
51197                 if (!result) {
51198                     var newMapper = createTypeMapper(typeParameters, typeArguments);
51199                     result = target.objectFlags & 4 ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) :
51200                         target.objectFlags & 32 ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) :
51201                             instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
51202                     target.instantiations.set(id, result);
51203                 }
51204                 return result;
51205             }
51206             return type;
51207         }
51208         function maybeTypeParameterReference(node) {
51209             return !(node.parent.kind === 177 && node.parent.typeArguments && node === node.parent.typeName ||
51210                 node.parent.kind === 199 && node.parent.typeArguments && node === node.parent.qualifier);
51211         }
51212         function isTypeParameterPossiblyReferenced(tp, node) {
51213             if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
51214                 var container = tp.symbol.declarations[0].parent;
51215                 for (var n = node; n !== container; n = n.parent) {
51216                     if (!n || n.kind === 234 || n.kind === 188 && ts.forEachChild(n.extendsType, containsReference)) {
51217                         return true;
51218                     }
51219                 }
51220                 return containsReference(node);
51221             }
51222             return true;
51223             function containsReference(node) {
51224                 switch (node.kind) {
51225                     case 191:
51226                         return !!tp.isThisType;
51227                     case 79:
51228                         return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
51229                             getTypeFromTypeNodeWorker(node) === tp;
51230                     case 180:
51231                         return true;
51232                     case 168:
51233                     case 167:
51234                         return !node.type && !!node.body ||
51235                             ts.some(node.typeParameters, containsReference) ||
51236                             ts.some(node.parameters, containsReference) ||
51237                             !!node.type && containsReference(node.type);
51238                 }
51239                 return !!ts.forEachChild(node, containsReference);
51240             }
51241         }
51242         function getHomomorphicTypeVariable(type) {
51243             var constraintType = getConstraintTypeFromMappedType(type);
51244             if (constraintType.flags & 4194304) {
51245                 var typeVariable = getActualTypeVariable(constraintType.type);
51246                 if (typeVariable.flags & 262144) {
51247                     return typeVariable;
51248                 }
51249             }
51250             return undefined;
51251         }
51252         function instantiateMappedType(type, mapper, aliasSymbol, aliasTypeArguments) {
51253             var typeVariable = getHomomorphicTypeVariable(type);
51254             if (typeVariable) {
51255                 var mappedTypeVariable = instantiateType(typeVariable, mapper);
51256                 if (typeVariable !== mappedTypeVariable) {
51257                     return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
51258                         if (t.flags & (3 | 58982400 | 524288 | 2097152) && t !== wildcardType && !isErrorType(t)) {
51259                             if (!type.declaration.nameType) {
51260                                 var constraint = void 0;
51261                                 if (isArrayType(t) || t.flags & 1 && findResolutionCycleStartIndex(typeVariable, 4) < 0 &&
51262                                     (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
51263                                     return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
51264                                 }
51265                                 if (isGenericTupleType(t)) {
51266                                     return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
51267                                 }
51268                                 if (isTupleType(t)) {
51269                                     return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper));
51270                                 }
51271                             }
51272                             return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
51273                         }
51274                         return t;
51275                     }, aliasSymbol, aliasTypeArguments);
51276                 }
51277             }
51278             return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
51279         }
51280         function getModifiedReadonlyState(state, modifiers) {
51281             return modifiers & 1 ? true : modifiers & 2 ? false : state;
51282         }
51283         function instantiateMappedGenericTupleType(tupleType, mappedType, typeVariable, mapper) {
51284             var elementFlags = tupleType.target.elementFlags;
51285             var elementTypes = ts.map(getTypeArguments(tupleType), function (t, i) {
51286                 var singleton = elementFlags[i] & 8 ? t :
51287                     elementFlags[i] & 4 ? createArrayType(t) :
51288                         createTupleType([t], [elementFlags[i]]);
51289                 return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
51290             });
51291             var newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
51292             return createTupleType(elementTypes, ts.map(elementTypes, function (_) { return 8; }), newReadonly);
51293         }
51294         function instantiateMappedArrayType(arrayType, mappedType, mapper) {
51295             var elementType = instantiateMappedTypeTemplate(mappedType, numberType, true, mapper);
51296             return isErrorType(elementType) ? errorType :
51297                 createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
51298         }
51299         function instantiateMappedTupleType(tupleType, mappedType, mapper) {
51300             var elementFlags = tupleType.target.elementFlags;
51301             var elementTypes = ts.map(getTypeArguments(tupleType), function (_, i) {
51302                 return instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2), mapper);
51303             });
51304             var modifiers = getMappedTypeModifiers(mappedType);
51305             var newTupleModifiers = modifiers & 4 ? ts.map(elementFlags, function (f) { return f & 1 ? 2 : f; }) :
51306                 modifiers & 8 ? ts.map(elementFlags, function (f) { return f & 2 ? 1 : f; }) :
51307                     elementFlags;
51308             var newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers);
51309             return ts.contains(elementTypes, errorType) ? errorType :
51310                 createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations);
51311         }
51312         function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
51313             var templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
51314             var propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
51315             var modifiers = getMappedTypeModifiers(type);
51316             return strictNullChecks && modifiers & 4 && !maybeTypeOfKind(propType, 32768 | 16384) ? getOptionalType(propType, true) :
51317                 strictNullChecks && modifiers & 8 && isOptional ? getTypeWithFacts(propType, 524288) :
51318                     propType;
51319         }
51320         function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
51321             var result = createObjectType(type.objectFlags | 64, type.symbol);
51322             if (type.objectFlags & 32) {
51323                 result.declaration = type.declaration;
51324                 var origTypeParameter = getTypeParameterFromMappedType(type);
51325                 var freshTypeParameter = cloneTypeParameter(origTypeParameter);
51326                 result.typeParameter = freshTypeParameter;
51327                 mapper = combineTypeMappers(makeUnaryTypeMapper(origTypeParameter, freshTypeParameter), mapper);
51328                 freshTypeParameter.mapper = mapper;
51329             }
51330             result.target = type;
51331             result.mapper = mapper;
51332             result.aliasSymbol = aliasSymbol || type.aliasSymbol;
51333             result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
51334             return result;
51335         }
51336         function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
51337             var root = type.root;
51338             if (root.outerTypeParameters) {
51339                 var typeArguments = ts.map(root.outerTypeParameters, function (t) { return getMappedType(t, mapper); });
51340                 var id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
51341                 var result = root.instantiations.get(id);
51342                 if (!result) {
51343                     var newMapper_1 = createTypeMapper(root.outerTypeParameters, typeArguments);
51344                     var checkType_1 = root.checkType;
51345                     var distributionType = root.isDistributive ? getMappedType(checkType_1, newMapper_1) : undefined;
51346                     result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 | 131072) ?
51347                         mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
51348                         getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
51349                     root.instantiations.set(id, result);
51350                 }
51351                 return result;
51352             }
51353             return type;
51354         }
51355         function instantiateType(type, mapper) {
51356             return type && mapper ? instantiateTypeWithAlias(type, mapper, undefined, undefined) : type;
51357         }
51358         function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
51359             if (!couldContainTypeVariables(type)) {
51360                 return type;
51361             }
51362             if (instantiationDepth === 100 || instantiationCount >= 5000000) {
51363                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth: instantiationDepth, instantiationCount: instantiationCount });
51364                 error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
51365                 return errorType;
51366             }
51367             totalInstantiationCount++;
51368             instantiationCount++;
51369             instantiationDepth++;
51370             var result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
51371             instantiationDepth--;
51372             return result;
51373         }
51374         function instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments) {
51375             var flags = type.flags;
51376             if (flags & 262144) {
51377                 return getMappedType(type, mapper);
51378             }
51379             if (flags & 524288) {
51380                 var objectFlags = type.objectFlags;
51381                 if (objectFlags & (4 | 16 | 32)) {
51382                     if (objectFlags & 4 && !type.node) {
51383                         var resolvedTypeArguments = type.resolvedTypeArguments;
51384                         var newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper);
51385                         return newTypeArguments !== resolvedTypeArguments ? createNormalizedTypeReference(type.target, newTypeArguments) : type;
51386                     }
51387                     if (objectFlags & 1024) {
51388                         return instantiateReverseMappedType(type, mapper);
51389                     }
51390                     return getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments);
51391                 }
51392                 return type;
51393             }
51394             if (flags & 3145728) {
51395                 var origin = type.flags & 1048576 ? type.origin : undefined;
51396                 var types = origin && origin.flags & 3145728 ? origin.types : type.types;
51397                 var newTypes = instantiateTypes(types, mapper);
51398                 if (newTypes === types && aliasSymbol === type.aliasSymbol) {
51399                     return type;
51400                 }
51401                 var newAliasSymbol = aliasSymbol || type.aliasSymbol;
51402                 var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
51403                 return flags & 2097152 || origin && origin.flags & 2097152 ?
51404                     getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
51405                     getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments);
51406             }
51407             if (flags & 4194304) {
51408                 return getIndexType(instantiateType(type.type, mapper));
51409             }
51410             if (flags & 134217728) {
51411                 return getTemplateLiteralType(type.texts, instantiateTypes(type.types, mapper));
51412             }
51413             if (flags & 268435456) {
51414                 return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
51415             }
51416             if (flags & 8388608) {
51417                 var newAliasSymbol = aliasSymbol || type.aliasSymbol;
51418                 var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
51419                 return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, undefined, newAliasSymbol, newAliasTypeArguments);
51420             }
51421             if (flags & 16777216) {
51422                 return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
51423             }
51424             if (flags & 33554432) {
51425                 var maybeVariable = instantiateType(type.baseType, mapper);
51426                 if (maybeVariable.flags & 8650752) {
51427                     return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper));
51428                 }
51429                 else {
51430                     var sub = instantiateType(type.substitute, mapper);
51431                     if (sub.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
51432                         return maybeVariable;
51433                     }
51434                     return sub;
51435                 }
51436             }
51437             return type;
51438         }
51439         function instantiateReverseMappedType(type, mapper) {
51440             var innerMappedType = instantiateType(type.mappedType, mapper);
51441             if (!(ts.getObjectFlags(innerMappedType) & 32)) {
51442                 return type;
51443             }
51444             var innerIndexType = instantiateType(type.constraintType, mapper);
51445             if (!(innerIndexType.flags & 4194304)) {
51446                 return type;
51447             }
51448             var instantiated = inferTypeForHomomorphicMappedType(instantiateType(type.source, mapper), innerMappedType, innerIndexType);
51449             if (instantiated) {
51450                 return instantiated;
51451             }
51452             return type;
51453         }
51454         function getPermissiveInstantiation(type) {
51455             return type.flags & (131068 | 3 | 131072) ? type :
51456                 type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
51457         }
51458         function getRestrictiveInstantiation(type) {
51459             if (type.flags & (131068 | 3 | 131072)) {
51460                 return type;
51461             }
51462             if (type.restrictiveInstantiation) {
51463                 return type.restrictiveInstantiation;
51464             }
51465             type.restrictiveInstantiation = instantiateType(type, restrictiveMapper);
51466             type.restrictiveInstantiation.restrictiveInstantiation = type.restrictiveInstantiation;
51467             return type.restrictiveInstantiation;
51468         }
51469         function instantiateIndexInfo(info, mapper) {
51470             return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
51471         }
51472         function isContextSensitive(node) {
51473             ts.Debug.assert(node.kind !== 168 || ts.isObjectLiteralMethod(node));
51474             switch (node.kind) {
51475                 case 212:
51476                 case 213:
51477                 case 168:
51478                 case 255:
51479                     return isContextSensitiveFunctionLikeDeclaration(node);
51480                 case 204:
51481                     return ts.some(node.properties, isContextSensitive);
51482                 case 203:
51483                     return ts.some(node.elements, isContextSensitive);
51484                 case 221:
51485                     return isContextSensitive(node.whenTrue) ||
51486                         isContextSensitive(node.whenFalse);
51487                 case 220:
51488                     return (node.operatorToken.kind === 56 || node.operatorToken.kind === 60) &&
51489                         (isContextSensitive(node.left) || isContextSensitive(node.right));
51490                 case 294:
51491                     return isContextSensitive(node.initializer);
51492                 case 211:
51493                     return isContextSensitive(node.expression);
51494                 case 285:
51495                     return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
51496                 case 284: {
51497                     var initializer = node.initializer;
51498                     return !!initializer && isContextSensitive(initializer);
51499                 }
51500                 case 287: {
51501                     var expression = node.expression;
51502                     return !!expression && isContextSensitive(expression);
51503                 }
51504             }
51505             return false;
51506         }
51507         function isContextSensitiveFunctionLikeDeclaration(node) {
51508             return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) &&
51509                 (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
51510         }
51511         function hasContextSensitiveReturnExpression(node) {
51512             return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 234 && isContextSensitive(node.body);
51513         }
51514         function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
51515             return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
51516                 isContextSensitiveFunctionLikeDeclaration(func);
51517         }
51518         function getTypeWithoutSignatures(type) {
51519             if (type.flags & 524288) {
51520                 var resolved = resolveStructuredTypeMembers(type);
51521                 if (resolved.constructSignatures.length || resolved.callSignatures.length) {
51522                     var result = createObjectType(16, type.symbol);
51523                     result.members = resolved.members;
51524                     result.properties = resolved.properties;
51525                     result.callSignatures = ts.emptyArray;
51526                     result.constructSignatures = ts.emptyArray;
51527                     result.indexInfos = ts.emptyArray;
51528                     return result;
51529                 }
51530             }
51531             else if (type.flags & 2097152) {
51532                 return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures));
51533             }
51534             return type;
51535         }
51536         function isTypeIdenticalTo(source, target) {
51537             return isTypeRelatedTo(source, target, identityRelation);
51538         }
51539         function compareTypesIdentical(source, target) {
51540             return isTypeRelatedTo(source, target, identityRelation) ? -1 : 0;
51541         }
51542         function compareTypesAssignable(source, target) {
51543             return isTypeRelatedTo(source, target, assignableRelation) ? -1 : 0;
51544         }
51545         function compareTypesSubtypeOf(source, target) {
51546             return isTypeRelatedTo(source, target, subtypeRelation) ? -1 : 0;
51547         }
51548         function isTypeSubtypeOf(source, target) {
51549             return isTypeRelatedTo(source, target, subtypeRelation);
51550         }
51551         function isTypeAssignableTo(source, target) {
51552             return isTypeRelatedTo(source, target, assignableRelation);
51553         }
51554         function isTypeDerivedFrom(source, target) {
51555             return source.flags & 1048576 ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
51556                 target.flags & 1048576 ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
51557                     source.flags & 58982400 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
51558                         target === globalObjectType ? !!(source.flags & (524288 | 67108864)) :
51559                             target === globalFunctionType ? !!(source.flags & 524288) && isFunctionObjectType(source) :
51560                                 hasBaseType(source, getTargetType(target)) || (isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType));
51561         }
51562         function isTypeComparableTo(source, target) {
51563             return isTypeRelatedTo(source, target, comparableRelation);
51564         }
51565         function areTypesComparable(type1, type2) {
51566             return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1);
51567         }
51568         function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain, errorOutputObject) {
51569             return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain, errorOutputObject);
51570         }
51571         function checkTypeAssignableToAndOptionallyElaborate(source, target, errorNode, expr, headMessage, containingMessageChain) {
51572             return checkTypeRelatedToAndOptionallyElaborate(source, target, assignableRelation, errorNode, expr, headMessage, containingMessageChain, undefined);
51573         }
51574         function checkTypeRelatedToAndOptionallyElaborate(source, target, relation, errorNode, expr, headMessage, containingMessageChain, errorOutputContainer) {
51575             if (isTypeRelatedTo(source, target, relation))
51576                 return true;
51577             if (!errorNode || !elaborateError(expr, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) {
51578                 return checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer);
51579             }
51580             return false;
51581         }
51582         function isOrHasGenericConditional(type) {
51583             return !!(type.flags & 16777216 || (type.flags & 2097152 && ts.some(type.types, isOrHasGenericConditional)));
51584         }
51585         function elaborateError(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) {
51586             if (!node || isOrHasGenericConditional(target))
51587                 return false;
51588             if (!checkTypeRelatedTo(source, target, relation, undefined)
51589                 && elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) {
51590                 return true;
51591             }
51592             switch (node.kind) {
51593                 case 287:
51594                 case 211:
51595                     return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
51596                 case 220:
51597                     switch (node.operatorToken.kind) {
51598                         case 63:
51599                         case 27:
51600                             return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
51601                     }
51602                     break;
51603                 case 204:
51604                     return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer);
51605                 case 203:
51606                     return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer);
51607                 case 285:
51608                     return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer);
51609                 case 213:
51610                     return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer);
51611             }
51612             return false;
51613         }
51614         function elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) {
51615             var callSignatures = getSignaturesOfType(source, 0);
51616             var constructSignatures = getSignaturesOfType(source, 1);
51617             for (var _i = 0, _a = [constructSignatures, callSignatures]; _i < _a.length; _i++) {
51618                 var signatures = _a[_i];
51619                 if (ts.some(signatures, function (s) {
51620                     var returnType = getReturnTypeOfSignature(s);
51621                     return !(returnType.flags & (1 | 131072)) && checkTypeRelatedTo(returnType, target, relation, undefined);
51622                 })) {
51623                     var resultObj = errorOutputContainer || {};
51624                     checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj);
51625                     var diagnostic = resultObj.errors[resultObj.errors.length - 1];
51626                     ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(node, signatures === constructSignatures ? ts.Diagnostics.Did_you_mean_to_use_new_with_this_expression : ts.Diagnostics.Did_you_mean_to_call_this_expression));
51627                     return true;
51628                 }
51629             }
51630             return false;
51631         }
51632         function elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer) {
51633             if (ts.isBlock(node.body)) {
51634                 return false;
51635             }
51636             if (ts.some(node.parameters, ts.hasType)) {
51637                 return false;
51638             }
51639             var sourceSig = getSingleCallSignature(source);
51640             if (!sourceSig) {
51641                 return false;
51642             }
51643             var targetSignatures = getSignaturesOfType(target, 0);
51644             if (!ts.length(targetSignatures)) {
51645                 return false;
51646             }
51647             var returnExpression = node.body;
51648             var sourceReturn = getReturnTypeOfSignature(sourceSig);
51649             var targetReturn = getUnionType(ts.map(targetSignatures, getReturnTypeOfSignature));
51650             if (!checkTypeRelatedTo(sourceReturn, targetReturn, relation, undefined)) {
51651                 var elaborated = returnExpression && elaborateError(returnExpression, sourceReturn, targetReturn, relation, undefined, containingMessageChain, errorOutputContainer);
51652                 if (elaborated) {
51653                     return elaborated;
51654                 }
51655                 var resultObj = errorOutputContainer || {};
51656                 checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, undefined, containingMessageChain, resultObj);
51657                 if (resultObj.errors) {
51658                     if (target.symbol && ts.length(target.symbol.declarations)) {
51659                         ts.addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], ts.createDiagnosticForNode(target.symbol.declarations[0], ts.Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature));
51660                     }
51661                     if ((ts.getFunctionFlags(node) & 2) === 0
51662                         && !getTypeOfPropertyOfType(sourceReturn, "then")
51663                         && checkTypeRelatedTo(createPromiseType(sourceReturn), targetReturn, relation, undefined)) {
51664                         ts.addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], ts.createDiagnosticForNode(node, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async));
51665                     }
51666                     return true;
51667                 }
51668             }
51669             return false;
51670         }
51671         function getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType) {
51672             var idx = getIndexedAccessTypeOrUndefined(target, nameType);
51673             if (idx) {
51674                 return idx;
51675             }
51676             if (target.flags & 1048576) {
51677                 var best = getBestMatchingType(source, target);
51678                 if (best) {
51679                     return getIndexedAccessTypeOrUndefined(best, nameType);
51680                 }
51681             }
51682         }
51683         function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
51684             next.contextualType = sourcePropType;
51685             try {
51686                 return checkExpressionForMutableLocation(next, 1, sourcePropType);
51687             }
51688             finally {
51689                 next.contextualType = undefined;
51690             }
51691         }
51692         function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
51693             var reportedError = false;
51694             for (var status = iterator.next(); !status.done; status = iterator.next()) {
51695                 var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
51696                 var targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType);
51697                 if (!targetPropType || targetPropType.flags & 8388608)
51698                     continue;
51699                 var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
51700                 if (!sourcePropType)
51701                     continue;
51702                 var propName = getPropertyNameFromIndex(nameType, undefined);
51703                 if (!checkTypeRelatedTo(sourcePropType, targetPropType, relation, undefined)) {
51704                     var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, undefined, containingMessageChain, errorOutputContainer);
51705                     reportedError = true;
51706                     if (!elaborated) {
51707                         var resultObj = errorOutputContainer || {};
51708                         var specificSource = next ? checkExpressionForMutableLocationWithContextualType(next, sourcePropType) : sourcePropType;
51709                         if (exactOptionalPropertyTypes && isExactOptionalPropertyMismatch(specificSource, targetPropType)) {
51710                             var diag = ts.createDiagnosticForNode(prop, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target, typeToString(specificSource), typeToString(targetPropType));
51711                             diagnostics.add(diag);
51712                             resultObj.errors = [diag];
51713                         }
51714                         else {
51715                             var targetIsOptional = !!(propName && (getPropertyOfType(target, propName) || unknownSymbol).flags & 16777216);
51716                             var sourceIsOptional = !!(propName && (getPropertyOfType(source, propName) || unknownSymbol).flags & 16777216);
51717                             targetPropType = removeMissingType(targetPropType, targetIsOptional);
51718                             sourcePropType = removeMissingType(sourcePropType, targetIsOptional && sourceIsOptional);
51719                             var result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj);
51720                             if (result && specificSource !== sourcePropType) {
51721                                 checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj);
51722                             }
51723                         }
51724                         if (resultObj.errors) {
51725                             var reportedDiag = resultObj.errors[resultObj.errors.length - 1];
51726                             var propertyName = isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : undefined;
51727                             var targetProp = propertyName !== undefined ? getPropertyOfType(target, propertyName) : undefined;
51728                             var issuedElaboration = false;
51729                             if (!targetProp) {
51730                                 var indexInfo = getApplicableIndexInfo(target, nameType);
51731                                 if (indexInfo && indexInfo.declaration && !ts.getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) {
51732                                     issuedElaboration = true;
51733                                     ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(indexInfo.declaration, ts.Diagnostics.The_expected_type_comes_from_this_index_signature));
51734                                 }
51735                             }
51736                             if (!issuedElaboration && (targetProp && ts.length(targetProp.declarations) || target.symbol && ts.length(target.symbol.declarations))) {
51737                                 var targetNode = targetProp && ts.length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
51738                                 if (!ts.getSourceFileOfNode(targetNode).hasNoDefaultLib) {
51739                                     ts.addRelatedInfo(reportedDiag, ts.createDiagnosticForNode(targetNode, ts.Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192) ? ts.unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target)));
51740                                 }
51741                             }
51742                         }
51743                     }
51744                 }
51745             }
51746             return reportedError;
51747         }
51748         function generateJsxAttributes(node) {
51749             var _i, _a, prop;
51750             return __generator(this, function (_b) {
51751                 switch (_b.label) {
51752                     case 0:
51753                         if (!ts.length(node.properties))
51754                             return [2];
51755                         _i = 0, _a = node.properties;
51756                         _b.label = 1;
51757                     case 1:
51758                         if (!(_i < _a.length)) return [3, 4];
51759                         prop = _a[_i];
51760                         if (ts.isJsxSpreadAttribute(prop) || isHyphenatedJsxName(ts.idText(prop.name)))
51761                             return [3, 3];
51762                         return [4, { errorNode: prop.name, innerExpression: prop.initializer, nameType: getStringLiteralType(ts.idText(prop.name)) }];
51763                     case 2:
51764                         _b.sent();
51765                         _b.label = 3;
51766                     case 3:
51767                         _i++;
51768                         return [3, 1];
51769                     case 4: return [2];
51770                 }
51771             });
51772         }
51773         function generateJsxChildren(node, getInvalidTextDiagnostic) {
51774             var memberOffset, i, child, nameType, elem;
51775             return __generator(this, function (_a) {
51776                 switch (_a.label) {
51777                     case 0:
51778                         if (!ts.length(node.children))
51779                             return [2];
51780                         memberOffset = 0;
51781                         i = 0;
51782                         _a.label = 1;
51783                     case 1:
51784                         if (!(i < node.children.length)) return [3, 5];
51785                         child = node.children[i];
51786                         nameType = getNumberLiteralType(i - memberOffset);
51787                         elem = getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic);
51788                         if (!elem) return [3, 3];
51789                         return [4, elem];
51790                     case 2:
51791                         _a.sent();
51792                         return [3, 4];
51793                     case 3:
51794                         memberOffset++;
51795                         _a.label = 4;
51796                     case 4:
51797                         i++;
51798                         return [3, 1];
51799                     case 5: return [2];
51800                 }
51801             });
51802         }
51803         function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
51804             switch (child.kind) {
51805                 case 287:
51806                     return { errorNode: child, innerExpression: child.expression, nameType: nameType };
51807                 case 11:
51808                     if (child.containsOnlyTriviaWhiteSpaces) {
51809                         break;
51810                     }
51811                     return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
51812                 case 277:
51813                 case 278:
51814                 case 281:
51815                     return { errorNode: child, innerExpression: child, nameType: nameType };
51816                 default:
51817                     return ts.Debug.assertNever(child, "Found invalid jsx child");
51818             }
51819         }
51820         function elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer) {
51821             var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation, containingMessageChain, errorOutputContainer);
51822             var invalidTextDiagnostic;
51823             if (ts.isJsxOpeningElement(node.parent) && ts.isJsxElement(node.parent.parent)) {
51824                 var containingElement = node.parent.parent;
51825                 var childPropName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
51826                 var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
51827                 var childrenNameType = getStringLiteralType(childrenPropName);
51828                 var childrenTargetType = getIndexedAccessType(target, childrenNameType);
51829                 var validChildren = ts.getSemanticJsxChildren(containingElement.children);
51830                 if (!ts.length(validChildren)) {
51831                     return result;
51832                 }
51833                 var moreThanOneRealChildren = ts.length(validChildren) > 1;
51834                 var arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
51835                 var nonArrayLikeTargetParts = filterType(childrenTargetType, function (t) { return !isArrayOrTupleLikeType(t); });
51836                 if (moreThanOneRealChildren) {
51837                     if (arrayLikeTargetParts !== neverType) {
51838                         var realSource = createTupleType(checkJsxChildren(containingElement, 0));
51839                         var children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic);
51840                         result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
51841                     }
51842                     else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
51843                         result = true;
51844                         var diag = error(containingElement.openingElement.tagName, ts.Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided, childrenPropName, typeToString(childrenTargetType));
51845                         if (errorOutputContainer && errorOutputContainer.skipLogging) {
51846                             (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
51847                         }
51848                     }
51849                 }
51850                 else {
51851                     if (nonArrayLikeTargetParts !== neverType) {
51852                         var child = validChildren[0];
51853                         var elem_1 = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic);
51854                         if (elem_1) {
51855                             result = elaborateElementwise((function () { return __generator(this, function (_a) {
51856                                 switch (_a.label) {
51857                                     case 0: return [4, elem_1];
51858                                     case 1:
51859                                         _a.sent();
51860                                         return [2];
51861                                 }
51862                             }); })(), source, target, relation, containingMessageChain, errorOutputContainer) || result;
51863                         }
51864                     }
51865                     else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
51866                         result = true;
51867                         var diag = error(containingElement.openingElement.tagName, ts.Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided, childrenPropName, typeToString(childrenTargetType));
51868                         if (errorOutputContainer && errorOutputContainer.skipLogging) {
51869                             (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
51870                         }
51871                     }
51872                 }
51873             }
51874             return result;
51875             function getInvalidTextualChildDiagnostic() {
51876                 if (!invalidTextDiagnostic) {
51877                     var tagNameText = ts.getTextOfNode(node.parent.tagName);
51878                     var childPropName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
51879                     var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
51880                     var childrenTargetType = getIndexedAccessType(target, getStringLiteralType(childrenPropName));
51881                     var diagnostic = ts.Diagnostics._0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2;
51882                     invalidTextDiagnostic = __assign(__assign({}, diagnostic), { key: "!!ALREADY FORMATTED!!", message: ts.formatMessage(undefined, diagnostic, tagNameText, childrenPropName, typeToString(childrenTargetType)) });
51883                 }
51884                 return invalidTextDiagnostic;
51885             }
51886         }
51887         function generateLimitedTupleElements(node, target) {
51888             var len, i, elem, nameType;
51889             return __generator(this, function (_a) {
51890                 switch (_a.label) {
51891                     case 0:
51892                         len = ts.length(node.elements);
51893                         if (!len)
51894                             return [2];
51895                         i = 0;
51896                         _a.label = 1;
51897                     case 1:
51898                         if (!(i < len)) return [3, 4];
51899                         if (isTupleLikeType(target) && !getPropertyOfType(target, ("" + i)))
51900                             return [3, 3];
51901                         elem = node.elements[i];
51902                         if (ts.isOmittedExpression(elem))
51903                             return [3, 3];
51904                         nameType = getNumberLiteralType(i);
51905                         return [4, { errorNode: elem, innerExpression: elem, nameType: nameType }];
51906                     case 2:
51907                         _a.sent();
51908                         _a.label = 3;
51909                     case 3:
51910                         i++;
51911                         return [3, 1];
51912                     case 4: return [2];
51913                 }
51914             });
51915         }
51916         function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
51917             if (target.flags & 131068)
51918                 return false;
51919             if (isTupleLikeType(source)) {
51920                 return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
51921             }
51922             var oldContext = node.contextualType;
51923             node.contextualType = target;
51924             try {
51925                 var tupleizedType = checkArrayLiteral(node, 1, true);
51926                 node.contextualType = oldContext;
51927                 if (isTupleLikeType(tupleizedType)) {
51928                     return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer);
51929                 }
51930                 return false;
51931             }
51932             finally {
51933                 node.contextualType = oldContext;
51934             }
51935         }
51936         function generateObjectLiteralElements(node) {
51937             var _i, _a, prop, type, _b;
51938             return __generator(this, function (_c) {
51939                 switch (_c.label) {
51940                     case 0:
51941                         if (!ts.length(node.properties))
51942                             return [2];
51943                         _i = 0, _a = node.properties;
51944                         _c.label = 1;
51945                     case 1:
51946                         if (!(_i < _a.length)) return [3, 8];
51947                         prop = _a[_i];
51948                         if (ts.isSpreadAssignment(prop))
51949                             return [3, 7];
51950                         type = getLiteralTypeFromProperty(getSymbolOfNode(prop), 8576);
51951                         if (!type || (type.flags & 131072)) {
51952                             return [3, 7];
51953                         }
51954                         _b = prop.kind;
51955                         switch (_b) {
51956                             case 172: return [3, 2];
51957                             case 171: return [3, 2];
51958                             case 168: return [3, 2];
51959                             case 295: return [3, 2];
51960                             case 294: return [3, 4];
51961                         }
51962                         return [3, 6];
51963                     case 2: return [4, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
51964                     case 3:
51965                         _c.sent();
51966                         return [3, 7];
51967                     case 4: return [4, { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: ts.isComputedNonLiteralName(prop.name) ? ts.Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : undefined }];
51968                     case 5:
51969                         _c.sent();
51970                         return [3, 7];
51971                     case 6:
51972                         ts.Debug.assertNever(prop);
51973                         _c.label = 7;
51974                     case 7:
51975                         _i++;
51976                         return [3, 1];
51977                     case 8: return [2];
51978                 }
51979             });
51980         }
51981         function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
51982             if (target.flags & 131068)
51983                 return false;
51984             return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
51985         }
51986         function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) {
51987             return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain);
51988         }
51989         function isSignatureAssignableTo(source, target, ignoreReturnTypes) {
51990             return compareSignaturesRelated(source, target, ignoreReturnTypes ? 4 : 0, false, undefined, undefined, compareTypesAssignable, undefined) !== 0;
51991         }
51992         function isAnySignature(s) {
51993             return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 &&
51994                 signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) &&
51995                 isTypeAny(getReturnTypeOfSignature(s));
51996         }
51997         function compareSignaturesRelated(source, target, checkMode, reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
51998             if (source === target) {
51999                 return -1;
52000             }
52001             if (isAnySignature(target)) {
52002                 return -1;
52003             }
52004             var targetCount = getParameterCount(target);
52005             var sourceHasMoreParameters = !hasEffectiveRestParameter(target) &&
52006                 (checkMode & 8 ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
52007             if (sourceHasMoreParameters) {
52008                 return 0;
52009             }
52010             if (source.typeParameters && source.typeParameters !== target.typeParameters) {
52011                 target = getCanonicalSignature(target);
52012                 source = instantiateSignatureInContextOf(source, target, undefined, compareTypes);
52013             }
52014             var sourceCount = getParameterCount(source);
52015             var sourceRestType = getNonArrayRestType(source);
52016             var targetRestType = getNonArrayRestType(target);
52017             if (sourceRestType || targetRestType) {
52018                 void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers);
52019             }
52020             if (sourceRestType && targetRestType && sourceCount !== targetCount) {
52021                 return 0;
52022             }
52023             var kind = target.declaration ? target.declaration.kind : 0;
52024             var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 168 &&
52025                 kind !== 167 && kind !== 170;
52026             var result = -1;
52027             var sourceThisType = getThisTypeOfSignature(source);
52028             if (sourceThisType && sourceThisType !== voidType) {
52029                 var targetThisType = getThisTypeOfSignature(target);
52030                 if (targetThisType) {
52031                     var related = !strictVariance && compareTypes(sourceThisType, targetThisType, false)
52032                         || compareTypes(targetThisType, sourceThisType, reportErrors);
52033                     if (!related) {
52034                         if (reportErrors) {
52035                             errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible);
52036                         }
52037                         return 0;
52038                     }
52039                     result &= related;
52040                 }
52041             }
52042             var paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
52043             var restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
52044             for (var i = 0; i < paramCount; i++) {
52045                 var sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
52046                 var targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
52047                 if (sourceType && targetType) {
52048                     var sourceSig = checkMode & 3 ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
52049                     var targetSig = checkMode & 3 ? undefined : getSingleCallSignature(getNonNullableType(targetType));
52050                     var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
52051                         (getFalsyFlags(sourceType) & 98304) === (getFalsyFlags(targetType) & 98304);
52052                     var related = callbacks ?
52053                         compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8) | (strictVariance ? 2 : 1), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
52054                         !(checkMode & 3) && !strictVariance && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors);
52055                     if (related && checkMode & 8 && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(sourceType, targetType, false)) {
52056                         related = 0;
52057                     }
52058                     if (!related) {
52059                         if (reportErrors) {
52060                             errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, ts.unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), ts.unescapeLeadingUnderscores(getParameterNameAtPosition(target, i)));
52061                         }
52062                         return 0;
52063                     }
52064                     result &= related;
52065                 }
52066             }
52067             if (!(checkMode & 4)) {
52068                 var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
52069                     : target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
52070                         : getReturnTypeOfSignature(target);
52071                 if (targetReturnType === voidType) {
52072                     return result;
52073                 }
52074                 var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
52075                     : source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
52076                         : getReturnTypeOfSignature(source);
52077                 var targetTypePredicate = getTypePredicateOfSignature(target);
52078                 if (targetTypePredicate) {
52079                     var sourceTypePredicate = getTypePredicateOfSignature(source);
52080                     if (sourceTypePredicate) {
52081                         result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors, errorReporter, compareTypes);
52082                     }
52083                     else if (ts.isIdentifierTypePredicate(targetTypePredicate)) {
52084                         if (reportErrors) {
52085                             errorReporter(ts.Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
52086                         }
52087                         return 0;
52088                     }
52089                 }
52090                 else {
52091                     result &= checkMode & 1 && compareTypes(targetReturnType, sourceReturnType, false) ||
52092                         compareTypes(sourceReturnType, targetReturnType, reportErrors);
52093                     if (!result && reportErrors && incompatibleErrorReporter) {
52094                         incompatibleErrorReporter(sourceReturnType, targetReturnType);
52095                     }
52096                 }
52097             }
52098             return result;
52099         }
52100         function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) {
52101             if (source.kind !== target.kind) {
52102                 if (reportErrors) {
52103                     errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);
52104                     errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
52105                 }
52106                 return 0;
52107             }
52108             if (source.kind === 1 || source.kind === 3) {
52109                 if (source.parameterIndex !== target.parameterIndex) {
52110                     if (reportErrors) {
52111                         errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, target.parameterName);
52112                         errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
52113                     }
52114                     return 0;
52115                 }
52116             }
52117             var related = source.type === target.type ? -1 :
52118                 source.type && target.type ? compareTypes(source.type, target.type, reportErrors) :
52119                     0;
52120             if (related === 0 && reportErrors) {
52121                 errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
52122             }
52123             return related;
52124         }
52125         function isImplementationCompatibleWithOverload(implementation, overload) {
52126             var erasedSource = getErasedSignature(implementation);
52127             var erasedTarget = getErasedSignature(overload);
52128             var sourceReturnType = getReturnTypeOfSignature(erasedSource);
52129             var targetReturnType = getReturnTypeOfSignature(erasedTarget);
52130             if (targetReturnType === voidType
52131                 || isTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation)
52132                 || isTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation)) {
52133                 return isSignatureAssignableTo(erasedSource, erasedTarget, true);
52134             }
52135             return false;
52136         }
52137         function isEmptyResolvedType(t) {
52138             return t !== anyFunctionType &&
52139                 t.properties.length === 0 &&
52140                 t.callSignatures.length === 0 &&
52141                 t.constructSignatures.length === 0 &&
52142                 t.indexInfos.length === 0;
52143         }
52144         function isEmptyObjectType(type) {
52145             return type.flags & 524288 ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) :
52146                 type.flags & 67108864 ? true :
52147                     type.flags & 1048576 ? ts.some(type.types, isEmptyObjectType) :
52148                         type.flags & 2097152 ? ts.every(type.types, isEmptyObjectType) :
52149                             false;
52150         }
52151         function isEmptyAnonymousObjectType(type) {
52152             return !!(ts.getObjectFlags(type) & 16 && (type.members && isEmptyResolvedType(type) ||
52153                 type.symbol && type.symbol.flags & 2048 && getMembersOfSymbol(type.symbol).size === 0));
52154         }
52155         function isStringIndexSignatureOnlyType(type) {
52156             return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
52157                 type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
52158                 false;
52159         }
52160         function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
52161             if (sourceSymbol === targetSymbol) {
52162                 return true;
52163             }
52164             var id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
52165             var entry = enumRelation.get(id);
52166             if (entry !== undefined && !(!(entry & 4) && entry & 2 && errorReporter)) {
52167                 return !!(entry & 1);
52168             }
52169             if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256) || !(targetSymbol.flags & 256)) {
52170                 enumRelation.set(id, 2 | 4);
52171                 return false;
52172             }
52173             var targetEnumType = getTypeOfSymbol(targetSymbol);
52174             for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(sourceSymbol)); _i < _a.length; _i++) {
52175                 var property = _a[_i];
52176                 if (property.flags & 8) {
52177                     var targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
52178                     if (!targetProperty || !(targetProperty.flags & 8)) {
52179                         if (errorReporter) {
52180                             errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, ts.symbolName(property), typeToString(getDeclaredTypeOfSymbol(targetSymbol), undefined, 64));
52181                             enumRelation.set(id, 2 | 4);
52182                         }
52183                         else {
52184                             enumRelation.set(id, 2);
52185                         }
52186                         return false;
52187                     }
52188                 }
52189             }
52190             enumRelation.set(id, 1);
52191             return true;
52192         }
52193         function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
52194             var s = source.flags;
52195             var t = target.flags;
52196             if (t & 3 || s & 131072 || source === wildcardType)
52197                 return true;
52198             if (t & 131072)
52199                 return false;
52200             if (s & 402653316 && t & 4)
52201                 return true;
52202             if (s & 128 && s & 1024 &&
52203                 t & 128 && !(t & 1024) &&
52204                 source.value === target.value)
52205                 return true;
52206             if (s & 296 && t & 8)
52207                 return true;
52208             if (s & 256 && s & 1024 &&
52209                 t & 256 && !(t & 1024) &&
52210                 source.value === target.value)
52211                 return true;
52212             if (s & 2112 && t & 64)
52213                 return true;
52214             if (s & 528 && t & 16)
52215                 return true;
52216             if (s & 12288 && t & 4096)
52217                 return true;
52218             if (s & 32 && t & 32 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52219                 return true;
52220             if (s & 1024 && t & 1024) {
52221                 if (s & 1048576 && t & 1048576 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
52222                     return true;
52223                 if (s & 2944 && t & 2944 &&
52224                     source.value === target.value &&
52225                     isEnumTypeRelatedTo(getParentOfSymbol(source.symbol), getParentOfSymbol(target.symbol), errorReporter))
52226                     return true;
52227             }
52228             if (s & 32768 && (!strictNullChecks || t & (32768 | 16384)))
52229                 return true;
52230             if (s & 65536 && (!strictNullChecks || t & 65536))
52231                 return true;
52232             if (s & 524288 && t & 67108864)
52233                 return true;
52234             if (relation === assignableRelation || relation === comparableRelation) {
52235                 if (s & 1)
52236                     return true;
52237                 if (s & (8 | 256) && !(s & 1024) && (t & 32 || relation === assignableRelation && t & 256 && t & 1024))
52238                     return true;
52239             }
52240             return false;
52241         }
52242         function isTypeRelatedTo(source, target, relation) {
52243             if (isFreshLiteralType(source)) {
52244                 source = source.regularType;
52245             }
52246             if (isFreshLiteralType(target)) {
52247                 target = target.regularType;
52248             }
52249             if (source === target) {
52250                 return true;
52251             }
52252             if (relation !== identityRelation) {
52253                 if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) {
52254                     return true;
52255                 }
52256             }
52257             else {
52258                 if (source.flags !== target.flags)
52259                     return false;
52260                 if (source.flags & 67358815)
52261                     return true;
52262             }
52263             if (source.flags & 524288 && target.flags & 524288) {
52264                 var related = relation.get(getRelationKey(source, target, 0, relation));
52265                 if (related !== undefined) {
52266                     return !!(related & 1);
52267                 }
52268             }
52269             if (source.flags & 469499904 || target.flags & 469499904) {
52270                 return checkTypeRelatedTo(source, target, relation, undefined);
52271             }
52272             return false;
52273         }
52274         function isIgnoredJsxProperty(source, sourceProp) {
52275             return ts.getObjectFlags(source) & 2048 && isHyphenatedJsxName(sourceProp.escapedName);
52276         }
52277         function getNormalizedType(type, writing) {
52278             while (true) {
52279                 var t = isFreshLiteralType(type) ? type.regularType :
52280                     ts.getObjectFlags(type) & 4 && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
52281                         type.flags & 3145728 ? getReducedType(type) :
52282                             type.flags & 33554432 ? writing ? type.baseType : type.substitute :
52283                                 type.flags & 25165824 ? getSimplifiedType(type, writing) :
52284                                     type;
52285                 t = getSingleBaseForNonAugmentingSubtype(t) || t;
52286                 if (t === type)
52287                     break;
52288                 type = t;
52289             }
52290             return type;
52291         }
52292         function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
52293             var errorInfo;
52294             var relatedInfo;
52295             var maybeKeys;
52296             var sourceStack;
52297             var targetStack;
52298             var maybeCount = 0;
52299             var sourceDepth = 0;
52300             var targetDepth = 0;
52301             var expandingFlags = 0;
52302             var overflow = false;
52303             var overrideNextErrorInfo = 0;
52304             var lastSkippedInfo;
52305             var incompatibleStack = [];
52306             var inPropertyCheck = false;
52307             ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
52308             var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
52309             if (incompatibleStack.length) {
52310                 reportIncompatibleStack();
52311             }
52312             if (overflow) {
52313                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth: targetDepth });
52314                 var diag = error(errorNode || currentNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
52315                 if (errorOutputContainer) {
52316                     (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
52317                 }
52318             }
52319             else if (errorInfo) {
52320                 if (containingMessageChain) {
52321                     var chain = containingMessageChain();
52322                     if (chain) {
52323                         ts.concatenateDiagnosticMessageChains(chain, errorInfo);
52324                         errorInfo = chain;
52325                     }
52326                 }
52327                 var relatedInformation = void 0;
52328                 if (headMessage && errorNode && !result && source.symbol) {
52329                     var links = getSymbolLinks(source.symbol);
52330                     if (links.originatingImport && !ts.isImportCall(links.originatingImport)) {
52331                         var helpfulRetry = checkTypeRelatedTo(getTypeOfSymbol(links.target), target, relation, undefined);
52332                         if (helpfulRetry) {
52333                             var diag_1 = ts.createDiagnosticForNode(links.originatingImport, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead);
52334                             relatedInformation = ts.append(relatedInformation, diag_1);
52335                         }
52336                     }
52337                 }
52338                 var diag = ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, relatedInformation);
52339                 if (relatedInfo) {
52340                     ts.addRelatedInfo.apply(void 0, __spreadArray([diag], relatedInfo, false));
52341                 }
52342                 if (errorOutputContainer) {
52343                     (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
52344                 }
52345                 if (!errorOutputContainer || !errorOutputContainer.skipLogging) {
52346                     diagnostics.add(diag);
52347                 }
52348             }
52349             if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === 0) {
52350                 ts.Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error.");
52351             }
52352             return result !== 0;
52353             function resetErrorInfo(saved) {
52354                 errorInfo = saved.errorInfo;
52355                 lastSkippedInfo = saved.lastSkippedInfo;
52356                 incompatibleStack = saved.incompatibleStack;
52357                 overrideNextErrorInfo = saved.overrideNextErrorInfo;
52358                 relatedInfo = saved.relatedInfo;
52359             }
52360             function captureErrorCalculationState() {
52361                 return {
52362                     errorInfo: errorInfo,
52363                     lastSkippedInfo: lastSkippedInfo,
52364                     incompatibleStack: incompatibleStack.slice(),
52365                     overrideNextErrorInfo: overrideNextErrorInfo,
52366                     relatedInfo: !relatedInfo ? undefined : relatedInfo.slice()
52367                 };
52368             }
52369             function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
52370                 overrideNextErrorInfo++;
52371                 lastSkippedInfo = undefined;
52372                 incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
52373             }
52374             function reportIncompatibleStack() {
52375                 var stack = incompatibleStack;
52376                 incompatibleStack = [];
52377                 var info = lastSkippedInfo;
52378                 lastSkippedInfo = undefined;
52379                 if (stack.length === 1) {
52380                     reportError.apply(void 0, stack[0]);
52381                     if (info) {
52382                         reportRelationError.apply(void 0, __spreadArray([undefined], info, false));
52383                     }
52384                     return;
52385                 }
52386                 var path = "";
52387                 var secondaryRootErrors = [];
52388                 while (stack.length) {
52389                     var _a = stack.pop(), msg = _a[0], args = _a.slice(1);
52390                     switch (msg.code) {
52391                         case ts.Diagnostics.Types_of_property_0_are_incompatible.code: {
52392                             if (path.indexOf("new ") === 0) {
52393                                 path = "(".concat(path, ")");
52394                             }
52395                             var str = "" + args[0];
52396                             if (path.length === 0) {
52397                                 path = "".concat(str);
52398                             }
52399                             else if (ts.isIdentifierText(str, ts.getEmitScriptTarget(compilerOptions))) {
52400                                 path = "".concat(path, ".").concat(str);
52401                             }
52402                             else if (str[0] === "[" && str[str.length - 1] === "]") {
52403                                 path = "".concat(path).concat(str);
52404                             }
52405                             else {
52406                                 path = "".concat(path, "[").concat(str, "]");
52407                             }
52408                             break;
52409                         }
52410                         case ts.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code:
52411                         case ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code:
52412                         case ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code:
52413                         case ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: {
52414                             if (path.length === 0) {
52415                                 var mappedMsg = msg;
52416                                 if (msg.code === ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) {
52417                                     mappedMsg = ts.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible;
52418                                 }
52419                                 else if (msg.code === ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) {
52420                                     mappedMsg = ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible;
52421                                 }
52422                                 secondaryRootErrors.unshift([mappedMsg, args[0], args[1]]);
52423                             }
52424                             else {
52425                                 var prefix = (msg.code === ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code ||
52426                                     msg.code === ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code)
52427                                     ? "new "
52428                                     : "";
52429                                 var params = (msg.code === ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ||
52430                                     msg.code === ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code)
52431                                     ? ""
52432                                     : "...";
52433                                 path = "".concat(prefix).concat(path, "(").concat(params, ")");
52434                             }
52435                             break;
52436                         }
52437                         case ts.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target.code: {
52438                             secondaryRootErrors.unshift([ts.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, args[0], args[1]]);
52439                             break;
52440                         }
52441                         case ts.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target.code: {
52442                             secondaryRootErrors.unshift([ts.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, args[0], args[1], args[2]]);
52443                             break;
52444                         }
52445                         default:
52446                             return ts.Debug.fail("Unhandled Diagnostic: ".concat(msg.code));
52447                     }
52448                 }
52449                 if (path) {
52450                     reportError(path[path.length - 1] === ")"
52451                         ? ts.Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types
52452                         : ts.Diagnostics.The_types_of_0_are_incompatible_between_these_types, path);
52453                 }
52454                 else {
52455                     secondaryRootErrors.shift();
52456                 }
52457                 for (var _i = 0, secondaryRootErrors_1 = secondaryRootErrors; _i < secondaryRootErrors_1.length; _i++) {
52458                     var _b = secondaryRootErrors_1[_i], msg = _b[0], args = _b.slice(1);
52459                     var originalValue = msg.elidedInCompatabilityPyramid;
52460                     msg.elidedInCompatabilityPyramid = false;
52461                     reportError.apply(void 0, __spreadArray([msg], args, false));
52462                     msg.elidedInCompatabilityPyramid = originalValue;
52463                 }
52464                 if (info) {
52465                     reportRelationError.apply(void 0, __spreadArray([undefined], info, false));
52466                 }
52467             }
52468             function reportError(message, arg0, arg1, arg2, arg3) {
52469                 ts.Debug.assert(!!errorNode);
52470                 if (incompatibleStack.length)
52471                     reportIncompatibleStack();
52472                 if (message.elidedInCompatabilityPyramid)
52473                     return;
52474                 errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3);
52475             }
52476             function associateRelatedInfo(info) {
52477                 ts.Debug.assert(!!errorInfo);
52478                 if (!relatedInfo) {
52479                     relatedInfo = [info];
52480                 }
52481                 else {
52482                     relatedInfo.push(info);
52483                 }
52484             }
52485             function reportRelationError(message, source, target) {
52486                 if (incompatibleStack.length)
52487                     reportIncompatibleStack();
52488                 var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
52489                 var generalizedSource = source;
52490                 var generalizedSourceType = sourceType;
52491                 if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) {
52492                     generalizedSource = getBaseTypeOfLiteralType(source);
52493                     ts.Debug.assert(!isTypeAssignableTo(generalizedSource, target), "generalized source shouldn't be assignable");
52494                     generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
52495                 }
52496                 if (target.flags & 262144) {
52497                     var constraint = getBaseConstraintOfType(target);
52498                     var needsOriginalSource = void 0;
52499                     if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source, constraint)))) {
52500                         reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, needsOriginalSource ? sourceType : generalizedSourceType, targetType, typeToString(constraint));
52501                     }
52502                     else {
52503                         errorInfo = undefined;
52504                         reportError(ts.Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1, targetType, generalizedSourceType);
52505                     }
52506                 }
52507                 if (!message) {
52508                     if (relation === comparableRelation) {
52509                         message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1;
52510                     }
52511                     else if (sourceType === targetType) {
52512                         message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated;
52513                     }
52514                     else if (exactOptionalPropertyTypes && getExactOptionalUnassignableProperties(source, target).length) {
52515                         message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;
52516                     }
52517                     else {
52518                         if (source.flags & 128 && target.flags & 1048576) {
52519                             var suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source, target);
52520                             if (suggestedType) {
52521                                 reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType));
52522                                 return;
52523                             }
52524                         }
52525                         message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1;
52526                     }
52527                 }
52528                 else if (message === ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1
52529                     && exactOptionalPropertyTypes
52530                     && getExactOptionalUnassignableProperties(source, target).length) {
52531                     message = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties;
52532                 }
52533                 reportError(message, generalizedSourceType, targetType);
52534             }
52535             function tryElaborateErrorsForPrimitivesAndObjects(source, target) {
52536                 var sourceType = symbolValueDeclarationIsContextSensitive(source.symbol) ? typeToString(source, source.symbol.valueDeclaration) : typeToString(source);
52537                 var targetType = symbolValueDeclarationIsContextSensitive(target.symbol) ? typeToString(target, target.symbol.valueDeclaration) : typeToString(target);
52538                 if ((globalStringType === source && stringType === target) ||
52539                     (globalNumberType === source && numberType === target) ||
52540                     (globalBooleanType === source && booleanType === target) ||
52541                     (getGlobalESSymbolType(false) === source && esSymbolType === target)) {
52542                     reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
52543                 }
52544             }
52545             function tryElaborateArrayLikeErrors(source, target, reportErrors) {
52546                 if (isTupleType(source)) {
52547                     if (source.target.readonly && isMutableArrayOrTuple(target)) {
52548                         if (reportErrors) {
52549                             reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
52550                         }
52551                         return false;
52552                     }
52553                     return isTupleType(target) || isArrayType(target);
52554                 }
52555                 if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
52556                     if (reportErrors) {
52557                         reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
52558                     }
52559                     return false;
52560                 }
52561                 if (isTupleType(target)) {
52562                     return isArrayType(source);
52563                 }
52564                 return true;
52565             }
52566             function isRelatedToWorker(source, target, reportErrors) {
52567                 return isRelatedTo(source, target, 3, reportErrors);
52568             }
52569             function isRelatedTo(originalSource, originalTarget, recursionFlags, reportErrors, headMessage, intersectionState) {
52570                 if (recursionFlags === void 0) { recursionFlags = 3; }
52571                 if (reportErrors === void 0) { reportErrors = false; }
52572                 if (intersectionState === void 0) { intersectionState = 0; }
52573                 if (originalSource.flags & 524288 && originalTarget.flags & 131068) {
52574                     if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
52575                         return -1;
52576                     }
52577                     reportErrorResults(originalSource, originalTarget, 0, !!(ts.getObjectFlags(originalSource) & 2048));
52578                     return 0;
52579                 }
52580                 var source = getNormalizedType(originalSource, false);
52581                 var target = getNormalizedType(originalTarget, true);
52582                 if (source === target)
52583                     return -1;
52584                 if (relation === identityRelation) {
52585                     return isIdenticalTo(source, target, recursionFlags);
52586                 }
52587                 if (source.flags & 262144 && getConstraintOfType(source) === target) {
52588                     return -1;
52589                 }
52590                 if (target.flags & 1048576 && source.flags & 524288 &&
52591                     target.types.length <= 3 && maybeTypeOfKind(target, 98304)) {
52592                     var nullStrippedTarget = extractTypesOfKind(target, ~98304);
52593                     if (!(nullStrippedTarget.flags & (1048576 | 131072))) {
52594                         target = getNormalizedType(nullStrippedTarget, true);
52595                     }
52596                     if (source === nullStrippedTarget)
52597                         return -1;
52598                 }
52599                 if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) ||
52600                     isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
52601                     return -1;
52602                 var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
52603                 var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 16384);
52604                 if (isPerformingExcessPropertyChecks) {
52605                     if (hasExcessProperties(source, target, reportErrors)) {
52606                         if (reportErrors) {
52607                             reportRelationError(headMessage, source, originalTarget.aliasSymbol ? originalTarget : target);
52608                         }
52609                         return 0;
52610                     }
52611                 }
52612                 var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) &&
52613                     source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
52614                     target.flags & (524288 | 2097152) && isWeakType(target) &&
52615                     (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
52616                 if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
52617                     if (reportErrors) {
52618                         var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source);
52619                         var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
52620                         var calls = getSignaturesOfType(source, 0);
52621                         var constructs = getSignaturesOfType(source, 1);
52622                         if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
52623                             constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
52624                             reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
52625                         }
52626                         else {
52627                             reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
52628                         }
52629                     }
52630                     return 0;
52631                 }
52632                 traceUnionsOrIntersectionsTooLarge(source, target);
52633                 var result = 0;
52634                 var saveErrorInfo = captureErrorCalculationState();
52635                 if ((source.flags & 1048576 || target.flags & 1048576) && getConstituentCount(source) * getConstituentCount(target) < 4) {
52636                     result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
52637                 }
52638                 else if (source.flags & 3145728 || target.flags & 3145728) {
52639                     result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags);
52640                 }
52641                 if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
52642                     if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
52643                         resetErrorInfo(saveErrorInfo);
52644                     }
52645                 }
52646                 if (!result && source.flags & (2097152 | 262144)) {
52647                     var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
52648                     if (constraint && (source.flags & 2097152 || target.flags & 1048576)) {
52649                         if (everyType(constraint, function (c) { return c !== source; })) {
52650                             if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
52651                                 resetErrorInfo(saveErrorInfo);
52652                             }
52653                         }
52654                     }
52655                 }
52656                 if (result && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
52657                     isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
52658                     inPropertyCheck = true;
52659                     result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
52660                     inPropertyCheck = false;
52661                 }
52662                 reportErrorResults(source, target, result, isComparingJsxAttributes);
52663                 return result;
52664                 function reportErrorResults(source, target, result, isComparingJsxAttributes) {
52665                     if (!result && reportErrors) {
52666                         var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
52667                         var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
52668                         source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
52669                         target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
52670                         var maybeSuppress = overrideNextErrorInfo > 0;
52671                         if (maybeSuppress) {
52672                             overrideNextErrorInfo--;
52673                         }
52674                         if (source.flags & 524288 && target.flags & 524288) {
52675                             var currentError = errorInfo;
52676                             tryElaborateArrayLikeErrors(source, target, reportErrors);
52677                             if (errorInfo !== currentError) {
52678                                 maybeSuppress = !!errorInfo;
52679                             }
52680                         }
52681                         if (source.flags & 524288 && target.flags & 131068) {
52682                             tryElaborateErrorsForPrimitivesAndObjects(source, target);
52683                         }
52684                         else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
52685                             reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
52686                         }
52687                         else if (isComparingJsxAttributes && target.flags & 2097152) {
52688                             var targetTypes = target.types;
52689                             var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
52690                             var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
52691                             if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
52692                                 (ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
52693                                 return result;
52694                             }
52695                         }
52696                         else {
52697                             errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
52698                         }
52699                         if (!headMessage && maybeSuppress) {
52700                             lastSkippedInfo = [source, target];
52701                             return result;
52702                         }
52703                         reportRelationError(headMessage, source, target);
52704                     }
52705                 }
52706             }
52707             function traceUnionsOrIntersectionsTooLarge(source, target) {
52708                 if (!ts.tracing) {
52709                     return;
52710                 }
52711                 if ((source.flags & 3145728) && (target.flags & 3145728)) {
52712                     var sourceUnionOrIntersection = source;
52713                     var targetUnionOrIntersection = target;
52714                     if (sourceUnionOrIntersection.objectFlags & targetUnionOrIntersection.objectFlags & 65536) {
52715                         return;
52716                     }
52717                     var sourceSize = sourceUnionOrIntersection.types.length;
52718                     var targetSize = targetUnionOrIntersection.types.length;
52719                     if (sourceSize * targetSize > 1E6) {
52720                         ts.tracing.instant("checkTypes", "traceUnionsOrIntersectionsTooLarge_DepthLimit", {
52721                             sourceId: source.id,
52722                             sourceSize: sourceSize,
52723                             targetId: target.id,
52724                             targetSize: targetSize,
52725                             pos: errorNode === null || errorNode === void 0 ? void 0 : errorNode.pos,
52726                             end: errorNode === null || errorNode === void 0 ? void 0 : errorNode.end
52727                         });
52728                     }
52729                 }
52730             }
52731             function isIdenticalTo(source, target, recursionFlags) {
52732                 if (source.flags !== target.flags)
52733                     return 0;
52734                 if (source.flags & 67358815)
52735                     return -1;
52736                 traceUnionsOrIntersectionsTooLarge(source, target);
52737                 if (source.flags & 3145728) {
52738                     var result_7 = eachTypeRelatedToSomeType(source, target);
52739                     if (result_7) {
52740                         result_7 &= eachTypeRelatedToSomeType(target, source);
52741                     }
52742                     return result_7;
52743                 }
52744                 return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
52745             }
52746             function getTypeOfPropertyInTypes(types, name) {
52747                 var appendPropType = function (propTypes, type) {
52748                     var _a;
52749                     type = getApparentType(type);
52750                     var prop = type.flags & 3145728 ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name);
52751                     var propType = prop && getTypeOfSymbol(prop) || ((_a = getApplicableIndexInfoForName(type, name)) === null || _a === void 0 ? void 0 : _a.type) || undefinedType;
52752                     return ts.append(propTypes, propType);
52753                 };
52754                 return getUnionType(ts.reduceLeft(types, appendPropType, undefined) || ts.emptyArray);
52755             }
52756             function hasExcessProperties(source, target, reportErrors) {
52757                 var _a;
52758                 if (!isExcessPropertyCheckTarget(target) || !noImplicitAny && ts.getObjectFlags(target) & 8192) {
52759                     return false;
52760                 }
52761                 var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
52762                 if ((relation === assignableRelation || relation === comparableRelation) &&
52763                     (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
52764                     return false;
52765                 }
52766                 var reducedTarget = target;
52767                 var checkTypes;
52768                 if (target.flags & 1048576) {
52769                     reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
52770                     checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget];
52771                 }
52772                 var _loop_18 = function (prop) {
52773                     if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
52774                         if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
52775                             if (reportErrors) {
52776                                 var errorTarget = filterType(reducedTarget, isExcessPropertyCheckTarget);
52777                                 if (!errorNode)
52778                                     return { value: ts.Debug.fail() };
52779                                 if (ts.isJsxAttributes(errorNode) || ts.isJsxOpeningLikeElement(errorNode) || ts.isJsxOpeningLikeElement(errorNode.parent)) {
52780                                     if (prop.valueDeclaration && ts.isJsxAttribute(prop.valueDeclaration) && ts.getSourceFileOfNode(errorNode) === ts.getSourceFileOfNode(prop.valueDeclaration.name)) {
52781                                         errorNode = prop.valueDeclaration.name;
52782                                     }
52783                                     var propName = symbolToString(prop);
52784                                     var suggestionSymbol = getSuggestedSymbolForNonexistentJSXAttribute(propName, errorTarget);
52785                                     var suggestion = suggestionSymbol ? symbolToString(suggestionSymbol) : undefined;
52786                                     if (suggestion) {
52787                                         reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(errorTarget), suggestion);
52788                                     }
52789                                     else {
52790                                         reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget));
52791                                     }
52792                                 }
52793                                 else {
52794                                     var objectLiteralDeclaration_1 = ((_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) && ts.firstOrUndefined(source.symbol.declarations);
52795                                     var suggestion = void 0;
52796                                     if (prop.valueDeclaration && ts.findAncestor(prop.valueDeclaration, function (d) { return d === objectLiteralDeclaration_1; }) && ts.getSourceFileOfNode(objectLiteralDeclaration_1) === ts.getSourceFileOfNode(errorNode)) {
52797                                         var propDeclaration = prop.valueDeclaration;
52798                                         ts.Debug.assertNode(propDeclaration, ts.isObjectLiteralElementLike);
52799                                         errorNode = propDeclaration;
52800                                         var name = propDeclaration.name;
52801                                         if (ts.isIdentifier(name)) {
52802                                             suggestion = getSuggestionForNonexistentProperty(name, errorTarget);
52803                                         }
52804                                     }
52805                                     if (suggestion !== undefined) {
52806                                         reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(errorTarget), suggestion);
52807                                     }
52808                                     else {
52809                                         reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget));
52810                                     }
52811                                 }
52812                             }
52813                             return { value: true };
52814                         }
52815                         if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), 3, reportErrors)) {
52816                             if (reportErrors) {
52817                                 reportIncompatibleError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop));
52818                             }
52819                             return { value: true };
52820                         }
52821                     }
52822                 };
52823                 for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
52824                     var prop = _b[_i];
52825                     var state_5 = _loop_18(prop);
52826                     if (typeof state_5 === "object")
52827                         return state_5.value;
52828                 }
52829                 return false;
52830             }
52831             function shouldCheckAsExcessProperty(prop, container) {
52832                 return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
52833             }
52834             function eachTypeRelatedToSomeType(source, target) {
52835                 var result = -1;
52836                 var sourceTypes = source.types;
52837                 for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) {
52838                     var sourceType = sourceTypes_1[_i];
52839                     var related = typeRelatedToSomeType(sourceType, target, false);
52840                     if (!related) {
52841                         return 0;
52842                     }
52843                     result &= related;
52844                 }
52845                 return result;
52846             }
52847             function typeRelatedToSomeType(source, target, reportErrors) {
52848                 var targetTypes = target.types;
52849                 if (target.flags & 1048576) {
52850                     if (containsType(targetTypes, source)) {
52851                         return -1;
52852                     }
52853                     var match = getMatchingUnionConstituentForType(target, source);
52854                     if (match) {
52855                         var related = isRelatedTo(source, match, 2, false);
52856                         if (related) {
52857                             return related;
52858                         }
52859                     }
52860                 }
52861                 for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) {
52862                     var type = targetTypes_1[_i];
52863                     var related = isRelatedTo(source, type, 2, false);
52864                     if (related) {
52865                         return related;
52866                     }
52867                 }
52868                 if (reportErrors) {
52869                     var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
52870                     isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], 2, true);
52871                 }
52872                 return 0;
52873             }
52874             function typeRelatedToEachType(source, target, reportErrors, intersectionState) {
52875                 var result = -1;
52876                 var targetTypes = target.types;
52877                 for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) {
52878                     var targetType = targetTypes_2[_i];
52879                     var related = isRelatedTo(source, targetType, 2, reportErrors, undefined, intersectionState);
52880                     if (!related) {
52881                         return 0;
52882                     }
52883                     result &= related;
52884                 }
52885                 return result;
52886             }
52887             function someTypeRelatedToType(source, target, reportErrors, intersectionState) {
52888                 var sourceTypes = source.types;
52889                 if (source.flags & 1048576 && containsType(sourceTypes, target)) {
52890                     return -1;
52891                 }
52892                 var len = sourceTypes.length;
52893                 for (var i = 0; i < len; i++) {
52894                     var related = isRelatedTo(sourceTypes[i], target, 1, reportErrors && i === len - 1, undefined, intersectionState);
52895                     if (related) {
52896                         return related;
52897                     }
52898                 }
52899                 return 0;
52900             }
52901             function getUndefinedStrippedTargetIfNeeded(source, target) {
52902                 if (source.flags & 1048576 && target.flags & 1048576 &&
52903                     !(source.types[0].flags & 32768) && target.types[0].flags & 32768) {
52904                     return extractTypesOfKind(target, ~32768);
52905                 }
52906                 return target;
52907             }
52908             function eachTypeRelatedToType(source, target, reportErrors, intersectionState) {
52909                 var result = -1;
52910                 var sourceTypes = source.types;
52911                 var undefinedStrippedTarget = getUndefinedStrippedTargetIfNeeded(source, target);
52912                 for (var i = 0; i < sourceTypes.length; i++) {
52913                     var sourceType = sourceTypes[i];
52914                     if (undefinedStrippedTarget.flags & 1048576 && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) {
52915                         var related_1 = isRelatedTo(sourceType, undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], 3, false, undefined, intersectionState);
52916                         if (related_1) {
52917                             result &= related_1;
52918                             continue;
52919                         }
52920                     }
52921                     var related = isRelatedTo(sourceType, target, 1, reportErrors, undefined, intersectionState);
52922                     if (!related) {
52923                         return 0;
52924                     }
52925                     result &= related;
52926                 }
52927                 return result;
52928             }
52929             function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, intersectionState) {
52930                 if (sources === void 0) { sources = ts.emptyArray; }
52931                 if (targets === void 0) { targets = ts.emptyArray; }
52932                 if (variances === void 0) { variances = ts.emptyArray; }
52933                 if (sources.length !== targets.length && relation === identityRelation) {
52934                     return 0;
52935                 }
52936                 var length = sources.length <= targets.length ? sources.length : targets.length;
52937                 var result = -1;
52938                 for (var i = 0; i < length; i++) {
52939                     var varianceFlags = i < variances.length ? variances[i] : 1;
52940                     var variance = varianceFlags & 7;
52941                     if (variance !== 4) {
52942                         var s = sources[i];
52943                         var t = targets[i];
52944                         var related = -1;
52945                         if (varianceFlags & 8) {
52946                             related = relation === identityRelation ? isRelatedTo(s, t, 3, false) : compareTypesIdentical(s, t);
52947                         }
52948                         else if (variance === 1) {
52949                             related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52950                         }
52951                         else if (variance === 2) {
52952                             related = isRelatedTo(t, s, 3, reportErrors, undefined, intersectionState);
52953                         }
52954                         else if (variance === 3) {
52955                             related = isRelatedTo(t, s, 3, false);
52956                             if (!related) {
52957                                 related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52958                             }
52959                         }
52960                         else {
52961                             related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52962                             if (related) {
52963                                 related &= isRelatedTo(t, s, 3, reportErrors, undefined, intersectionState);
52964                             }
52965                         }
52966                         if (!related) {
52967                             return 0;
52968                         }
52969                         result &= related;
52970                     }
52971                 }
52972                 return result;
52973             }
52974             function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags) {
52975                 if (overflow) {
52976                     return 0;
52977                 }
52978                 var id = getRelationKey(source, target, intersectionState | (inPropertyCheck ? 16 : 0), relation);
52979                 var entry = relation.get(id);
52980                 if (entry !== undefined) {
52981                     if (reportErrors && entry & 2 && !(entry & 4)) {
52982                     }
52983                     else {
52984                         if (outofbandVarianceMarkerHandler) {
52985                             var saved = entry & 24;
52986                             if (saved & 8) {
52987                                 instantiateType(source, makeFunctionTypeMapper(reportUnmeasurableMarkers));
52988                             }
52989                             if (saved & 16) {
52990                                 instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
52991                             }
52992                         }
52993                         return entry & 1 ? -1 : 0;
52994                     }
52995                 }
52996                 if (!maybeKeys) {
52997                     maybeKeys = [];
52998                     sourceStack = [];
52999                     targetStack = [];
53000                 }
53001                 else {
53002                     var broadestEquivalentId = id.split(",").map(function (i) { return i.replace(/-\d+/g, function (_match, offset) {
53003                         var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
53004                         return "=".concat(index);
53005                     }); }).join(",");
53006                     for (var i = 0; i < maybeCount; i++) {
53007                         if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
53008                             return 3;
53009                         }
53010                     }
53011                     if (sourceDepth === 100 || targetDepth === 100) {
53012                         overflow = true;
53013                         return 0;
53014                     }
53015                 }
53016                 var maybeStart = maybeCount;
53017                 maybeKeys[maybeCount] = id;
53018                 maybeCount++;
53019                 var saveExpandingFlags = expandingFlags;
53020                 if (recursionFlags & 1) {
53021                     sourceStack[sourceDepth] = source;
53022                     sourceDepth++;
53023                     if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, sourceDepth))
53024                         expandingFlags |= 1;
53025                 }
53026                 if (recursionFlags & 2) {
53027                     targetStack[targetDepth] = target;
53028                     targetDepth++;
53029                     if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, targetDepth))
53030                         expandingFlags |= 2;
53031                 }
53032                 var originalHandler;
53033                 var propagatingVarianceFlags = 0;
53034                 if (outofbandVarianceMarkerHandler) {
53035                     originalHandler = outofbandVarianceMarkerHandler;
53036                     outofbandVarianceMarkerHandler = function (onlyUnreliable) {
53037                         propagatingVarianceFlags |= onlyUnreliable ? 16 : 8;
53038                         return originalHandler(onlyUnreliable);
53039                     };
53040                 }
53041                 if (expandingFlags === 3) {
53042                     ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", {
53043                         sourceId: source.id,
53044                         sourceIdStack: sourceStack.map(function (t) { return t.id; }),
53045                         targetId: target.id,
53046                         targetIdStack: targetStack.map(function (t) { return t.id; }),
53047                         depth: sourceDepth,
53048                         targetDepth: targetDepth
53049                     });
53050                 }
53051                 var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
53052                 if (outofbandVarianceMarkerHandler) {
53053                     outofbandVarianceMarkerHandler = originalHandler;
53054                 }
53055                 if (recursionFlags & 1) {
53056                     sourceDepth--;
53057                 }
53058                 if (recursionFlags & 2) {
53059                     targetDepth--;
53060                 }
53061                 expandingFlags = saveExpandingFlags;
53062                 if (result) {
53063                     if (result === -1 || (sourceDepth === 0 && targetDepth === 0)) {
53064                         if (result === -1 || result === 3) {
53065                             for (var i = maybeStart; i < maybeCount; i++) {
53066                                 relation.set(maybeKeys[i], 1 | propagatingVarianceFlags);
53067                             }
53068                         }
53069                         maybeCount = maybeStart;
53070                     }
53071                 }
53072                 else {
53073                     relation.set(id, (reportErrors ? 4 : 0) | 2 | propagatingVarianceFlags);
53074                     maybeCount = maybeStart;
53075                 }
53076                 return result;
53077             }
53078             function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
53079                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
53080                 var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
53081                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
53082                 return result;
53083             }
53084             function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
53085                 if (intersectionState & 4) {
53086                     return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
53087                 }
53088                 if (intersectionState & 8) {
53089                     if (source.flags & 1048576) {
53090                         return relation === comparableRelation ?
53091                             someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState & ~8) :
53092                             eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState & ~8);
53093                     }
53094                     if (target.flags & 1048576) {
53095                         return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
53096                     }
53097                     if (target.flags & 2097152) {
53098                         return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2);
53099                     }
53100                     if (relation === comparableRelation && target.flags & 131068) {
53101                         var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
53102                         if (constraints !== source.types) {
53103                             source = getIntersectionType(constraints);
53104                             if (!(source.flags & 2097152)) {
53105                                 return isRelatedTo(source, target, 1, false);
53106                             }
53107                         }
53108                     }
53109                     return someTypeRelatedToType(source, target, false, 1);
53110                 }
53111                 var flags = source.flags & target.flags;
53112                 if (relation === identityRelation && !(flags & 524288)) {
53113                     if (flags & 4194304) {
53114                         return isRelatedTo(source.type, target.type, 3, false);
53115                     }
53116                     var result_8 = 0;
53117                     if (flags & 8388608) {
53118                         if (result_8 = isRelatedTo(source.objectType, target.objectType, 3, false)) {
53119                             if (result_8 &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
53120                                 return result_8;
53121                             }
53122                         }
53123                     }
53124                     if (flags & 16777216) {
53125                         if (source.root.isDistributive === target.root.isDistributive) {
53126                             if (result_8 = isRelatedTo(source.checkType, target.checkType, 3, false)) {
53127                                 if (result_8 &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
53128                                     if (result_8 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
53129                                         if (result_8 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
53130                                             return result_8;
53131                                         }
53132                                     }
53133                                 }
53134                             }
53135                         }
53136                     }
53137                     if (flags & 33554432) {
53138                         return isRelatedTo(source.substitute, target.substitute, 3, false);
53139                     }
53140                     return 0;
53141                 }
53142                 var result;
53143                 var originalErrorInfo;
53144                 var varianceCheckFailed = false;
53145                 var saveErrorInfo = captureErrorCalculationState();
53146                 if (source.flags & (524288 | 16777216) && source.aliasSymbol &&
53147                     source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
53148                     !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
53149                     var variances = getAliasVariances(source.aliasSymbol);
53150                     if (variances === ts.emptyArray) {
53151                         return 1;
53152                     }
53153                     var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, intersectionState);
53154                     if (varianceResult !== undefined) {
53155                         return varianceResult;
53156                     }
53157                 }
53158                 if (isSingleElementGenericTupleType(source) && !source.target.readonly && (result = isRelatedTo(getTypeArguments(source)[0], target, 1)) ||
53159                     isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
53160                     return result;
53161                 }
53162                 if (target.flags & 262144) {
53163                     if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
53164                         if (!(getMappedTypeModifiers(source) & 4)) {
53165                             var templateType = getTemplateTypeFromMappedType(source);
53166                             var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
53167                             if (result = isRelatedTo(templateType, indexedAccessType, 3, reportErrors)) {
53168                                 return result;
53169                             }
53170                         }
53171                     }
53172                 }
53173                 else if (target.flags & 4194304) {
53174                     var targetType_1 = target.type;
53175                     if (source.flags & 4194304) {
53176                         if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
53177                             return result;
53178                         }
53179                     }
53180                     if (isTupleType(targetType_1)) {
53181                         if (result = isRelatedTo(source, getKnownKeysOfTupleType(targetType_1), 2, reportErrors)) {
53182                             return result;
53183                         }
53184                     }
53185                     else {
53186                         var constraint = getSimplifiedTypeOrConstraint(targetType_1);
53187                         if (constraint) {
53188                             if (isRelatedTo(source, getIndexType(constraint, target.stringsOnly), 2, reportErrors) === -1) {
53189                                 return -1;
53190                             }
53191                         }
53192                         else if (isGenericMappedType(targetType_1)) {
53193                             var nameType_1 = getNameTypeFromMappedType(targetType_1);
53194                             var constraintType = getConstraintTypeFromMappedType(targetType_1);
53195                             var targetKeys = void 0;
53196                             if (nameType_1 && isMappedTypeWithKeyofConstraintDeclaration(targetType_1)) {
53197                                 var modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType_1));
53198                                 var mappedKeys_1 = [];
53199                                 forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, false, function (t) { return void mappedKeys_1.push(instantiateType(nameType_1, appendTypeMapping(targetType_1.mapper, getTypeParameterFromMappedType(targetType_1), t))); });
53200                                 targetKeys = getUnionType(__spreadArray(__spreadArray([], mappedKeys_1, true), [nameType_1], false));
53201                             }
53202                             else {
53203                                 targetKeys = nameType_1 || constraintType;
53204                             }
53205                             if (isRelatedTo(source, targetKeys, 2, reportErrors) === -1) {
53206                                 return -1;
53207                             }
53208                         }
53209                     }
53210                 }
53211                 else if (target.flags & 8388608) {
53212                     if (source.flags & 8388608) {
53213                         if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
53214                             result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
53215                         }
53216                         if (result) {
53217                             resetErrorInfo(saveErrorInfo);
53218                             return result;
53219                         }
53220                         if (reportErrors) {
53221                             originalErrorInfo = errorInfo;
53222                         }
53223                     }
53224                     if (relation === assignableRelation || relation === comparableRelation) {
53225                         var objectType = target.objectType;
53226                         var indexType = target.indexType;
53227                         var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
53228                         var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
53229                         if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
53230                             var accessFlags = 4 | (baseObjectType !== objectType ? 2 : 0);
53231                             var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, accessFlags);
53232                             if (constraint) {
53233                                 if (reportErrors && originalErrorInfo) {
53234                                     resetErrorInfo(saveErrorInfo);
53235                                 }
53236                                 if (result = isRelatedTo(source, constraint, 2, reportErrors)) {
53237                                     return result;
53238                                 }
53239                                 if (reportErrors && originalErrorInfo && errorInfo) {
53240                                     errorInfo = countMessageChainBreadth([originalErrorInfo]) <= countMessageChainBreadth([errorInfo]) ? originalErrorInfo : errorInfo;
53241                                 }
53242                             }
53243                         }
53244                     }
53245                     if (reportErrors) {
53246                         originalErrorInfo = undefined;
53247                     }
53248                 }
53249                 else if (isGenericMappedType(target) && relation !== identityRelation) {
53250                     var keysRemapped = !!target.declaration.nameType;
53251                     var templateType = getTemplateTypeFromMappedType(target);
53252                     var modifiers = getMappedTypeModifiers(target);
53253                     if (!(modifiers & 8)) {
53254                         if (!keysRemapped && templateType.flags & 8388608 && templateType.objectType === source &&
53255                             templateType.indexType === getTypeParameterFromMappedType(target)) {
53256                             return -1;
53257                         }
53258                         if (!isGenericMappedType(source)) {
53259                             var targetKeys = keysRemapped ? getNameTypeFromMappedType(target) : getConstraintTypeFromMappedType(target);
53260                             var sourceKeys = getIndexType(source, undefined, true);
53261                             var includeOptional = modifiers & 4;
53262                             var filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : undefined;
53263                             if (includeOptional
53264                                 ? !(filteredByApplicability.flags & 131072)
53265                                 : isRelatedTo(targetKeys, sourceKeys, 3)) {
53266                                 var templateType_1 = getTemplateTypeFromMappedType(target);
53267                                 var typeParameter = getTypeParameterFromMappedType(target);
53268                                 var nonNullComponent = extractTypesOfKind(templateType_1, ~98304);
53269                                 if (!keysRemapped && nonNullComponent.flags & 8388608 && nonNullComponent.indexType === typeParameter) {
53270                                     if (result = isRelatedTo(source, nonNullComponent.objectType, 2, reportErrors)) {
53271                                         return result;
53272                                     }
53273                                 }
53274                                 else {
53275                                     var indexingType = keysRemapped
53276                                         ? (filteredByApplicability || targetKeys)
53277                                         : filteredByApplicability
53278                                             ? getIntersectionType([filteredByApplicability, typeParameter])
53279                                             : typeParameter;
53280                                     var indexedAccessType = getIndexedAccessType(source, indexingType);
53281                                     if (result = isRelatedTo(indexedAccessType, templateType_1, 3, reportErrors)) {
53282                                         return result;
53283                                     }
53284                                 }
53285                             }
53286                             originalErrorInfo = errorInfo;
53287                             resetErrorInfo(saveErrorInfo);
53288                         }
53289                     }
53290                 }
53291                 else if (target.flags & 16777216) {
53292                     if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
53293                         resetErrorInfo(saveErrorInfo);
53294                         return 3;
53295                     }
53296                     var c = target;
53297                     if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
53298                         var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
53299                         var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
53300                         if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
53301                             result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
53302                             if (result) {
53303                                 resetErrorInfo(saveErrorInfo);
53304                                 return result;
53305                             }
53306                         }
53307                     }
53308                 }
53309                 else if (target.flags & 134217728) {
53310                     if (source.flags & 134217728) {
53311                         if (relation === comparableRelation) {
53312                             return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
53313                         }
53314                         instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
53315                     }
53316                     if (isTypeMatchedByTemplateLiteralType(source, target)) {
53317                         return -1;
53318                     }
53319                 }
53320                 if (source.flags & 8650752) {
53321                     if (!(source.flags & 8388608 && target.flags & 8388608)) {
53322                         var constraint = getConstraintOfType(source);
53323                         if (!constraint || (source.flags & 262144 && constraint.flags & 1)) {
53324                             if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
53325                                 resetErrorInfo(saveErrorInfo);
53326                                 return result;
53327                             }
53328                         }
53329                         else if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
53330                             resetErrorInfo(saveErrorInfo);
53331                             return result;
53332                         }
53333                         else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(target.flags & source.flags & 262144), undefined, intersectionState)) {
53334                             resetErrorInfo(saveErrorInfo);
53335                             return result;
53336                         }
53337                     }
53338                 }
53339                 else if (source.flags & 4194304) {
53340                     if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
53341                         resetErrorInfo(saveErrorInfo);
53342                         return result;
53343                     }
53344                 }
53345                 else if (source.flags & 134217728 && !(target.flags & 524288)) {
53346                     if (!(target.flags & 134217728)) {
53347                         var constraint = getBaseConstraintOfType(source);
53348                         if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
53349                             resetErrorInfo(saveErrorInfo);
53350                             return result;
53351                         }
53352                     }
53353                 }
53354                 else if (source.flags & 268435456) {
53355                     if (target.flags & 268435456 && source.symbol === target.symbol) {
53356                         if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
53357                             resetErrorInfo(saveErrorInfo);
53358                             return result;
53359                         }
53360                     }
53361                     else {
53362                         var constraint = getBaseConstraintOfType(source);
53363                         if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
53364                             resetErrorInfo(saveErrorInfo);
53365                             return result;
53366                         }
53367                     }
53368                 }
53369                 else if (source.flags & 16777216) {
53370                     if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
53371                         resetErrorInfo(saveErrorInfo);
53372                         return 3;
53373                     }
53374                     if (target.flags & 16777216) {
53375                         var sourceParams = source.root.inferTypeParameters;
53376                         var sourceExtends = source.extendsType;
53377                         var mapper = void 0;
53378                         if (sourceParams) {
53379                             var ctx = createInferenceContext(sourceParams, undefined, 0, isRelatedToWorker);
53380                             inferTypes(ctx.inferences, target.extendsType, sourceExtends, 512 | 1024);
53381                             sourceExtends = instantiateType(sourceExtends, ctx.mapper);
53382                             mapper = ctx.mapper;
53383                         }
53384                         if (isTypeIdenticalTo(sourceExtends, target.extendsType) &&
53385                             (isRelatedTo(source.checkType, target.checkType, 3) || isRelatedTo(target.checkType, source.checkType, 3))) {
53386                             if (result = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source), mapper), getTrueTypeFromConditionalType(target), 3, reportErrors)) {
53387                                 result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
53388                             }
53389                             if (result) {
53390                                 resetErrorInfo(saveErrorInfo);
53391                                 return result;
53392                             }
53393                         }
53394                     }
53395                     else {
53396                         var distributiveConstraint = getConstraintOfDistributiveConditionalType(source);
53397                         if (distributiveConstraint) {
53398                             if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
53399                                 resetErrorInfo(saveErrorInfo);
53400                                 return result;
53401                             }
53402                         }
53403                     }
53404                     var defaultConstraint = getDefaultConstraintOfConditionalType(source);
53405                     if (defaultConstraint) {
53406                         if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
53407                             resetErrorInfo(saveErrorInfo);
53408                             return result;
53409                         }
53410                     }
53411                 }
53412                 else {
53413                     if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target) && isEmptyObjectType(source)) {
53414                         return -1;
53415                     }
53416                     if (isGenericMappedType(target)) {
53417                         if (isGenericMappedType(source)) {
53418                             if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
53419                                 resetErrorInfo(saveErrorInfo);
53420                                 return result;
53421                             }
53422                         }
53423                         return 0;
53424                     }
53425                     var sourceIsPrimitive = !!(source.flags & 131068);
53426                     if (relation !== identityRelation) {
53427                         source = getApparentType(source);
53428                     }
53429                     else if (isGenericMappedType(source)) {
53430                         return 0;
53431                     }
53432                     if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && source.target === target.target &&
53433                         !isTupleType(source) && !(ts.getObjectFlags(source) & 4096 || ts.getObjectFlags(target) & 4096)) {
53434                         var variances = getVariances(source.target);
53435                         if (variances === ts.emptyArray) {
53436                             return 1;
53437                         }
53438                         var varianceResult = relateVariances(getTypeArguments(source), getTypeArguments(target), variances, intersectionState);
53439                         if (varianceResult !== undefined) {
53440                             return varianceResult;
53441                         }
53442                     }
53443                     else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
53444                         if (relation !== identityRelation) {
53445                             return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3, reportErrors);
53446                         }
53447                         else {
53448                             return 0;
53449                         }
53450                     }
53451                     else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target) && ts.getObjectFlags(target) & 16384 && !isEmptyObjectType(source)) {
53452                         return 0;
53453                     }
53454                     if (source.flags & (524288 | 2097152) && target.flags & 524288) {
53455                         var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
53456                         result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, intersectionState);
53457                         if (result) {
53458                             result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors);
53459                             if (result) {
53460                                 result &= signaturesRelatedTo(source, target, 1, reportStructuralErrors);
53461                                 if (result) {
53462                                     result &= indexSignaturesRelatedTo(source, target, sourceIsPrimitive, reportStructuralErrors, intersectionState);
53463                                 }
53464                             }
53465                         }
53466                         if (varianceCheckFailed && result) {
53467                             errorInfo = originalErrorInfo || errorInfo || saveErrorInfo.errorInfo;
53468                         }
53469                         else if (result) {
53470                             return result;
53471                         }
53472                     }
53473                     if (source.flags & (524288 | 2097152) && target.flags & 1048576) {
53474                         var objectOnlyTarget = extractTypesOfKind(target, 524288 | 2097152 | 33554432);
53475                         if (objectOnlyTarget.flags & 1048576) {
53476                             var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
53477                             if (result_9) {
53478                                 return result_9;
53479                             }
53480                         }
53481                     }
53482                 }
53483                 return 0;
53484                 function countMessageChainBreadth(info) {
53485                     if (!info)
53486                         return 0;
53487                     return ts.reduceLeft(info, function (value, chain) { return value + 1 + countMessageChainBreadth(chain.next); }, 0);
53488                 }
53489                 function relateVariances(sourceTypeArguments, targetTypeArguments, variances, intersectionState) {
53490                     if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, intersectionState)) {
53491                         return result;
53492                     }
53493                     if (ts.some(variances, function (v) { return !!(v & 24); })) {
53494                         originalErrorInfo = undefined;
53495                         resetErrorInfo(saveErrorInfo);
53496                         return undefined;
53497                     }
53498                     var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
53499                     varianceCheckFailed = !allowStructuralFallback;
53500                     if (variances !== ts.emptyArray && !allowStructuralFallback) {
53501                         if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7) === 0; }))) {
53502                             return 0;
53503                         }
53504                         originalErrorInfo = errorInfo;
53505                         resetErrorInfo(saveErrorInfo);
53506                     }
53507                 }
53508             }
53509             function reportUnmeasurableMarkers(p) {
53510                 if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
53511                     outofbandVarianceMarkerHandler(false);
53512                 }
53513                 return p;
53514             }
53515             function reportUnreliableMarkers(p) {
53516                 if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
53517                     outofbandVarianceMarkerHandler(true);
53518                 }
53519                 return p;
53520             }
53521             function mappedTypeRelatedTo(source, target, reportErrors) {
53522                 var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
53523                     getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
53524                 if (modifiersRelated) {
53525                     var result_10;
53526                     var targetConstraint = getConstraintTypeFromMappedType(target);
53527                     var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
53528                     if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3, reportErrors)) {
53529                         var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
53530                         if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
53531                             return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3, reportErrors);
53532                         }
53533                     }
53534                 }
53535                 return 0;
53536             }
53537             function typeRelatedToDiscriminatedType(source, target) {
53538                 var sourceProperties = getPropertiesOfType(source);
53539                 var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
53540                 if (!sourcePropertiesFiltered)
53541                     return 0;
53542                 var numCombinations = 1;
53543                 for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
53544                     var sourceProperty = sourcePropertiesFiltered_1[_i];
53545                     numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty));
53546                     if (numCombinations > 25) {
53547                         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations: numCombinations });
53548                         return 0;
53549                     }
53550                 }
53551                 var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
53552                 var excludedProperties = new ts.Set();
53553                 for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
53554                     var sourceProperty = sourcePropertiesFiltered[i];
53555                     var sourcePropertyType = getNonMissingTypeOfSymbol(sourceProperty);
53556                     sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576
53557                         ? sourcePropertyType.types
53558                         : [sourcePropertyType];
53559                     excludedProperties.add(sourceProperty.escapedName);
53560                 }
53561                 var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
53562                 var matchingTypes = [];
53563                 var _loop_19 = function (combination) {
53564                     var hasMatch = false;
53565                     outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
53566                         var type = _d[_c];
53567                         var _loop_20 = function (i) {
53568                             var sourceProperty = sourcePropertiesFiltered[i];
53569                             var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
53570                             if (!targetProperty)
53571                                 return "continue-outer";
53572                             if (sourceProperty === targetProperty)
53573                                 return "continue";
53574                             var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, false, 0, strictNullChecks || relation === comparableRelation);
53575                             if (!related) {
53576                                 return "continue-outer";
53577                             }
53578                         };
53579                         for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
53580                             var state_7 = _loop_20(i);
53581                             switch (state_7) {
53582                                 case "continue-outer": continue outer;
53583                             }
53584                         }
53585                         ts.pushIfUnique(matchingTypes, type, ts.equateValues);
53586                         hasMatch = true;
53587                     }
53588                     if (!hasMatch) {
53589                         return { value: 0 };
53590                     }
53591                 };
53592                 for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
53593                     var combination = discriminantCombinations_1[_a];
53594                     var state_6 = _loop_19(combination);
53595                     if (typeof state_6 === "object")
53596                         return state_6.value;
53597                 }
53598                 var result = -1;
53599                 for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
53600                     var type = matchingTypes_1[_b];
53601                     result &= propertiesRelatedTo(source, type, false, excludedProperties, 0);
53602                     if (result) {
53603                         result &= signaturesRelatedTo(source, type, 0, false);
53604                         if (result) {
53605                             result &= signaturesRelatedTo(source, type, 1, false);
53606                             if (result && !(isTupleType(source) && isTupleType(type))) {
53607                                 result &= indexSignaturesRelatedTo(source, type, false, false, 0);
53608                             }
53609                         }
53610                     }
53611                     if (!result) {
53612                         return result;
53613                     }
53614                 }
53615                 return result;
53616             }
53617             function excludeProperties(properties, excludedProperties) {
53618                 if (!excludedProperties || properties.length === 0)
53619                     return properties;
53620                 var result;
53621                 for (var i = 0; i < properties.length; i++) {
53622                     if (!excludedProperties.has(properties[i].escapedName)) {
53623                         if (result) {
53624                             result.push(properties[i]);
53625                         }
53626                     }
53627                     else if (!result) {
53628                         result = properties.slice(0, i);
53629                     }
53630                 }
53631                 return result || properties;
53632             }
53633             function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState) {
53634                 var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48);
53635                 var effectiveTarget = addOptionality(getNonMissingTypeOfSymbol(targetProp), false, targetIsOptional);
53636                 var effectiveSource = getTypeOfSourceProperty(sourceProp);
53637                 return isRelatedTo(effectiveSource, effectiveTarget, 3, reportErrors, undefined, intersectionState);
53638             }
53639             function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState, skipOptional) {
53640                 var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
53641                 var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
53642                 if (sourcePropFlags & 8 || targetPropFlags & 8) {
53643                     if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) {
53644                         if (reportErrors) {
53645                             if (sourcePropFlags & 8 && targetPropFlags & 8) {
53646                                 reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
53647                             }
53648                             else {
53649                                 reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source));
53650                             }
53651                         }
53652                         return 0;
53653                     }
53654                 }
53655                 else if (targetPropFlags & 16) {
53656                     if (!isValidOverrideOf(sourceProp, targetProp)) {
53657                         if (reportErrors) {
53658                             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));
53659                         }
53660                         return 0;
53661                     }
53662                 }
53663                 else if (sourcePropFlags & 16) {
53664                     if (reportErrors) {
53665                         reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
53666                     }
53667                     return 0;
53668                 }
53669                 var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
53670                 if (!related) {
53671                     if (reportErrors) {
53672                         reportIncompatibleError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
53673                     }
53674                     return 0;
53675                 }
53676                 if (!skipOptional && sourceProp.flags & 16777216 && !(targetProp.flags & 16777216)) {
53677                     if (reportErrors) {
53678                         reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
53679                     }
53680                     return 0;
53681                 }
53682                 return related;
53683             }
53684             function reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties) {
53685                 var shouldSkipElaboration = false;
53686                 if (unmatchedProperty.valueDeclaration
53687                     && ts.isNamedDeclaration(unmatchedProperty.valueDeclaration)
53688                     && ts.isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
53689                     && source.symbol
53690                     && source.symbol.flags & 32) {
53691                     var privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText;
53692                     var symbolTableKey = ts.getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription);
53693                     if (symbolTableKey && getPropertyOfType(source, symbolTableKey)) {
53694                         var sourceName = ts.factory.getDeclarationName(source.symbol.valueDeclaration);
53695                         var targetName = ts.factory.getDeclarationName(target.symbol.valueDeclaration);
53696                         reportError(ts.Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2, diagnosticName(privateIdentifierDescription), diagnosticName(sourceName.escapedText === "" ? anon : sourceName), diagnosticName(targetName.escapedText === "" ? anon : targetName));
53697                         return;
53698                     }
53699                 }
53700                 var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, false));
53701                 if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
53702                     headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
53703                     shouldSkipElaboration = true;
53704                 }
53705                 if (props.length === 1) {
53706                     var propName = symbolToString(unmatchedProperty);
53707                     reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false));
53708                     if (ts.length(unmatchedProperty.declarations)) {
53709                         associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
53710                     }
53711                     if (shouldSkipElaboration && errorInfo) {
53712                         overrideNextErrorInfo++;
53713                     }
53714                 }
53715                 else if (tryElaborateArrayLikeErrors(source, target, false)) {
53716                     if (props.length > 5) {
53717                         reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
53718                     }
53719                     else {
53720                         reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
53721                     }
53722                     if (shouldSkipElaboration && errorInfo) {
53723                         overrideNextErrorInfo++;
53724                     }
53725                 }
53726             }
53727             function propertiesRelatedTo(source, target, reportErrors, excludedProperties, intersectionState) {
53728                 if (relation === identityRelation) {
53729                     return propertiesIdenticalTo(source, target, excludedProperties);
53730                 }
53731                 var result = -1;
53732                 if (isTupleType(target)) {
53733                     if (isArrayType(source) || isTupleType(source)) {
53734                         if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
53735                             return 0;
53736                         }
53737                         var sourceArity = getTypeReferenceArity(source);
53738                         var targetArity = getTypeReferenceArity(target);
53739                         var sourceRestFlag = isTupleType(source) ? source.target.combinedFlags & 4 : 4;
53740                         var targetRestFlag = target.target.combinedFlags & 4;
53741                         var sourceMinLength = isTupleType(source) ? source.target.minLength : 0;
53742                         var targetMinLength = target.target.minLength;
53743                         if (!sourceRestFlag && sourceArity < targetMinLength) {
53744                             if (reportErrors) {
53745                                 reportError(ts.Diagnostics.Source_has_0_element_s_but_target_requires_1, sourceArity, targetMinLength);
53746                             }
53747                             return 0;
53748                         }
53749                         if (!targetRestFlag && targetArity < sourceMinLength) {
53750                             if (reportErrors) {
53751                                 reportError(ts.Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity);
53752                             }
53753                             return 0;
53754                         }
53755                         if (!targetRestFlag && (sourceRestFlag || targetArity < sourceArity)) {
53756                             if (reportErrors) {
53757                                 if (sourceMinLength < targetMinLength) {
53758                                     reportError(ts.Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength);
53759                                 }
53760                                 else {
53761                                     reportError(ts.Diagnostics.Target_allows_only_0_element_s_but_source_may_have_more, targetArity);
53762                                 }
53763                             }
53764                             return 0;
53765                         }
53766                         var sourceTypeArguments = getTypeArguments(source);
53767                         var targetTypeArguments = getTypeArguments(target);
53768                         var startCount = Math.min(isTupleType(source) ? getStartElementCount(source.target, 11) : 0, getStartElementCount(target.target, 11));
53769                         var endCount = Math.min(isTupleType(source) ? getEndElementCount(source.target, 11) : 0, targetRestFlag ? getEndElementCount(target.target, 11) : 0);
53770                         var canExcludeDiscriminants = !!excludedProperties;
53771                         for (var i = 0; i < targetArity; i++) {
53772                             var sourceIndex = i < targetArity - endCount ? i : i + sourceArity - targetArity;
53773                             var sourceFlags = isTupleType(source) && (i < startCount || i >= targetArity - endCount) ? source.target.elementFlags[sourceIndex] : 4;
53774                             var targetFlags = target.target.elementFlags[i];
53775                             if (targetFlags & 8 && !(sourceFlags & 8)) {
53776                                 if (reportErrors) {
53777                                     reportError(ts.Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, i);
53778                                 }
53779                                 return 0;
53780                             }
53781                             if (sourceFlags & 8 && !(targetFlags & 12)) {
53782                                 if (reportErrors) {
53783                                     reportError(ts.Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourceIndex, i);
53784                                 }
53785                                 return 0;
53786                             }
53787                             if (targetFlags & 1 && !(sourceFlags & 1)) {
53788                                 if (reportErrors) {
53789                                     reportError(ts.Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, i);
53790                                 }
53791                                 return 0;
53792                             }
53793                             if (canExcludeDiscriminants) {
53794                                 if (sourceFlags & 12 || targetFlags & 12) {
53795                                     canExcludeDiscriminants = false;
53796                                 }
53797                                 if (canExcludeDiscriminants && (excludedProperties === null || excludedProperties === void 0 ? void 0 : excludedProperties.has(("" + i)))) {
53798                                     continue;
53799                                 }
53800                             }
53801                             var sourceType = !isTupleType(source) ? sourceTypeArguments[0] :
53802                                 i < startCount || i >= targetArity - endCount ? removeMissingType(sourceTypeArguments[sourceIndex], !!(sourceFlags & targetFlags & 2)) :
53803                                     getElementTypeOfSliceOfTupleType(source, startCount, endCount) || neverType;
53804                             var targetType = targetTypeArguments[i];
53805                             var targetCheckType = sourceFlags & 8 && targetFlags & 4 ? createArrayType(targetType) :
53806                                 removeMissingType(targetType, !!(targetFlags & 2));
53807                             var related = isRelatedTo(sourceType, targetCheckType, 3, reportErrors, undefined, intersectionState);
53808                             if (!related) {
53809                                 if (reportErrors && (targetArity > 1 || sourceArity > 1)) {
53810                                     if (i < startCount || i >= targetArity - endCount || sourceArity - startCount - endCount === 1) {
53811                                         reportIncompatibleError(ts.Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourceIndex, i);
53812                                     }
53813                                     else {
53814                                         reportIncompatibleError(ts.Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, startCount, sourceArity - endCount - 1, i);
53815                                     }
53816                                 }
53817                                 return 0;
53818                             }
53819                             result &= related;
53820                         }
53821                         return result;
53822                     }
53823                     if (target.target.combinedFlags & 12) {
53824                         return 0;
53825                     }
53826                 }
53827                 var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
53828                 var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, false);
53829                 if (unmatchedProperty) {
53830                     if (reportErrors) {
53831                         reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
53832                     }
53833                     return 0;
53834                 }
53835                 if (isObjectLiteralType(target)) {
53836                     for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
53837                         var sourceProp = _a[_i];
53838                         if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
53839                             var sourceType = getTypeOfSymbol(sourceProp);
53840                             if (!(sourceType.flags & 32768)) {
53841                                 if (reportErrors) {
53842                                     reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
53843                                 }
53844                                 return 0;
53845                             }
53846                         }
53847                     }
53848                 }
53849                 var properties = getPropertiesOfType(target);
53850                 var numericNamesOnly = isTupleType(source) && isTupleType(target);
53851                 for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
53852                     var targetProp = _c[_b];
53853                     var name = targetProp.escapedName;
53854                     if (!(targetProp.flags & 4194304) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
53855                         var sourceProp = getPropertyOfType(source, name);
53856                         if (sourceProp && sourceProp !== targetProp) {
53857                             var related = propertyRelatedTo(source, target, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors, intersectionState, relation === comparableRelation);
53858                             if (!related) {
53859                                 return 0;
53860                             }
53861                             result &= related;
53862                         }
53863                     }
53864                 }
53865                 return result;
53866             }
53867             function propertiesIdenticalTo(source, target, excludedProperties) {
53868                 if (!(source.flags & 524288 && target.flags & 524288)) {
53869                     return 0;
53870                 }
53871                 var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
53872                 var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
53873                 if (sourceProperties.length !== targetProperties.length) {
53874                     return 0;
53875                 }
53876                 var result = -1;
53877                 for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) {
53878                     var sourceProp = sourceProperties_1[_i];
53879                     var targetProp = getPropertyOfObjectType(target, sourceProp.escapedName);
53880                     if (!targetProp) {
53881                         return 0;
53882                     }
53883                     var related = compareProperties(sourceProp, targetProp, isRelatedTo);
53884                     if (!related) {
53885                         return 0;
53886                     }
53887                     result &= related;
53888                 }
53889                 return result;
53890             }
53891             function signaturesRelatedTo(source, target, kind, reportErrors) {
53892                 var _a, _b;
53893                 if (relation === identityRelation) {
53894                     return signaturesIdenticalTo(source, target, kind);
53895                 }
53896                 if (target === anyFunctionType || source === anyFunctionType) {
53897                     return -1;
53898                 }
53899                 var sourceIsJSConstructor = source.symbol && isJSConstructor(source.symbol.valueDeclaration);
53900                 var targetIsJSConstructor = target.symbol && isJSConstructor(target.symbol.valueDeclaration);
53901                 var sourceSignatures = getSignaturesOfType(source, (sourceIsJSConstructor && kind === 1) ?
53902                     0 : kind);
53903                 var targetSignatures = getSignaturesOfType(target, (targetIsJSConstructor && kind === 1) ?
53904                     0 : kind);
53905                 if (kind === 1 && sourceSignatures.length && targetSignatures.length) {
53906                     var sourceIsAbstract = !!(sourceSignatures[0].flags & 4);
53907                     var targetIsAbstract = !!(targetSignatures[0].flags & 4);
53908                     if (sourceIsAbstract && !targetIsAbstract) {
53909                         if (reportErrors) {
53910                             reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
53911                         }
53912                         return 0;
53913                     }
53914                     if (!constructorVisibilitiesAreCompatible(sourceSignatures[0], targetSignatures[0], reportErrors)) {
53915                         return 0;
53916                     }
53917                 }
53918                 var result = -1;
53919                 var saveErrorInfo = captureErrorCalculationState();
53920                 var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
53921                 var sourceObjectFlags = ts.getObjectFlags(source);
53922                 var targetObjectFlags = ts.getObjectFlags(target);
53923                 if (sourceObjectFlags & 64 && targetObjectFlags & 64 && source.symbol === target.symbol) {
53924                     for (var i = 0; i < targetSignatures.length; i++) {
53925                         var related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], true, reportErrors, incompatibleReporter(sourceSignatures[i], targetSignatures[i]));
53926                         if (!related) {
53927                             return 0;
53928                         }
53929                         result &= related;
53930                     }
53931                 }
53932                 else if (sourceSignatures.length === 1 && targetSignatures.length === 1) {
53933                     var eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
53934                     var sourceSignature = ts.first(sourceSignatures);
53935                     var targetSignature = ts.first(targetSignatures);
53936                     result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature));
53937                     if (!result && reportErrors && kind === 1 && (sourceObjectFlags & targetObjectFlags) &&
53938                         (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 170 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 170)) {
53939                         var constructSignatureToString = function (signature) {
53940                             return signatureToString(signature, undefined, 262144, kind);
53941                         };
53942                         reportError(ts.Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(sourceSignature), constructSignatureToString(targetSignature));
53943                         reportError(ts.Diagnostics.Types_of_construct_signatures_are_incompatible);
53944                         return result;
53945                     }
53946                 }
53947                 else {
53948                     outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {
53949                         var t = targetSignatures_1[_i];
53950                         var shouldElaborateErrors = reportErrors;
53951                         for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) {
53952                             var s = sourceSignatures_1[_c];
53953                             var related = signatureRelatedTo(s, t, true, shouldElaborateErrors, incompatibleReporter(s, t));
53954                             if (related) {
53955                                 result &= related;
53956                                 resetErrorInfo(saveErrorInfo);
53957                                 continue outer;
53958                             }
53959                             shouldElaborateErrors = false;
53960                         }
53961                         if (shouldElaborateErrors) {
53962                             reportError(ts.Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source), signatureToString(t, undefined, undefined, kind));
53963                         }
53964                         return 0;
53965                     }
53966                 }
53967                 return result;
53968             }
53969             function reportIncompatibleCallSignatureReturn(siga, sigb) {
53970                 if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
53971                     return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
53972                 }
53973                 return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); };
53974             }
53975             function reportIncompatibleConstructSignatureReturn(siga, sigb) {
53976                 if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
53977                     return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
53978                 }
53979                 return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); };
53980             }
53981             function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
53982                 return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, makeFunctionTypeMapper(reportUnreliableMarkers));
53983             }
53984             function signaturesIdenticalTo(source, target, kind) {
53985                 var sourceSignatures = getSignaturesOfType(source, kind);
53986                 var targetSignatures = getSignaturesOfType(target, kind);
53987                 if (sourceSignatures.length !== targetSignatures.length) {
53988                     return 0;
53989                 }
53990                 var result = -1;
53991                 for (var i = 0; i < sourceSignatures.length; i++) {
53992                     var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo);
53993                     if (!related) {
53994                         return 0;
53995                     }
53996                     result &= related;
53997                 }
53998                 return result;
53999             }
54000             function membersRelatedToIndexInfo(source, targetInfo, reportErrors) {
54001                 var result = -1;
54002                 var keyType = targetInfo.keyType;
54003                 var props = source.flags & 2097152 ? getPropertiesOfUnionOrIntersectionType(source) : getPropertiesOfObjectType(source);
54004                 for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {
54005                     var prop = props_2[_i];
54006                     if (isIgnoredJsxProperty(source, prop)) {
54007                         continue;
54008                     }
54009                     if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576), keyType)) {
54010                         var propType = getNonMissingTypeOfSymbol(prop);
54011                         var type = exactOptionalPropertyTypes || propType.flags & 32768 || keyType === numberType || !(prop.flags & 16777216)
54012                             ? propType
54013                             : getTypeWithFacts(propType, 524288);
54014                         var related = isRelatedTo(type, targetInfo.type, 3, reportErrors);
54015                         if (!related) {
54016                             if (reportErrors) {
54017                                 reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));
54018                             }
54019                             return 0;
54020                         }
54021                         result &= related;
54022                     }
54023                 }
54024                 for (var _a = 0, _b = getIndexInfosOfType(source); _a < _b.length; _a++) {
54025                     var info = _b[_a];
54026                     if (isApplicableIndexType(info.keyType, keyType)) {
54027                         var related = indexInfoRelatedTo(info, targetInfo, reportErrors);
54028                         if (!related) {
54029                             return 0;
54030                         }
54031                         result &= related;
54032                     }
54033                 }
54034                 return result;
54035             }
54036             function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) {
54037                 var related = isRelatedTo(sourceInfo.type, targetInfo.type, 3, reportErrors);
54038                 if (!related && reportErrors) {
54039                     if (sourceInfo.keyType === targetInfo.keyType) {
54040                         reportError(ts.Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
54041                     }
54042                     else {
54043                         reportError(ts.Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
54044                     }
54045                 }
54046                 return related;
54047             }
54048             function indexSignaturesRelatedTo(source, target, sourceIsPrimitive, reportErrors, intersectionState) {
54049                 if (relation === identityRelation) {
54050                     return indexSignaturesIdenticalTo(source, target);
54051                 }
54052                 var indexInfos = getIndexInfosOfType(target);
54053                 var targetHasStringIndex = ts.some(indexInfos, function (info) { return info.keyType === stringType; });
54054                 var result = -1;
54055                 for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
54056                     var targetInfo = indexInfos_3[_i];
54057                     var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 ? -1 :
54058                         isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3, reportErrors) :
54059                             typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
54060                     if (!related) {
54061                         return 0;
54062                     }
54063                     result &= related;
54064                 }
54065                 return result;
54066             }
54067             function typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState) {
54068                 var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
54069                 if (sourceInfo) {
54070                     return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);
54071                 }
54072                 if (!(intersectionState & 1) && isObjectTypeWithInferableIndex(source)) {
54073                     return membersRelatedToIndexInfo(source, targetInfo, reportErrors);
54074                 }
54075                 if (reportErrors) {
54076                     reportError(ts.Diagnostics.Index_signature_for_type_0_is_missing_in_type_1, typeToString(targetInfo.keyType), typeToString(source));
54077                 }
54078                 return 0;
54079             }
54080             function indexSignaturesIdenticalTo(source, target) {
54081                 var sourceInfos = getIndexInfosOfType(source);
54082                 var targetInfos = getIndexInfosOfType(target);
54083                 if (sourceInfos.length !== targetInfos.length) {
54084                     return 0;
54085                 }
54086                 for (var _i = 0, targetInfos_1 = targetInfos; _i < targetInfos_1.length; _i++) {
54087                     var targetInfo = targetInfos_1[_i];
54088                     var sourceInfo = getIndexInfoOfType(source, targetInfo.keyType);
54089                     if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type, 3) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
54090                         return 0;
54091                     }
54092                 }
54093                 return -1;
54094             }
54095             function constructorVisibilitiesAreCompatible(sourceSignature, targetSignature, reportErrors) {
54096                 if (!sourceSignature.declaration || !targetSignature.declaration) {
54097                     return true;
54098                 }
54099                 var sourceAccessibility = ts.getSelectedEffectiveModifierFlags(sourceSignature.declaration, 24);
54100                 var targetAccessibility = ts.getSelectedEffectiveModifierFlags(targetSignature.declaration, 24);
54101                 if (targetAccessibility === 8) {
54102                     return true;
54103                 }
54104                 if (targetAccessibility === 16 && sourceAccessibility !== 8) {
54105                     return true;
54106                 }
54107                 if (targetAccessibility !== 16 && !sourceAccessibility) {
54108                     return true;
54109                 }
54110                 if (reportErrors) {
54111                     reportError(ts.Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility));
54112                 }
54113                 return false;
54114             }
54115         }
54116         function typeCouldHaveTopLevelSingletonTypes(type) {
54117             if (type.flags & 16) {
54118                 return false;
54119             }
54120             if (type.flags & 3145728) {
54121                 return !!ts.forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
54122             }
54123             if (type.flags & 465829888) {
54124                 var constraint = getConstraintOfType(type);
54125                 if (constraint && constraint !== type) {
54126                     return typeCouldHaveTopLevelSingletonTypes(constraint);
54127                 }
54128             }
54129             return isUnitType(type) || !!(type.flags & 134217728);
54130         }
54131         function getExactOptionalUnassignableProperties(source, target) {
54132             if (isTupleType(source) && isTupleType(target))
54133                 return ts.emptyArray;
54134             return getPropertiesOfType(target)
54135                 .filter(function (targetProp) { return isExactOptionalPropertyMismatch(getTypeOfPropertyOfType(source, targetProp.escapedName), getTypeOfSymbol(targetProp)); });
54136         }
54137         function isExactOptionalPropertyMismatch(source, target) {
54138             return !!source && !!target && maybeTypeOfKind(source, 32768) && !!containsMissingType(target);
54139         }
54140         function getExactOptionalProperties(type) {
54141             return getPropertiesOfType(type).filter(function (targetProp) { return containsMissingType(getTypeOfSymbol(targetProp)); });
54142         }
54143         function getBestMatchingType(source, target, isRelatedTo) {
54144             if (isRelatedTo === void 0) { isRelatedTo = compareTypesAssignable; }
54145             return findMatchingDiscriminantType(source, target, isRelatedTo, true) ||
54146                 findMatchingTypeReferenceOrTypeAliasReference(source, target) ||
54147                 findBestTypeForObjectLiteral(source, target) ||
54148                 findBestTypeForInvokable(source, target) ||
54149                 findMostOverlappyType(source, target);
54150         }
54151         function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue, skipPartial) {
54152             var discriminable = target.types.map(function (_) { return undefined; });
54153             for (var _i = 0, discriminators_1 = discriminators; _i < discriminators_1.length; _i++) {
54154                 var _a = discriminators_1[_i], getDiscriminatingType = _a[0], propertyName = _a[1];
54155                 var targetProp = getUnionOrIntersectionProperty(target, propertyName);
54156                 if (skipPartial && targetProp && ts.getCheckFlags(targetProp) & 16) {
54157                     continue;
54158                 }
54159                 var i = 0;
54160                 for (var _b = 0, _c = target.types; _b < _c.length; _b++) {
54161                     var type = _c[_b];
54162                     var targetType = getTypeOfPropertyOfType(type, propertyName);
54163                     if (targetType && related(getDiscriminatingType(), targetType)) {
54164                         discriminable[i] = discriminable[i] === undefined ? true : discriminable[i];
54165                     }
54166                     else {
54167                         discriminable[i] = false;
54168                     }
54169                     i++;
54170                 }
54171             }
54172             var match = discriminable.indexOf(true);
54173             if (match === -1) {
54174                 return defaultValue;
54175             }
54176             var nextMatch = discriminable.indexOf(true, match + 1);
54177             while (nextMatch !== -1) {
54178                 if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
54179                     return defaultValue;
54180                 }
54181                 nextMatch = discriminable.indexOf(true, nextMatch + 1);
54182             }
54183             return target.types[match];
54184         }
54185         function isWeakType(type) {
54186             if (type.flags & 524288) {
54187                 var resolved = resolveStructuredTypeMembers(type);
54188                 return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 &&
54189                     resolved.properties.length > 0 && ts.every(resolved.properties, function (p) { return !!(p.flags & 16777216); });
54190             }
54191             if (type.flags & 2097152) {
54192                 return ts.every(type.types, isWeakType);
54193             }
54194             return false;
54195         }
54196         function hasCommonProperties(source, target, isComparingJsxAttributes) {
54197             for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
54198                 var prop = _a[_i];
54199                 if (isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
54200                     return true;
54201                 }
54202             }
54203             return false;
54204         }
54205         function getMarkerTypeReference(type, source, target) {
54206             var result = createTypeReference(type, ts.map(type.typeParameters, function (t) { return t === source ? target : t; }));
54207             result.objectFlags |= 4096;
54208             return result;
54209         }
54210         function getAliasVariances(symbol) {
54211             var links = getSymbolLinks(symbol);
54212             return getVariancesWorker(links.typeParameters, links, function (_links, param, marker) {
54213                 var type = getTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, makeUnaryTypeMapper(param, marker)));
54214                 type.aliasTypeArgumentsContainsMarker = true;
54215                 return type;
54216             });
54217         }
54218         function getVariancesWorker(typeParameters, cache, createMarkerType) {
54219             var _a, _b, _c;
54220             if (typeParameters === void 0) { typeParameters = ts.emptyArray; }
54221             var variances = cache.variances;
54222             if (!variances) {
54223                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 });
54224                 cache.variances = ts.emptyArray;
54225                 variances = [];
54226                 var _loop_21 = function (tp) {
54227                     var unmeasurable = false;
54228                     var unreliable = false;
54229                     var oldHandler = outofbandVarianceMarkerHandler;
54230                     outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
54231                     var typeWithSuper = createMarkerType(cache, tp, markerSuperType);
54232                     var typeWithSub = createMarkerType(cache, tp, markerSubType);
54233                     var variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? 1 : 0) |
54234                         (isTypeAssignableTo(typeWithSuper, typeWithSub) ? 2 : 0);
54235                     if (variance === 3 && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
54236                         variance = 4;
54237                     }
54238                     outofbandVarianceMarkerHandler = oldHandler;
54239                     if (unmeasurable || unreliable) {
54240                         if (unmeasurable) {
54241                             variance |= 8;
54242                         }
54243                         if (unreliable) {
54244                             variance |= 16;
54245                         }
54246                     }
54247                     variances.push(variance);
54248                 };
54249                 for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
54250                     var tp = typeParameters_1[_i];
54251                     _loop_21(tp);
54252                 }
54253                 cache.variances = variances;
54254                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
54255             }
54256             return variances;
54257         }
54258         function getVariances(type) {
54259             if (type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8) {
54260                 return arrayVariances;
54261             }
54262             return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference);
54263         }
54264         function hasCovariantVoidArgument(typeArguments, variances) {
54265             for (var i = 0; i < variances.length; i++) {
54266                 if ((variances[i] & 7) === 1 && typeArguments[i].flags & 16384) {
54267                     return true;
54268                 }
54269             }
54270             return false;
54271         }
54272         function isUnconstrainedTypeParameter(type) {
54273             return type.flags & 262144 && !getConstraintOfTypeParameter(type);
54274         }
54275         function isNonDeferredTypeReference(type) {
54276             return !!(ts.getObjectFlags(type) & 4) && !type.node;
54277         }
54278         function isTypeReferenceWithGenericArguments(type) {
54279             return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144) || isTypeReferenceWithGenericArguments(t); });
54280         }
54281         function getTypeReferenceId(type, typeParameters, depth) {
54282             if (depth === void 0) { depth = 0; }
54283             var result = "" + type.target.id;
54284             for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
54285                 var t = _a[_i];
54286                 if (isUnconstrainedTypeParameter(t)) {
54287                     var index = typeParameters.indexOf(t);
54288                     if (index < 0) {
54289                         index = typeParameters.length;
54290                         typeParameters.push(t);
54291                     }
54292                     result += "=" + index;
54293                 }
54294                 else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
54295                     result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
54296                 }
54297                 else {
54298                     result += "-" + t.id;
54299                 }
54300             }
54301             return result;
54302         }
54303         function getRelationKey(source, target, intersectionState, relation) {
54304             if (relation === identityRelation && source.id > target.id) {
54305                 var temp = source;
54306                 source = target;
54307                 target = temp;
54308             }
54309             var postFix = intersectionState ? ":" + intersectionState : "";
54310             if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) {
54311                 var typeParameters = [];
54312                 return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters) + postFix;
54313             }
54314             return source.id + "," + target.id + postFix;
54315         }
54316         function forEachProperty(prop, callback) {
54317             if (ts.getCheckFlags(prop) & 6) {
54318                 for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) {
54319                     var t = _a[_i];
54320                     var p = getPropertyOfType(t, prop.escapedName);
54321                     var result = p && forEachProperty(p, callback);
54322                     if (result) {
54323                         return result;
54324                     }
54325                 }
54326                 return undefined;
54327             }
54328             return callback(prop);
54329         }
54330         function getDeclaringClass(prop) {
54331             return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined;
54332         }
54333         function getTypeOfPropertyInBaseClass(property) {
54334             var classType = getDeclaringClass(property);
54335             var baseClassType = classType && getBaseTypes(classType)[0];
54336             return baseClassType && getTypeOfPropertyOfType(baseClassType, property.escapedName);
54337         }
54338         function isPropertyInClassDerivedFrom(prop, baseClass) {
54339             return forEachProperty(prop, function (sp) {
54340                 var sourceClass = getDeclaringClass(sp);
54341                 return sourceClass ? hasBaseType(sourceClass, baseClass) : false;
54342             });
54343         }
54344         function isValidOverrideOf(sourceProp, targetProp) {
54345             return !forEachProperty(targetProp, function (tp) { return ts.getDeclarationModifierFlagsFromSymbol(tp) & 16 ?
54346                 !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; });
54347         }
54348         function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
54349             return forEachProperty(prop, function (p) { return ts.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 ?
54350                 !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
54351         }
54352         function isDeeplyNestedType(type, stack, depth, maxDepth) {
54353             if (maxDepth === void 0) { maxDepth = 5; }
54354             if (depth >= maxDepth) {
54355                 var identity_1 = getRecursionIdentity(type);
54356                 var count = 0;
54357                 for (var i = 0; i < depth; i++) {
54358                     if (getRecursionIdentity(stack[i]) === identity_1) {
54359                         count++;
54360                         if (count >= maxDepth) {
54361                             return true;
54362                         }
54363                     }
54364                 }
54365             }
54366             return false;
54367         }
54368         function getRecursionIdentity(type) {
54369             if (type.flags & 524288 && !isObjectOrArrayLiteralType(type)) {
54370                 if (ts.getObjectFlags(type) && 4 && type.node) {
54371                     return type.node;
54372                 }
54373                 if (type.symbol && !(ts.getObjectFlags(type) & 16 && type.symbol.flags & 32)) {
54374                     return type.symbol;
54375                 }
54376                 if (isTupleType(type)) {
54377                     return type.target;
54378                 }
54379             }
54380             if (type.flags & 262144) {
54381                 return type.symbol;
54382             }
54383             if (type.flags & 8388608) {
54384                 do {
54385                     type = type.objectType;
54386                 } while (type.flags & 8388608);
54387                 return type;
54388             }
54389             if (type.flags & 16777216) {
54390                 return type.root;
54391             }
54392             return type;
54393         }
54394         function isPropertyIdenticalTo(sourceProp, targetProp) {
54395             return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0;
54396         }
54397         function compareProperties(sourceProp, targetProp, compareTypes) {
54398             if (sourceProp === targetProp) {
54399                 return -1;
54400             }
54401             var sourcePropAccessibility = ts.getDeclarationModifierFlagsFromSymbol(sourceProp) & 24;
54402             var targetPropAccessibility = ts.getDeclarationModifierFlagsFromSymbol(targetProp) & 24;
54403             if (sourcePropAccessibility !== targetPropAccessibility) {
54404                 return 0;
54405             }
54406             if (sourcePropAccessibility) {
54407                 if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) {
54408                     return 0;
54409                 }
54410             }
54411             else {
54412                 if ((sourceProp.flags & 16777216) !== (targetProp.flags & 16777216)) {
54413                     return 0;
54414                 }
54415             }
54416             if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {
54417                 return 0;
54418             }
54419             return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
54420         }
54421         function isMatchingSignature(source, target, partialMatch) {
54422             var sourceParameterCount = getParameterCount(source);
54423             var targetParameterCount = getParameterCount(target);
54424             var sourceMinArgumentCount = getMinArgumentCount(source);
54425             var targetMinArgumentCount = getMinArgumentCount(target);
54426             var sourceHasRestParameter = hasEffectiveRestParameter(source);
54427             var targetHasRestParameter = hasEffectiveRestParameter(target);
54428             if (sourceParameterCount === targetParameterCount &&
54429                 sourceMinArgumentCount === targetMinArgumentCount &&
54430                 sourceHasRestParameter === targetHasRestParameter) {
54431                 return true;
54432             }
54433             if (partialMatch && sourceMinArgumentCount <= targetMinArgumentCount) {
54434                 return true;
54435             }
54436             return false;
54437         }
54438         function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {
54439             if (source === target) {
54440                 return -1;
54441             }
54442             if (!(isMatchingSignature(source, target, partialMatch))) {
54443                 return 0;
54444             }
54445             if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) {
54446                 return 0;
54447             }
54448             if (target.typeParameters) {
54449                 var mapper = createTypeMapper(source.typeParameters, target.typeParameters);
54450                 for (var i = 0; i < target.typeParameters.length; i++) {
54451                     var s = source.typeParameters[i];
54452                     var t = target.typeParameters[i];
54453                     if (!(s === t || compareTypes(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) &&
54454                         compareTypes(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) {
54455                         return 0;
54456                     }
54457                 }
54458                 source = instantiateSignature(source, mapper, true);
54459             }
54460             var result = -1;
54461             if (!ignoreThisTypes) {
54462                 var sourceThisType = getThisTypeOfSignature(source);
54463                 if (sourceThisType) {
54464                     var targetThisType = getThisTypeOfSignature(target);
54465                     if (targetThisType) {
54466                         var related = compareTypes(sourceThisType, targetThisType);
54467                         if (!related) {
54468                             return 0;
54469                         }
54470                         result &= related;
54471                     }
54472                 }
54473             }
54474             var targetLen = getParameterCount(target);
54475             for (var i = 0; i < targetLen; i++) {
54476                 var s = getTypeAtPosition(source, i);
54477                 var t = getTypeAtPosition(target, i);
54478                 var related = compareTypes(t, s);
54479                 if (!related) {
54480                     return 0;
54481                 }
54482                 result &= related;
54483             }
54484             if (!ignoreReturnTypes) {
54485                 var sourceTypePredicate = getTypePredicateOfSignature(source);
54486                 var targetTypePredicate = getTypePredicateOfSignature(target);
54487                 result &= sourceTypePredicate || targetTypePredicate ?
54488                     compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) :
54489                     compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
54490             }
54491             return result;
54492         }
54493         function compareTypePredicatesIdentical(source, target, compareTypes) {
54494             return !(source && target && typePredicateKindsMatch(source, target)) ? 0 :
54495                 source.type === target.type ? -1 :
54496                     source.type && target.type ? compareTypes(source.type, target.type) :
54497                         0;
54498         }
54499         function literalTypesWithSameBaseType(types) {
54500             var commonBaseType;
54501             for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
54502                 var t = types_13[_i];
54503                 var baseType = getBaseTypeOfLiteralType(t);
54504                 if (!commonBaseType) {
54505                     commonBaseType = baseType;
54506                 }
54507                 if (baseType === t || baseType !== commonBaseType) {
54508                     return false;
54509                 }
54510             }
54511             return true;
54512         }
54513         function getSupertypeOrUnion(types) {
54514             if (types.length === 1) {
54515                 return types[0];
54516             }
54517             return literalTypesWithSameBaseType(types) ?
54518                 getUnionType(types) :
54519                 ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
54520         }
54521         function getCommonSupertype(types) {
54522             if (!strictNullChecks) {
54523                 return getSupertypeOrUnion(types);
54524             }
54525             var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304); });
54526             return primaryTypes.length ?
54527                 getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304) :
54528                 getUnionType(types, 2);
54529         }
54530         function getCommonSubtype(types) {
54531             return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s; });
54532         }
54533         function isArrayType(type) {
54534             return !!(ts.getObjectFlags(type) & 4) && (type.target === globalArrayType || type.target === globalReadonlyArrayType);
54535         }
54536         function isReadonlyArrayType(type) {
54537             return !!(ts.getObjectFlags(type) & 4) && type.target === globalReadonlyArrayType;
54538         }
54539         function isMutableArrayOrTuple(type) {
54540             return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
54541         }
54542         function getElementTypeOfArrayType(type) {
54543             return isArrayType(type) ? getTypeArguments(type)[0] : undefined;
54544         }
54545         function isArrayLikeType(type) {
54546             return isArrayType(type) || !(type.flags & 98304) && isTypeAssignableTo(type, anyReadonlyArrayType);
54547         }
54548         function getSingleBaseForNonAugmentingSubtype(type) {
54549             if (!(ts.getObjectFlags(type) & 4) || !(ts.getObjectFlags(type.target) & 3)) {
54550                 return undefined;
54551             }
54552             if (ts.getObjectFlags(type) & 33554432) {
54553                 return ts.getObjectFlags(type) & 67108864 ? type.cachedEquivalentBaseType : undefined;
54554             }
54555             type.objectFlags |= 33554432;
54556             var target = type.target;
54557             if (ts.getObjectFlags(target) & 1) {
54558                 var baseTypeNode = getBaseTypeNodeOfClass(target);
54559                 if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 205) {
54560                     return undefined;
54561                 }
54562             }
54563             var bases = getBaseTypes(target);
54564             if (bases.length !== 1) {
54565                 return undefined;
54566             }
54567             if (getMembersOfSymbol(type.symbol).size) {
54568                 return undefined;
54569             }
54570             var instantiatedBase = !ts.length(target.typeParameters) ? bases[0] : instantiateType(bases[0], createTypeMapper(target.typeParameters, getTypeArguments(type).slice(0, target.typeParameters.length)));
54571             if (ts.length(getTypeArguments(type)) > ts.length(target.typeParameters)) {
54572                 instantiatedBase = getTypeWithThisArgument(instantiatedBase, ts.last(getTypeArguments(type)));
54573             }
54574             type.objectFlags |= 67108864;
54575             return type.cachedEquivalentBaseType = instantiatedBase;
54576         }
54577         function isEmptyLiteralType(type) {
54578             return strictNullChecks ? type === implicitNeverType : type === undefinedWideningType;
54579         }
54580         function isEmptyArrayLiteralType(type) {
54581             var elementType = getElementTypeOfArrayType(type);
54582             return !!elementType && isEmptyLiteralType(elementType);
54583         }
54584         function isTupleLikeType(type) {
54585             return isTupleType(type) || !!getPropertyOfType(type, "0");
54586         }
54587         function isArrayOrTupleLikeType(type) {
54588             return isArrayLikeType(type) || isTupleLikeType(type);
54589         }
54590         function getTupleElementType(type, index) {
54591             var propType = getTypeOfPropertyOfType(type, "" + index);
54592             if (propType) {
54593                 return propType;
54594             }
54595             if (everyType(type, isTupleType)) {
54596                 return mapType(type, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
54597             }
54598             return undefined;
54599         }
54600         function isNeitherUnitTypeNorNever(type) {
54601             return !(type.flags & (109440 | 131072));
54602         }
54603         function isUnitType(type) {
54604             return !!(type.flags & 109440);
54605         }
54606         function isUnitLikeType(type) {
54607             return type.flags & 2097152 ? ts.some(type.types, isUnitType) :
54608                 !!(type.flags & 109440);
54609         }
54610         function extractUnitType(type) {
54611             return type.flags & 2097152 ? ts.find(type.types, isUnitType) || type : type;
54612         }
54613         function isLiteralType(type) {
54614             return type.flags & 16 ? true :
54615                 type.flags & 1048576 ? type.flags & 1024 ? true : ts.every(type.types, isUnitType) :
54616                     isUnitType(type);
54617         }
54618         function getBaseTypeOfLiteralType(type) {
54619             return type.flags & 1024 ? getBaseTypeOfEnumLiteralType(type) :
54620                 type.flags & 128 ? stringType :
54621                     type.flags & 256 ? numberType :
54622                         type.flags & 2048 ? bigintType :
54623                             type.flags & 512 ? booleanType :
54624                                 type.flags & 1048576 ? mapType(type, getBaseTypeOfLiteralType) :
54625                                     type;
54626         }
54627         function getWidenedLiteralType(type) {
54628             return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
54629                 type.flags & 128 && isFreshLiteralType(type) ? stringType :
54630                     type.flags & 256 && isFreshLiteralType(type) ? numberType :
54631                         type.flags & 2048 && isFreshLiteralType(type) ? bigintType :
54632                             type.flags & 512 && isFreshLiteralType(type) ? booleanType :
54633                                 type.flags & 1048576 ? mapType(type, getWidenedLiteralType) :
54634                                     type;
54635         }
54636         function getWidenedUniqueESSymbolType(type) {
54637             return type.flags & 8192 ? esSymbolType :
54638                 type.flags & 1048576 ? mapType(type, getWidenedUniqueESSymbolType) :
54639                     type;
54640         }
54641         function getWidenedLiteralLikeTypeForContextualType(type, contextualType) {
54642             if (!isLiteralOfContextualType(type, contextualType)) {
54643                 type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
54644             }
54645             return type;
54646         }
54647         function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
54648             if (type && isUnitType(type)) {
54649                 var contextualType = !contextualSignatureReturnType ? undefined :
54650                     isAsync ? getPromisedTypeOfPromise(contextualSignatureReturnType) :
54651                         contextualSignatureReturnType;
54652                 type = getWidenedLiteralLikeTypeForContextualType(type, contextualType);
54653             }
54654             return type;
54655         }
54656         function getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(type, contextualSignatureReturnType, kind, isAsyncGenerator) {
54657             if (type && isUnitType(type)) {
54658                 var contextualType = !contextualSignatureReturnType ? undefined :
54659                     getIterationTypeOfGeneratorFunctionReturnType(kind, contextualSignatureReturnType, isAsyncGenerator);
54660                 type = getWidenedLiteralLikeTypeForContextualType(type, contextualType);
54661             }
54662             return type;
54663         }
54664         function isTupleType(type) {
54665             return !!(ts.getObjectFlags(type) & 4 && type.target.objectFlags & 8);
54666         }
54667         function isGenericTupleType(type) {
54668             return isTupleType(type) && !!(type.target.combinedFlags & 8);
54669         }
54670         function isSingleElementGenericTupleType(type) {
54671             return isGenericTupleType(type) && type.target.elementFlags.length === 1;
54672         }
54673         function getRestTypeOfTupleType(type) {
54674             return getElementTypeOfSliceOfTupleType(type, type.target.fixedLength);
54675         }
54676         function getRestArrayTypeOfTupleType(type) {
54677             var restType = getRestTypeOfTupleType(type);
54678             return restType && createArrayType(restType);
54679         }
54680         function getElementTypeOfSliceOfTupleType(type, index, endSkipCount, writing) {
54681             if (endSkipCount === void 0) { endSkipCount = 0; }
54682             if (writing === void 0) { writing = false; }
54683             var length = getTypeReferenceArity(type) - endSkipCount;
54684             if (index < length) {
54685                 var typeArguments = getTypeArguments(type);
54686                 var elementTypes = [];
54687                 for (var i = index; i < length; i++) {
54688                     var t = typeArguments[i];
54689                     elementTypes.push(type.target.elementFlags[i] & 8 ? getIndexedAccessType(t, numberType) : t);
54690                 }
54691                 return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
54692             }
54693             return undefined;
54694         }
54695         function isTupleTypeStructureMatching(t1, t2) {
54696             return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) &&
54697                 ts.every(t1.target.elementFlags, function (f, i) { return (f & 12) === (t2.target.elementFlags[i] & 12); });
54698         }
54699         function isZeroBigInt(_a) {
54700             var value = _a.value;
54701             return value.base10Value === "0";
54702         }
54703         function getFalsyFlagsOfTypes(types) {
54704             var result = 0;
54705             for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
54706                 var t = types_14[_i];
54707                 result |= getFalsyFlags(t);
54708             }
54709             return result;
54710         }
54711         function getFalsyFlags(type) {
54712             return type.flags & 1048576 ? getFalsyFlagsOfTypes(type.types) :
54713                 type.flags & 128 ? type.value === "" ? 128 : 0 :
54714                     type.flags & 256 ? type.value === 0 ? 256 : 0 :
54715                         type.flags & 2048 ? isZeroBigInt(type) ? 2048 : 0 :
54716                             type.flags & 512 ? (type === falseType || type === regularFalseType) ? 512 : 0 :
54717                                 type.flags & 117724;
54718         }
54719         function removeDefinitelyFalsyTypes(type) {
54720             return getFalsyFlags(type) & 117632 ?
54721                 filterType(type, function (t) { return !(getFalsyFlags(t) & 117632); }) :
54722                 type;
54723         }
54724         function extractDefinitelyFalsyTypes(type) {
54725             return mapType(type, getDefinitelyFalsyPartOfType);
54726         }
54727         function getDefinitelyFalsyPartOfType(type) {
54728             return type.flags & 4 ? emptyStringType :
54729                 type.flags & 8 ? zeroType :
54730                     type.flags & 64 ? zeroBigIntType :
54731                         type === regularFalseType ||
54732                             type === falseType ||
54733                             type.flags & (16384 | 32768 | 65536 | 3) ||
54734                             type.flags & 128 && type.value === "" ||
54735                             type.flags & 256 && type.value === 0 ||
54736                             type.flags & 2048 && isZeroBigInt(type) ? type :
54737                             neverType;
54738         }
54739         function getNullableType(type, flags) {
54740             var missing = (flags & ~type.flags) & (32768 | 65536);
54741             return missing === 0 ? type :
54742                 missing === 32768 ? getUnionType([type, undefinedType]) :
54743                     missing === 65536 ? getUnionType([type, nullType]) :
54744                         getUnionType([type, undefinedType, nullType]);
54745         }
54746         function getOptionalType(type, isProperty) {
54747             if (isProperty === void 0) { isProperty = false; }
54748             ts.Debug.assert(strictNullChecks);
54749             return type.flags & 32768 ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
54750         }
54751         function getGlobalNonNullableTypeInstantiation(type) {
54752             var reducedType = getTypeWithFacts(type, 2097152);
54753             if (!deferredGlobalNonNullableTypeAlias) {
54754                 deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, undefined) || unknownSymbol;
54755             }
54756             return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
54757                 getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
54758                 reducedType;
54759         }
54760         function getNonNullableType(type) {
54761             return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
54762         }
54763         function addOptionalTypeMarker(type) {
54764             return strictNullChecks ? getUnionType([type, optionalType]) : type;
54765         }
54766         function removeOptionalTypeMarker(type) {
54767             return strictNullChecks ? removeType(type, optionalType) : type;
54768         }
54769         function propagateOptionalTypeMarker(type, node, wasOptional) {
54770             return wasOptional ? ts.isOutermostOptionalChain(node) ? getOptionalType(type) : addOptionalTypeMarker(type) : type;
54771         }
54772         function getOptionalExpressionType(exprType, expression) {
54773             return ts.isExpressionOfOptionalChainRoot(expression) ? getNonNullableType(exprType) :
54774                 ts.isOptionalChain(expression) ? removeOptionalTypeMarker(exprType) :
54775                     exprType;
54776         }
54777         function removeMissingType(type, isOptional) {
54778             return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type;
54779         }
54780         function containsMissingType(type) {
54781             return exactOptionalPropertyTypes && (type === missingType || type.flags & 1048576 && containsType(type.types, missingType));
54782         }
54783         function removeMissingOrUndefinedType(type) {
54784             return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, 524288);
54785         }
54786         function isCoercibleUnderDoubleEquals(source, target) {
54787             return ((source.flags & (8 | 4 | 512)) !== 0)
54788                 && ((target.flags & (8 | 4 | 16)) !== 0);
54789         }
54790         function isObjectTypeWithInferableIndex(type) {
54791             return type.flags & 2097152 ? ts.every(type.types, isObjectTypeWithInferableIndex) :
54792                 !!(type.symbol && (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0 &&
54793                     !typeHasCallOrConstructSignatures(type)) || !!(ts.getObjectFlags(type) & 1024 && isObjectTypeWithInferableIndex(type.source));
54794         }
54795         function createSymbolWithType(source, type) {
54796             var symbol = createSymbol(source.flags, source.escapedName, ts.getCheckFlags(source) & 8);
54797             symbol.declarations = source.declarations;
54798             symbol.parent = source.parent;
54799             symbol.type = type;
54800             symbol.target = source;
54801             if (source.valueDeclaration) {
54802                 symbol.valueDeclaration = source.valueDeclaration;
54803             }
54804             var nameType = getSymbolLinks(source).nameType;
54805             if (nameType) {
54806                 symbol.nameType = nameType;
54807             }
54808             return symbol;
54809         }
54810         function transformTypeOfMembers(type, f) {
54811             var members = ts.createSymbolTable();
54812             for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {
54813                 var property = _a[_i];
54814                 var original = getTypeOfSymbol(property);
54815                 var updated = f(original);
54816                 members.set(property.escapedName, updated === original ? property : createSymbolWithType(property, updated));
54817             }
54818             return members;
54819         }
54820         function getRegularTypeOfObjectLiteral(type) {
54821             if (!(isObjectLiteralType(type) && ts.getObjectFlags(type) & 16384)) {
54822                 return type;
54823             }
54824             var regularType = type.regularType;
54825             if (regularType) {
54826                 return regularType;
54827             }
54828             var resolved = type;
54829             var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral);
54830             var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.indexInfos);
54831             regularNew.flags = resolved.flags;
54832             regularNew.objectFlags |= resolved.objectFlags & ~16384;
54833             type.regularType = regularNew;
54834             return regularNew;
54835         }
54836         function createWideningContext(parent, propertyName, siblings) {
54837             return { parent: parent, propertyName: propertyName, siblings: siblings, resolvedProperties: undefined };
54838         }
54839         function getSiblingsOfContext(context) {
54840             if (!context.siblings) {
54841                 var siblings_1 = [];
54842                 for (var _i = 0, _a = getSiblingsOfContext(context.parent); _i < _a.length; _i++) {
54843                     var type = _a[_i];
54844                     if (isObjectLiteralType(type)) {
54845                         var prop = getPropertyOfObjectType(type, context.propertyName);
54846                         if (prop) {
54847                             forEachType(getTypeOfSymbol(prop), function (t) {
54848                                 siblings_1.push(t);
54849                             });
54850                         }
54851                     }
54852                 }
54853                 context.siblings = siblings_1;
54854             }
54855             return context.siblings;
54856         }
54857         function getPropertiesOfContext(context) {
54858             if (!context.resolvedProperties) {
54859                 var names = new ts.Map();
54860                 for (var _i = 0, _a = getSiblingsOfContext(context); _i < _a.length; _i++) {
54861                     var t = _a[_i];
54862                     if (isObjectLiteralType(t) && !(ts.getObjectFlags(t) & 4194304)) {
54863                         for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
54864                             var prop = _c[_b];
54865                             names.set(prop.escapedName, prop);
54866                         }
54867                     }
54868                 }
54869                 context.resolvedProperties = ts.arrayFrom(names.values());
54870             }
54871             return context.resolvedProperties;
54872         }
54873         function getWidenedProperty(prop, context) {
54874             if (!(prop.flags & 4)) {
54875                 return prop;
54876             }
54877             var original = getTypeOfSymbol(prop);
54878             var propContext = context && createWideningContext(context, prop.escapedName, undefined);
54879             var widened = getWidenedTypeWithContext(original, propContext);
54880             return widened === original ? prop : createSymbolWithType(prop, widened);
54881         }
54882         function getUndefinedProperty(prop) {
54883             var cached = undefinedProperties.get(prop.escapedName);
54884             if (cached) {
54885                 return cached;
54886             }
54887             var result = createSymbolWithType(prop, missingType);
54888             result.flags |= 16777216;
54889             undefinedProperties.set(prop.escapedName, result);
54890             return result;
54891         }
54892         function getWidenedTypeOfObjectLiteral(type, context) {
54893             var members = ts.createSymbolTable();
54894             for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {
54895                 var prop = _a[_i];
54896                 members.set(prop.escapedName, getWidenedProperty(prop, context));
54897             }
54898             if (context) {
54899                 for (var _b = 0, _c = getPropertiesOfContext(context); _b < _c.length; _b++) {
54900                     var prop = _c[_b];
54901                     if (!members.has(prop.escapedName)) {
54902                         members.set(prop.escapedName, getUndefinedProperty(prop));
54903                     }
54904                 }
54905             }
54906             var result = createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, ts.sameMap(getIndexInfosOfType(type), function (info) { return createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly); }));
54907             result.objectFlags |= (ts.getObjectFlags(type) & (8192 | 524288));
54908             return result;
54909         }
54910         function getWidenedType(type) {
54911             return getWidenedTypeWithContext(type, undefined);
54912         }
54913         function getWidenedTypeWithContext(type, context) {
54914             if (ts.getObjectFlags(type) & 393216) {
54915                 if (context === undefined && type.widened) {
54916                     return type.widened;
54917                 }
54918                 var result = void 0;
54919                 if (type.flags & (1 | 98304)) {
54920                     result = anyType;
54921                 }
54922                 else if (isObjectLiteralType(type)) {
54923                     result = getWidenedTypeOfObjectLiteral(type, context);
54924                 }
54925                 else if (type.flags & 1048576) {
54926                     var unionContext_1 = context || createWideningContext(undefined, undefined, type.types);
54927                     var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 ? t : getWidenedTypeWithContext(t, unionContext_1); });
54928                     result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 : 1);
54929                 }
54930                 else if (type.flags & 2097152) {
54931                     result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
54932                 }
54933                 else if (isArrayType(type) || isTupleType(type)) {
54934                     result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
54935                 }
54936                 if (result && context === undefined) {
54937                     type.widened = result;
54938                 }
54939                 return result || type;
54940             }
54941             return type;
54942         }
54943         function reportWideningErrorsInType(type) {
54944             var errorReported = false;
54945             if (ts.getObjectFlags(type) & 131072) {
54946                 if (type.flags & 1048576) {
54947                     if (ts.some(type.types, isEmptyObjectType)) {
54948                         errorReported = true;
54949                     }
54950                     else {
54951                         for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
54952                             var t = _a[_i];
54953                             if (reportWideningErrorsInType(t)) {
54954                                 errorReported = true;
54955                             }
54956                         }
54957                     }
54958                 }
54959                 if (isArrayType(type) || isTupleType(type)) {
54960                     for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
54961                         var t = _c[_b];
54962                         if (reportWideningErrorsInType(t)) {
54963                             errorReported = true;
54964                         }
54965                     }
54966                 }
54967                 if (isObjectLiteralType(type)) {
54968                     for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
54969                         var p = _e[_d];
54970                         var t = getTypeOfSymbol(p);
54971                         if (ts.getObjectFlags(t) & 131072) {
54972                             if (!reportWideningErrorsInType(t)) {
54973                                 error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
54974                             }
54975                             errorReported = true;
54976                         }
54977                     }
54978                 }
54979             }
54980             return errorReported;
54981         }
54982         function reportImplicitAny(declaration, type, wideningKind) {
54983             var typeAsString = typeToString(getWidenedType(type));
54984             if (ts.isInJSFile(declaration) && !ts.isCheckJsEnabledForFile(ts.getSourceFileOfNode(declaration), compilerOptions)) {
54985                 return;
54986             }
54987             var diagnostic;
54988             switch (declaration.kind) {
54989                 case 220:
54990                 case 166:
54991                 case 165:
54992                     diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
54993                     break;
54994                 case 163:
54995                     var param = declaration;
54996                     if (ts.isIdentifier(param.name) &&
54997                         (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
54998                         param.parent.parameters.indexOf(param) > -1 &&
54999                         (resolveName(param, param.name.escapedText, 788968, undefined, param.name.escapedText, true) ||
55000                             param.name.originalKeywordKind && ts.isTypeNodeKind(param.name.originalKeywordKind))) {
55001                         var newName = "arg" + param.parent.parameters.indexOf(param);
55002                         var typeName = ts.declarationNameToString(param.name) + (param.dotDotDotToken ? "[]" : "");
55003                         errorOrSuggestion(noImplicitAny, declaration, ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName);
55004                         return;
55005                     }
55006                     diagnostic = declaration.dotDotDotToken ?
55007                         noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
55008                         noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
55009                     break;
55010                 case 202:
55011                     diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
55012                     if (!noImplicitAny) {
55013                         return;
55014                     }
55015                     break;
55016                 case 315:
55017                     error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
55018                     return;
55019                 case 255:
55020                 case 168:
55021                 case 167:
55022                 case 171:
55023                 case 172:
55024                 case 212:
55025                 case 213:
55026                     if (noImplicitAny && !declaration.name) {
55027                         if (wideningKind === 3) {
55028                             error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString);
55029                         }
55030                         else {
55031                             error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
55032                         }
55033                         return;
55034                     }
55035                     diagnostic = !noImplicitAny ? ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage :
55036                         wideningKind === 3 ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type :
55037                             ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type;
55038                     break;
55039                 case 194:
55040                     if (noImplicitAny) {
55041                         error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
55042                     }
55043                     return;
55044                 default:
55045                     diagnostic = noImplicitAny ? ts.Diagnostics.Variable_0_implicitly_has_an_1_type : ts.Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
55046             }
55047             errorOrSuggestion(noImplicitAny, declaration, diagnostic, ts.declarationNameToString(ts.getNameOfDeclaration(declaration)), typeAsString);
55048         }
55049         function reportErrorsFromWidening(declaration, type, wideningKind) {
55050             if (produceDiagnostics && noImplicitAny && ts.getObjectFlags(type) & 131072 && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration))) {
55051                 if (!reportWideningErrorsInType(type)) {
55052                     reportImplicitAny(declaration, type, wideningKind);
55053                 }
55054             }
55055         }
55056         function applyToParameterTypes(source, target, callback) {
55057             var sourceCount = getParameterCount(source);
55058             var targetCount = getParameterCount(target);
55059             var sourceRestType = getEffectiveRestType(source);
55060             var targetRestType = getEffectiveRestType(target);
55061             var targetNonRestCount = targetRestType ? targetCount - 1 : targetCount;
55062             var paramCount = sourceRestType ? targetNonRestCount : Math.min(sourceCount, targetNonRestCount);
55063             var sourceThisType = getThisTypeOfSignature(source);
55064             if (sourceThisType) {
55065                 var targetThisType = getThisTypeOfSignature(target);
55066                 if (targetThisType) {
55067                     callback(sourceThisType, targetThisType);
55068                 }
55069             }
55070             for (var i = 0; i < paramCount; i++) {
55071                 callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i));
55072             }
55073             if (targetRestType) {
55074                 callback(getRestTypeAtPosition(source, paramCount), targetRestType);
55075             }
55076         }
55077         function applyToReturnTypes(source, target, callback) {
55078             var sourceTypePredicate = getTypePredicateOfSignature(source);
55079             var targetTypePredicate = getTypePredicateOfSignature(target);
55080             if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
55081                 callback(sourceTypePredicate.type, targetTypePredicate.type);
55082             }
55083             else {
55084                 callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
55085             }
55086         }
55087         function createInferenceContext(typeParameters, signature, flags, compareTypes) {
55088             return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable);
55089         }
55090         function cloneInferenceContext(context, extraFlags) {
55091             if (extraFlags === void 0) { extraFlags = 0; }
55092             return context && createInferenceContextWorker(ts.map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes);
55093         }
55094         function createInferenceContextWorker(inferences, signature, flags, compareTypes) {
55095             var context = {
55096                 inferences: inferences,
55097                 signature: signature,
55098                 flags: flags,
55099                 compareTypes: compareTypes,
55100                 mapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, true); }),
55101                 nonFixingMapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, false); }),
55102             };
55103             return context;
55104         }
55105         function mapToInferredType(context, t, fix) {
55106             var inferences = context.inferences;
55107             for (var i = 0; i < inferences.length; i++) {
55108                 var inference = inferences[i];
55109                 if (t === inference.typeParameter) {
55110                     if (fix && !inference.isFixed) {
55111                         clearCachedInferences(inferences);
55112                         inference.isFixed = true;
55113                     }
55114                     return getInferredType(context, i);
55115                 }
55116             }
55117             return t;
55118         }
55119         function clearCachedInferences(inferences) {
55120             for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
55121                 var inference = inferences_1[_i];
55122                 if (!inference.isFixed) {
55123                     inference.inferredType = undefined;
55124                 }
55125             }
55126         }
55127         function createInferenceInfo(typeParameter) {
55128             return {
55129                 typeParameter: typeParameter,
55130                 candidates: undefined,
55131                 contraCandidates: undefined,
55132                 inferredType: undefined,
55133                 priority: undefined,
55134                 topLevel: true,
55135                 isFixed: false,
55136                 impliedArity: undefined
55137             };
55138         }
55139         function cloneInferenceInfo(inference) {
55140             return {
55141                 typeParameter: inference.typeParameter,
55142                 candidates: inference.candidates && inference.candidates.slice(),
55143                 contraCandidates: inference.contraCandidates && inference.contraCandidates.slice(),
55144                 inferredType: inference.inferredType,
55145                 priority: inference.priority,
55146                 topLevel: inference.topLevel,
55147                 isFixed: inference.isFixed,
55148                 impliedArity: inference.impliedArity
55149             };
55150         }
55151         function cloneInferredPartOfContext(context) {
55152             var inferences = ts.filter(context.inferences, hasInferenceCandidates);
55153             return inferences.length ?
55154                 createInferenceContextWorker(ts.map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) :
55155                 undefined;
55156         }
55157         function getMapperFromContext(context) {
55158             return context && context.mapper;
55159         }
55160         function couldContainTypeVariables(type) {
55161             var objectFlags = ts.getObjectFlags(type);
55162             if (objectFlags & 1048576) {
55163                 return !!(objectFlags & 2097152);
55164             }
55165             var result = !!(type.flags & 465829888 ||
55166                 type.flags & 524288 && !isNonGenericTopLevelType(type) && (objectFlags & 4 && (type.node || ts.forEach(getTypeArguments(type), couldContainTypeVariables)) ||
55167                     objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations ||
55168                     objectFlags & (32 | 1024 | 8388608)) ||
55169                 type.flags & 3145728 && !(type.flags & 1024) && !isNonGenericTopLevelType(type) && ts.some(type.types, couldContainTypeVariables));
55170             if (type.flags & 3899393) {
55171                 type.objectFlags |= 1048576 | (result ? 2097152 : 0);
55172             }
55173             return result;
55174         }
55175         function isNonGenericTopLevelType(type) {
55176             if (type.aliasSymbol && !type.aliasTypeArguments) {
55177                 var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 258);
55178                 return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 303 ? true : n.kind === 260 ? false : "quit"; }));
55179             }
55180             return false;
55181         }
55182         function isTypeParameterAtTopLevel(type, typeParameter) {
55183             return !!(type === typeParameter ||
55184                 type.flags & 3145728 && ts.some(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }) ||
55185                 type.flags & 16777216 && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
55186         }
55187         function createEmptyObjectTypeFromStringLiteral(type) {
55188             var members = ts.createSymbolTable();
55189             forEachType(type, function (t) {
55190                 if (!(t.flags & 128)) {
55191                     return;
55192                 }
55193                 var name = ts.escapeLeadingUnderscores(t.value);
55194                 var literalProp = createSymbol(4, name);
55195                 literalProp.type = anyType;
55196                 if (t.symbol) {
55197                     literalProp.declarations = t.symbol.declarations;
55198                     literalProp.valueDeclaration = t.symbol.valueDeclaration;
55199                 }
55200                 members.set(name, literalProp);
55201             });
55202             var indexInfos = type.flags & 4 ? [createIndexInfo(stringType, emptyObjectType, false)] : ts.emptyArray;
55203             return createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, indexInfos);
55204         }
55205         function inferTypeForHomomorphicMappedType(source, target, constraint) {
55206             if (inInferTypeForHomomorphicMappedType) {
55207                 return undefined;
55208             }
55209             var key = source.id + "," + target.id + "," + constraint.id;
55210             if (reverseMappedCache.has(key)) {
55211                 return reverseMappedCache.get(key);
55212             }
55213             inInferTypeForHomomorphicMappedType = true;
55214             var type = createReverseMappedType(source, target, constraint);
55215             inInferTypeForHomomorphicMappedType = false;
55216             reverseMappedCache.set(key, type);
55217             return type;
55218         }
55219         function isPartiallyInferableType(type) {
55220             return !(ts.getObjectFlags(type) & 524288) ||
55221                 isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); }) ||
55222                 isTupleType(type) && ts.some(getTypeArguments(type), isPartiallyInferableType);
55223         }
55224         function createReverseMappedType(source, target, constraint) {
55225             if (!(getIndexInfoOfType(source, stringType) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
55226                 return undefined;
55227             }
55228             if (isArrayType(source)) {
55229                 return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
55230             }
55231             if (isTupleType(source)) {
55232                 var elementTypes = ts.map(getTypeArguments(source), function (t) { return inferReverseMappedType(t, target, constraint); });
55233                 var elementFlags = getMappedTypeModifiers(target) & 4 ?
55234                     ts.sameMap(source.target.elementFlags, function (f) { return f & 2 ? 1 : f; }) :
55235                     source.target.elementFlags;
55236                 return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
55237             }
55238             var reversed = createObjectType(1024 | 16, undefined);
55239             reversed.source = source;
55240             reversed.mappedType = target;
55241             reversed.constraintType = constraint;
55242             return reversed;
55243         }
55244         function getTypeOfReverseMappedSymbol(symbol) {
55245             var links = getSymbolLinks(symbol);
55246             if (!links.type) {
55247                 links.type = inferReverseMappedType(symbol.propertyType, symbol.mappedType, symbol.constraintType);
55248             }
55249             return links.type;
55250         }
55251         function inferReverseMappedType(sourceType, target, constraint) {
55252             var typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
55253             var templateType = getTemplateTypeFromMappedType(target);
55254             var inference = createInferenceInfo(typeParameter);
55255             inferTypes([inference], sourceType, templateType);
55256             return getTypeFromInference(inference) || unknownType;
55257         }
55258         function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
55259             var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
55260             return __generator(this, function (_a) {
55261                 switch (_a.label) {
55262                     case 0:
55263                         properties = getPropertiesOfType(target);
55264                         _i = 0, properties_2 = properties;
55265                         _a.label = 1;
55266                     case 1:
55267                         if (!(_i < properties_2.length)) return [3, 6];
55268                         targetProp = properties_2[_i];
55269                         if (isStaticPrivateIdentifierProperty(targetProp)) {
55270                             return [3, 5];
55271                         }
55272                         if (!(requireOptionalProperties || !(targetProp.flags & 16777216 || ts.getCheckFlags(targetProp) & 48))) return [3, 5];
55273                         sourceProp = getPropertyOfType(source, targetProp.escapedName);
55274                         if (!!sourceProp) return [3, 3];
55275                         return [4, targetProp];
55276                     case 2:
55277                         _a.sent();
55278                         return [3, 5];
55279                     case 3:
55280                         if (!matchDiscriminantProperties) return [3, 5];
55281                         targetType = getTypeOfSymbol(targetProp);
55282                         if (!(targetType.flags & 109440)) return [3, 5];
55283                         sourceType = getTypeOfSymbol(sourceProp);
55284                         if (!!(sourceType.flags & 1 || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) return [3, 5];
55285                         return [4, targetProp];
55286                     case 4:
55287                         _a.sent();
55288                         _a.label = 5;
55289                     case 5:
55290                         _i++;
55291                         return [3, 1];
55292                     case 6: return [2];
55293                 }
55294             });
55295         }
55296         function getUnmatchedProperty(source, target, requireOptionalProperties, matchDiscriminantProperties) {
55297             var result = getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties).next();
55298             if (!result.done)
55299                 return result.value;
55300         }
55301         function tupleTypesDefinitelyUnrelated(source, target) {
55302             return !(target.target.combinedFlags & 8) && target.target.minLength > source.target.minLength ||
55303                 !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
55304         }
55305         function typesDefinitelyUnrelated(source, target) {
55306             return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) :
55307                 !!getUnmatchedProperty(source, target, false, true) &&
55308                     !!getUnmatchedProperty(target, source, false, false);
55309         }
55310         function getTypeFromInference(inference) {
55311             return inference.candidates ? getUnionType(inference.candidates, 2) :
55312                 inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
55313                     undefined;
55314         }
55315         function hasSkipDirectInferenceFlag(node) {
55316             return !!getNodeLinks(node).skipDirectInference;
55317         }
55318         function isFromInferenceBlockedSource(type) {
55319             return !!(type.symbol && ts.some(type.symbol.declarations, hasSkipDirectInferenceFlag));
55320         }
55321         function templateLiteralTypesDefinitelyUnrelated(source, target) {
55322             var sourceStart = source.texts[0];
55323             var targetStart = target.texts[0];
55324             var sourceEnd = source.texts[source.texts.length - 1];
55325             var targetEnd = target.texts[target.texts.length - 1];
55326             var startLen = Math.min(sourceStart.length, targetStart.length);
55327             var endLen = Math.min(sourceEnd.length, targetEnd.length);
55328             return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
55329                 sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
55330         }
55331         function isValidBigIntString(s) {
55332             var scanner = ts.createScanner(99, false);
55333             var success = true;
55334             scanner.setOnError(function () { return success = false; });
55335             scanner.setText(s + "n");
55336             var result = scanner.scan();
55337             if (result === 40) {
55338                 result = scanner.scan();
55339             }
55340             var flags = scanner.getTokenFlags();
55341             return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
55342         }
55343         function isValidTypeForTemplateLiteralPlaceholder(source, target) {
55344             if (source === target || target.flags & (1 | 4)) {
55345                 return true;
55346             }
55347             if (source.flags & 128) {
55348                 var value = source.value;
55349                 return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
55350                     target.flags & 64 && value !== "" && isValidBigIntString(value) ||
55351                     target.flags & (512 | 98304) && value === target.intrinsicName);
55352             }
55353             if (source.flags & 134217728) {
55354                 var texts = source.texts;
55355                 return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
55356             }
55357             return isTypeAssignableTo(source, target);
55358         }
55359         function inferTypesFromTemplateLiteralType(source, target) {
55360             return source.flags & 128 ? inferFromLiteralPartsToTemplateLiteral([source.value], ts.emptyArray, target) :
55361                 source.flags & 134217728 ?
55362                     ts.arraysEqual(source.texts, target.texts) ? ts.map(source.types, getStringLikeTypeForType) :
55363                         inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
55364                     undefined;
55365         }
55366         function isTypeMatchedByTemplateLiteralType(source, target) {
55367             var inferences = inferTypesFromTemplateLiteralType(source, target);
55368             return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
55369         }
55370         function getStringLikeTypeForType(type) {
55371             return type.flags & (1 | 402653316) ? type : getTemplateLiteralType(["", ""], [type]);
55372         }
55373         function inferFromLiteralPartsToTemplateLiteral(sourceTexts, sourceTypes, target) {
55374             var lastSourceIndex = sourceTexts.length - 1;
55375             var sourceStartText = sourceTexts[0];
55376             var sourceEndText = sourceTexts[lastSourceIndex];
55377             var targetTexts = target.texts;
55378             var lastTargetIndex = targetTexts.length - 1;
55379             var targetStartText = targetTexts[0];
55380             var targetEndText = targetTexts[lastTargetIndex];
55381             if (lastSourceIndex === 0 && sourceStartText.length < targetStartText.length + targetEndText.length ||
55382                 !sourceStartText.startsWith(targetStartText) || !sourceEndText.endsWith(targetEndText))
55383                 return undefined;
55384             var remainingEndText = sourceEndText.slice(0, sourceEndText.length - targetEndText.length);
55385             var matches = [];
55386             var seg = 0;
55387             var pos = targetStartText.length;
55388             for (var i = 1; i < lastTargetIndex; i++) {
55389                 var delim = targetTexts[i];
55390                 if (delim.length > 0) {
55391                     var s = seg;
55392                     var p = pos;
55393                     while (true) {
55394                         p = getSourceText(s).indexOf(delim, p);
55395                         if (p >= 0)
55396                             break;
55397                         s++;
55398                         if (s === sourceTexts.length)
55399                             return undefined;
55400                         p = 0;
55401                     }
55402                     addMatch(s, p);
55403                     pos += delim.length;
55404                 }
55405                 else if (pos < getSourceText(seg).length) {
55406                     addMatch(seg, pos + 1);
55407                 }
55408                 else if (seg < lastSourceIndex) {
55409                     addMatch(seg + 1, 0);
55410                 }
55411                 else {
55412                     return undefined;
55413                 }
55414             }
55415             addMatch(lastSourceIndex, getSourceText(lastSourceIndex).length);
55416             return matches;
55417             function getSourceText(index) {
55418                 return index < lastSourceIndex ? sourceTexts[index] : remainingEndText;
55419             }
55420             function addMatch(s, p) {
55421                 var matchType = s === seg ?
55422                     getStringLiteralType(getSourceText(s).slice(pos, p)) :
55423                     getTemplateLiteralType(__spreadArray(__spreadArray([sourceTexts[seg].slice(pos)], sourceTexts.slice(seg + 1, s), true), [getSourceText(s).slice(0, p)], false), sourceTypes.slice(seg, s));
55424                 matches.push(matchType);
55425                 seg = s;
55426                 pos = p;
55427             }
55428         }
55429         function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
55430             if (priority === void 0) { priority = 0; }
55431             if (contravariant === void 0) { contravariant = false; }
55432             var bivariant = false;
55433             var propagationType;
55434             var inferencePriority = 2048;
55435             var allowComplexConstraintInference = true;
55436             var visited;
55437             var sourceStack;
55438             var targetStack;
55439             var expandingFlags = 0;
55440             inferFromTypes(originalSource, originalTarget);
55441             function inferFromTypes(source, target) {
55442                 if (!couldContainTypeVariables(target)) {
55443                     return;
55444                 }
55445                 if (source === wildcardType) {
55446                     var savePropagationType = propagationType;
55447                     propagationType = source;
55448                     inferFromTypes(target, target);
55449                     propagationType = savePropagationType;
55450                     return;
55451                 }
55452                 if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {
55453                     inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
55454                     return;
55455                 }
55456                 if (source === target && source.flags & 3145728) {
55457                     for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
55458                         var t = _a[_i];
55459                         inferFromTypes(t, t);
55460                     }
55461                     return;
55462                 }
55463                 if (target.flags & 1048576) {
55464                     var _b = inferFromMatchingTypes(source.flags & 1048576 ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
55465                     var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
55466                     if (targets.length === 0) {
55467                         return;
55468                     }
55469                     target = getUnionType(targets);
55470                     if (sources.length === 0) {
55471                         inferWithPriority(source, target, 1);
55472                         return;
55473                     }
55474                     source = getUnionType(sources);
55475                 }
55476                 else if (target.flags & 2097152 && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
55477                     if (!(source.flags & 1048576)) {
55478                         var _d = inferFromMatchingTypes(source.flags & 2097152 ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
55479                         if (sources.length === 0 || targets.length === 0) {
55480                             return;
55481                         }
55482                         source = getIntersectionType(sources);
55483                         target = getIntersectionType(targets);
55484                     }
55485                 }
55486                 else if (target.flags & (8388608 | 33554432)) {
55487                     target = getActualTypeVariable(target);
55488                 }
55489                 if (target.flags & 8650752) {
55490                     if (ts.getObjectFlags(source) & 524288 || source === nonInferrableAnyType || source === silentNeverType ||
55491                         (priority & 128 && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
55492                         return;
55493                     }
55494                     var inference = getInferenceInfoForType(target);
55495                     if (inference) {
55496                         if (!inference.isFixed) {
55497                             if (inference.priority === undefined || priority < inference.priority) {
55498                                 inference.candidates = undefined;
55499                                 inference.contraCandidates = undefined;
55500                                 inference.topLevel = true;
55501                                 inference.priority = priority;
55502                             }
55503                             if (priority === inference.priority) {
55504                                 var candidate = propagationType || source;
55505                                 if (contravariant && !bivariant) {
55506                                     if (!ts.contains(inference.contraCandidates, candidate)) {
55507                                         inference.contraCandidates = ts.append(inference.contraCandidates, candidate);
55508                                         clearCachedInferences(inferences);
55509                                     }
55510                                 }
55511                                 else if (!ts.contains(inference.candidates, candidate)) {
55512                                     inference.candidates = ts.append(inference.candidates, candidate);
55513                                     clearCachedInferences(inferences);
55514                                 }
55515                             }
55516                             if (!(priority & 128) && target.flags & 262144 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
55517                                 inference.topLevel = false;
55518                                 clearCachedInferences(inferences);
55519                             }
55520                         }
55521                         inferencePriority = Math.min(inferencePriority, priority);
55522                         return;
55523                     }
55524                     else {
55525                         var simplified = getSimplifiedType(target, false);
55526                         if (simplified !== target) {
55527                             invokeOnce(source, simplified, inferFromTypes);
55528                         }
55529                         else if (target.flags & 8388608) {
55530                             var indexType = getSimplifiedType(target.indexType, false);
55531                             if (indexType.flags & 465829888) {
55532                                 var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false);
55533                                 if (simplified_1 && simplified_1 !== target) {
55534                                     invokeOnce(source, simplified_1, inferFromTypes);
55535                                 }
55536                             }
55537                         }
55538                     }
55539                 }
55540                 if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target)) &&
55541                     !(source.node && target.node)) {
55542                     inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
55543                 }
55544                 else if (source.flags & 4194304 && target.flags & 4194304) {
55545                     contravariant = !contravariant;
55546                     inferFromTypes(source.type, target.type);
55547                     contravariant = !contravariant;
55548                 }
55549                 else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) {
55550                     var empty = createEmptyObjectTypeFromStringLiteral(source);
55551                     contravariant = !contravariant;
55552                     inferWithPriority(empty, target.type, 256);
55553                     contravariant = !contravariant;
55554                 }
55555                 else if (source.flags & 8388608 && target.flags & 8388608) {
55556                     inferFromTypes(source.objectType, target.objectType);
55557                     inferFromTypes(source.indexType, target.indexType);
55558                 }
55559                 else if (source.flags & 268435456 && target.flags & 268435456) {
55560                     if (source.symbol === target.symbol) {
55561                         inferFromTypes(source.type, target.type);
55562                     }
55563                 }
55564                 else if (source.flags & 33554432) {
55565                     inferFromTypes(source.baseType, target);
55566                     var oldPriority = priority;
55567                     priority |= 4;
55568                     inferFromTypes(source.substitute, target);
55569                     priority = oldPriority;
55570                 }
55571                 else if (target.flags & 16777216) {
55572                     invokeOnce(source, target, inferToConditionalType);
55573                 }
55574                 else if (target.flags & 3145728) {
55575                     inferToMultipleTypes(source, target.types, target.flags);
55576                 }
55577                 else if (source.flags & 1048576) {
55578                     var sourceTypes = source.types;
55579                     for (var _e = 0, sourceTypes_2 = sourceTypes; _e < sourceTypes_2.length; _e++) {
55580                         var sourceType = sourceTypes_2[_e];
55581                         inferFromTypes(sourceType, target);
55582                     }
55583                 }
55584                 else if (target.flags & 134217728) {
55585                     inferToTemplateLiteralType(source, target);
55586                 }
55587                 else {
55588                     source = getReducedType(source);
55589                     if (!(priority & 512 && source.flags & (2097152 | 465829888))) {
55590                         var apparentSource = getApparentType(source);
55591                         if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 | 2097152))) {
55592                             allowComplexConstraintInference = false;
55593                             return inferFromTypes(apparentSource, target);
55594                         }
55595                         source = apparentSource;
55596                     }
55597                     if (source.flags & (524288 | 2097152)) {
55598                         invokeOnce(source, target, inferFromObjectTypes);
55599                     }
55600                 }
55601             }
55602             function inferWithPriority(source, target, newPriority) {
55603                 var savePriority = priority;
55604                 priority |= newPriority;
55605                 inferFromTypes(source, target);
55606                 priority = savePriority;
55607             }
55608             function invokeOnce(source, target, action) {
55609                 var key = source.id + "," + target.id;
55610                 var status = visited && visited.get(key);
55611                 if (status !== undefined) {
55612                     inferencePriority = Math.min(inferencePriority, status);
55613                     return;
55614                 }
55615                 (visited || (visited = new ts.Map())).set(key, -1);
55616                 var saveInferencePriority = inferencePriority;
55617                 inferencePriority = 2048;
55618                 var saveExpandingFlags = expandingFlags;
55619                 var sourceIdentity = getRecursionIdentity(source);
55620                 var targetIdentity = getRecursionIdentity(target);
55621                 if (ts.contains(sourceStack, sourceIdentity))
55622                     expandingFlags |= 1;
55623                 if (ts.contains(targetStack, targetIdentity))
55624                     expandingFlags |= 2;
55625                 if (expandingFlags !== 3) {
55626                     (sourceStack || (sourceStack = [])).push(sourceIdentity);
55627                     (targetStack || (targetStack = [])).push(targetIdentity);
55628                     action(source, target);
55629                     targetStack.pop();
55630                     sourceStack.pop();
55631                 }
55632                 else {
55633                     inferencePriority = -1;
55634                 }
55635                 expandingFlags = saveExpandingFlags;
55636                 visited.set(key, inferencePriority);
55637                 inferencePriority = Math.min(inferencePriority, saveInferencePriority);
55638             }
55639             function inferFromMatchingTypes(sources, targets, matches) {
55640                 var matchedSources;
55641                 var matchedTargets;
55642                 for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
55643                     var t = targets_1[_i];
55644                     for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
55645                         var s = sources_1[_a];
55646                         if (matches(s, t)) {
55647                             inferFromTypes(s, t);
55648                             matchedSources = ts.appendIfUnique(matchedSources, s);
55649                             matchedTargets = ts.appendIfUnique(matchedTargets, t);
55650                         }
55651                     }
55652                 }
55653                 return [
55654                     matchedSources ? ts.filter(sources, function (t) { return !ts.contains(matchedSources, t); }) : sources,
55655                     matchedTargets ? ts.filter(targets, function (t) { return !ts.contains(matchedTargets, t); }) : targets,
55656                 ];
55657             }
55658             function inferFromTypeArguments(sourceTypes, targetTypes, variances) {
55659                 var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
55660                 for (var i = 0; i < count; i++) {
55661                     if (i < variances.length && (variances[i] & 7) === 2) {
55662                         inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
55663                     }
55664                     else {
55665                         inferFromTypes(sourceTypes[i], targetTypes[i]);
55666                     }
55667                 }
55668             }
55669             function inferFromContravariantTypes(source, target) {
55670                 if (strictFunctionTypes || priority & 1024) {
55671                     contravariant = !contravariant;
55672                     inferFromTypes(source, target);
55673                     contravariant = !contravariant;
55674                 }
55675                 else {
55676                     inferFromTypes(source, target);
55677                 }
55678             }
55679             function getInferenceInfoForType(type) {
55680                 if (type.flags & 8650752) {
55681                     for (var _i = 0, inferences_2 = inferences; _i < inferences_2.length; _i++) {
55682                         var inference = inferences_2[_i];
55683                         if (type === inference.typeParameter) {
55684                             return inference;
55685                         }
55686                     }
55687                 }
55688                 return undefined;
55689             }
55690             function getSingleTypeVariableFromIntersectionTypes(types) {
55691                 var typeVariable;
55692                 for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
55693                     var type = types_15[_i];
55694                     var t = type.flags & 2097152 && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
55695                     if (!t || typeVariable && t !== typeVariable) {
55696                         return undefined;
55697                     }
55698                     typeVariable = t;
55699                 }
55700                 return typeVariable;
55701             }
55702             function inferToMultipleTypes(source, targets, targetFlags) {
55703                 var typeVariableCount = 0;
55704                 if (targetFlags & 1048576) {
55705                     var nakedTypeVariable = void 0;
55706                     var sources = source.flags & 1048576 ? source.types : [source];
55707                     var matched_1 = new Array(sources.length);
55708                     var inferenceCircularity = false;
55709                     for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
55710                         var t = targets_2[_i];
55711                         if (getInferenceInfoForType(t)) {
55712                             nakedTypeVariable = t;
55713                             typeVariableCount++;
55714                         }
55715                         else {
55716                             for (var i = 0; i < sources.length; i++) {
55717                                 var saveInferencePriority = inferencePriority;
55718                                 inferencePriority = 2048;
55719                                 inferFromTypes(sources[i], t);
55720                                 if (inferencePriority === priority)
55721                                     matched_1[i] = true;
55722                                 inferenceCircularity = inferenceCircularity || inferencePriority === -1;
55723                                 inferencePriority = Math.min(inferencePriority, saveInferencePriority);
55724                             }
55725                         }
55726                     }
55727                     if (typeVariableCount === 0) {
55728                         var intersectionTypeVariable = getSingleTypeVariableFromIntersectionTypes(targets);
55729                         if (intersectionTypeVariable) {
55730                             inferWithPriority(source, intersectionTypeVariable, 1);
55731                         }
55732                         return;
55733                     }
55734                     if (typeVariableCount === 1 && !inferenceCircularity) {
55735                         var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
55736                         if (unmatched.length) {
55737                             inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
55738                             return;
55739                         }
55740                     }
55741                 }
55742                 else {
55743                     for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
55744                         var t = targets_3[_a];
55745                         if (getInferenceInfoForType(t)) {
55746                             typeVariableCount++;
55747                         }
55748                         else {
55749                             inferFromTypes(source, t);
55750                         }
55751                     }
55752                 }
55753                 if (targetFlags & 2097152 ? typeVariableCount === 1 : typeVariableCount > 0) {
55754                     for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
55755                         var t = targets_4[_b];
55756                         if (getInferenceInfoForType(t)) {
55757                             inferWithPriority(source, t, 1);
55758                         }
55759                     }
55760                 }
55761             }
55762             function inferToMappedType(source, target, constraintType) {
55763                 if (constraintType.flags & 1048576) {
55764                     var result = false;
55765                     for (var _i = 0, _a = constraintType.types; _i < _a.length; _i++) {
55766                         var type = _a[_i];
55767                         result = inferToMappedType(source, target, type) || result;
55768                     }
55769                     return result;
55770                 }
55771                 if (constraintType.flags & 4194304) {
55772                     var inference = getInferenceInfoForType(constraintType.type);
55773                     if (inference && !inference.isFixed && !isFromInferenceBlockedSource(source)) {
55774                         var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
55775                         if (inferredType) {
55776                             inferWithPriority(inferredType, inference.typeParameter, ts.getObjectFlags(source) & 524288 ?
55777                                 16 :
55778                                 8);
55779                         }
55780                     }
55781                     return true;
55782                 }
55783                 if (constraintType.flags & 262144) {
55784                     inferWithPriority(getIndexType(source), constraintType, 32);
55785                     var extendedConstraint = getConstraintOfType(constraintType);
55786                     if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
55787                         return true;
55788                     }
55789                     var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
55790                     var indexTypes = ts.map(getIndexInfosOfType(source), function (info) { return info !== enumNumberIndexInfo ? info.type : neverType; });
55791                     inferFromTypes(getUnionType(ts.concatenate(propTypes, indexTypes)), getTemplateTypeFromMappedType(target));
55792                     return true;
55793                 }
55794                 return false;
55795             }
55796             function inferToConditionalType(source, target) {
55797                 if (source.flags & 16777216) {
55798                     inferFromTypes(source.checkType, target.checkType);
55799                     inferFromTypes(source.extendsType, target.extendsType);
55800                     inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
55801                     inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
55802                 }
55803                 else {
55804                     var savePriority = priority;
55805                     priority |= contravariant ? 64 : 0;
55806                     var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
55807                     inferToMultipleTypes(source, targetTypes, target.flags);
55808                     priority = savePriority;
55809                 }
55810             }
55811             function inferToTemplateLiteralType(source, target) {
55812                 var matches = inferTypesFromTemplateLiteralType(source, target);
55813                 var types = target.types;
55814                 if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
55815                     for (var i = 0; i < types.length; i++) {
55816                         inferFromTypes(matches ? matches[i] : neverType, types[i]);
55817                     }
55818                 }
55819             }
55820             function inferFromObjectTypes(source, target) {
55821                 if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
55822                     inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
55823                     return;
55824                 }
55825                 if (isGenericMappedType(source) && isGenericMappedType(target)) {
55826                     inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
55827                     inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
55828                     var sourceNameType = getNameTypeFromMappedType(source);
55829                     var targetNameType = getNameTypeFromMappedType(target);
55830                     if (sourceNameType && targetNameType)
55831                         inferFromTypes(sourceNameType, targetNameType);
55832                 }
55833                 if (ts.getObjectFlags(target) & 32 && !target.declaration.nameType) {
55834                     var constraintType = getConstraintTypeFromMappedType(target);
55835                     if (inferToMappedType(source, target, constraintType)) {
55836                         return;
55837                     }
55838                 }
55839                 if (!typesDefinitelyUnrelated(source, target)) {
55840                     if (isArrayType(source) || isTupleType(source)) {
55841                         if (isTupleType(target)) {
55842                             var sourceArity = getTypeReferenceArity(source);
55843                             var targetArity = getTypeReferenceArity(target);
55844                             var elementTypes = getTypeArguments(target);
55845                             var elementFlags = target.target.elementFlags;
55846                             if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
55847                                 for (var i = 0; i < targetArity; i++) {
55848                                     inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
55849                                 }
55850                                 return;
55851                             }
55852                             var startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
55853                             var endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3) : 0);
55854                             for (var i = 0; i < startLength; i++) {
55855                                 inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
55856                             }
55857                             if (!isTupleType(source) || sourceArity - startLength - endLength === 1 && source.target.elementFlags[startLength] & 4) {
55858                                 var restType = getTypeArguments(source)[startLength];
55859                                 for (var i = startLength; i < targetArity - endLength; i++) {
55860                                     inferFromTypes(elementFlags[i] & 8 ? createArrayType(restType) : restType, elementTypes[i]);
55861                                 }
55862                             }
55863                             else {
55864                                 var middleLength = targetArity - startLength - endLength;
55865                                 if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(source)) {
55866                                     var targetInfo = getInferenceInfoForType(elementTypes[startLength]);
55867                                     if (targetInfo && targetInfo.impliedArity !== undefined) {
55868                                         inferFromTypes(sliceTupleType(source, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
55869                                         inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
55870                                     }
55871                                 }
55872                                 else if (middleLength === 1 && elementFlags[startLength] & 8) {
55873                                     var endsInOptional = target.target.elementFlags[targetArity - 1] & 2;
55874                                     var sourceSlice = isTupleType(source) ? sliceTupleType(source, startLength, endLength) : createArrayType(getTypeArguments(source)[0]);
55875                                     inferWithPriority(sourceSlice, elementTypes[startLength], endsInOptional ? 2 : 0);
55876                                 }
55877                                 else if (middleLength === 1 && elementFlags[startLength] & 4) {
55878                                     var restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, endLength) : getTypeArguments(source)[0];
55879                                     if (restType) {
55880                                         inferFromTypes(restType, elementTypes[startLength]);
55881                                     }
55882                                 }
55883                             }
55884                             for (var i = 0; i < endLength; i++) {
55885                                 inferFromTypes(getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
55886                             }
55887                             return;
55888                         }
55889                         if (isArrayType(target)) {
55890                             inferFromIndexTypes(source, target);
55891                             return;
55892                         }
55893                     }
55894                     inferFromProperties(source, target);
55895                     inferFromSignatures(source, target, 0);
55896                     inferFromSignatures(source, target, 1);
55897                     inferFromIndexTypes(source, target);
55898                 }
55899             }
55900             function inferFromProperties(source, target) {
55901                 var properties = getPropertiesOfObjectType(target);
55902                 for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
55903                     var targetProp = properties_3[_i];
55904                     var sourceProp = getPropertyOfType(source, targetProp.escapedName);
55905                     if (sourceProp) {
55906                         inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
55907                     }
55908                 }
55909             }
55910             function inferFromSignatures(source, target, kind) {
55911                 var sourceSignatures = getSignaturesOfType(source, kind);
55912                 var targetSignatures = getSignaturesOfType(target, kind);
55913                 var sourceLen = sourceSignatures.length;
55914                 var targetLen = targetSignatures.length;
55915                 var len = sourceLen < targetLen ? sourceLen : targetLen;
55916                 var skipParameters = !!(ts.getObjectFlags(source) & 524288);
55917                 for (var i = 0; i < len; i++) {
55918                     inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]), skipParameters);
55919                 }
55920             }
55921             function inferFromSignature(source, target, skipParameters) {
55922                 if (!skipParameters) {
55923                     var saveBivariant = bivariant;
55924                     var kind = target.declaration ? target.declaration.kind : 0;
55925                     bivariant = bivariant || kind === 168 || kind === 167 || kind === 170;
55926                     applyToParameterTypes(source, target, inferFromContravariantTypes);
55927                     bivariant = saveBivariant;
55928                 }
55929                 applyToReturnTypes(source, target, inferFromTypes);
55930             }
55931             function inferFromIndexTypes(source, target) {
55932                 var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32) ? 8 : 0;
55933                 var indexInfos = getIndexInfosOfType(target);
55934                 if (isObjectTypeWithInferableIndex(source)) {
55935                     for (var _i = 0, indexInfos_4 = indexInfos; _i < indexInfos_4.length; _i++) {
55936                         var targetInfo = indexInfos_4[_i];
55937                         var propTypes = [];
55938                         for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) {
55939                             var prop = _b[_a];
55940                             if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576), targetInfo.keyType)) {
55941                                 var propType = getTypeOfSymbol(prop);
55942                                 propTypes.push(prop.flags & 16777216 ? removeMissingOrUndefinedType(propType) : propType);
55943                             }
55944                         }
55945                         for (var _c = 0, _d = getIndexInfosOfType(source); _c < _d.length; _c++) {
55946                             var info = _d[_c];
55947                             if (isApplicableIndexType(info.keyType, targetInfo.keyType)) {
55948                                 propTypes.push(info.type);
55949                             }
55950                         }
55951                         if (propTypes.length) {
55952                             inferWithPriority(getUnionType(propTypes), targetInfo.type, priority);
55953                         }
55954                     }
55955                 }
55956                 for (var _e = 0, indexInfos_5 = indexInfos; _e < indexInfos_5.length; _e++) {
55957                     var targetInfo = indexInfos_5[_e];
55958                     var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType);
55959                     if (sourceInfo) {
55960                         inferWithPriority(sourceInfo.type, targetInfo.type, priority);
55961                     }
55962                 }
55963             }
55964         }
55965         function isTypeOrBaseIdenticalTo(s, t) {
55966             return exactOptionalPropertyTypes && t === missingType ? s === t :
55967                 (isTypeIdenticalTo(s, t) || !!(t.flags & 4 && s.flags & 128 || t.flags & 8 && s.flags & 256));
55968         }
55969         function isTypeCloselyMatchedBy(s, t) {
55970             return !!(s.flags & 524288 && t.flags & 524288 && s.symbol && s.symbol === t.symbol ||
55971                 s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
55972         }
55973         function hasPrimitiveConstraint(type) {
55974             var constraint = getConstraintOfTypeParameter(type);
55975             return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 | 4194304 | 134217728 | 268435456);
55976         }
55977         function isObjectLiteralType(type) {
55978             return !!(ts.getObjectFlags(type) & 128);
55979         }
55980         function isObjectOrArrayLiteralType(type) {
55981             return !!(ts.getObjectFlags(type) & (128 | 32768));
55982         }
55983         function unionObjectAndArrayLiteralCandidates(candidates) {
55984             if (candidates.length > 1) {
55985                 var objectLiterals = ts.filter(candidates, isObjectOrArrayLiteralType);
55986                 if (objectLiterals.length) {
55987                     var literalsType = getUnionType(objectLiterals, 2);
55988                     return ts.concatenate(ts.filter(candidates, function (t) { return !isObjectOrArrayLiteralType(t); }), [literalsType]);
55989                 }
55990             }
55991             return candidates;
55992         }
55993         function getContravariantInference(inference) {
55994             return inference.priority & 416 ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
55995         }
55996         function getCovariantInference(inference, signature) {
55997             var candidates = unionObjectAndArrayLiteralCandidates(inference.candidates);
55998             var primitiveConstraint = hasPrimitiveConstraint(inference.typeParameter);
55999             var widenLiteralTypes = !primitiveConstraint && inference.topLevel &&
56000                 (inference.isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), inference.typeParameter));
56001             var baseCandidates = primitiveConstraint ? ts.sameMap(candidates, getRegularTypeOfLiteralType) :
56002                 widenLiteralTypes ? ts.sameMap(candidates, getWidenedLiteralType) :
56003                     candidates;
56004             var unwidenedType = inference.priority & 416 ?
56005                 getUnionType(baseCandidates, 2) :
56006                 getCommonSupertype(baseCandidates);
56007             return getWidenedType(unwidenedType);
56008         }
56009         function getInferredType(context, index) {
56010             var inference = context.inferences[index];
56011             if (!inference.inferredType) {
56012                 var inferredType = void 0;
56013                 var signature = context.signature;
56014                 if (signature) {
56015                     var inferredCovariantType_1 = inference.candidates ? getCovariantInference(inference, signature) : undefined;
56016                     if (inference.contraCandidates) {
56017                         inferredType = inferredCovariantType_1 && !(inferredCovariantType_1.flags & 131072) &&
56018                             ts.some(inference.contraCandidates, function (t) { return isTypeSubtypeOf(inferredCovariantType_1, t); }) ?
56019                             inferredCovariantType_1 : getContravariantInference(inference);
56020                     }
56021                     else if (inferredCovariantType_1) {
56022                         inferredType = inferredCovariantType_1;
56023                     }
56024                     else if (context.flags & 1) {
56025                         inferredType = silentNeverType;
56026                     }
56027                     else {
56028                         var defaultType = getDefaultFromTypeParameter(inference.typeParameter);
56029                         if (defaultType) {
56030                             inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
56031                         }
56032                     }
56033                 }
56034                 else {
56035                     inferredType = getTypeFromInference(inference);
56036                 }
56037                 inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2));
56038                 var constraint = getConstraintOfTypeParameter(inference.typeParameter);
56039                 if (constraint) {
56040                     var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
56041                     if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
56042                         inference.inferredType = inferredType = instantiatedConstraint;
56043                     }
56044                 }
56045             }
56046             return inference.inferredType;
56047         }
56048         function getDefaultTypeArgumentType(isInJavaScriptFile) {
56049             return isInJavaScriptFile ? anyType : unknownType;
56050         }
56051         function getInferredTypes(context) {
56052             var result = [];
56053             for (var i = 0; i < context.inferences.length; i++) {
56054                 result.push(getInferredType(context, i));
56055             }
56056             return result;
56057         }
56058         function getCannotFindNameDiagnosticForName(node) {
56059             switch (node.escapedText) {
56060                 case "document":
56061                 case "console":
56062                     return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
56063                 case "$":
56064                     return compilerOptions.types
56065                         ? ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig
56066                         : ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery;
56067                 case "describe":
56068                 case "suite":
56069                 case "it":
56070                 case "test":
56071                     return compilerOptions.types
56072                         ? ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig
56073                         : ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha;
56074                 case "process":
56075                 case "require":
56076                 case "Buffer":
56077                 case "module":
56078                     return compilerOptions.types
56079                         ? ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig
56080                         : ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode;
56081                 case "Map":
56082                 case "Set":
56083                 case "Promise":
56084                 case "Symbol":
56085                 case "WeakMap":
56086                 case "WeakSet":
56087                 case "Iterator":
56088                 case "AsyncIterator":
56089                 case "SharedArrayBuffer":
56090                 case "Atomics":
56091                 case "AsyncIterable":
56092                 case "AsyncIterableIterator":
56093                 case "AsyncGenerator":
56094                 case "AsyncGeneratorFunction":
56095                 case "BigInt":
56096                 case "Reflect":
56097                 case "BigInt64Array":
56098                 case "BigUint64Array":
56099                     return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later;
56100                 default:
56101                     if (node.parent.kind === 295) {
56102                         return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
56103                     }
56104                     else {
56105                         return ts.Diagnostics.Cannot_find_name_0;
56106                     }
56107             }
56108         }
56109         function getResolvedSymbol(node) {
56110             var links = getNodeLinks(node);
56111             if (!links.resolvedSymbol) {
56112                 links.resolvedSymbol = !ts.nodeIsMissing(node) &&
56113                     resolveName(node, node.escapedText, 111551 | 1048576, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node), false) || unknownSymbol;
56114             }
56115             return links.resolvedSymbol;
56116         }
56117         function isInTypeQuery(node) {
56118             return !!ts.findAncestor(node, function (n) { return n.kind === 180 ? true : n.kind === 79 || n.kind === 160 ? false : "quit"; });
56119         }
56120         function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
56121             switch (node.kind) {
56122                 case 79:
56123                     if (!ts.isThisInTypeQuery(node)) {
56124                         var symbol = getResolvedSymbol(node);
56125                         return symbol !== unknownSymbol ? "".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType), "|").concat(getSymbolId(symbol)) : undefined;
56126                     }
56127                 case 108:
56128                     return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType));
56129                 case 229:
56130                 case 211:
56131                     return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
56132                 case 160:
56133                     var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
56134                     return left && left + "." + node.right.escapedText;
56135                 case 205:
56136                 case 206:
56137                     var propName = getAccessedPropertyName(node);
56138                     if (propName !== undefined) {
56139                         var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
56140                         return key && key + "." + propName;
56141                     }
56142             }
56143             return undefined;
56144         }
56145         function isMatchingReference(source, target) {
56146             switch (target.kind) {
56147                 case 211:
56148                 case 229:
56149                     return isMatchingReference(source, target.expression);
56150                 case 220:
56151                     return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) ||
56152                         (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 && isMatchingReference(source, target.right));
56153             }
56154             switch (source.kind) {
56155                 case 230:
56156                     return target.kind === 230
56157                         && source.keywordToken === target.keywordToken
56158                         && source.name.escapedText === target.name.escapedText;
56159                 case 79:
56160                 case 80:
56161                     return ts.isThisInTypeQuery(source) ?
56162                         target.kind === 108 :
56163                         target.kind === 79 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
56164                             (target.kind === 253 || target.kind === 202) &&
56165                                 getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
56166                 case 108:
56167                     return target.kind === 108;
56168                 case 106:
56169                     return target.kind === 106;
56170                 case 229:
56171                 case 211:
56172                     return isMatchingReference(source.expression, target);
56173                 case 205:
56174                 case 206:
56175                     return ts.isAccessExpression(target) &&
56176                         getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
56177                         isMatchingReference(source.expression, target.expression);
56178                 case 160:
56179                     return ts.isAccessExpression(target) &&
56180                         source.right.escapedText === getAccessedPropertyName(target) &&
56181                         isMatchingReference(source.left, target.expression);
56182                 case 220:
56183                     return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 && isMatchingReference(source.right, target));
56184             }
56185             return false;
56186         }
56187         function getPropertyAccess(expr) {
56188             if (ts.isAccessExpression(expr)) {
56189                 return expr;
56190             }
56191             if (ts.isIdentifier(expr)) {
56192                 var symbol = getResolvedSymbol(expr);
56193                 if (isConstVariable(symbol)) {
56194                     var declaration = symbol.valueDeclaration;
56195                     if (ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && ts.isAccessExpression(declaration.initializer)) {
56196                         return declaration.initializer;
56197                     }
56198                     if (ts.isBindingElement(declaration) && !declaration.initializer) {
56199                         var parent = declaration.parent.parent;
56200                         if (ts.isVariableDeclaration(parent) && !parent.type && parent.initializer && (ts.isIdentifier(parent.initializer) || ts.isAccessExpression(parent.initializer))) {
56201                             return declaration;
56202                         }
56203                     }
56204                 }
56205             }
56206             return undefined;
56207         }
56208         function getAccessedPropertyName(access) {
56209             var propertyName;
56210             return access.kind === 205 ? access.name.escapedText :
56211                 access.kind === 206 && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
56212                     access.kind === 202 && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
56213                         undefined;
56214         }
56215         function containsMatchingReference(source, target) {
56216             while (ts.isAccessExpression(source)) {
56217                 source = source.expression;
56218                 if (isMatchingReference(source, target)) {
56219                     return true;
56220                 }
56221             }
56222             return false;
56223         }
56224         function optionalChainContainsReference(source, target) {
56225             while (ts.isOptionalChain(source)) {
56226                 source = source.expression;
56227                 if (isMatchingReference(source, target)) {
56228                     return true;
56229                 }
56230             }
56231             return false;
56232         }
56233         function isDiscriminantProperty(type, name) {
56234             if (type && type.flags & 1048576) {
56235                 var prop = getUnionOrIntersectionProperty(type, name);
56236                 if (prop && ts.getCheckFlags(prop) & 2) {
56237                     if (prop.isDiscriminantProperty === undefined) {
56238                         prop.isDiscriminantProperty =
56239                             (prop.checkFlags & 192) === 192 &&
56240                                 !isGenericType(getTypeOfSymbol(prop));
56241                     }
56242                     return !!prop.isDiscriminantProperty;
56243                 }
56244             }
56245             return false;
56246         }
56247         function findDiscriminantProperties(sourceProperties, target) {
56248             var result;
56249             for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) {
56250                 var sourceProperty = sourceProperties_2[_i];
56251                 if (isDiscriminantProperty(target, sourceProperty.escapedName)) {
56252                     if (result) {
56253                         result.push(sourceProperty);
56254                         continue;
56255                     }
56256                     result = [sourceProperty];
56257                 }
56258             }
56259             return result;
56260         }
56261         function mapTypesByKeyProperty(types, name) {
56262             var map = new ts.Map();
56263             var count = 0;
56264             var _loop_22 = function (type) {
56265                 if (type.flags & (524288 | 2097152 | 58982400)) {
56266                     var discriminant = getTypeOfPropertyOfType(type, name);
56267                     if (discriminant) {
56268                         if (!isLiteralType(discriminant)) {
56269                             return { value: undefined };
56270                         }
56271                         var duplicate_1 = false;
56272                         forEachType(discriminant, function (t) {
56273                             var id = getTypeId(getRegularTypeOfLiteralType(t));
56274                             var existing = map.get(id);
56275                             if (!existing) {
56276                                 map.set(id, type);
56277                             }
56278                             else if (existing !== unknownType) {
56279                                 map.set(id, unknownType);
56280                                 duplicate_1 = true;
56281                             }
56282                         });
56283                         if (!duplicate_1)
56284                             count++;
56285                     }
56286                 }
56287             };
56288             for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
56289                 var type = types_16[_i];
56290                 var state_8 = _loop_22(type);
56291                 if (typeof state_8 === "object")
56292                     return state_8.value;
56293             }
56294             return count >= 10 && count * 2 >= types.length ? map : undefined;
56295         }
56296         function getKeyPropertyName(unionType) {
56297             var types = unionType.types;
56298             if (types.length < 10 || ts.getObjectFlags(unionType) & 65536 ||
56299                 ts.countWhere(types, function (t) { return !!(t.flags & (524288 | 58982400)); }) < 10) {
56300                 return undefined;
56301             }
56302             if (unionType.keyPropertyName === undefined) {
56303                 var keyPropertyName = ts.forEach(types, function (t) {
56304                     return t.flags & (524288 | 58982400) ?
56305                         ts.forEach(getPropertiesOfType(t), function (p) { return isUnitType(getTypeOfSymbol(p)) ? p.escapedName : undefined; }) :
56306                         undefined;
56307                 });
56308                 var mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
56309                 unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
56310                 unionType.constituentMap = mapByKeyProperty;
56311             }
56312             return unionType.keyPropertyName.length ? unionType.keyPropertyName : undefined;
56313         }
56314         function getConstituentTypeForKeyType(unionType, keyType) {
56315             var _a;
56316             var result = (_a = unionType.constituentMap) === null || _a === void 0 ? void 0 : _a.get(getTypeId(getRegularTypeOfLiteralType(keyType)));
56317             return result !== unknownType ? result : undefined;
56318         }
56319         function getMatchingUnionConstituentForType(unionType, type) {
56320             var keyPropertyName = getKeyPropertyName(unionType);
56321             var propType = keyPropertyName && getTypeOfPropertyOfType(type, keyPropertyName);
56322             return propType && getConstituentTypeForKeyType(unionType, propType);
56323         }
56324         function getMatchingUnionConstituentForObjectLiteral(unionType, node) {
56325             var keyPropertyName = getKeyPropertyName(unionType);
56326             var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 294 &&
56327                 p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); });
56328             var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer);
56329             return propType && getConstituentTypeForKeyType(unionType, propType);
56330         }
56331         function isOrContainsMatchingReference(source, target) {
56332             return isMatchingReference(source, target) || containsMatchingReference(source, target);
56333         }
56334         function hasMatchingArgument(expression, reference) {
56335             if (expression.arguments) {
56336                 for (var _i = 0, _a = expression.arguments; _i < _a.length; _i++) {
56337                     var argument = _a[_i];
56338                     if (isOrContainsMatchingReference(reference, argument)) {
56339                         return true;
56340                     }
56341                 }
56342             }
56343             if (expression.expression.kind === 205 &&
56344                 isOrContainsMatchingReference(reference, expression.expression.expression)) {
56345                 return true;
56346             }
56347             return false;
56348         }
56349         function getFlowNodeId(flow) {
56350             if (!flow.id || flow.id < 0) {
56351                 flow.id = nextFlowId;
56352                 nextFlowId++;
56353             }
56354             return flow.id;
56355         }
56356         function typeMaybeAssignableTo(source, target) {
56357             if (!(source.flags & 1048576)) {
56358                 return isTypeAssignableTo(source, target);
56359             }
56360             for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
56361                 var t = _a[_i];
56362                 if (isTypeAssignableTo(t, target)) {
56363                     return true;
56364                 }
56365             }
56366             return false;
56367         }
56368         function getAssignmentReducedType(declaredType, assignedType) {
56369             if (declaredType !== assignedType) {
56370                 if (assignedType.flags & 131072) {
56371                     return assignedType;
56372                 }
56373                 var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
56374                 if (assignedType.flags & 512 && isFreshLiteralType(assignedType)) {
56375                     reducedType = mapType(reducedType, getFreshTypeOfLiteralType);
56376                 }
56377                 if (isTypeAssignableTo(assignedType, reducedType)) {
56378                     return reducedType;
56379                 }
56380             }
56381             return declaredType;
56382         }
56383         function isFunctionObjectType(type) {
56384             var resolved = resolveStructuredTypeMembers(type);
56385             return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
56386                 resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
56387         }
56388         function getTypeFacts(type, ignoreObjects) {
56389             if (ignoreObjects === void 0) { ignoreObjects = false; }
56390             var flags = type.flags;
56391             if (flags & 4) {
56392                 return strictNullChecks ? 16317953 : 16776705;
56393             }
56394             if (flags & 128) {
56395                 var isEmpty = type.value === "";
56396                 return strictNullChecks ?
56397                     isEmpty ? 12123649 : 7929345 :
56398                     isEmpty ? 12582401 : 16776705;
56399             }
56400             if (flags & (8 | 32)) {
56401                 return strictNullChecks ? 16317698 : 16776450;
56402             }
56403             if (flags & 256) {
56404                 var isZero = type.value === 0;
56405                 return strictNullChecks ?
56406                     isZero ? 12123394 : 7929090 :
56407                     isZero ? 12582146 : 16776450;
56408             }
56409             if (flags & 64) {
56410                 return strictNullChecks ? 16317188 : 16775940;
56411             }
56412             if (flags & 2048) {
56413                 var isZero = isZeroBigInt(type);
56414                 return strictNullChecks ?
56415                     isZero ? 12122884 : 7928580 :
56416                     isZero ? 12581636 : 16775940;
56417             }
56418             if (flags & 16) {
56419                 return strictNullChecks ? 16316168 : 16774920;
56420             }
56421             if (flags & 528) {
56422                 return strictNullChecks ?
56423                     (type === falseType || type === regularFalseType) ? 12121864 : 7927560 :
56424                     (type === falseType || type === regularFalseType) ? 12580616 : 16774920;
56425             }
56426             if (flags & 524288 && !ignoreObjects) {
56427                 return ts.getObjectFlags(type) & 16 && isEmptyObjectType(type) ?
56428                     strictNullChecks ? 16318463 : 16777215 :
56429                     isFunctionObjectType(type) ?
56430                         strictNullChecks ? 7880640 : 16728000 :
56431                         strictNullChecks ? 7888800 : 16736160;
56432             }
56433             if (flags & (16384 | 32768)) {
56434                 return 9830144;
56435             }
56436             if (flags & 65536) {
56437                 return 9363232;
56438             }
56439             if (flags & 12288) {
56440                 return strictNullChecks ? 7925520 : 16772880;
56441             }
56442             if (flags & 67108864) {
56443                 return strictNullChecks ? 7888800 : 16736160;
56444             }
56445             if (flags & 131072) {
56446                 return 0;
56447             }
56448             if (flags & 465829888) {
56449                 return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
56450                     strictNullChecks ? 7929345 : 16776705;
56451             }
56452             if (flags & 1048576) {
56453                 return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t, ignoreObjects); }, 0);
56454             }
56455             if (flags & 2097152) {
56456                 ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068));
56457                 return ts.reduceLeft(type.types, function (facts, t) { return facts & getTypeFacts(t, ignoreObjects); }, 16777215);
56458             }
56459             return 16777215;
56460         }
56461         function getTypeWithFacts(type, include) {
56462             return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
56463         }
56464         function getTypeWithDefault(type, defaultExpression) {
56465             return defaultExpression ?
56466                 getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
56467                 type;
56468         }
56469         function getTypeOfDestructuredProperty(type, name) {
56470             var _a;
56471             var nameType = getLiteralTypeFromPropertyName(name);
56472             if (!isTypeUsableAsPropertyName(nameType))
56473                 return errorType;
56474             var text = getPropertyNameFromType(nameType);
56475             return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a = getApplicableIndexInfoForName(type, text)) === null || _a === void 0 ? void 0 : _a.type) || errorType;
56476         }
56477         function getTypeOfDestructuredArrayElement(type, index) {
56478             return everyType(type, isTupleLikeType) && getTupleElementType(type, index) ||
56479                 includeUndefinedInIndexSignature(checkIteratedTypeOrElementType(65, type, undefinedType, undefined)) ||
56480                 errorType;
56481         }
56482         function includeUndefinedInIndexSignature(type) {
56483             if (!type)
56484                 return type;
56485             return compilerOptions.noUncheckedIndexedAccess ?
56486                 getUnionType([type, undefinedType]) :
56487                 type;
56488         }
56489         function getTypeOfDestructuredSpreadExpression(type) {
56490             return createArrayType(checkIteratedTypeOrElementType(65, type, undefinedType, undefined) || errorType);
56491         }
56492         function getAssignedTypeOfBinaryExpression(node) {
56493             var isDestructuringDefaultAssignment = node.parent.kind === 203 && isDestructuringAssignmentTarget(node.parent) ||
56494                 node.parent.kind === 294 && isDestructuringAssignmentTarget(node.parent.parent);
56495             return isDestructuringDefaultAssignment ?
56496                 getTypeWithDefault(getAssignedType(node), node.right) :
56497                 getTypeOfExpression(node.right);
56498         }
56499         function isDestructuringAssignmentTarget(parent) {
56500             return parent.parent.kind === 220 && parent.parent.left === parent ||
56501                 parent.parent.kind === 243 && parent.parent.initializer === parent;
56502         }
56503         function getAssignedTypeOfArrayLiteralElement(node, element) {
56504             return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
56505         }
56506         function getAssignedTypeOfSpreadExpression(node) {
56507             return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent));
56508         }
56509         function getAssignedTypeOfPropertyAssignment(node) {
56510             return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name);
56511         }
56512         function getAssignedTypeOfShorthandPropertyAssignment(node) {
56513             return getTypeWithDefault(getAssignedTypeOfPropertyAssignment(node), node.objectAssignmentInitializer);
56514         }
56515         function getAssignedType(node) {
56516             var parent = node.parent;
56517             switch (parent.kind) {
56518                 case 242:
56519                     return stringType;
56520                 case 243:
56521                     return checkRightHandSideOfForOf(parent) || errorType;
56522                 case 220:
56523                     return getAssignedTypeOfBinaryExpression(parent);
56524                 case 214:
56525                     return undefinedType;
56526                 case 203:
56527                     return getAssignedTypeOfArrayLiteralElement(parent, node);
56528                 case 224:
56529                     return getAssignedTypeOfSpreadExpression(parent);
56530                 case 294:
56531                     return getAssignedTypeOfPropertyAssignment(parent);
56532                 case 295:
56533                     return getAssignedTypeOfShorthandPropertyAssignment(parent);
56534             }
56535             return errorType;
56536         }
56537         function getInitialTypeOfBindingElement(node) {
56538             var pattern = node.parent;
56539             var parentType = getInitialType(pattern.parent);
56540             var type = pattern.kind === 200 ?
56541                 getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
56542                 !node.dotDotDotToken ?
56543                     getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
56544                     getTypeOfDestructuredSpreadExpression(parentType);
56545             return getTypeWithDefault(type, node.initializer);
56546         }
56547         function getTypeOfInitializer(node) {
56548             var links = getNodeLinks(node);
56549             return links.resolvedType || getTypeOfExpression(node);
56550         }
56551         function getInitialTypeOfVariableDeclaration(node) {
56552             if (node.initializer) {
56553                 return getTypeOfInitializer(node.initializer);
56554             }
56555             if (node.parent.parent.kind === 242) {
56556                 return stringType;
56557             }
56558             if (node.parent.parent.kind === 243) {
56559                 return checkRightHandSideOfForOf(node.parent.parent) || errorType;
56560             }
56561             return errorType;
56562         }
56563         function getInitialType(node) {
56564             return node.kind === 253 ?
56565                 getInitialTypeOfVariableDeclaration(node) :
56566                 getInitialTypeOfBindingElement(node);
56567         }
56568         function isEmptyArrayAssignment(node) {
56569             return node.kind === 253 && node.initializer &&
56570                 isEmptyArrayLiteral(node.initializer) ||
56571                 node.kind !== 202 && node.parent.kind === 220 &&
56572                     isEmptyArrayLiteral(node.parent.right);
56573         }
56574         function getReferenceCandidate(node) {
56575             switch (node.kind) {
56576                 case 211:
56577                     return getReferenceCandidate(node.expression);
56578                 case 220:
56579                     switch (node.operatorToken.kind) {
56580                         case 63:
56581                         case 75:
56582                         case 76:
56583                         case 77:
56584                             return getReferenceCandidate(node.left);
56585                         case 27:
56586                             return getReferenceCandidate(node.right);
56587                     }
56588             }
56589             return node;
56590         }
56591         function getReferenceRoot(node) {
56592             var parent = node.parent;
56593             return parent.kind === 211 ||
56594                 parent.kind === 220 && parent.operatorToken.kind === 63 && parent.left === node ||
56595                 parent.kind === 220 && parent.operatorToken.kind === 27 && parent.right === node ?
56596                 getReferenceRoot(parent) : node;
56597         }
56598         function getTypeOfSwitchClause(clause) {
56599             if (clause.kind === 288) {
56600                 return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
56601             }
56602             return neverType;
56603         }
56604         function getSwitchClauseTypes(switchStatement) {
56605             var links = getNodeLinks(switchStatement);
56606             if (!links.switchTypes) {
56607                 links.switchTypes = [];
56608                 for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
56609                     var clause = _a[_i];
56610                     links.switchTypes.push(getTypeOfSwitchClause(clause));
56611                 }
56612             }
56613             return links.switchTypes;
56614         }
56615         function getSwitchClauseTypeOfWitnesses(switchStatement, retainDefault) {
56616             var witnesses = [];
56617             for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
56618                 var clause = _a[_i];
56619                 if (clause.kind === 288) {
56620                     if (ts.isStringLiteralLike(clause.expression)) {
56621                         witnesses.push(clause.expression.text);
56622                         continue;
56623                     }
56624                     return ts.emptyArray;
56625                 }
56626                 if (retainDefault)
56627                     witnesses.push(undefined);
56628             }
56629             return witnesses;
56630         }
56631         function eachTypeContainedIn(source, types) {
56632             return source.flags & 1048576 ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source);
56633         }
56634         function isTypeSubsetOf(source, target) {
56635             return source === target || target.flags & 1048576 && isTypeSubsetOfUnion(source, target);
56636         }
56637         function isTypeSubsetOfUnion(source, target) {
56638             if (source.flags & 1048576) {
56639                 for (var _i = 0, _a = source.types; _i < _a.length; _i++) {
56640                     var t = _a[_i];
56641                     if (!containsType(target.types, t)) {
56642                         return false;
56643                     }
56644                 }
56645                 return true;
56646             }
56647             if (source.flags & 1024 && getBaseTypeOfEnumLiteralType(source) === target) {
56648                 return true;
56649             }
56650             return containsType(target.types, source);
56651         }
56652         function forEachType(type, f) {
56653             return type.flags & 1048576 ? ts.forEach(type.types, f) : f(type);
56654         }
56655         function someType(type, f) {
56656             return type.flags & 1048576 ? ts.some(type.types, f) : f(type);
56657         }
56658         function everyType(type, f) {
56659             return type.flags & 1048576 ? ts.every(type.types, f) : f(type);
56660         }
56661         function everyContainedType(type, f) {
56662             return type.flags & 3145728 ? ts.every(type.types, f) : f(type);
56663         }
56664         function filterType(type, f) {
56665             if (type.flags & 1048576) {
56666                 var types = type.types;
56667                 var filtered = ts.filter(types, f);
56668                 if (filtered === types) {
56669                     return type;
56670                 }
56671                 var origin = type.origin;
56672                 var newOrigin = void 0;
56673                 if (origin && origin.flags & 1048576) {
56674                     var originTypes = origin.types;
56675                     var originFiltered = ts.filter(originTypes, function (t) { return !!(t.flags & 1048576) || f(t); });
56676                     if (originTypes.length - originFiltered.length === types.length - filtered.length) {
56677                         if (originFiltered.length === 1) {
56678                             return originFiltered[0];
56679                         }
56680                         newOrigin = createOriginUnionOrIntersectionType(1048576, originFiltered);
56681                     }
56682                 }
56683                 return getUnionTypeFromSortedList(filtered, type.objectFlags, undefined, undefined, newOrigin);
56684             }
56685             return type.flags & 131072 || f(type) ? type : neverType;
56686         }
56687         function removeType(type, targetType) {
56688             return filterType(type, function (t) { return t !== targetType; });
56689         }
56690         function countTypes(type) {
56691             return type.flags & 1048576 ? type.types.length : 1;
56692         }
56693         function mapType(type, mapper, noReductions) {
56694             if (type.flags & 131072) {
56695                 return type;
56696             }
56697             if (!(type.flags & 1048576)) {
56698                 return mapper(type);
56699             }
56700             var origin = type.origin;
56701             var types = origin && origin.flags & 1048576 ? origin.types : type.types;
56702             var mappedTypes;
56703             var changed = false;
56704             for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
56705                 var t = types_17[_i];
56706                 var mapped = t.flags & 1048576 ? mapType(t, mapper, noReductions) : mapper(t);
56707                 changed || (changed = t !== mapped);
56708                 if (mapped) {
56709                     if (!mappedTypes) {
56710                         mappedTypes = [mapped];
56711                     }
56712                     else {
56713                         mappedTypes.push(mapped);
56714                     }
56715                 }
56716             }
56717             return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 : 1) : type;
56718         }
56719         function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
56720             return type.flags & 1048576 && aliasSymbol ?
56721                 getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
56722                 mapType(type, mapper);
56723         }
56724         function getConstituentCount(type) {
56725             return type.flags & 1048576 ? type.types.length : 1;
56726         }
56727         function extractTypesOfKind(type, kind) {
56728             return filterType(type, function (t) { return (t.flags & kind) !== 0; });
56729         }
56730         function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {
56731             if (maybeTypeOfKind(typeWithPrimitives, 4 | 134217728 | 8 | 64) &&
56732                 maybeTypeOfKind(typeWithLiterals, 128 | 134217728 | 268435456 | 256 | 2048)) {
56733                 return mapType(typeWithPrimitives, function (t) {
56734                     return t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 128 | 134217728 | 268435456) :
56735                         isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 4 | 134217728 | 268435456) ? extractTypesOfKind(typeWithLiterals, 128) :
56736                             t.flags & 8 ? extractTypesOfKind(typeWithLiterals, 8 | 256) :
56737                                 t.flags & 64 ? extractTypesOfKind(typeWithLiterals, 64 | 2048) : t;
56738                 });
56739             }
56740             return typeWithPrimitives;
56741         }
56742         function isIncomplete(flowType) {
56743             return flowType.flags === 0;
56744         }
56745         function getTypeFromFlowType(flowType) {
56746             return flowType.flags === 0 ? flowType.type : flowType;
56747         }
56748         function createFlowType(type, incomplete) {
56749             return incomplete ? { flags: 0, type: type.flags & 131072 ? silentNeverType : type } : type;
56750         }
56751         function createEvolvingArrayType(elementType) {
56752             var result = createObjectType(256);
56753             result.elementType = elementType;
56754             return result;
56755         }
56756         function getEvolvingArrayType(elementType) {
56757             return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType));
56758         }
56759         function addEvolvingArrayElementType(evolvingArrayType, node) {
56760             var elementType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)));
56761             return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
56762         }
56763         function createFinalArrayType(elementType) {
56764             return elementType.flags & 131072 ?
56765                 autoArrayType :
56766                 createArrayType(elementType.flags & 1048576 ?
56767                     getUnionType(elementType.types, 2) :
56768                     elementType);
56769         }
56770         function getFinalArrayType(evolvingArrayType) {
56771             return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
56772         }
56773         function finalizeEvolvingArrayType(type) {
56774             return ts.getObjectFlags(type) & 256 ? getFinalArrayType(type) : type;
56775         }
56776         function getElementTypeOfEvolvingArrayType(type) {
56777             return ts.getObjectFlags(type) & 256 ? type.elementType : neverType;
56778         }
56779         function isEvolvingArrayTypeList(types) {
56780             var hasEvolvingArrayType = false;
56781             for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
56782                 var t = types_18[_i];
56783                 if (!(t.flags & 131072)) {
56784                     if (!(ts.getObjectFlags(t) & 256)) {
56785                         return false;
56786                     }
56787                     hasEvolvingArrayType = true;
56788                 }
56789             }
56790             return hasEvolvingArrayType;
56791         }
56792         function isEvolvingArrayOperationTarget(node) {
56793             var root = getReferenceRoot(node);
56794             var parent = root.parent;
56795             var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" ||
56796                 parent.parent.kind === 207
56797                     && ts.isIdentifier(parent.name)
56798                     && ts.isPushOrUnshiftIdentifier(parent.name));
56799             var isElementAssignment = parent.kind === 206 &&
56800                 parent.expression === root &&
56801                 parent.parent.kind === 220 &&
56802                 parent.parent.operatorToken.kind === 63 &&
56803                 parent.parent.left === parent &&
56804                 !ts.isAssignmentTarget(parent.parent) &&
56805                 isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296);
56806             return isLengthPushOrUnshift || isElementAssignment;
56807         }
56808         function isDeclarationWithExplicitTypeAnnotation(node) {
56809             return (ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isParameter(node)) &&
56810                 !!(ts.getEffectiveTypeAnnotationNode(node) ||
56811                     ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer));
56812         }
56813         function getExplicitTypeOfSymbol(symbol, diagnostic) {
56814             if (symbol.flags & (16 | 8192 | 32 | 512)) {
56815                 return getTypeOfSymbol(symbol);
56816             }
56817             if (symbol.flags & (3 | 4)) {
56818                 if (ts.getCheckFlags(symbol) & 262144) {
56819                     var origin = symbol.syntheticOrigin;
56820                     if (origin && getExplicitTypeOfSymbol(origin)) {
56821                         return getTypeOfSymbol(symbol);
56822                     }
56823                 }
56824                 var declaration = symbol.valueDeclaration;
56825                 if (declaration) {
56826                     if (isDeclarationWithExplicitTypeAnnotation(declaration)) {
56827                         return getTypeOfSymbol(symbol);
56828                     }
56829                     if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) {
56830                         var statement = declaration.parent.parent;
56831                         var expressionType = getTypeOfDottedName(statement.expression, undefined);
56832                         if (expressionType) {
56833                             var use = statement.awaitModifier ? 15 : 13;
56834                             return checkIteratedTypeOrElementType(use, expressionType, undefinedType, undefined);
56835                         }
56836                     }
56837                     if (diagnostic) {
56838                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_needs_an_explicit_type_annotation, symbolToString(symbol)));
56839                     }
56840                 }
56841             }
56842         }
56843         function getTypeOfDottedName(node, diagnostic) {
56844             if (!(node.flags & 16777216)) {
56845                 switch (node.kind) {
56846                     case 79:
56847                         var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node));
56848                         return getExplicitTypeOfSymbol(symbol.flags & 2097152 ? resolveAlias(symbol) : symbol, diagnostic);
56849                     case 108:
56850                         return getExplicitThisType(node);
56851                     case 106:
56852                         return checkSuperExpression(node);
56853                     case 205: {
56854                         var type = getTypeOfDottedName(node.expression, diagnostic);
56855                         if (type) {
56856                             var name = node.name;
56857                             var prop = void 0;
56858                             if (ts.isPrivateIdentifier(name)) {
56859                                 if (!type.symbol) {
56860                                     return undefined;
56861                                 }
56862                                 prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
56863                             }
56864                             else {
56865                                 prop = getPropertyOfType(type, name.escapedText);
56866                             }
56867                             return prop && getExplicitTypeOfSymbol(prop, diagnostic);
56868                         }
56869                         return undefined;
56870                     }
56871                     case 211:
56872                         return getTypeOfDottedName(node.expression, diagnostic);
56873                 }
56874             }
56875         }
56876         function getEffectsSignature(node) {
56877             var links = getNodeLinks(node);
56878             var signature = links.effectsSignature;
56879             if (signature === undefined) {
56880                 var funcType = void 0;
56881                 if (node.parent.kind === 237) {
56882                     funcType = getTypeOfDottedName(node.expression, undefined);
56883                 }
56884                 else if (node.expression.kind !== 106) {
56885                     if (ts.isOptionalChain(node)) {
56886                         funcType = checkNonNullType(getOptionalExpressionType(checkExpression(node.expression), node.expression), node.expression);
56887                     }
56888                     else {
56889                         funcType = checkNonNullExpression(node.expression);
56890                     }
56891                 }
56892                 var signatures = getSignaturesOfType(funcType && getApparentType(funcType) || unknownType, 0);
56893                 var candidate = signatures.length === 1 && !signatures[0].typeParameters ? signatures[0] :
56894                     ts.some(signatures, hasTypePredicateOrNeverReturnType) ? getResolvedSignature(node) :
56895                         undefined;
56896                 signature = links.effectsSignature = candidate && hasTypePredicateOrNeverReturnType(candidate) ? candidate : unknownSignature;
56897             }
56898             return signature === unknownSignature ? undefined : signature;
56899         }
56900         function hasTypePredicateOrNeverReturnType(signature) {
56901             return !!(getTypePredicateOfSignature(signature) ||
56902                 signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 131072);
56903         }
56904         function getTypePredicateArgument(predicate, callExpression) {
56905             if (predicate.kind === 1 || predicate.kind === 3) {
56906                 return callExpression.arguments[predicate.parameterIndex];
56907             }
56908             var invokedExpression = ts.skipParentheses(callExpression.expression);
56909             return ts.isAccessExpression(invokedExpression) ? ts.skipParentheses(invokedExpression.expression) : undefined;
56910         }
56911         function reportFlowControlError(node) {
56912             var block = ts.findAncestor(node, ts.isFunctionOrModuleBlock);
56913             var sourceFile = ts.getSourceFileOfNode(node);
56914             var span = ts.getSpanOfTokenAtPosition(sourceFile, block.statements.pos);
56915             diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis));
56916         }
56917         function isReachableFlowNode(flow) {
56918             var result = isReachableFlowNodeWorker(flow, false);
56919             lastFlowNode = flow;
56920             lastFlowNodeReachable = result;
56921             return result;
56922         }
56923         function isFalseExpression(expr) {
56924             var node = ts.skipParentheses(expr, true);
56925             return node.kind === 95 || node.kind === 220 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) ||
56926                 node.operatorToken.kind === 56 && isFalseExpression(node.left) && isFalseExpression(node.right));
56927         }
56928         function isReachableFlowNodeWorker(flow, noCacheCheck) {
56929             while (true) {
56930                 if (flow === lastFlowNode) {
56931                     return lastFlowNodeReachable;
56932                 }
56933                 var flags = flow.flags;
56934                 if (flags & 4096) {
56935                     if (!noCacheCheck) {
56936                         var id = getFlowNodeId(flow);
56937                         var reachable = flowNodeReachable[id];
56938                         return reachable !== undefined ? reachable : (flowNodeReachable[id] = isReachableFlowNodeWorker(flow, true));
56939                     }
56940                     noCacheCheck = false;
56941                 }
56942                 if (flags & (16 | 96 | 256)) {
56943                     flow = flow.antecedent;
56944                 }
56945                 else if (flags & 512) {
56946                     var signature = getEffectsSignature(flow.node);
56947                     if (signature) {
56948                         var predicate = getTypePredicateOfSignature(signature);
56949                         if (predicate && predicate.kind === 3 && !predicate.type) {
56950                             var predicateArgument = flow.node.arguments[predicate.parameterIndex];
56951                             if (predicateArgument && isFalseExpression(predicateArgument)) {
56952                                 return false;
56953                             }
56954                         }
56955                         if (getReturnTypeOfSignature(signature).flags & 131072) {
56956                             return false;
56957                         }
56958                     }
56959                     flow = flow.antecedent;
56960                 }
56961                 else if (flags & 4) {
56962                     return ts.some(flow.antecedents, function (f) { return isReachableFlowNodeWorker(f, false); });
56963                 }
56964                 else if (flags & 8) {
56965                     var antecedents = flow.antecedents;
56966                     if (antecedents === undefined || antecedents.length === 0) {
56967                         return false;
56968                     }
56969                     flow = antecedents[0];
56970                 }
56971                 else if (flags & 128) {
56972                     if (flow.clauseStart === flow.clauseEnd && isExhaustiveSwitchStatement(flow.switchStatement)) {
56973                         return false;
56974                     }
56975                     flow = flow.antecedent;
56976                 }
56977                 else if (flags & 1024) {
56978                     lastFlowNode = undefined;
56979                     var target = flow.target;
56980                     var saveAntecedents = target.antecedents;
56981                     target.antecedents = flow.antecedents;
56982                     var result = isReachableFlowNodeWorker(flow.antecedent, false);
56983                     target.antecedents = saveAntecedents;
56984                     return result;
56985                 }
56986                 else {
56987                     return !(flags & 1);
56988                 }
56989             }
56990         }
56991         function isPostSuperFlowNode(flow, noCacheCheck) {
56992             while (true) {
56993                 var flags = flow.flags;
56994                 if (flags & 4096) {
56995                     if (!noCacheCheck) {
56996                         var id = getFlowNodeId(flow);
56997                         var postSuper = flowNodePostSuper[id];
56998                         return postSuper !== undefined ? postSuper : (flowNodePostSuper[id] = isPostSuperFlowNode(flow, true));
56999                     }
57000                     noCacheCheck = false;
57001                 }
57002                 if (flags & (16 | 96 | 256 | 128)) {
57003                     flow = flow.antecedent;
57004                 }
57005                 else if (flags & 512) {
57006                     if (flow.node.expression.kind === 106) {
57007                         return true;
57008                     }
57009                     flow = flow.antecedent;
57010                 }
57011                 else if (flags & 4) {
57012                     return ts.every(flow.antecedents, function (f) { return isPostSuperFlowNode(f, false); });
57013                 }
57014                 else if (flags & 8) {
57015                     flow = flow.antecedents[0];
57016                 }
57017                 else if (flags & 1024) {
57018                     var target = flow.target;
57019                     var saveAntecedents = target.antecedents;
57020                     target.antecedents = flow.antecedents;
57021                     var result = isPostSuperFlowNode(flow.antecedent, false);
57022                     target.antecedents = saveAntecedents;
57023                     return result;
57024                 }
57025                 else {
57026                     return !!(flags & 1);
57027                 }
57028             }
57029         }
57030         function isConstantReference(node) {
57031             switch (node.kind) {
57032                 case 79: {
57033                     var symbol = getResolvedSymbol(node);
57034                     return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
57035                 }
57036                 case 205:
57037                 case 206:
57038                     return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
57039             }
57040             return false;
57041         }
57042         function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) {
57043             if (initialType === void 0) { initialType = declaredType; }
57044             var key;
57045             var isKeySet = false;
57046             var flowDepth = 0;
57047             if (flowAnalysisDisabled) {
57048                 return errorType;
57049             }
57050             if (!reference.flowNode) {
57051                 return declaredType;
57052             }
57053             flowInvocationCount++;
57054             var sharedFlowStart = sharedFlowCount;
57055             var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
57056             sharedFlowCount = sharedFlowStart;
57057             var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
57058             if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 229 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) {
57059                 return declaredType;
57060             }
57061             return resultType === nonNullUnknownType ? unknownType : resultType;
57062             function getOrSetCacheKey() {
57063                 if (isKeySet) {
57064                     return key;
57065                 }
57066                 isKeySet = true;
57067                 return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
57068             }
57069             function getTypeAtFlowNode(flow) {
57070                 if (flowDepth === 2000) {
57071                     ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
57072                     flowAnalysisDisabled = true;
57073                     reportFlowControlError(reference);
57074                     return errorType;
57075                 }
57076                 flowDepth++;
57077                 var sharedFlow;
57078                 while (true) {
57079                     var flags = flow.flags;
57080                     if (flags & 4096) {
57081                         for (var i = sharedFlowStart; i < sharedFlowCount; i++) {
57082                             if (sharedFlowNodes[i] === flow) {
57083                                 flowDepth--;
57084                                 return sharedFlowTypes[i];
57085                             }
57086                         }
57087                         sharedFlow = flow;
57088                     }
57089                     var type = void 0;
57090                     if (flags & 16) {
57091                         type = getTypeAtFlowAssignment(flow);
57092                         if (!type) {
57093                             flow = flow.antecedent;
57094                             continue;
57095                         }
57096                     }
57097                     else if (flags & 512) {
57098                         type = getTypeAtFlowCall(flow);
57099                         if (!type) {
57100                             flow = flow.antecedent;
57101                             continue;
57102                         }
57103                     }
57104                     else if (flags & 96) {
57105                         type = getTypeAtFlowCondition(flow);
57106                     }
57107                     else if (flags & 128) {
57108                         type = getTypeAtSwitchClause(flow);
57109                     }
57110                     else if (flags & 12) {
57111                         if (flow.antecedents.length === 1) {
57112                             flow = flow.antecedents[0];
57113                             continue;
57114                         }
57115                         type = flags & 4 ?
57116                             getTypeAtFlowBranchLabel(flow) :
57117                             getTypeAtFlowLoopLabel(flow);
57118                     }
57119                     else if (flags & 256) {
57120                         type = getTypeAtFlowArrayMutation(flow);
57121                         if (!type) {
57122                             flow = flow.antecedent;
57123                             continue;
57124                         }
57125                     }
57126                     else if (flags & 1024) {
57127                         var target = flow.target;
57128                         var saveAntecedents = target.antecedents;
57129                         target.antecedents = flow.antecedents;
57130                         type = getTypeAtFlowNode(flow.antecedent);
57131                         target.antecedents = saveAntecedents;
57132                     }
57133                     else if (flags & 2) {
57134                         var container = flow.node;
57135                         if (container && container !== flowContainer &&
57136                             reference.kind !== 205 &&
57137                             reference.kind !== 206 &&
57138                             reference.kind !== 108) {
57139                             flow = container.flowNode;
57140                             continue;
57141                         }
57142                         type = initialType;
57143                     }
57144                     else {
57145                         type = convertAutoToAny(declaredType);
57146                     }
57147                     if (sharedFlow) {
57148                         sharedFlowNodes[sharedFlowCount] = sharedFlow;
57149                         sharedFlowTypes[sharedFlowCount] = type;
57150                         sharedFlowCount++;
57151                     }
57152                     flowDepth--;
57153                     return type;
57154                 }
57155             }
57156             function getInitialOrAssignedType(flow) {
57157                 var node = flow.node;
57158                 return getNarrowableTypeForReference(node.kind === 253 || node.kind === 202 ?
57159                     getInitialType(node) :
57160                     getAssignedType(node), reference);
57161             }
57162             function getTypeAtFlowAssignment(flow) {
57163                 var node = flow.node;
57164                 if (isMatchingReference(reference, node)) {
57165                     if (!isReachableFlowNode(flow)) {
57166                         return unreachableNeverType;
57167                     }
57168                     if (ts.getAssignmentTargetKind(node) === 2) {
57169                         var flowType = getTypeAtFlowNode(flow.antecedent);
57170                         return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));
57171                     }
57172                     if (declaredType === autoType || declaredType === autoArrayType) {
57173                         if (isEmptyArrayAssignment(node)) {
57174                             return getEvolvingArrayType(neverType);
57175                         }
57176                         var assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
57177                         return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
57178                     }
57179                     if (declaredType.flags & 1048576) {
57180                         return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow));
57181                     }
57182                     return declaredType;
57183                 }
57184                 if (containsMatchingReference(reference, node)) {
57185                     if (!isReachableFlowNode(flow)) {
57186                         return unreachableNeverType;
57187                     }
57188                     if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
57189                         var init = ts.getDeclaredExpandoInitializer(node);
57190                         if (init && (init.kind === 212 || init.kind === 213)) {
57191                             return getTypeAtFlowNode(flow.antecedent);
57192                         }
57193                     }
57194                     return declaredType;
57195                 }
57196                 if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 242 && isMatchingReference(reference, node.parent.parent.expression)) {
57197                     return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
57198                 }
57199                 return undefined;
57200             }
57201             function narrowTypeByAssertion(type, expr) {
57202                 var node = ts.skipParentheses(expr, true);
57203                 if (node.kind === 95) {
57204                     return unreachableNeverType;
57205                 }
57206                 if (node.kind === 220) {
57207                     if (node.operatorToken.kind === 55) {
57208                         return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right);
57209                     }
57210                     if (node.operatorToken.kind === 56) {
57211                         return getUnionType([narrowTypeByAssertion(type, node.left), narrowTypeByAssertion(type, node.right)]);
57212                     }
57213                 }
57214                 return narrowType(type, node, true);
57215             }
57216             function getTypeAtFlowCall(flow) {
57217                 var signature = getEffectsSignature(flow.node);
57218                 if (signature) {
57219                     var predicate = getTypePredicateOfSignature(signature);
57220                     if (predicate && (predicate.kind === 2 || predicate.kind === 3)) {
57221                         var flowType = getTypeAtFlowNode(flow.antecedent);
57222                         var type = finalizeEvolvingArrayType(getTypeFromFlowType(flowType));
57223                         var narrowedType = predicate.type ? narrowTypeByTypePredicate(type, predicate, flow.node, true) :
57224                             predicate.kind === 3 && predicate.parameterIndex >= 0 && predicate.parameterIndex < flow.node.arguments.length ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) :
57225                                 type;
57226                         return narrowedType === type ? flowType : createFlowType(narrowedType, isIncomplete(flowType));
57227                     }
57228                     if (getReturnTypeOfSignature(signature).flags & 131072) {
57229                         return unreachableNeverType;
57230                     }
57231                 }
57232                 return undefined;
57233             }
57234             function getTypeAtFlowArrayMutation(flow) {
57235                 if (declaredType === autoType || declaredType === autoArrayType) {
57236                     var node = flow.node;
57237                     var expr = node.kind === 207 ?
57238                         node.expression.expression :
57239                         node.left.expression;
57240                     if (isMatchingReference(reference, getReferenceCandidate(expr))) {
57241                         var flowType = getTypeAtFlowNode(flow.antecedent);
57242                         var type = getTypeFromFlowType(flowType);
57243                         if (ts.getObjectFlags(type) & 256) {
57244                             var evolvedType_1 = type;
57245                             if (node.kind === 207) {
57246                                 for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
57247                                     var arg = _a[_i];
57248                                     evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
57249                                 }
57250                             }
57251                             else {
57252                                 var indexType = getContextFreeTypeOfExpression(node.left.argumentExpression);
57253                                 if (isTypeAssignableToKind(indexType, 296)) {
57254                                     evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right);
57255                                 }
57256                             }
57257                             return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType));
57258                         }
57259                         return flowType;
57260                     }
57261                 }
57262                 return undefined;
57263             }
57264             function getTypeAtFlowCondition(flow) {
57265                 var flowType = getTypeAtFlowNode(flow.antecedent);
57266                 var type = getTypeFromFlowType(flowType);
57267                 if (type.flags & 131072) {
57268                     return flowType;
57269                 }
57270                 var assumeTrue = (flow.flags & 32) !== 0;
57271                 var nonEvolvingType = finalizeEvolvingArrayType(type);
57272                 var narrowedType = narrowType(nonEvolvingType, flow.node, assumeTrue);
57273                 if (narrowedType === nonEvolvingType) {
57274                     return flowType;
57275                 }
57276                 return createFlowType(narrowedType, isIncomplete(flowType));
57277             }
57278             function getTypeAtSwitchClause(flow) {
57279                 var expr = flow.switchStatement.expression;
57280                 var flowType = getTypeAtFlowNode(flow.antecedent);
57281                 var type = getTypeFromFlowType(flowType);
57282                 if (isMatchingReference(reference, expr)) {
57283                     type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
57284                 }
57285                 else if (expr.kind === 215 && isMatchingReference(reference, expr.expression)) {
57286                     type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
57287                 }
57288                 else {
57289                     if (strictNullChecks) {
57290                         if (optionalChainContainsReference(expr, reference)) {
57291                             type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 | 131072)); });
57292                         }
57293                         else if (expr.kind === 215 && optionalChainContainsReference(expr.expression, reference)) {
57294                             type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 || t.flags & 128 && t.value === "undefined"); });
57295                         }
57296                     }
57297                     var access = getDiscriminantPropertyAccess(expr, type);
57298                     if (access) {
57299                         type = narrowTypeBySwitchOnDiscriminantProperty(type, access, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
57300                     }
57301                 }
57302                 return createFlowType(type, isIncomplete(flowType));
57303             }
57304             function getTypeAtFlowBranchLabel(flow) {
57305                 var antecedentTypes = [];
57306                 var subtypeReduction = false;
57307                 var seenIncomplete = false;
57308                 var bypassFlow;
57309                 for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {
57310                     var antecedent = _a[_i];
57311                     if (!bypassFlow && antecedent.flags & 128 && antecedent.clauseStart === antecedent.clauseEnd) {
57312                         bypassFlow = antecedent;
57313                         continue;
57314                     }
57315                     var flowType = getTypeAtFlowNode(antecedent);
57316                     var type = getTypeFromFlowType(flowType);
57317                     if (type === declaredType && declaredType === initialType) {
57318                         return type;
57319                     }
57320                     ts.pushIfUnique(antecedentTypes, type);
57321                     if (!isTypeSubsetOf(type, declaredType)) {
57322                         subtypeReduction = true;
57323                     }
57324                     if (isIncomplete(flowType)) {
57325                         seenIncomplete = true;
57326                     }
57327                 }
57328                 if (bypassFlow) {
57329                     var flowType = getTypeAtFlowNode(bypassFlow);
57330                     var type = getTypeFromFlowType(flowType);
57331                     if (!ts.contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) {
57332                         if (type === declaredType && declaredType === initialType) {
57333                             return type;
57334                         }
57335                         antecedentTypes.push(type);
57336                         if (!isTypeSubsetOf(type, declaredType)) {
57337                             subtypeReduction = true;
57338                         }
57339                         if (isIncomplete(flowType)) {
57340                             seenIncomplete = true;
57341                         }
57342                     }
57343                 }
57344                 return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? 2 : 1), seenIncomplete);
57345             }
57346             function getTypeAtFlowLoopLabel(flow) {
57347                 var id = getFlowNodeId(flow);
57348                 var cache = flowLoopCaches[id] || (flowLoopCaches[id] = new ts.Map());
57349                 var key = getOrSetCacheKey();
57350                 if (!key) {
57351                     return declaredType;
57352                 }
57353                 var cached = cache.get(key);
57354                 if (cached) {
57355                     return cached;
57356                 }
57357                 for (var i = flowLoopStart; i < flowLoopCount; i++) {
57358                     if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) {
57359                         return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], 1), true);
57360                     }
57361                 }
57362                 var antecedentTypes = [];
57363                 var subtypeReduction = false;
57364                 var firstAntecedentType;
57365                 for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) {
57366                     var antecedent = _a[_i];
57367                     var flowType = void 0;
57368                     if (!firstAntecedentType) {
57369                         flowType = firstAntecedentType = getTypeAtFlowNode(antecedent);
57370                     }
57371                     else {
57372                         flowLoopNodes[flowLoopCount] = flow;
57373                         flowLoopKeys[flowLoopCount] = key;
57374                         flowLoopTypes[flowLoopCount] = antecedentTypes;
57375                         flowLoopCount++;
57376                         var saveFlowTypeCache = flowTypeCache;
57377                         flowTypeCache = undefined;
57378                         flowType = getTypeAtFlowNode(antecedent);
57379                         flowTypeCache = saveFlowTypeCache;
57380                         flowLoopCount--;
57381                         var cached_1 = cache.get(key);
57382                         if (cached_1) {
57383                             return cached_1;
57384                         }
57385                     }
57386                     var type = getTypeFromFlowType(flowType);
57387                     ts.pushIfUnique(antecedentTypes, type);
57388                     if (!isTypeSubsetOf(type, declaredType)) {
57389                         subtypeReduction = true;
57390                     }
57391                     if (type === declaredType) {
57392                         break;
57393                     }
57394                 }
57395                 var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? 2 : 1);
57396                 if (isIncomplete(firstAntecedentType)) {
57397                     return createFlowType(result, true);
57398                 }
57399                 cache.set(key, result);
57400                 return result;
57401             }
57402             function getUnionOrEvolvingArrayType(types, subtypeReduction) {
57403                 if (isEvolvingArrayTypeList(types)) {
57404                     return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
57405                 }
57406                 var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
57407                 if (result !== declaredType && result.flags & declaredType.flags & 1048576 && ts.arraysEqual(result.types, declaredType.types)) {
57408                     return declaredType;
57409                 }
57410                 return result;
57411             }
57412             function getDiscriminantPropertyAccess(expr, computedType) {
57413                 var access, name;
57414                 var type = declaredType.flags & 1048576 ? declaredType : computedType;
57415                 return type.flags & 1048576 && (access = getPropertyAccess(expr)) && (name = getAccessedPropertyName(access)) &&
57416                     isMatchingReference(reference, ts.isAccessExpression(access) ? access.expression : access.parent.parent.initializer) &&
57417                     isDiscriminantProperty(type, name) ?
57418                     access : undefined;
57419             }
57420             function narrowTypeByDiscriminant(type, access, narrowType) {
57421                 var propName = getAccessedPropertyName(access);
57422                 if (propName === undefined) {
57423                     return type;
57424                 }
57425                 var removeNullable = strictNullChecks && ts.isOptionalChain(access) && maybeTypeOfKind(type, 98304);
57426                 var propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152) : type, propName);
57427                 if (!propType) {
57428                     return type;
57429                 }
57430                 propType = removeNullable ? getOptionalType(propType) : propType;
57431                 var narrowedPropType = narrowType(propType);
57432                 return filterType(type, function (t) {
57433                     var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
57434                     return !(narrowedPropType.flags & 131072) && isTypeComparableTo(narrowedPropType, discriminantType);
57435                 });
57436             }
57437             function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
57438                 if ((operator === 36 || operator === 37) && type.flags & 1048576) {
57439                     var keyPropertyName = getKeyPropertyName(type);
57440                     if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) {
57441                         var candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value));
57442                         if (candidate) {
57443                             return operator === (assumeTrue ? 36 : 37) ? candidate :
57444                                 isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) :
57445                                     type;
57446                         }
57447                     }
57448                 }
57449                 return narrowTypeByDiscriminant(type, access, function (t) { return narrowTypeByEquality(t, operator, value, assumeTrue); });
57450             }
57451             function narrowTypeBySwitchOnDiscriminantProperty(type, access, switchStatement, clauseStart, clauseEnd) {
57452                 if (clauseStart < clauseEnd && type.flags & 1048576 && getKeyPropertyName(type) === getAccessedPropertyName(access)) {
57453                     var clauseTypes = getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd);
57454                     var candidate = getUnionType(ts.map(clauseTypes, function (t) { return getConstituentTypeForKeyType(type, t) || unknownType; }));
57455                     if (candidate !== unknownType) {
57456                         return candidate;
57457                     }
57458                 }
57459                 return narrowTypeByDiscriminant(type, access, function (t) { return narrowTypeBySwitchOnDiscriminant(t, switchStatement, clauseStart, clauseEnd); });
57460             }
57461             function narrowTypeByTruthiness(type, expr, assumeTrue) {
57462                 if (isMatchingReference(reference, expr)) {
57463                     return type.flags & 2 && assumeTrue ? nonNullUnknownType :
57464                         getTypeWithFacts(type, assumeTrue ? 4194304 : 8388608);
57465                 }
57466                 if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
57467                     type = getTypeWithFacts(type, 2097152);
57468                 }
57469                 var access = getDiscriminantPropertyAccess(expr, type);
57470                 if (access) {
57471                     return narrowTypeByDiscriminant(type, access, function (t) { return getTypeWithFacts(t, assumeTrue ? 4194304 : 8388608); });
57472                 }
57473                 return type;
57474             }
57475             function isTypePresencePossible(type, propName, assumeTrue) {
57476                 var prop = getPropertyOfType(type, propName);
57477                 if (prop) {
57478                     return prop.flags & 16777216 ? true : assumeTrue;
57479                 }
57480                 return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
57481             }
57482             function narrowByInKeyword(type, name, assumeTrue) {
57483                 if (type.flags & 1048576
57484                     || type.flags & 524288 && declaredType !== type
57485                     || isThisTypeParameter(type)
57486                     || type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
57487                     return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
57488                 }
57489                 return type;
57490             }
57491             function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
57492                 switch (expr.operatorToken.kind) {
57493                     case 63:
57494                     case 75:
57495                     case 76:
57496                     case 77:
57497                         return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
57498                     case 34:
57499                     case 35:
57500                     case 36:
57501                     case 37:
57502                         var operator = expr.operatorToken.kind;
57503                         var left = getReferenceCandidate(expr.left);
57504                         var right = getReferenceCandidate(expr.right);
57505                         if (left.kind === 215 && ts.isStringLiteralLike(right)) {
57506                             return narrowTypeByTypeof(type, left, operator, right, assumeTrue);
57507                         }
57508                         if (right.kind === 215 && ts.isStringLiteralLike(left)) {
57509                             return narrowTypeByTypeof(type, right, operator, left, assumeTrue);
57510                         }
57511                         if (isMatchingReference(reference, left)) {
57512                             return narrowTypeByEquality(type, operator, right, assumeTrue);
57513                         }
57514                         if (isMatchingReference(reference, right)) {
57515                             return narrowTypeByEquality(type, operator, left, assumeTrue);
57516                         }
57517                         if (strictNullChecks) {
57518                             if (optionalChainContainsReference(left, reference)) {
57519                                 type = narrowTypeByOptionalChainContainment(type, operator, right, assumeTrue);
57520                             }
57521                             else if (optionalChainContainsReference(right, reference)) {
57522                                 type = narrowTypeByOptionalChainContainment(type, operator, left, assumeTrue);
57523                             }
57524                         }
57525                         var leftAccess = getDiscriminantPropertyAccess(left, type);
57526                         if (leftAccess) {
57527                             return narrowTypeByDiscriminantProperty(type, leftAccess, operator, right, assumeTrue);
57528                         }
57529                         var rightAccess = getDiscriminantPropertyAccess(right, type);
57530                         if (rightAccess) {
57531                             return narrowTypeByDiscriminantProperty(type, rightAccess, operator, left, assumeTrue);
57532                         }
57533                         if (isMatchingConstructorReference(left)) {
57534                             return narrowTypeByConstructor(type, operator, right, assumeTrue);
57535                         }
57536                         if (isMatchingConstructorReference(right)) {
57537                             return narrowTypeByConstructor(type, operator, left, assumeTrue);
57538                         }
57539                         break;
57540                     case 102:
57541                         return narrowTypeByInstanceof(type, expr, assumeTrue);
57542                     case 101:
57543                         if (ts.isPrivateIdentifier(expr.left)) {
57544                             return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
57545                         }
57546                         var target = getReferenceCandidate(expr.right);
57547                         var leftType = getTypeOfNode(expr.left);
57548                         if (leftType.flags & 128) {
57549                             var name = ts.escapeLeadingUnderscores(leftType.value);
57550                             if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
57551                                 getAccessedPropertyName(reference) === name) {
57552                                 return getTypeWithFacts(type, assumeTrue ? 524288 : 65536);
57553                             }
57554                             if (isMatchingReference(reference, target)) {
57555                                 return narrowByInKeyword(type, name, assumeTrue);
57556                             }
57557                         }
57558                         break;
57559                     case 27:
57560                         return narrowType(type, expr.right, assumeTrue);
57561                     case 55:
57562                         return assumeTrue ?
57563                             narrowType(narrowType(type, expr.left, true), expr.right, true) :
57564                             getUnionType([narrowType(type, expr.left, false), narrowType(type, expr.right, false)]);
57565                     case 56:
57566                         return assumeTrue ?
57567                             getUnionType([narrowType(type, expr.left, true), narrowType(type, expr.right, true)]) :
57568                             narrowType(narrowType(type, expr.left, false), expr.right, false);
57569                 }
57570                 return type;
57571             }
57572             function narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue) {
57573                 var target = getReferenceCandidate(expr.right);
57574                 if (!isMatchingReference(reference, target)) {
57575                     return type;
57576                 }
57577                 ts.Debug.assertNode(expr.left, ts.isPrivateIdentifier);
57578                 var symbol = getSymbolForPrivateIdentifierExpression(expr.left);
57579                 if (symbol === undefined) {
57580                     return type;
57581                 }
57582                 var classSymbol = symbol.parent;
57583                 var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
57584                     ? getTypeOfSymbol(classSymbol)
57585                     : getDeclaredTypeOfSymbol(classSymbol);
57586                 return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
57587             }
57588             function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
57589                 var equalsOperator = operator === 34 || operator === 36;
57590                 var nullableFlags = operator === 34 || operator === 35 ? 98304 : 32768;
57591                 var valueType = getTypeOfExpression(value);
57592                 var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
57593                     equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 | nullableFlags)); });
57594                 return removeNullable ? getTypeWithFacts(type, 2097152) : type;
57595             }
57596             function narrowTypeByEquality(type, operator, value, assumeTrue) {
57597                 if (type.flags & 1) {
57598                     return type;
57599                 }
57600                 if (operator === 35 || operator === 37) {
57601                     assumeTrue = !assumeTrue;
57602                 }
57603                 var valueType = getTypeOfExpression(value);
57604                 if (assumeTrue && (type.flags & 2) && (operator === 34 || operator === 35) && (valueType.flags & 65536)) {
57605                     return getUnionType([nullType, undefinedType]);
57606                 }
57607                 if ((type.flags & 2) && assumeTrue && (operator === 36 || operator === 37)) {
57608                     if (valueType.flags & (131068 | 67108864)) {
57609                         return valueType;
57610                     }
57611                     if (valueType.flags & 524288) {
57612                         return nonPrimitiveType;
57613                     }
57614                     return type;
57615                 }
57616                 if (valueType.flags & 98304) {
57617                     if (!strictNullChecks) {
57618                         return type;
57619                     }
57620                     var doubleEquals = operator === 34 || operator === 35;
57621                     var facts = doubleEquals ?
57622                         assumeTrue ? 262144 : 2097152 :
57623                         valueType.flags & 65536 ?
57624                             assumeTrue ? 131072 : 1048576 :
57625                             assumeTrue ? 65536 : 524288;
57626                     return type.flags & 2 && facts & (1048576 | 2097152) ? nonNullUnknownType : getTypeWithFacts(type, facts);
57627                 }
57628                 if (assumeTrue) {
57629                     var filterFn = operator === 34 ?
57630                         function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } :
57631                         function (t) { return areTypesComparable(t, valueType); };
57632                     return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType);
57633                 }
57634                 if (isUnitType(valueType)) {
57635                     return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); });
57636                 }
57637                 return type;
57638             }
57639             function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) {
57640                 if (operator === 35 || operator === 37) {
57641                     assumeTrue = !assumeTrue;
57642                 }
57643                 var target = getReferenceCandidate(typeOfExpr.expression);
57644                 if (!isMatchingReference(reference, target)) {
57645                     if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
57646                         return getTypeWithFacts(type, 2097152);
57647                     }
57648                     return type;
57649                 }
57650                 if (type.flags & 1 && literal.text === "function") {
57651                     return type;
57652                 }
57653                 if (assumeTrue && type.flags & 2 && literal.text === "object") {
57654                     return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
57655                 }
57656                 var facts = assumeTrue ?
57657                     typeofEQFacts.get(literal.text) || 128 :
57658                     typeofNEFacts.get(literal.text) || 32768;
57659                 var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
57660                 return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
57661             }
57662             function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
57663                 var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
57664                 return everyClauseChecks ? getTypeWithFacts(type, 2097152) : type;
57665             }
57666             function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) {
57667                 var switchTypes = getSwitchClauseTypes(switchStatement);
57668                 if (!switchTypes.length) {
57669                     return type;
57670                 }
57671                 var clauseTypes = switchTypes.slice(clauseStart, clauseEnd);
57672                 var hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType);
57673                 if ((type.flags & 2) && !hasDefaultClause) {
57674                     var groundClauseTypes = void 0;
57675                     for (var i = 0; i < clauseTypes.length; i += 1) {
57676                         var t = clauseTypes[i];
57677                         if (t.flags & (131068 | 67108864)) {
57678                             if (groundClauseTypes !== undefined) {
57679                                 groundClauseTypes.push(t);
57680                             }
57681                         }
57682                         else if (t.flags & 524288) {
57683                             if (groundClauseTypes === undefined) {
57684                                 groundClauseTypes = clauseTypes.slice(0, i);
57685                             }
57686                             groundClauseTypes.push(nonPrimitiveType);
57687                         }
57688                         else {
57689                             return type;
57690                         }
57691                     }
57692                     return getUnionType(groundClauseTypes === undefined ? clauseTypes : groundClauseTypes);
57693                 }
57694                 var discriminantType = getUnionType(clauseTypes);
57695                 var caseType = discriminantType.flags & 131072 ? neverType :
57696                     replacePrimitivesWithLiterals(filterType(type, function (t) { return areTypesComparable(discriminantType, t); }), discriminantType);
57697                 if (!hasDefaultClause) {
57698                     return caseType;
57699                 }
57700                 var defaultType = filterType(type, function (t) { return !(isUnitLikeType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))); });
57701                 return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]);
57702             }
57703             function getImpliedTypeFromTypeofGuard(type, text) {
57704                 switch (text) {
57705                     case "function":
57706                         return type.flags & 1 ? type : globalFunctionType;
57707                     case "object":
57708                         return type.flags & 2 ? getUnionType([nonPrimitiveType, nullType]) : type;
57709                     default:
57710                         return typeofTypesByName.get(text);
57711                 }
57712             }
57713             function narrowUnionMemberByTypeof(candidate) {
57714                 return function (type) {
57715                     if (isTypeSubtypeOf(type, candidate)) {
57716                         return type;
57717                     }
57718                     if (isTypeSubtypeOf(candidate, type)) {
57719                         return candidate;
57720                     }
57721                     if (type.flags & 465829888) {
57722                         var constraint = getBaseConstraintOfType(type) || anyType;
57723                         if (isTypeSubtypeOf(candidate, constraint)) {
57724                             return getIntersectionType([type, candidate]);
57725                         }
57726                     }
57727                     return type;
57728                 };
57729             }
57730             function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
57731                 var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
57732                 if (!switchWitnesses.length) {
57733                     return type;
57734                 }
57735                 var defaultCaseLocation = ts.findIndex(switchWitnesses, function (elem) { return elem === undefined; });
57736                 var hasDefaultClause = clauseStart === clauseEnd || (defaultCaseLocation >= clauseStart && defaultCaseLocation < clauseEnd);
57737                 var clauseWitnesses;
57738                 var switchFacts;
57739                 if (defaultCaseLocation > -1) {
57740                     var witnesses = switchWitnesses.filter(function (witness) { return witness !== undefined; });
57741                     var fixedClauseStart = defaultCaseLocation < clauseStart ? clauseStart - 1 : clauseStart;
57742                     var fixedClauseEnd = defaultCaseLocation < clauseEnd ? clauseEnd - 1 : clauseEnd;
57743                     clauseWitnesses = witnesses.slice(fixedClauseStart, fixedClauseEnd);
57744                     switchFacts = getFactsFromTypeofSwitch(fixedClauseStart, fixedClauseEnd, witnesses, hasDefaultClause);
57745                 }
57746                 else {
57747                     clauseWitnesses = switchWitnesses.slice(clauseStart, clauseEnd);
57748                     switchFacts = getFactsFromTypeofSwitch(clauseStart, clauseEnd, switchWitnesses, hasDefaultClause);
57749                 }
57750                 if (hasDefaultClause) {
57751                     return filterType(type, function (t) { return (getTypeFacts(t) & switchFacts) === switchFacts; });
57752                 }
57753                 var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
57754                 return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
57755             }
57756             function isMatchingConstructorReference(expr) {
57757                 return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
57758                     ts.isElementAccessExpression(expr) && ts.isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") &&
57759                     isMatchingReference(reference, expr.expression);
57760             }
57761             function narrowTypeByConstructor(type, operator, identifier, assumeTrue) {
57762                 if (assumeTrue ? (operator !== 34 && operator !== 36) : (operator !== 35 && operator !== 37)) {
57763                     return type;
57764                 }
57765                 var identifierType = getTypeOfExpression(identifier);
57766                 if (!isFunctionType(identifierType) && !isConstructorType(identifierType)) {
57767                     return type;
57768                 }
57769                 var prototypeProperty = getPropertyOfType(identifierType, "prototype");
57770                 if (!prototypeProperty) {
57771                     return type;
57772                 }
57773                 var prototypeType = getTypeOfSymbol(prototypeProperty);
57774                 var candidate = !isTypeAny(prototypeType) ? prototypeType : undefined;
57775                 if (!candidate || candidate === globalObjectType || candidate === globalFunctionType) {
57776                     return type;
57777                 }
57778                 if (isTypeAny(type)) {
57779                     return candidate;
57780                 }
57781                 return filterType(type, function (t) { return isConstructedBy(t, candidate); });
57782                 function isConstructedBy(source, target) {
57783                     if (source.flags & 524288 && ts.getObjectFlags(source) & 1 ||
57784                         target.flags & 524288 && ts.getObjectFlags(target) & 1) {
57785                         return source.symbol === target.symbol;
57786                     }
57787                     return isTypeSubtypeOf(source, target);
57788                 }
57789             }
57790             function narrowTypeByInstanceof(type, expr, assumeTrue) {
57791                 var left = getReferenceCandidate(expr.left);
57792                 if (!isMatchingReference(reference, left)) {
57793                     if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
57794                         return getTypeWithFacts(type, 2097152);
57795                     }
57796                     return type;
57797                 }
57798                 var rightType = getTypeOfExpression(expr.right);
57799                 if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
57800                     return type;
57801                 }
57802                 var targetType;
57803                 var prototypeProperty = getPropertyOfType(rightType, "prototype");
57804                 if (prototypeProperty) {
57805                     var prototypePropertyType = getTypeOfSymbol(prototypeProperty);
57806                     if (!isTypeAny(prototypePropertyType)) {
57807                         targetType = prototypePropertyType;
57808                     }
57809                 }
57810                 if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
57811                     return type;
57812                 }
57813                 if (!targetType) {
57814                     var constructSignatures = getSignaturesOfType(rightType, 1);
57815                     targetType = constructSignatures.length ?
57816                         getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })) :
57817                         emptyObjectType;
57818                 }
57819                 if (!assumeTrue && rightType.flags & 1048576) {
57820                     var nonConstructorTypeInUnion = ts.find(rightType.types, function (t) { return !isConstructorType(t); });
57821                     if (!nonConstructorTypeInUnion)
57822                         return type;
57823                 }
57824                 return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
57825             }
57826             function getNarrowedType(type, candidate, assumeTrue, isRelated) {
57827                 if (!assumeTrue) {
57828                     return filterType(type, function (t) { return !isRelated(t, candidate); });
57829                 }
57830                 if (type.flags & 1048576) {
57831                     var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
57832                     if (!(assignableType.flags & 131072)) {
57833                         return assignableType;
57834                     }
57835                 }
57836                 return isTypeSubtypeOf(candidate, type) ? candidate :
57837                     isTypeAssignableTo(type, candidate) ? type :
57838                         isTypeAssignableTo(candidate, type) ? candidate :
57839                             getIntersectionType([type, candidate]);
57840             }
57841             function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
57842                 if (hasMatchingArgument(callExpression, reference)) {
57843                     var signature = assumeTrue || !ts.isCallChain(callExpression) ? getEffectsSignature(callExpression) : undefined;
57844                     var predicate = signature && getTypePredicateOfSignature(signature);
57845                     if (predicate && (predicate.kind === 0 || predicate.kind === 1)) {
57846                         return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue);
57847                     }
57848                 }
57849                 if (containsMissingType(type) && ts.isAccessExpression(reference) && ts.isPropertyAccessExpression(callExpression.expression)) {
57850                     var callAccess = callExpression.expression;
57851                     if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) &&
57852                         ts.isIdentifier(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) {
57853                         var argument = callExpression.arguments[0];
57854                         if (ts.isStringLiteralLike(argument) && getAccessedPropertyName(reference) === ts.escapeLeadingUnderscores(argument.text)) {
57855                             return getTypeWithFacts(type, assumeTrue ? 524288 : 65536);
57856                         }
57857                     }
57858                 }
57859                 return type;
57860             }
57861             function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
57862                 if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
57863                     var predicateArgument = getTypePredicateArgument(predicate, callExpression);
57864                     if (predicateArgument) {
57865                         if (isMatchingReference(reference, predicateArgument)) {
57866                             return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
57867                         }
57868                         if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
57869                             !(getTypeFacts(predicate.type) & 65536)) {
57870                             type = getTypeWithFacts(type, 2097152);
57871                         }
57872                         var access = getDiscriminantPropertyAccess(predicateArgument, type);
57873                         if (access) {
57874                             return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, isTypeSubtypeOf); });
57875                         }
57876                     }
57877                 }
57878                 return type;
57879             }
57880             function narrowType(type, expr, assumeTrue) {
57881                 if (ts.isExpressionOfOptionalChainRoot(expr) ||
57882                     ts.isBinaryExpression(expr.parent) && expr.parent.operatorToken.kind === 60 && expr.parent.left === expr) {
57883                     return narrowTypeByOptionality(type, expr, assumeTrue);
57884                 }
57885                 switch (expr.kind) {
57886                     case 79:
57887                         if (!isMatchingReference(reference, expr) && inlineLevel < 5) {
57888                             var symbol = getResolvedSymbol(expr);
57889                             if (isConstVariable(symbol)) {
57890                                 var declaration = symbol.valueDeclaration;
57891                                 if (declaration && ts.isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isConstantReference(reference)) {
57892                                     inlineLevel++;
57893                                     var result = narrowType(type, declaration.initializer, assumeTrue);
57894                                     inlineLevel--;
57895                                     return result;
57896                                 }
57897                             }
57898                         }
57899                     case 108:
57900                     case 106:
57901                     case 205:
57902                     case 206:
57903                         return narrowTypeByTruthiness(type, expr, assumeTrue);
57904                     case 207:
57905                         return narrowTypeByCallExpression(type, expr, assumeTrue);
57906                     case 211:
57907                     case 229:
57908                         return narrowType(type, expr.expression, assumeTrue);
57909                     case 220:
57910                         return narrowTypeByBinaryExpression(type, expr, assumeTrue);
57911                     case 218:
57912                         if (expr.operator === 53) {
57913                             return narrowType(type, expr.operand, !assumeTrue);
57914                         }
57915                         break;
57916                 }
57917                 return type;
57918             }
57919             function narrowTypeByOptionality(type, expr, assumePresent) {
57920                 if (isMatchingReference(reference, expr)) {
57921                     return getTypeWithFacts(type, assumePresent ? 2097152 : 262144);
57922                 }
57923                 var access = getDiscriminantPropertyAccess(expr, type);
57924                 if (access) {
57925                     return narrowTypeByDiscriminant(type, access, function (t) { return getTypeWithFacts(t, assumePresent ? 2097152 : 262144); });
57926                 }
57927                 return type;
57928             }
57929         }
57930         function getTypeOfSymbolAtLocation(symbol, location) {
57931             symbol = symbol.exportSymbol || symbol;
57932             if (location.kind === 79 || location.kind === 80) {
57933                 if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
57934                     location = location.parent;
57935                 }
57936                 if (ts.isExpressionNode(location) && (!ts.isAssignmentTarget(location) || ts.isWriteAccess(location))) {
57937                     var type = getTypeOfExpression(location);
57938                     if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
57939                         return type;
57940                     }
57941                 }
57942             }
57943             if (ts.isDeclarationName(location) && ts.isSetAccessor(location.parent) && getAnnotatedAccessorTypeNode(location.parent)) {
57944                 return resolveTypeOfAccessors(location.parent.symbol, true);
57945             }
57946             return getNonMissingTypeOfSymbol(symbol);
57947         }
57948         function getControlFlowContainer(node) {
57949             return ts.findAncestor(node.parent, function (node) {
57950                 return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
57951                     node.kind === 261 ||
57952                     node.kind === 303 ||
57953                     node.kind === 166;
57954             });
57955         }
57956         function isSymbolAssigned(symbol) {
57957             if (!symbol.valueDeclaration) {
57958                 return false;
57959             }
57960             var parent = ts.getRootDeclaration(symbol.valueDeclaration).parent;
57961             var links = getNodeLinks(parent);
57962             if (!(links.flags & 8388608)) {
57963                 links.flags |= 8388608;
57964                 if (!hasParentWithAssignmentsMarked(parent)) {
57965                     markNodeAssignments(parent);
57966                 }
57967             }
57968             return symbol.isAssigned || false;
57969         }
57970         function hasParentWithAssignmentsMarked(node) {
57971             return !!ts.findAncestor(node.parent, function (node) {
57972                 return (ts.isFunctionLike(node) || ts.isCatchClause(node)) && !!(getNodeLinks(node).flags & 8388608);
57973             });
57974         }
57975         function markNodeAssignments(node) {
57976             if (node.kind === 79) {
57977                 if (ts.isAssignmentTarget(node)) {
57978                     var symbol = getResolvedSymbol(node);
57979                     if (ts.isParameterOrCatchClauseVariable(symbol)) {
57980                         symbol.isAssigned = true;
57981                     }
57982                 }
57983             }
57984             else {
57985                 ts.forEachChild(node, markNodeAssignments);
57986             }
57987         }
57988         function isConstVariable(symbol) {
57989             return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0;
57990         }
57991         function removeOptionalityFromDeclaredType(declaredType, declaration) {
57992             if (pushTypeResolution(declaration.symbol, 2)) {
57993                 var annotationIncludesUndefined = strictNullChecks &&
57994                     declaration.kind === 163 &&
57995                     declaration.initializer &&
57996                     getFalsyFlags(declaredType) & 32768 &&
57997                     !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768);
57998                 popTypeResolution();
57999                 return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288) : declaredType;
58000             }
58001             else {
58002                 reportCircularityError(declaration.symbol);
58003                 return declaredType;
58004             }
58005         }
58006         function isConstraintPosition(type, node) {
58007             var parent = node.parent;
58008             return parent.kind === 205 ||
58009                 parent.kind === 207 && parent.expression === node ||
58010                 parent.kind === 206 && parent.expression === node &&
58011                     !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
58012         }
58013         function isGenericTypeWithUnionConstraint(type) {
58014             return !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576));
58015         }
58016         function isGenericTypeWithoutNullableConstraint(type) {
58017             return !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304));
58018         }
58019         function hasNonBindingPatternContextualTypeWithNoGenericTypes(node) {
58020             var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
58021                 !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
58022                 getContextualType(node, 8);
58023             return contextualType && !isGenericType(contextualType);
58024         }
58025         function getNarrowableTypeForReference(type, reference, checkMode) {
58026             var substituteConstraints = !(checkMode && checkMode & 2) &&
58027                 someType(type, isGenericTypeWithUnionConstraint) &&
58028                 (isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
58029             return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
58030         }
58031         function isExportOrExportExpression(location) {
58032             return !!ts.findAncestor(location, function (n) {
58033                 var parent = n.parent;
58034                 if (parent === undefined) {
58035                     return "quit";
58036                 }
58037                 if (ts.isExportAssignment(parent)) {
58038                     return parent.expression === n && ts.isEntityNameExpression(n);
58039                 }
58040                 if (ts.isExportSpecifier(parent)) {
58041                     return parent.name === n || parent.propertyName === n;
58042                 }
58043                 return false;
58044             });
58045         }
58046         function markAliasReferenced(symbol, location) {
58047             if (isNonLocalAlias(symbol, 111551) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
58048                 var target = resolveAlias(symbol);
58049                 if (target.flags & 111551) {
58050                     if (compilerOptions.isolatedModules ||
58051                         ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
58052                         !isConstEnumOrConstEnumOnlyModule(target)) {
58053                         markAliasSymbolAsReferenced(symbol);
58054                     }
58055                     else {
58056                         markConstEnumAliasAsReferenced(symbol);
58057                     }
58058                 }
58059             }
58060         }
58061         function checkIdentifier(node, checkMode) {
58062             var symbol = getResolvedSymbol(node);
58063             if (symbol === unknownSymbol) {
58064                 return errorType;
58065             }
58066             if (symbol === argumentsSymbol) {
58067                 if (isInPropertyInitializerOrClassStaticBlock(node)) {
58068                     error(node, ts.Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
58069                     return errorType;
58070                 }
58071                 var container = ts.getContainingFunction(node);
58072                 if (languageVersion < 2) {
58073                     if (container.kind === 213) {
58074                         error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
58075                     }
58076                     else if (ts.hasSyntacticModifier(container, 256)) {
58077                         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);
58078                     }
58079                 }
58080                 getNodeLinks(container).flags |= 8192;
58081                 return getTypeOfSymbol(symbol);
58082             }
58083             if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) {
58084                 markAliasReferenced(symbol, node);
58085             }
58086             var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
58087             var sourceSymbol = localOrExportSymbol.flags & 2097152 ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
58088             if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 && isUncalledFunctionReference(node, sourceSymbol)) {
58089                 addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
58090             }
58091             var declaration = localOrExportSymbol.valueDeclaration;
58092             if (declaration && localOrExportSymbol.flags & 32) {
58093                 if (declaration.kind === 256
58094                     && ts.nodeIsDecorated(declaration)) {
58095                     var container = ts.getContainingClass(node);
58096                     while (container !== undefined) {
58097                         if (container === declaration && container.name !== node) {
58098                             getNodeLinks(declaration).flags |= 16777216;
58099                             getNodeLinks(node).flags |= 33554432;
58100                             break;
58101                         }
58102                         container = ts.getContainingClass(container);
58103                     }
58104                 }
58105                 else if (declaration.kind === 225) {
58106                     var container = ts.getThisContainer(node, false);
58107                     while (container.kind !== 303) {
58108                         if (container.parent === declaration) {
58109                             if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) {
58110                                 getNodeLinks(declaration).flags |= 16777216;
58111                                 getNodeLinks(node).flags |= 33554432;
58112                             }
58113                             break;
58114                         }
58115                         container = ts.getThisContainer(container, false);
58116                     }
58117                 }
58118             }
58119             checkNestedBlockScopedBinding(node, symbol);
58120             var type = getTypeOfSymbol(localOrExportSymbol);
58121             var assignmentKind = ts.getAssignmentTargetKind(node);
58122             if (assignmentKind) {
58123                 if (!(localOrExportSymbol.flags & 3) &&
58124                     !(ts.isInJSFile(node) && localOrExportSymbol.flags & 512)) {
58125                     var assignmentError = localOrExportSymbol.flags & 384 ? ts.Diagnostics.Cannot_assign_to_0_because_it_is_an_enum
58126                         : localOrExportSymbol.flags & 32 ? ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_class
58127                             : localOrExportSymbol.flags & 1536 ? ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace
58128                                 : localOrExportSymbol.flags & 16 ? ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_function
58129                                     : localOrExportSymbol.flags & 2097152 ? ts.Diagnostics.Cannot_assign_to_0_because_it_is_an_import
58130                                         : ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable;
58131                     error(node, assignmentError, symbolToString(symbol));
58132                     return errorType;
58133                 }
58134                 if (isReadonlySymbol(localOrExportSymbol)) {
58135                     if (localOrExportSymbol.flags & 3) {
58136                         error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol));
58137                     }
58138                     else {
58139                         error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol));
58140                     }
58141                     return errorType;
58142                 }
58143             }
58144             var isAlias = localOrExportSymbol.flags & 2097152;
58145             if (localOrExportSymbol.flags & 3) {
58146                 if (assignmentKind === 1) {
58147                     return type;
58148                 }
58149             }
58150             else if (isAlias) {
58151                 declaration = getDeclarationOfAliasSymbol(symbol);
58152             }
58153             else {
58154                 return type;
58155             }
58156             if (!declaration) {
58157                 return type;
58158             }
58159             type = getNarrowableTypeForReference(type, node, checkMode);
58160             var isParameter = ts.getRootDeclaration(declaration).kind === 163;
58161             var declarationContainer = getControlFlowContainer(declaration);
58162             var flowContainer = getControlFlowContainer(node);
58163             var isOuterVariable = flowContainer !== declarationContainer;
58164             var isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
58165             var isModuleExports = symbol.flags & 134217728;
58166             while (flowContainer !== declarationContainer && (flowContainer.kind === 212 ||
58167                 flowContainer.kind === 213 || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) &&
58168                 (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) {
58169                 flowContainer = getControlFlowContainer(flowContainer);
58170             }
58171             var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
58172                 type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 ||
58173                     isInTypeQuery(node) || node.parent.kind === 274) ||
58174                 node.parent.kind === 229 ||
58175                 declaration.kind === 253 && declaration.exclamationToken ||
58176                 declaration.flags & 8388608;
58177             var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
58178                 type === autoType || type === autoArrayType ? undefinedType :
58179                     getOptionalType(type);
58180             var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
58181             if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
58182                 if (flowType === autoType || flowType === autoArrayType) {
58183                     if (noImplicitAny) {
58184                         error(ts.getNameOfDeclaration(declaration), ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
58185                         error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
58186                     }
58187                     return convertAutoToAny(flowType);
58188                 }
58189             }
58190             else if (!assumeInitialized && !(getFalsyFlags(type) & 32768) && getFalsyFlags(flowType) & 32768) {
58191                 error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
58192                 return type;
58193             }
58194             return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
58195         }
58196         function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
58197             return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n) || (n.parent && ts.isPropertyDeclaration(n.parent) && !ts.hasStaticModifier(n.parent) && n.parent.initializer === n); });
58198         }
58199         function getPartOfForStatementContainingNode(node, container) {
58200             return ts.findAncestor(node, function (n) { return n === container ? "quit" : n === container.initializer || n === container.condition || n === container.incrementor || n === container.statement; });
58201         }
58202         function getEnclosingIterationStatement(node) {
58203             return ts.findAncestor(node, function (n) { return (!n || ts.nodeStartsNewLexicalEnvironment(n)) ? "quit" : ts.isIterationStatement(n, false); });
58204         }
58205         function checkNestedBlockScopedBinding(node, symbol) {
58206             if (languageVersion >= 2 ||
58207                 (symbol.flags & (2 | 32)) === 0 ||
58208                 !symbol.valueDeclaration ||
58209                 ts.isSourceFile(symbol.valueDeclaration) ||
58210                 symbol.valueDeclaration.parent.kind === 291) {
58211                 return;
58212             }
58213             var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
58214             var isCaptured = isInsideFunctionOrInstancePropertyInitializer(node, container);
58215             var enclosingIterationStatement = getEnclosingIterationStatement(container);
58216             if (enclosingIterationStatement) {
58217                 if (isCaptured) {
58218                     var capturesBlockScopeBindingInLoopBody = true;
58219                     if (ts.isForStatement(container)) {
58220                         var varDeclList = ts.getAncestor(symbol.valueDeclaration, 254);
58221                         if (varDeclList && varDeclList.parent === container) {
58222                             var part = getPartOfForStatementContainingNode(node.parent, container);
58223                             if (part) {
58224                                 var links = getNodeLinks(part);
58225                                 links.flags |= 131072;
58226                                 var capturedBindings = links.capturedBlockScopeBindings || (links.capturedBlockScopeBindings = []);
58227                                 ts.pushIfUnique(capturedBindings, symbol);
58228                                 if (part === container.initializer) {
58229                                     capturesBlockScopeBindingInLoopBody = false;
58230                                 }
58231                             }
58232                         }
58233                     }
58234                     if (capturesBlockScopeBindingInLoopBody) {
58235                         getNodeLinks(enclosingIterationStatement).flags |= 65536;
58236                     }
58237                 }
58238                 if (ts.isForStatement(container)) {
58239                     var varDeclList = ts.getAncestor(symbol.valueDeclaration, 254);
58240                     if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
58241                         getNodeLinks(symbol.valueDeclaration).flags |= 4194304;
58242                     }
58243                 }
58244                 getNodeLinks(symbol.valueDeclaration).flags |= 524288;
58245             }
58246             if (isCaptured) {
58247                 getNodeLinks(symbol.valueDeclaration).flags |= 262144;
58248             }
58249         }
58250         function isBindingCapturedByNode(node, decl) {
58251             var links = getNodeLinks(node);
58252             return !!links && ts.contains(links.capturedBlockScopeBindings, getSymbolOfNode(decl));
58253         }
58254         function isAssignedInBodyOfForStatement(node, container) {
58255             var current = node;
58256             while (current.parent.kind === 211) {
58257                 current = current.parent;
58258             }
58259             var isAssigned = false;
58260             if (ts.isAssignmentTarget(current)) {
58261                 isAssigned = true;
58262             }
58263             else if ((current.parent.kind === 218 || current.parent.kind === 219)) {
58264                 var expr = current.parent;
58265                 isAssigned = expr.operator === 45 || expr.operator === 46;
58266             }
58267             if (!isAssigned) {
58268                 return false;
58269             }
58270             return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; });
58271         }
58272         function captureLexicalThis(node, container) {
58273             getNodeLinks(node).flags |= 2;
58274             if (container.kind === 166 || container.kind === 170) {
58275                 var classNode = container.parent;
58276                 getNodeLinks(classNode).flags |= 4;
58277             }
58278             else {
58279                 getNodeLinks(container).flags |= 4;
58280             }
58281         }
58282         function findFirstSuperCall(node) {
58283             return ts.isSuperCall(node) ? node :
58284                 ts.isFunctionLike(node) ? undefined :
58285                     ts.forEachChild(node, findFirstSuperCall);
58286         }
58287         function classDeclarationExtendsNull(classDecl) {
58288             var classSymbol = getSymbolOfNode(classDecl);
58289             var classInstanceType = getDeclaredTypeOfSymbol(classSymbol);
58290             var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType);
58291             return baseConstructorType === nullWideningType;
58292         }
58293         function checkThisBeforeSuper(node, container, diagnosticMessage) {
58294             var containingClassDecl = container.parent;
58295             var baseTypeNode = ts.getClassExtendsHeritageElement(containingClassDecl);
58296             if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {
58297                 if (node.flowNode && !isPostSuperFlowNode(node.flowNode, false)) {
58298                     error(node, diagnosticMessage);
58299                 }
58300             }
58301         }
58302         function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) {
58303             if (ts.isPropertyDeclaration(container) && ts.hasStaticModifier(container) &&
58304                 container.initializer && ts.textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && ts.length(container.parent.decorators)) {
58305                 error(thisExpression, ts.Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class);
58306             }
58307         }
58308         function checkThisExpression(node) {
58309             var isNodeInTypeQuery = isInTypeQuery(node);
58310             var container = ts.getThisContainer(node, true);
58311             var capturedByArrowFunction = false;
58312             if (container.kind === 170) {
58313                 checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
58314             }
58315             if (container.kind === 213) {
58316                 container = ts.getThisContainer(container, false);
58317                 capturedByArrowFunction = true;
58318             }
58319             checkThisInStaticClassFieldInitializerInDecoratedClass(node, container);
58320             switch (container.kind) {
58321                 case 260:
58322                     error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
58323                     break;
58324                 case 259:
58325                     error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
58326                     break;
58327                 case 170:
58328                     if (isInConstructorArgumentInitializer(node, container)) {
58329                         error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
58330                     }
58331                     break;
58332                 case 161:
58333                     error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
58334                     break;
58335             }
58336             if (!isNodeInTypeQuery && capturedByArrowFunction && languageVersion < 2) {
58337                 captureLexicalThis(node, container);
58338             }
58339             var type = tryGetThisTypeAt(node, true, container);
58340             if (noImplicitThis) {
58341                 var globalThisType_1 = getTypeOfSymbol(globalThisSymbol);
58342                 if (type === globalThisType_1 && capturedByArrowFunction) {
58343                     error(node, ts.Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this);
58344                 }
58345                 else if (!type) {
58346                     var diag = error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
58347                     if (!ts.isSourceFile(container)) {
58348                         var outsideThis = tryGetThisTypeAt(container);
58349                         if (outsideThis && outsideThis !== globalThisType_1) {
58350                             ts.addRelatedInfo(diag, ts.createDiagnosticForNode(container, ts.Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container));
58351                         }
58352                     }
58353                 }
58354             }
58355             return type || anyType;
58356         }
58357         function tryGetThisTypeAt(node, includeGlobalThis, container) {
58358             if (includeGlobalThis === void 0) { includeGlobalThis = true; }
58359             if (container === void 0) { container = ts.getThisContainer(node, false); }
58360             var isInJS = ts.isInJSFile(node);
58361             if (ts.isFunctionLike(container) &&
58362                 (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) {
58363                 var thisType = getThisTypeOfDeclaration(container) || isInJS && getTypeForThisExpressionFromJSDoc(container);
58364                 if (!thisType) {
58365                     var className = getClassNameFromPrototypeMethod(container);
58366                     if (isInJS && className) {
58367                         var classSymbol = checkExpression(className).symbol;
58368                         if (classSymbol && classSymbol.members && (classSymbol.flags & 16)) {
58369                             thisType = getDeclaredTypeOfSymbol(classSymbol).thisType;
58370                         }
58371                     }
58372                     else if (isJSConstructor(container)) {
58373                         thisType = getDeclaredTypeOfSymbol(getMergedSymbol(container.symbol)).thisType;
58374                     }
58375                     thisType || (thisType = getContextualThisParameterType(container));
58376                 }
58377                 if (thisType) {
58378                     return getFlowTypeOfReference(node, thisType);
58379                 }
58380             }
58381             if (ts.isClassLike(container.parent)) {
58382                 var symbol = getSymbolOfNode(container.parent);
58383                 var type = ts.isStatic(container) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType;
58384                 return getFlowTypeOfReference(node, type);
58385             }
58386             if (ts.isSourceFile(container)) {
58387                 if (container.commonJsModuleIndicator) {
58388                     var fileSymbol = getSymbolOfNode(container);
58389                     return fileSymbol && getTypeOfSymbol(fileSymbol);
58390                 }
58391                 else if (container.externalModuleIndicator) {
58392                     return undefinedType;
58393                 }
58394                 else if (includeGlobalThis) {
58395                     return getTypeOfSymbol(globalThisSymbol);
58396                 }
58397             }
58398         }
58399         function getExplicitThisType(node) {
58400             var container = ts.getThisContainer(node, false);
58401             if (ts.isFunctionLike(container)) {
58402                 var signature = getSignatureFromDeclaration(container);
58403                 if (signature.thisParameter) {
58404                     return getExplicitTypeOfSymbol(signature.thisParameter);
58405                 }
58406             }
58407             if (ts.isClassLike(container.parent)) {
58408                 var symbol = getSymbolOfNode(container.parent);
58409                 return ts.isStatic(container) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType;
58410             }
58411         }
58412         function getClassNameFromPrototypeMethod(container) {
58413             if (container.kind === 212 &&
58414                 ts.isBinaryExpression(container.parent) &&
58415                 ts.getAssignmentDeclarationKind(container.parent) === 3) {
58416                 return container.parent
58417                     .left
58418                     .expression
58419                     .expression;
58420             }
58421             else if (container.kind === 168 &&
58422                 container.parent.kind === 204 &&
58423                 ts.isBinaryExpression(container.parent.parent) &&
58424                 ts.getAssignmentDeclarationKind(container.parent.parent) === 6) {
58425                 return container.parent.parent.left.expression;
58426             }
58427             else if (container.kind === 212 &&
58428                 container.parent.kind === 294 &&
58429                 container.parent.parent.kind === 204 &&
58430                 ts.isBinaryExpression(container.parent.parent.parent) &&
58431                 ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6) {
58432                 return container.parent.parent.parent.left.expression;
58433             }
58434             else if (container.kind === 212 &&
58435                 ts.isPropertyAssignment(container.parent) &&
58436                 ts.isIdentifier(container.parent.name) &&
58437                 (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
58438                 ts.isObjectLiteralExpression(container.parent.parent) &&
58439                 ts.isCallExpression(container.parent.parent.parent) &&
58440                 container.parent.parent.parent.arguments[2] === container.parent.parent &&
58441                 ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 9) {
58442                 return container.parent.parent.parent.arguments[0].expression;
58443             }
58444             else if (ts.isMethodDeclaration(container) &&
58445                 ts.isIdentifier(container.name) &&
58446                 (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") &&
58447                 ts.isObjectLiteralExpression(container.parent) &&
58448                 ts.isCallExpression(container.parent.parent) &&
58449                 container.parent.parent.arguments[2] === container.parent &&
58450                 ts.getAssignmentDeclarationKind(container.parent.parent) === 9) {
58451                 return container.parent.parent.arguments[0].expression;
58452             }
58453         }
58454         function getTypeForThisExpressionFromJSDoc(node) {
58455             var jsdocType = ts.getJSDocType(node);
58456             if (jsdocType && jsdocType.kind === 315) {
58457                 var jsDocFunctionType = jsdocType;
58458                 if (jsDocFunctionType.parameters.length > 0 &&
58459                     jsDocFunctionType.parameters[0].name &&
58460                     jsDocFunctionType.parameters[0].name.escapedText === "this") {
58461                     return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
58462                 }
58463             }
58464             var thisTag = ts.getJSDocThisTag(node);
58465             if (thisTag && thisTag.typeExpression) {
58466                 return getTypeFromTypeNode(thisTag.typeExpression);
58467             }
58468         }
58469         function isInConstructorArgumentInitializer(node, constructorDecl) {
58470             return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 163 && n.parent === constructorDecl; });
58471         }
58472         function checkSuperExpression(node) {
58473             var isCallExpression = node.parent.kind === 207 && node.parent.expression === node;
58474             var immediateContainer = ts.getSuperContainer(node, true);
58475             var container = immediateContainer;
58476             var needToCaptureLexicalThis = false;
58477             if (!isCallExpression) {
58478                 while (container && container.kind === 213) {
58479                     container = ts.getSuperContainer(container, true);
58480                     needToCaptureLexicalThis = languageVersion < 2;
58481                 }
58482             }
58483             var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
58484             var nodeCheckFlag = 0;
58485             if (!canUseSuperExpression) {
58486                 var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 161; });
58487                 if (current && current.kind === 161) {
58488                     error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
58489                 }
58490                 else if (isCallExpression) {
58491                     error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
58492                 }
58493                 else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 204)) {
58494                     error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
58495                 }
58496                 else {
58497                     error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
58498                 }
58499                 return errorType;
58500             }
58501             if (!isCallExpression && immediateContainer.kind === 170) {
58502                 checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
58503             }
58504             if (ts.isStatic(container) || isCallExpression) {
58505                 nodeCheckFlag = 512;
58506                 if (!isCallExpression &&
58507                     languageVersion >= 2 && languageVersion <= 8 &&
58508                     (ts.isPropertyDeclaration(container) || ts.isClassStaticBlockDeclaration(container))) {
58509                     ts.forEachEnclosingBlockScopeContainer(node.parent, function (current) {
58510                         if (!ts.isSourceFile(current) || ts.isExternalOrCommonJsModule(current)) {
58511                             getNodeLinks(current).flags |= 134217728;
58512                         }
58513                     });
58514                 }
58515             }
58516             else {
58517                 nodeCheckFlag = 256;
58518             }
58519             getNodeLinks(node).flags |= nodeCheckFlag;
58520             if (container.kind === 168 && ts.hasSyntacticModifier(container, 256)) {
58521                 if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
58522                     getNodeLinks(container).flags |= 4096;
58523                 }
58524                 else {
58525                     getNodeLinks(container).flags |= 2048;
58526                 }
58527             }
58528             if (needToCaptureLexicalThis) {
58529                 captureLexicalThis(node.parent, container);
58530             }
58531             if (container.parent.kind === 204) {
58532                 if (languageVersion < 2) {
58533                     error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
58534                     return errorType;
58535                 }
58536                 else {
58537                     return anyType;
58538                 }
58539             }
58540             var classLikeDeclaration = container.parent;
58541             if (!ts.getClassExtendsHeritageElement(classLikeDeclaration)) {
58542                 error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class);
58543                 return errorType;
58544             }
58545             var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration));
58546             var baseClassType = classType && getBaseTypes(classType)[0];
58547             if (!baseClassType) {
58548                 return errorType;
58549             }
58550             if (container.kind === 170 && isInConstructorArgumentInitializer(node, container)) {
58551                 error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
58552                 return errorType;
58553             }
58554             return nodeCheckFlag === 512
58555                 ? getBaseConstructorTypeOfClass(classType)
58556                 : getTypeWithThisArgument(baseClassType, classType.thisType);
58557             function isLegalUsageOfSuperExpression(container) {
58558                 if (!container) {
58559                     return false;
58560                 }
58561                 if (isCallExpression) {
58562                     return container.kind === 170;
58563                 }
58564                 else {
58565                     if (ts.isClassLike(container.parent) || container.parent.kind === 204) {
58566                         if (ts.isStatic(container)) {
58567                             return container.kind === 168 ||
58568                                 container.kind === 167 ||
58569                                 container.kind === 171 ||
58570                                 container.kind === 172 ||
58571                                 container.kind === 166 ||
58572                                 container.kind === 169;
58573                         }
58574                         else {
58575                             return container.kind === 168 ||
58576                                 container.kind === 167 ||
58577                                 container.kind === 171 ||
58578                                 container.kind === 172 ||
58579                                 container.kind === 166 ||
58580                                 container.kind === 165 ||
58581                                 container.kind === 170;
58582                         }
58583                     }
58584                 }
58585                 return false;
58586             }
58587         }
58588         function getContainingObjectLiteral(func) {
58589             return (func.kind === 168 ||
58590                 func.kind === 171 ||
58591                 func.kind === 172) && func.parent.kind === 204 ? func.parent :
58592                 func.kind === 212 && func.parent.kind === 294 ? func.parent.parent :
58593                     undefined;
58594         }
58595         function getThisTypeArgument(type) {
58596             return ts.getObjectFlags(type) & 4 && type.target === globalThisType ? getTypeArguments(type)[0] : undefined;
58597         }
58598         function getThisTypeFromContextualType(type) {
58599             return mapType(type, function (t) {
58600                 return t.flags & 2097152 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
58601             });
58602         }
58603         function getContextualThisParameterType(func) {
58604             if (func.kind === 213) {
58605                 return undefined;
58606             }
58607             if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
58608                 var contextualSignature = getContextualSignature(func);
58609                 if (contextualSignature) {
58610                     var thisParameter = contextualSignature.thisParameter;
58611                     if (thisParameter) {
58612                         return getTypeOfSymbol(thisParameter);
58613                     }
58614                 }
58615             }
58616             var inJs = ts.isInJSFile(func);
58617             if (noImplicitThis || inJs) {
58618                 var containingLiteral = getContainingObjectLiteral(func);
58619                 if (containingLiteral) {
58620                     var contextualType = getApparentTypeOfContextualType(containingLiteral);
58621                     var literal = containingLiteral;
58622                     var type = contextualType;
58623                     while (type) {
58624                         var thisType = getThisTypeFromContextualType(type);
58625                         if (thisType) {
58626                             return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
58627                         }
58628                         if (literal.parent.kind !== 294) {
58629                             break;
58630                         }
58631                         literal = literal.parent.parent;
58632                         type = getApparentTypeOfContextualType(literal);
58633                     }
58634                     return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
58635                 }
58636                 var parent = ts.walkUpParenthesizedExpressions(func.parent);
58637                 if (parent.kind === 220 && parent.operatorToken.kind === 63) {
58638                     var target = parent.left;
58639                     if (ts.isAccessExpression(target)) {
58640                         var expression = target.expression;
58641                         if (inJs && ts.isIdentifier(expression)) {
58642                             var sourceFile = ts.getSourceFileOfNode(parent);
58643                             if (sourceFile.commonJsModuleIndicator && getResolvedSymbol(expression) === sourceFile.symbol) {
58644                                 return undefined;
58645                             }
58646                         }
58647                         return getWidenedType(checkExpressionCached(expression));
58648                     }
58649                 }
58650             }
58651             return undefined;
58652         }
58653         function getContextuallyTypedParameterType(parameter) {
58654             var func = parameter.parent;
58655             if (!isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
58656                 return undefined;
58657             }
58658             var iife = ts.getImmediatelyInvokedFunctionExpression(func);
58659             if (iife && iife.arguments) {
58660                 var args = getEffectiveCallArguments(iife);
58661                 var indexOfParameter = func.parameters.indexOf(parameter);
58662                 if (parameter.dotDotDotToken) {
58663                     return getSpreadArgumentType(args, indexOfParameter, args.length, anyType, undefined, 0);
58664                 }
58665                 var links = getNodeLinks(iife);
58666                 var cached = links.resolvedSignature;
58667                 links.resolvedSignature = anySignature;
58668                 var type = indexOfParameter < args.length ?
58669                     getWidenedLiteralType(checkExpression(args[indexOfParameter])) :
58670                     parameter.initializer ? undefined : undefinedWideningType;
58671                 links.resolvedSignature = cached;
58672                 return type;
58673             }
58674             var contextualSignature = getContextualSignature(func);
58675             if (contextualSignature) {
58676                 var index = func.parameters.indexOf(parameter) - (ts.getThisParameter(func) ? 1 : 0);
58677                 return parameter.dotDotDotToken && ts.lastOrUndefined(func.parameters) === parameter ?
58678                     getRestTypeAtPosition(contextualSignature, index) :
58679                     tryGetTypeAtPosition(contextualSignature, index);
58680             }
58681         }
58682         function getContextualTypeForVariableLikeDeclaration(declaration) {
58683             var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
58684             if (typeNode) {
58685                 return getTypeFromTypeNode(typeNode);
58686             }
58687             switch (declaration.kind) {
58688                 case 163:
58689                     return getContextuallyTypedParameterType(declaration);
58690                 case 202:
58691                     return getContextualTypeForBindingElement(declaration);
58692                 case 166:
58693                     if (ts.isStatic(declaration)) {
58694                         return getContextualTypeForStaticPropertyDeclaration(declaration);
58695                     }
58696             }
58697         }
58698         function getContextualTypeForBindingElement(declaration) {
58699             var parent = declaration.parent.parent;
58700             var name = declaration.propertyName || declaration.name;
58701             var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
58702                 parent.kind !== 202 && parent.initializer && checkDeclarationInitializer(parent);
58703             if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
58704                 return undefined;
58705             if (parent.name.kind === 201) {
58706                 var index = ts.indexOfNode(declaration.parent.elements, declaration);
58707                 if (index < 0)
58708                     return undefined;
58709                 return getContextualTypeForElementExpression(parentType, index);
58710             }
58711             var nameType = getLiteralTypeFromPropertyName(name);
58712             if (isTypeUsableAsPropertyName(nameType)) {
58713                 var text = getPropertyNameFromType(nameType);
58714                 return getTypeOfPropertyOfType(parentType, text);
58715             }
58716         }
58717         function getContextualTypeForStaticPropertyDeclaration(declaration) {
58718             var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
58719             if (!parentType)
58720                 return undefined;
58721             return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
58722         }
58723         function getContextualTypeForInitializerExpression(node, contextFlags) {
58724             var declaration = node.parent;
58725             if (ts.hasInitializer(declaration) && node === declaration.initializer) {
58726                 var result = getContextualTypeForVariableLikeDeclaration(declaration);
58727                 if (result) {
58728                     return result;
58729                 }
58730                 if (!(contextFlags & 8) && ts.isBindingPattern(declaration.name)) {
58731                     return getTypeFromBindingPattern(declaration.name, true, false);
58732                 }
58733             }
58734             return undefined;
58735         }
58736         function getContextualTypeForReturnExpression(node) {
58737             var func = ts.getContainingFunction(node);
58738             if (func) {
58739                 var contextualReturnType = getContextualReturnType(func);
58740                 if (contextualReturnType) {
58741                     var functionFlags = ts.getFunctionFlags(func);
58742                     if (functionFlags & 1) {
58743                         var use = functionFlags & 2 ? 2 : 1;
58744                         var iterationTypes = getIterationTypesOfIterable(contextualReturnType, use, undefined);
58745                         if (!iterationTypes) {
58746                             return undefined;
58747                         }
58748                         contextualReturnType = iterationTypes.returnType;
58749                     }
58750                     if (functionFlags & 2) {
58751                         var contextualAwaitedType = mapType(contextualReturnType, getAwaitedTypeNoAlias);
58752                         return contextualAwaitedType && getUnionType([contextualAwaitedType, createPromiseLikeType(contextualAwaitedType)]);
58753                     }
58754                     return contextualReturnType;
58755                 }
58756             }
58757             return undefined;
58758         }
58759         function getContextualTypeForAwaitOperand(node, contextFlags) {
58760             var contextualType = getContextualType(node, contextFlags);
58761             if (contextualType) {
58762                 var contextualAwaitedType = getAwaitedTypeNoAlias(contextualType);
58763                 return contextualAwaitedType && getUnionType([contextualAwaitedType, createPromiseLikeType(contextualAwaitedType)]);
58764             }
58765             return undefined;
58766         }
58767         function getContextualTypeForYieldOperand(node) {
58768             var func = ts.getContainingFunction(node);
58769             if (func) {
58770                 var functionFlags = ts.getFunctionFlags(func);
58771                 var contextualReturnType = getContextualReturnType(func);
58772                 if (contextualReturnType) {
58773                     return node.asteriskToken
58774                         ? contextualReturnType
58775                         : getIterationTypeOfGeneratorFunctionReturnType(0, contextualReturnType, (functionFlags & 2) !== 0);
58776                 }
58777             }
58778             return undefined;
58779         }
58780         function isInParameterInitializerBeforeContainingFunction(node) {
58781             var inBindingInitializer = false;
58782             while (node.parent && !ts.isFunctionLike(node.parent)) {
58783                 if (ts.isParameter(node.parent) && (inBindingInitializer || node.parent.initializer === node)) {
58784                     return true;
58785                 }
58786                 if (ts.isBindingElement(node.parent) && node.parent.initializer === node) {
58787                     inBindingInitializer = true;
58788                 }
58789                 node = node.parent;
58790             }
58791             return false;
58792         }
58793         function getContextualIterationType(kind, functionDecl) {
58794             var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
58795             var contextualReturnType = getContextualReturnType(functionDecl);
58796             if (contextualReturnType) {
58797                 return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
58798                     || undefined;
58799             }
58800             return undefined;
58801         }
58802         function getContextualReturnType(functionDecl) {
58803             var returnType = getReturnTypeFromAnnotation(functionDecl);
58804             if (returnType) {
58805                 return returnType;
58806             }
58807             var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
58808             if (signature && !isResolvingReturnTypeOfSignature(signature)) {
58809                 return getReturnTypeOfSignature(signature);
58810             }
58811             var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
58812             if (iife) {
58813                 return getContextualType(iife);
58814             }
58815             return undefined;
58816         }
58817         function getContextualTypeForArgument(callTarget, arg) {
58818             var args = getEffectiveCallArguments(callTarget);
58819             var argIndex = args.indexOf(arg);
58820             return argIndex === -1 ? undefined : getContextualTypeForArgumentAtIndex(callTarget, argIndex);
58821         }
58822         function getContextualTypeForArgumentAtIndex(callTarget, argIndex) {
58823             if (ts.isImportCall(callTarget)) {
58824                 return argIndex === 0 ? stringType :
58825                     argIndex === 1 ? getGlobalImportCallOptionsType(false) :
58826                         anyType;
58827             }
58828             var signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget);
58829             if (ts.isJsxOpeningLikeElement(callTarget) && argIndex === 0) {
58830                 return getEffectiveFirstArgumentForJsxSignature(signature, callTarget);
58831             }
58832             var restIndex = signature.parameters.length - 1;
58833             return signatureHasRestParameter(signature) && argIndex >= restIndex ?
58834                 getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256) :
58835                 getTypeAtPosition(signature, argIndex);
58836         }
58837         function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
58838             if (template.parent.kind === 209) {
58839                 return getContextualTypeForArgument(template.parent, substitutionExpression);
58840             }
58841             return undefined;
58842         }
58843         function getContextualTypeForBinaryOperand(node, contextFlags) {
58844             var binaryExpression = node.parent;
58845             var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
58846             switch (operatorToken.kind) {
58847                 case 63:
58848                 case 76:
58849                 case 75:
58850                 case 77:
58851                     return node === right ? getContextualTypeForAssignmentDeclaration(binaryExpression) : undefined;
58852                 case 56:
58853                 case 60:
58854                     var type = getContextualType(binaryExpression, contextFlags);
58855                     return node === right && (type && type.pattern || !type && !ts.isDefaultedExpandoInitializer(binaryExpression)) ?
58856                         getTypeOfExpression(left) : type;
58857                 case 55:
58858                 case 27:
58859                     return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
58860                 default:
58861                     return undefined;
58862             }
58863         }
58864         function getSymbolForExpression(e) {
58865             if (e.symbol) {
58866                 return e.symbol;
58867             }
58868             if (ts.isIdentifier(e)) {
58869                 return getResolvedSymbol(e);
58870             }
58871             if (ts.isPropertyAccessExpression(e)) {
58872                 var lhsType = getTypeOfExpression(e.expression);
58873                 return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
58874             }
58875             return undefined;
58876             function tryGetPrivateIdentifierPropertyOfType(type, id) {
58877                 var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
58878                 return lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(type, lexicallyScopedSymbol);
58879             }
58880         }
58881         function getContextualTypeForAssignmentDeclaration(binaryExpression) {
58882             var _a, _b;
58883             var kind = ts.getAssignmentDeclarationKind(binaryExpression);
58884             switch (kind) {
58885                 case 0:
58886                 case 4:
58887                     var lhsSymbol = getSymbolForExpression(binaryExpression.left);
58888                     var decl = lhsSymbol && lhsSymbol.valueDeclaration;
58889                     if (decl && (ts.isPropertyDeclaration(decl) || ts.isPropertySignature(decl))) {
58890                         var overallAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
58891                         return (overallAnnotation && instantiateType(getTypeFromTypeNode(overallAnnotation), getSymbolLinks(lhsSymbol).mapper)) ||
58892                             (decl.initializer && getTypeOfExpression(binaryExpression.left));
58893                     }
58894                     if (kind === 0) {
58895                         return getTypeOfExpression(binaryExpression.left);
58896                     }
58897                     return getContextualTypeForThisPropertyAssignment(binaryExpression);
58898                 case 5:
58899                     if (isPossiblyAliasedThisProperty(binaryExpression, kind)) {
58900                         return getContextualTypeForThisPropertyAssignment(binaryExpression);
58901                     }
58902                     else if (!binaryExpression.left.symbol) {
58903                         return getTypeOfExpression(binaryExpression.left);
58904                     }
58905                     else {
58906                         var decl_1 = binaryExpression.left.symbol.valueDeclaration;
58907                         if (!decl_1) {
58908                             return undefined;
58909                         }
58910                         var lhs = ts.cast(binaryExpression.left, ts.isAccessExpression);
58911                         var overallAnnotation = ts.getEffectiveTypeAnnotationNode(decl_1);
58912                         if (overallAnnotation) {
58913                             return getTypeFromTypeNode(overallAnnotation);
58914                         }
58915                         else if (ts.isIdentifier(lhs.expression)) {
58916                             var id = lhs.expression;
58917                             var parentSymbol = resolveName(id, id.escapedText, 111551, undefined, id.escapedText, true);
58918                             if (parentSymbol) {
58919                                 var annotated_1 = parentSymbol.valueDeclaration && ts.getEffectiveTypeAnnotationNode(parentSymbol.valueDeclaration);
58920                                 if (annotated_1) {
58921                                     var nameStr = ts.getElementOrPropertyAccessName(lhs);
58922                                     if (nameStr !== undefined) {
58923                                         return getTypeOfPropertyOfContextualType(getTypeFromTypeNode(annotated_1), nameStr);
58924                                     }
58925                                 }
58926                                 return undefined;
58927                             }
58928                         }
58929                         return ts.isInJSFile(decl_1) ? undefined : getTypeOfExpression(binaryExpression.left);
58930                     }
58931                 case 1:
58932                 case 6:
58933                 case 3:
58934                     var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
58935                 case 2:
58936                     valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
58937                     var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
58938                     return annotated ? getTypeFromTypeNode(annotated) : undefined;
58939                 case 7:
58940                 case 8:
58941                 case 9:
58942                     return ts.Debug.fail("Does not apply");
58943                 default:
58944                     return ts.Debug.assertNever(kind);
58945             }
58946         }
58947         function isPossiblyAliasedThisProperty(declaration, kind) {
58948             if (kind === void 0) { kind = ts.getAssignmentDeclarationKind(declaration); }
58949             if (kind === 4) {
58950                 return true;
58951             }
58952             if (!ts.isInJSFile(declaration) || kind !== 5 || !ts.isIdentifier(declaration.left.expression)) {
58953                 return false;
58954             }
58955             var name = declaration.left.expression.escapedText;
58956             var symbol = resolveName(declaration.left, name, 111551, undefined, undefined, true, true);
58957             return ts.isThisInitializedDeclaration(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration);
58958         }
58959         function getContextualTypeForThisPropertyAssignment(binaryExpression) {
58960             if (!binaryExpression.symbol)
58961                 return getTypeOfExpression(binaryExpression.left);
58962             if (binaryExpression.symbol.valueDeclaration) {
58963                 var annotated = ts.getEffectiveTypeAnnotationNode(binaryExpression.symbol.valueDeclaration);
58964                 if (annotated) {
58965                     var type = getTypeFromTypeNode(annotated);
58966                     if (type) {
58967                         return type;
58968                     }
58969                 }
58970             }
58971             var thisAccess = ts.cast(binaryExpression.left, ts.isAccessExpression);
58972             if (!ts.isObjectLiteralMethod(ts.getThisContainer(thisAccess.expression, false))) {
58973                 return undefined;
58974             }
58975             var thisType = checkThisExpression(thisAccess.expression);
58976             var nameStr = ts.getElementOrPropertyAccessName(thisAccess);
58977             return nameStr !== undefined && getTypeOfPropertyOfContextualType(thisType, nameStr) || undefined;
58978         }
58979         function isCircularMappedProperty(symbol) {
58980             return !!(ts.getCheckFlags(symbol) & 262144 && !symbol.type && findResolutionCycleStartIndex(symbol, 0) >= 0);
58981         }
58982         function getTypeOfPropertyOfContextualType(type, name) {
58983             return mapType(type, function (t) {
58984                 var _a;
58985                 if (isGenericMappedType(t)) {
58986                     var constraint = getConstraintTypeFromMappedType(t);
58987                     var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
58988                     var propertyNameType = getStringLiteralType(ts.unescapeLeadingUnderscores(name));
58989                     if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
58990                         return substituteIndexedMappedType(t, propertyNameType);
58991                     }
58992                 }
58993                 else if (t.flags & 3670016) {
58994                     var prop = getPropertyOfType(t, name);
58995                     if (prop) {
58996                         return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
58997                     }
58998                     if (isTupleType(t)) {
58999                         var restType = getRestTypeOfTupleType(t);
59000                         if (restType && isNumericLiteralName(name) && +name >= 0) {
59001                             return restType;
59002                         }
59003                     }
59004                     return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
59005                 }
59006                 return undefined;
59007             }, true);
59008         }
59009         function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
59010             ts.Debug.assert(ts.isObjectLiteralMethod(node));
59011             if (node.flags & 16777216) {
59012                 return undefined;
59013             }
59014             return getContextualTypeForObjectLiteralElement(node, contextFlags);
59015         }
59016         function getContextualTypeForObjectLiteralElement(element, contextFlags) {
59017             var objectLiteral = element.parent;
59018             var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
59019             if (propertyAssignmentType) {
59020                 return propertyAssignmentType;
59021             }
59022             var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
59023             if (type) {
59024                 if (hasBindableName(element)) {
59025                     return getTypeOfPropertyOfContextualType(type, getSymbolOfNode(element).escapedName);
59026                 }
59027                 if (element.name) {
59028                     var nameType_2 = getLiteralTypeFromPropertyName(element.name);
59029                     return mapType(type, function (t) { var _a; return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType_2)) === null || _a === void 0 ? void 0 : _a.type; }, true);
59030                 }
59031             }
59032             return undefined;
59033         }
59034         function getContextualTypeForElementExpression(arrayContextualType, index) {
59035             return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index)
59036                 || mapType(arrayContextualType, function (t) { return getIteratedTypeOrElementType(1, t, undefinedType, undefined, false); }, true));
59037         }
59038         function getContextualTypeForConditionalOperand(node, contextFlags) {
59039             var conditional = node.parent;
59040             return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
59041         }
59042         function getContextualTypeForChildJsxExpression(node, child) {
59043             var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
59044             var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
59045             if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
59046                 return undefined;
59047             }
59048             var realChildren = ts.getSemanticJsxChildren(node.children);
59049             var childIndex = realChildren.indexOf(child);
59050             var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
59051             return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
59052                 if (isArrayLikeType(t)) {
59053                     return getIndexedAccessType(t, getNumberLiteralType(childIndex));
59054                 }
59055                 else {
59056                     return t;
59057                 }
59058             }, true));
59059         }
59060         function getContextualTypeForJsxExpression(node) {
59061             var exprParent = node.parent;
59062             return ts.isJsxAttributeLike(exprParent)
59063                 ? getContextualType(node)
59064                 : ts.isJsxElement(exprParent)
59065                     ? getContextualTypeForChildJsxExpression(exprParent, node)
59066                     : undefined;
59067         }
59068         function getContextualTypeForJsxAttribute(attribute) {
59069             if (ts.isJsxAttribute(attribute)) {
59070                 var attributesType = getApparentTypeOfContextualType(attribute.parent);
59071                 if (!attributesType || isTypeAny(attributesType)) {
59072                     return undefined;
59073                 }
59074                 return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
59075             }
59076             else {
59077                 return getContextualType(attribute.parent);
59078             }
59079         }
59080         function isPossiblyDiscriminantValue(node) {
59081             switch (node.kind) {
59082                 case 10:
59083                 case 8:
59084                 case 9:
59085                 case 14:
59086                 case 110:
59087                 case 95:
59088                 case 104:
59089                 case 79:
59090                 case 152:
59091                     return true;
59092                 case 205:
59093                 case 211:
59094                     return isPossiblyDiscriminantValue(node.expression);
59095                 case 287:
59096                     return !node.expression || isPossiblyDiscriminantValue(node.expression);
59097             }
59098             return false;
59099         }
59100         function discriminateContextualTypeByObjectMembers(node, contextualType) {
59101             return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 294 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
59102         }
59103         function discriminateContextualTypeByJSXAttributes(node, contextualType) {
59104             return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
59105         }
59106         function getApparentTypeOfContextualType(node, contextFlags) {
59107             var contextualType = ts.isObjectLiteralMethod(node) ?
59108                 getContextualTypeForObjectLiteralMethod(node, contextFlags) :
59109                 getContextualType(node, contextFlags);
59110             var instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
59111             if (instantiatedType && !(contextFlags && contextFlags & 2 && instantiatedType.flags & 8650752)) {
59112                 var apparentType = mapType(instantiatedType, getApparentType, true);
59113                 return apparentType.flags & 1048576 && ts.isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) :
59114                     apparentType.flags & 1048576 && ts.isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) :
59115                         apparentType;
59116             }
59117         }
59118         function instantiateContextualType(contextualType, node, contextFlags) {
59119             if (contextualType && maybeTypeOfKind(contextualType, 465829888)) {
59120                 var inferenceContext = getInferenceContext(node);
59121                 if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
59122                     if (contextFlags && contextFlags & 1) {
59123                         return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
59124                     }
59125                     if (inferenceContext.returnMapper) {
59126                         return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
59127                     }
59128                 }
59129             }
59130             return contextualType;
59131         }
59132         function instantiateInstantiableTypes(type, mapper) {
59133             if (type.flags & 465829888) {
59134                 return instantiateType(type, mapper);
59135             }
59136             if (type.flags & 1048576) {
59137                 return getUnionType(ts.map(type.types, function (t) { return instantiateInstantiableTypes(t, mapper); }), 0);
59138             }
59139             if (type.flags & 2097152) {
59140                 return getIntersectionType(ts.map(type.types, function (t) { return instantiateInstantiableTypes(t, mapper); }));
59141             }
59142             return type;
59143         }
59144         function getContextualType(node, contextFlags) {
59145             if (node.flags & 16777216) {
59146                 return undefined;
59147             }
59148             if (node.contextualType) {
59149                 return node.contextualType;
59150             }
59151             var parent = node.parent;
59152             switch (parent.kind) {
59153                 case 253:
59154                 case 163:
59155                 case 166:
59156                 case 165:
59157                 case 202:
59158                     return getContextualTypeForInitializerExpression(node, contextFlags);
59159                 case 213:
59160                 case 246:
59161                     return getContextualTypeForReturnExpression(node);
59162                 case 223:
59163                     return getContextualTypeForYieldOperand(parent);
59164                 case 217:
59165                     return getContextualTypeForAwaitOperand(parent, contextFlags);
59166                 case 207:
59167                 case 208:
59168                     return getContextualTypeForArgument(parent, node);
59169                 case 210:
59170                 case 228:
59171                     return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type);
59172                 case 220:
59173                     return getContextualTypeForBinaryOperand(node, contextFlags);
59174                 case 294:
59175                 case 295:
59176                     return getContextualTypeForObjectLiteralElement(parent, contextFlags);
59177                 case 296:
59178                     return getContextualType(parent.parent, contextFlags);
59179                 case 203: {
59180                     var arrayLiteral = parent;
59181                     var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
59182                     return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
59183                 }
59184                 case 221:
59185                     return getContextualTypeForConditionalOperand(node, contextFlags);
59186                 case 232:
59187                     ts.Debug.assert(parent.parent.kind === 222);
59188                     return getContextualTypeForSubstitutionExpression(parent.parent, node);
59189                 case 211: {
59190                     var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
59191                     return !tag ? getContextualType(parent, contextFlags) :
59192                         ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) :
59193                             getTypeFromTypeNode(tag.typeExpression.type);
59194                 }
59195                 case 229:
59196                     return getContextualType(parent, contextFlags);
59197                 case 287:
59198                     return getContextualTypeForJsxExpression(parent);
59199                 case 284:
59200                 case 286:
59201                     return getContextualTypeForJsxAttribute(parent);
59202                 case 279:
59203                 case 278:
59204                     return getContextualJsxElementAttributesType(parent, contextFlags);
59205             }
59206             return undefined;
59207             function tryFindWhenConstTypeReference(node) {
59208                 return getContextualType(node);
59209             }
59210         }
59211         function getInferenceContext(node) {
59212             var ancestor = ts.findAncestor(node, function (n) { return !!n.inferenceContext; });
59213             return ancestor && ancestor.inferenceContext;
59214         }
59215         function getContextualJsxElementAttributesType(node, contextFlags) {
59216             if (ts.isJsxOpeningElement(node) && node.parent.contextualType && contextFlags !== 4) {
59217                 return node.parent.contextualType;
59218             }
59219             return getContextualTypeForArgumentAtIndex(node, 0);
59220         }
59221         function getEffectiveFirstArgumentForJsxSignature(signature, node) {
59222             return getJsxReferenceKind(node) !== 0
59223                 ? getJsxPropsTypeFromCallSignature(signature, node)
59224                 : getJsxPropsTypeFromClassType(signature, node);
59225         }
59226         function getJsxPropsTypeFromCallSignature(sig, context) {
59227             var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
59228             propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
59229             var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
59230             if (!isErrorType(intrinsicAttribs)) {
59231                 propsType = intersectTypes(intrinsicAttribs, propsType);
59232             }
59233             return propsType;
59234         }
59235         function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) {
59236             if (sig.compositeSignatures) {
59237                 var results = [];
59238                 for (var _i = 0, _a = sig.compositeSignatures; _i < _a.length; _i++) {
59239                     var signature = _a[_i];
59240                     var instance = getReturnTypeOfSignature(signature);
59241                     if (isTypeAny(instance)) {
59242                         return instance;
59243                     }
59244                     var propType = getTypeOfPropertyOfType(instance, forcedLookupLocation);
59245                     if (!propType) {
59246                         return;
59247                     }
59248                     results.push(propType);
59249                 }
59250                 return getIntersectionType(results);
59251             }
59252             var instanceType = getReturnTypeOfSignature(sig);
59253             return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation);
59254         }
59255         function getStaticTypeOfReferencedJsxConstructor(context) {
59256             if (isJsxIntrinsicIdentifier(context.tagName)) {
59257                 var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context);
59258                 var fakeSignature = createSignatureForJSXIntrinsic(context, result);
59259                 return getOrCreateTypeFromSignature(fakeSignature);
59260             }
59261             var tagType = checkExpressionCached(context.tagName);
59262             if (tagType.flags & 128) {
59263                 var result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context);
59264                 if (!result) {
59265                     return errorType;
59266                 }
59267                 var fakeSignature = createSignatureForJSXIntrinsic(context, result);
59268                 return getOrCreateTypeFromSignature(fakeSignature);
59269             }
59270             return tagType;
59271         }
59272         function getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType) {
59273             var managedSym = getJsxLibraryManagedAttributes(ns);
59274             if (managedSym) {
59275                 var declaredManagedType = getDeclaredTypeOfSymbol(managedSym);
59276                 var ctorType = getStaticTypeOfReferencedJsxConstructor(context);
59277                 if (managedSym.flags & 524288) {
59278                     var params = getSymbolLinks(managedSym).typeParameters;
59279                     if (ts.length(params) >= 2) {
59280                         var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts.isInJSFile(context));
59281                         return getTypeAliasInstantiation(managedSym, args);
59282                     }
59283                 }
59284                 if (ts.length(declaredManagedType.typeParameters) >= 2) {
59285                     var args = fillMissingTypeArguments([ctorType, attributesType], declaredManagedType.typeParameters, 2, ts.isInJSFile(context));
59286                     return createTypeReference(declaredManagedType, args);
59287                 }
59288             }
59289             return attributesType;
59290         }
59291         function getJsxPropsTypeFromClassType(sig, context) {
59292             var ns = getJsxNamespaceAt(context);
59293             var forcedLookupLocation = getJsxElementPropertiesName(ns);
59294             var attributesType = forcedLookupLocation === undefined
59295                 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
59296                 : forcedLookupLocation === ""
59297                     ? getReturnTypeOfSignature(sig)
59298                     : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
59299             if (!attributesType) {
59300                 if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
59301                     error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
59302                 }
59303                 return unknownType;
59304             }
59305             attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
59306             if (isTypeAny(attributesType)) {
59307                 return attributesType;
59308             }
59309             else {
59310                 var apparentAttributesType = attributesType;
59311                 var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context);
59312                 if (!isErrorType(intrinsicClassAttribs)) {
59313                     var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
59314                     var hostClassType = getReturnTypeOfSignature(sig);
59315                     apparentAttributesType = intersectTypes(typeParams
59316                         ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)))
59317                         : intrinsicClassAttribs, apparentAttributesType);
59318                 }
59319                 var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
59320                 if (!isErrorType(intrinsicAttribs)) {
59321                     apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);
59322                 }
59323                 return apparentAttributesType;
59324             }
59325         }
59326         function getIntersectedSignatures(signatures) {
59327             return ts.getStrictOptionValue(compilerOptions, "noImplicitAny")
59328                 ? ts.reduceLeft(signatures, function (left, right) {
59329                     return left === right || !left ? left
59330                         : compareTypeParametersIdentical(left.typeParameters, right.typeParameters) ? combineSignaturesOfIntersectionMembers(left, right)
59331                             : undefined;
59332                 })
59333                 : undefined;
59334         }
59335         function combineIntersectionThisParam(left, right, mapper) {
59336             if (!left || !right) {
59337                 return left || right;
59338             }
59339             var thisType = getUnionType([getTypeOfSymbol(left), instantiateType(getTypeOfSymbol(right), mapper)]);
59340             return createSymbolWithType(left, thisType);
59341         }
59342         function combineIntersectionParameters(left, right, mapper) {
59343             var leftCount = getParameterCount(left);
59344             var rightCount = getParameterCount(right);
59345             var longest = leftCount >= rightCount ? left : right;
59346             var shorter = longest === left ? right : left;
59347             var longestCount = longest === left ? leftCount : rightCount;
59348             var eitherHasEffectiveRest = (hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right));
59349             var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest);
59350             var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0));
59351             for (var i = 0; i < longestCount; i++) {
59352                 var longestParamType = tryGetTypeAtPosition(longest, i);
59353                 if (longest === right) {
59354                     longestParamType = instantiateType(longestParamType, mapper);
59355                 }
59356                 var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType;
59357                 if (shorter === right) {
59358                     shorterParamType = instantiateType(shorterParamType, mapper);
59359                 }
59360                 var unionParamType = getUnionType([longestParamType, shorterParamType]);
59361                 var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === (longestCount - 1);
59362                 var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter);
59363                 var leftName = i >= leftCount ? undefined : getParameterNameAtPosition(left, i);
59364                 var rightName = i >= rightCount ? undefined : getParameterNameAtPosition(right, i);
59365                 var paramName = leftName === rightName ? leftName :
59366                     !leftName ? rightName :
59367                         !rightName ? leftName :
59368                             undefined;
59369                 var paramSymbol = createSymbol(1 | (isOptional && !isRestParam ? 16777216 : 0), paramName || "arg".concat(i));
59370                 paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
59371                 params[i] = paramSymbol;
59372             }
59373             if (needsExtraRestElement) {
59374                 var restParamSymbol = createSymbol(1, "args");
59375                 restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount));
59376                 if (shorter === right) {
59377                     restParamSymbol.type = instantiateType(restParamSymbol.type, mapper);
59378                 }
59379                 params[longestCount] = restParamSymbol;
59380             }
59381             return params;
59382         }
59383         function combineSignaturesOfIntersectionMembers(left, right) {
59384             var typeParams = left.typeParameters || right.typeParameters;
59385             var paramMapper;
59386             if (left.typeParameters && right.typeParameters) {
59387                 paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
59388             }
59389             var declaration = left.declaration;
59390             var params = combineIntersectionParameters(left, right, paramMapper);
59391             var thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
59392             var minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
59393             var result = createSignature(declaration, typeParams, thisParam, params, undefined, undefined, minArgCount, (left.flags | right.flags) & 39);
59394             result.compositeKind = 2097152;
59395             result.compositeSignatures = ts.concatenate(left.compositeKind === 2097152 && left.compositeSignatures || [left], [right]);
59396             if (paramMapper) {
59397                 result.mapper = left.compositeKind === 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper;
59398             }
59399             return result;
59400         }
59401         function getContextualCallSignature(type, node) {
59402             var signatures = getSignaturesOfType(type, 0);
59403             var applicableByArity = ts.filter(signatures, function (s) { return !isAritySmaller(s, node); });
59404             return applicableByArity.length === 1 ? applicableByArity[0] : getIntersectedSignatures(applicableByArity);
59405         }
59406         function isAritySmaller(signature, target) {
59407             var targetParameterCount = 0;
59408             for (; targetParameterCount < target.parameters.length; targetParameterCount++) {
59409                 var param = target.parameters[targetParameterCount];
59410                 if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {
59411                     break;
59412                 }
59413             }
59414             if (target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0])) {
59415                 targetParameterCount--;
59416             }
59417             return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
59418         }
59419         function getContextualSignatureForFunctionLikeDeclaration(node) {
59420             return ts.isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
59421                 ? getContextualSignature(node)
59422                 : undefined;
59423         }
59424         function getContextualSignature(node) {
59425             ts.Debug.assert(node.kind !== 168 || ts.isObjectLiteralMethod(node));
59426             var typeTagSignature = getSignatureOfTypeTag(node);
59427             if (typeTagSignature) {
59428                 return typeTagSignature;
59429             }
59430             var type = getApparentTypeOfContextualType(node, 1);
59431             if (!type) {
59432                 return undefined;
59433             }
59434             if (!(type.flags & 1048576)) {
59435                 return getContextualCallSignature(type, node);
59436             }
59437             var signatureList;
59438             var types = type.types;
59439             for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
59440                 var current = types_19[_i];
59441                 var signature = getContextualCallSignature(current, node);
59442                 if (signature) {
59443                     if (!signatureList) {
59444                         signatureList = [signature];
59445                     }
59446                     else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) {
59447                         return undefined;
59448                     }
59449                     else {
59450                         signatureList.push(signature);
59451                     }
59452                 }
59453             }
59454             if (signatureList) {
59455                 return signatureList.length === 1 ? signatureList[0] : createUnionSignature(signatureList[0], signatureList);
59456             }
59457         }
59458         function checkSpreadExpression(node, checkMode) {
59459             if (languageVersion < 2) {
59460                 checkExternalEmitHelpers(node, compilerOptions.downlevelIteration ? 1536 : 1024);
59461             }
59462             var arrayOrIterableType = checkExpression(node.expression, checkMode);
59463             return checkIteratedTypeOrElementType(33, arrayOrIterableType, undefinedType, node.expression);
59464         }
59465         function checkSyntheticExpression(node) {
59466             return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
59467         }
59468         function hasDefaultValue(node) {
59469             return (node.kind === 202 && !!node.initializer) ||
59470                 (node.kind === 220 && node.operatorToken.kind === 63);
59471         }
59472         function checkArrayLiteral(node, checkMode, forceTuple) {
59473             var elements = node.elements;
59474             var elementCount = elements.length;
59475             var elementTypes = [];
59476             var elementFlags = [];
59477             var contextualType = getApparentTypeOfContextualType(node);
59478             var inDestructuringPattern = ts.isAssignmentTarget(node);
59479             var inConstContext = isConstContext(node);
59480             var hasOmittedExpression = false;
59481             for (var i = 0; i < elementCount; i++) {
59482                 var e = elements[i];
59483                 if (e.kind === 224) {
59484                     if (languageVersion < 2) {
59485                         checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 : 1024);
59486                     }
59487                     var spreadType = checkExpression(e.expression, checkMode, forceTuple);
59488                     if (isArrayLikeType(spreadType)) {
59489                         elementTypes.push(spreadType);
59490                         elementFlags.push(8);
59491                     }
59492                     else if (inDestructuringPattern) {
59493                         var restElementType = getIndexTypeOfType(spreadType, numberType) ||
59494                             getIteratedTypeOrElementType(65, spreadType, undefinedType, undefined, false) ||
59495                             unknownType;
59496                         elementTypes.push(restElementType);
59497                         elementFlags.push(4);
59498                     }
59499                     else {
59500                         elementTypes.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, e.expression));
59501                         elementFlags.push(4);
59502                     }
59503                 }
59504                 else if (exactOptionalPropertyTypes && e.kind === 226) {
59505                     hasOmittedExpression = true;
59506                     elementTypes.push(missingType);
59507                     elementFlags.push(2);
59508                 }
59509                 else {
59510                     var elementContextualType = getContextualTypeForElementExpression(contextualType, elementTypes.length);
59511                     var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
59512                     elementTypes.push(addOptionality(type, true, hasOmittedExpression));
59513                     elementFlags.push(hasOmittedExpression ? 2 : 1);
59514                 }
59515             }
59516             if (inDestructuringPattern) {
59517                 return createTupleType(elementTypes, elementFlags);
59518             }
59519             if (forceTuple || inConstContext || contextualType && someType(contextualType, isTupleLikeType)) {
59520                 return createArrayLiteralType(createTupleType(elementTypes, elementFlags, inConstContext));
59521             }
59522             return createArrayLiteralType(createArrayType(elementTypes.length ?
59523                 getUnionType(ts.sameMap(elementTypes, function (t, i) { return elementFlags[i] & 8 ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t; }), 2) :
59524                 strictNullChecks ? implicitNeverType : undefinedWideningType, inConstContext));
59525         }
59526         function createArrayLiteralType(type) {
59527             if (!(ts.getObjectFlags(type) & 4)) {
59528                 return type;
59529             }
59530             var literalType = type.literalType;
59531             if (!literalType) {
59532                 literalType = type.literalType = cloneTypeReference(type);
59533                 literalType.objectFlags |= 32768 | 262144;
59534             }
59535             return literalType;
59536         }
59537         function isNumericName(name) {
59538             switch (name.kind) {
59539                 case 161:
59540                     return isNumericComputedName(name);
59541                 case 79:
59542                     return isNumericLiteralName(name.escapedText);
59543                 case 8:
59544                 case 10:
59545                     return isNumericLiteralName(name.text);
59546                 default:
59547                     return false;
59548             }
59549         }
59550         function isNumericComputedName(name) {
59551             return isTypeAssignableToKind(checkComputedPropertyName(name), 296);
59552         }
59553         function isNumericLiteralName(name) {
59554             return (+name).toString() === name;
59555         }
59556         function checkComputedPropertyName(node) {
59557             var links = getNodeLinks(node.expression);
59558             if (!links.resolvedType) {
59559                 if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent))
59560                     && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101) {
59561                     return links.resolvedType = errorType;
59562                 }
59563                 links.resolvedType = checkExpression(node.expression);
59564                 if (ts.isPropertyDeclaration(node.parent) && !ts.hasStaticModifier(node.parent) && ts.isClassExpression(node.parent.parent)) {
59565                     var container = ts.getEnclosingBlockScopeContainer(node.parent.parent);
59566                     var enclosingIterationStatement = getEnclosingIterationStatement(container);
59567                     if (enclosingIterationStatement) {
59568                         getNodeLinks(enclosingIterationStatement).flags |= 65536;
59569                         getNodeLinks(node).flags |= 524288;
59570                         getNodeLinks(node.parent.parent).flags |= 524288;
59571                     }
59572                 }
59573                 if (links.resolvedType.flags & 98304 ||
59574                     !isTypeAssignableToKind(links.resolvedType, 402653316 | 296 | 12288) &&
59575                         !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
59576                     error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any);
59577                 }
59578             }
59579             return links.resolvedType;
59580         }
59581         function isSymbolWithNumericName(symbol) {
59582             var _a;
59583             var firstDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0];
59584             return isNumericLiteralName(symbol.escapedName) || (firstDecl && ts.isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name));
59585         }
59586         function isSymbolWithSymbolName(symbol) {
59587             var _a;
59588             var firstDecl = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0];
59589             return ts.isKnownSymbol(symbol) || (firstDecl && ts.isNamedDeclaration(firstDecl) && ts.isComputedPropertyName(firstDecl.name) &&
59590                 isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096));
59591         }
59592         function getObjectLiteralIndexInfo(node, offset, properties, keyType) {
59593             var propTypes = [];
59594             for (var i = offset; i < properties.length; i++) {
59595                 var prop = properties[i];
59596                 if (keyType === stringType && !isSymbolWithSymbolName(prop) ||
59597                     keyType === numberType && isSymbolWithNumericName(prop) ||
59598                     keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
59599                     propTypes.push(getTypeOfSymbol(properties[i]));
59600                 }
59601             }
59602             var unionType = propTypes.length ? getUnionType(propTypes, 2) : undefinedType;
59603             return createIndexInfo(keyType, unionType, isConstContext(node));
59604         }
59605         function getImmediateAliasedSymbol(symbol) {
59606             ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here.");
59607             var links = getSymbolLinks(symbol);
59608             if (!links.immediateTarget) {
59609                 var node = getDeclarationOfAliasSymbol(symbol);
59610                 if (!node)
59611                     return ts.Debug.fail();
59612                 links.immediateTarget = getTargetOfAliasDeclaration(node, true);
59613             }
59614             return links.immediateTarget;
59615         }
59616         function checkObjectLiteral(node, checkMode) {
59617             var inDestructuringPattern = ts.isAssignmentTarget(node);
59618             checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
59619             var allPropertiesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
59620             var propertiesTable = ts.createSymbolTable();
59621             var propertiesArray = [];
59622             var spread = emptyObjectType;
59623             var contextualType = getApparentTypeOfContextualType(node);
59624             var contextualTypeHasPattern = contextualType && contextualType.pattern &&
59625                 (contextualType.pattern.kind === 200 || contextualType.pattern.kind === 204);
59626             var inConstContext = isConstContext(node);
59627             var checkFlags = inConstContext ? 8 : 0;
59628             var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
59629             var enumTag = ts.getJSDocEnumTag(node);
59630             var isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
59631             var objectFlags = freshObjectLiteralFlag;
59632             var patternWithComputedProperties = false;
59633             var hasComputedStringProperty = false;
59634             var hasComputedNumberProperty = false;
59635             var hasComputedSymbolProperty = false;
59636             for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
59637                 var elem = _a[_i];
59638                 if (elem.name && ts.isComputedPropertyName(elem.name)) {
59639                     checkComputedPropertyName(elem.name);
59640                 }
59641             }
59642             var offset = 0;
59643             for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
59644                 var memberDecl = _c[_b];
59645                 var member = getSymbolOfNode(memberDecl);
59646                 var computedNameType = memberDecl.name && memberDecl.name.kind === 161 ?
59647                     checkComputedPropertyName(memberDecl.name) : undefined;
59648                 if (memberDecl.kind === 294 ||
59649                     memberDecl.kind === 295 ||
59650                     ts.isObjectLiteralMethod(memberDecl)) {
59651                     var type = memberDecl.kind === 294 ? checkPropertyAssignment(memberDecl, checkMode) :
59652                         memberDecl.kind === 295 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) :
59653                             checkObjectLiteralMethod(memberDecl, checkMode);
59654                     if (isInJavascript) {
59655                         var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
59656                         if (jsDocType) {
59657                             checkTypeAssignableTo(type, jsDocType, memberDecl);
59658                             type = jsDocType;
59659                         }
59660                         else if (enumTag && enumTag.typeExpression) {
59661                             checkTypeAssignableTo(type, getTypeFromTypeNode(enumTag.typeExpression), memberDecl);
59662                         }
59663                     }
59664                     objectFlags |= ts.getObjectFlags(type) & 917504;
59665                     var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
59666                     var prop = nameType ?
59667                         createSymbol(4 | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096) :
59668                         createSymbol(4 | member.flags, member.escapedName, checkFlags);
59669                     if (nameType) {
59670                         prop.nameType = nameType;
59671                     }
59672                     if (inDestructuringPattern) {
59673                         var isOptional = (memberDecl.kind === 294 && hasDefaultValue(memberDecl.initializer)) ||
59674                             (memberDecl.kind === 295 && memberDecl.objectAssignmentInitializer);
59675                         if (isOptional) {
59676                             prop.flags |= 16777216;
59677                         }
59678                     }
59679                     else if (contextualTypeHasPattern && !(ts.getObjectFlags(contextualType) & 512)) {
59680                         var impliedProp = getPropertyOfType(contextualType, member.escapedName);
59681                         if (impliedProp) {
59682                             prop.flags |= impliedProp.flags & 16777216;
59683                         }
59684                         else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
59685                             error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));
59686                         }
59687                     }
59688                     prop.declarations = member.declarations;
59689                     prop.parent = member.parent;
59690                     if (member.valueDeclaration) {
59691                         prop.valueDeclaration = member.valueDeclaration;
59692                     }
59693                     prop.type = type;
59694                     prop.target = member;
59695                     member = prop;
59696                     allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
59697                 }
59698                 else if (memberDecl.kind === 296) {
59699                     if (languageVersion < 2) {
59700                         checkExternalEmitHelpers(memberDecl, 2);
59701                     }
59702                     if (propertiesArray.length > 0) {
59703                         spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext);
59704                         propertiesArray = [];
59705                         propertiesTable = ts.createSymbolTable();
59706                         hasComputedStringProperty = false;
59707                         hasComputedNumberProperty = false;
59708                         hasComputedSymbolProperty = false;
59709                     }
59710                     var type = getReducedType(checkExpression(memberDecl.expression));
59711                     if (isValidSpreadType(type)) {
59712                         var mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext);
59713                         if (allPropertiesTable) {
59714                             checkSpreadPropOverrides(mergedType, allPropertiesTable, memberDecl);
59715                         }
59716                         offset = propertiesArray.length;
59717                         if (isErrorType(spread)) {
59718                             continue;
59719                         }
59720                         spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
59721                     }
59722                     else {
59723                         error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
59724                         spread = errorType;
59725                     }
59726                     continue;
59727                 }
59728                 else {
59729                     ts.Debug.assert(memberDecl.kind === 171 || memberDecl.kind === 172);
59730                     checkNodeDeferred(memberDecl);
59731                 }
59732                 if (computedNameType && !(computedNameType.flags & 8576)) {
59733                     if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) {
59734                         if (isTypeAssignableTo(computedNameType, numberType)) {
59735                             hasComputedNumberProperty = true;
59736                         }
59737                         else if (isTypeAssignableTo(computedNameType, esSymbolType)) {
59738                             hasComputedSymbolProperty = true;
59739                         }
59740                         else {
59741                             hasComputedStringProperty = true;
59742                         }
59743                         if (inDestructuringPattern) {
59744                             patternWithComputedProperties = true;
59745                         }
59746                     }
59747                 }
59748                 else {
59749                     propertiesTable.set(member.escapedName, member);
59750                 }
59751                 propertiesArray.push(member);
59752             }
59753             if (contextualTypeHasPattern && node.parent.kind !== 296) {
59754                 for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) {
59755                     var prop = _e[_d];
59756                     if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
59757                         if (!(prop.flags & 16777216)) {
59758                             error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
59759                         }
59760                         propertiesTable.set(prop.escapedName, prop);
59761                         propertiesArray.push(prop);
59762                     }
59763                 }
59764             }
59765             if (isErrorType(spread)) {
59766                 return errorType;
59767             }
59768             if (spread !== emptyObjectType) {
59769                 if (propertiesArray.length > 0) {
59770                     spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext);
59771                     propertiesArray = [];
59772                     propertiesTable = ts.createSymbolTable();
59773                     hasComputedStringProperty = false;
59774                     hasComputedNumberProperty = false;
59775                 }
59776                 return mapType(spread, function (t) { return t === emptyObjectType ? createObjectLiteralType() : t; });
59777             }
59778             return createObjectLiteralType();
59779             function createObjectLiteralType() {
59780                 var indexInfos = [];
59781                 if (hasComputedStringProperty)
59782                     indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, stringType));
59783                 if (hasComputedNumberProperty)
59784                     indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, numberType));
59785                 if (hasComputedSymbolProperty)
59786                     indexInfos.push(getObjectLiteralIndexInfo(node, offset, propertiesArray, esSymbolType));
59787                 var result = createAnonymousType(node.symbol, propertiesTable, ts.emptyArray, ts.emptyArray, indexInfos);
59788                 result.objectFlags |= objectFlags | 128 | 262144;
59789                 if (isJSObjectLiteral) {
59790                     result.objectFlags |= 8192;
59791                 }
59792                 if (patternWithComputedProperties) {
59793                     result.objectFlags |= 512;
59794                 }
59795                 if (inDestructuringPattern) {
59796                     result.pattern = node;
59797                 }
59798                 return result;
59799             }
59800         }
59801         function isValidSpreadType(type) {
59802             if (type.flags & 465829888) {
59803                 var constraint = getBaseConstraintOfType(type);
59804                 if (constraint !== undefined) {
59805                     return isValidSpreadType(constraint);
59806                 }
59807             }
59808             return !!(type.flags & (1 | 67108864 | 524288 | 58982400) ||
59809                 getFalsyFlags(type) & 117632 && isValidSpreadType(removeDefinitelyFalsyTypes(type)) ||
59810                 type.flags & 3145728 && ts.every(type.types, isValidSpreadType));
59811         }
59812         function checkJsxSelfClosingElementDeferred(node) {
59813             checkJsxOpeningLikeElementOrOpeningFragment(node);
59814         }
59815         function checkJsxSelfClosingElement(node, _checkMode) {
59816             checkNodeDeferred(node);
59817             return getJsxElementTypeAt(node) || anyType;
59818         }
59819         function checkJsxElementDeferred(node) {
59820             checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement);
59821             if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) {
59822                 getIntrinsicTagSymbol(node.closingElement);
59823             }
59824             else {
59825                 checkExpression(node.closingElement.tagName);
59826             }
59827             checkJsxChildren(node);
59828         }
59829         function checkJsxElement(node, _checkMode) {
59830             checkNodeDeferred(node);
59831             return getJsxElementTypeAt(node) || anyType;
59832         }
59833         function checkJsxFragment(node) {
59834             checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
59835             var nodeSourceFile = ts.getSourceFileOfNode(node);
59836             if (ts.getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx"))
59837                 && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
59838                 error(node, compilerOptions.jsxFactory
59839                     ? ts.Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option
59840                     : ts.Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments);
59841             }
59842             checkJsxChildren(node);
59843             return getJsxElementTypeAt(node) || anyType;
59844         }
59845         function isHyphenatedJsxName(name) {
59846             return ts.stringContains(name, "-");
59847         }
59848         function isJsxIntrinsicIdentifier(tagName) {
59849             return tagName.kind === 79 && ts.isIntrinsicJsxName(tagName.escapedText);
59850         }
59851         function checkJsxAttribute(node, checkMode) {
59852             return node.initializer
59853                 ? checkExpressionForMutableLocation(node.initializer, checkMode)
59854                 : trueType;
59855         }
59856         function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
59857             var attributes = openingLikeElement.attributes;
59858             var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined;
59859             var attributesTable = ts.createSymbolTable();
59860             var spread = emptyJsxObjectType;
59861             var hasSpreadAnyType = false;
59862             var typeToIntersect;
59863             var explicitlySpecifyChildrenAttribute = false;
59864             var objectFlags = 2048;
59865             var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(openingLikeElement));
59866             for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) {
59867                 var attributeDecl = _a[_i];
59868                 var member = attributeDecl.symbol;
59869                 if (ts.isJsxAttribute(attributeDecl)) {
59870                     var exprType = checkJsxAttribute(attributeDecl, checkMode);
59871                     objectFlags |= ts.getObjectFlags(exprType) & 917504;
59872                     var attributeSymbol = createSymbol(4 | member.flags, member.escapedName);
59873                     attributeSymbol.declarations = member.declarations;
59874                     attributeSymbol.parent = member.parent;
59875                     if (member.valueDeclaration) {
59876                         attributeSymbol.valueDeclaration = member.valueDeclaration;
59877                     }
59878                     attributeSymbol.type = exprType;
59879                     attributeSymbol.target = member;
59880                     attributesTable.set(attributeSymbol.escapedName, attributeSymbol);
59881                     allAttributesTable === null || allAttributesTable === void 0 ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol);
59882                     if (attributeDecl.name.escapedText === jsxChildrenPropertyName) {
59883                         explicitlySpecifyChildrenAttribute = true;
59884                     }
59885                 }
59886                 else {
59887                     ts.Debug.assert(attributeDecl.kind === 286);
59888                     if (attributesTable.size > 0) {
59889                         spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false);
59890                         attributesTable = ts.createSymbolTable();
59891                     }
59892                     var exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode));
59893                     if (isTypeAny(exprType)) {
59894                         hasSpreadAnyType = true;
59895                     }
59896                     if (isValidSpreadType(exprType)) {
59897                         spread = getSpreadType(spread, exprType, attributes.symbol, objectFlags, false);
59898                         if (allAttributesTable) {
59899                             checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
59900                         }
59901                     }
59902                     else {
59903                         typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
59904                     }
59905                 }
59906             }
59907             if (!hasSpreadAnyType) {
59908                 if (attributesTable.size > 0) {
59909                     spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false);
59910                 }
59911             }
59912             var parent = openingLikeElement.parent.kind === 277 ? openingLikeElement.parent : undefined;
59913             if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
59914                 var childrenTypes = checkJsxChildren(parent, checkMode);
59915                 if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
59916                     if (explicitlySpecifyChildrenAttribute) {
59917                         error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
59918                     }
59919                     var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
59920                     var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
59921                     var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
59922                     childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
59923                         childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) :
59924                             createArrayType(getUnionType(childrenTypes));
59925                     childrenPropSymbol.valueDeclaration = ts.factory.createPropertySignature(undefined, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName), undefined, undefined);
59926                     ts.setParent(childrenPropSymbol.valueDeclaration, attributes);
59927                     childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol;
59928                     var childPropMap = ts.createSymbolTable();
59929                     childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol);
59930                     spread = getSpreadType(spread, createAnonymousType(attributes.symbol, childPropMap, ts.emptyArray, ts.emptyArray, ts.emptyArray), attributes.symbol, objectFlags, false);
59931                 }
59932             }
59933             if (hasSpreadAnyType) {
59934                 return anyType;
59935             }
59936             if (typeToIntersect && spread !== emptyJsxObjectType) {
59937                 return getIntersectionType([typeToIntersect, spread]);
59938             }
59939             return typeToIntersect || (spread === emptyJsxObjectType ? createJsxAttributesType() : spread);
59940             function createJsxAttributesType() {
59941                 objectFlags |= freshObjectLiteralFlag;
59942                 var result = createAnonymousType(attributes.symbol, attributesTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
59943                 result.objectFlags |= objectFlags | 128 | 262144;
59944                 return result;
59945             }
59946         }
59947         function checkJsxChildren(node, checkMode) {
59948             var childrenTypes = [];
59949             for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
59950                 var child = _a[_i];
59951                 if (child.kind === 11) {
59952                     if (!child.containsOnlyTriviaWhiteSpaces) {
59953                         childrenTypes.push(stringType);
59954                     }
59955                 }
59956                 else if (child.kind === 287 && !child.expression) {
59957                     continue;
59958                 }
59959                 else {
59960                     childrenTypes.push(checkExpressionForMutableLocation(child, checkMode));
59961                 }
59962             }
59963             return childrenTypes;
59964         }
59965         function checkSpreadPropOverrides(type, props, spread) {
59966             for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {
59967                 var right = _a[_i];
59968                 if (!(right.flags & 16777216)) {
59969                     var left = props.get(right.escapedName);
59970                     if (left) {
59971                         var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
59972                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
59973                     }
59974                 }
59975             }
59976         }
59977         function checkJsxAttributes(node, checkMode) {
59978             return createJsxAttributesTypeFromAttributesProperty(node.parent, checkMode);
59979         }
59980         function getJsxType(name, location) {
59981             var namespace = getJsxNamespaceAt(location);
59982             var exports = namespace && getExportsOfSymbol(namespace);
59983             var typeSymbol = exports && getSymbol(exports, name, 788968);
59984             return typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType;
59985         }
59986         function getIntrinsicTagSymbol(node) {
59987             var links = getNodeLinks(node);
59988             if (!links.resolvedSymbol) {
59989                 var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node);
59990                 if (!isErrorType(intrinsicElementsType)) {
59991                     if (!ts.isIdentifier(node.tagName))
59992                         return ts.Debug.fail();
59993                     var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.escapedText);
59994                     if (intrinsicProp) {
59995                         links.jsxFlags |= 1;
59996                         return links.resolvedSymbol = intrinsicProp;
59997                     }
59998                     var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, stringType);
59999                     if (indexSignatureType) {
60000                         links.jsxFlags |= 2;
60001                         return links.resolvedSymbol = intrinsicElementsType.symbol;
60002                     }
60003                     error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.idText(node.tagName), "JSX." + JsxNames.IntrinsicElements);
60004                     return links.resolvedSymbol = unknownSymbol;
60005                 }
60006                 else {
60007                     if (noImplicitAny) {
60008                         error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, ts.unescapeLeadingUnderscores(JsxNames.IntrinsicElements));
60009                     }
60010                     return links.resolvedSymbol = unknownSymbol;
60011                 }
60012             }
60013             return links.resolvedSymbol;
60014         }
60015         function getJsxNamespaceContainerForImplicitImport(location) {
60016             var file = location && ts.getSourceFileOfNode(location);
60017             var links = file && getNodeLinks(file);
60018             if (links && links.jsxImplicitImportContainer === false) {
60019                 return undefined;
60020             }
60021             if (links && links.jsxImplicitImportContainer) {
60022                 return links.jsxImplicitImportContainer;
60023             }
60024             var runtimeImportSpecifier = ts.getJSXRuntimeImport(ts.getJSXImplicitImportBase(compilerOptions, file), compilerOptions);
60025             if (!runtimeImportSpecifier) {
60026                 return undefined;
60027             }
60028             var isClassic = ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Classic;
60029             var errorMessage = isClassic
60030                 ? ts.Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option
60031                 : ts.Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
60032             var mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location);
60033             var result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : undefined;
60034             if (links) {
60035                 links.jsxImplicitImportContainer = result || false;
60036             }
60037             return result;
60038         }
60039         function getJsxNamespaceAt(location) {
60040             var links = location && getNodeLinks(location);
60041             if (links && links.jsxNamespace) {
60042                 return links.jsxNamespace;
60043             }
60044             if (!links || links.jsxNamespace !== false) {
60045                 var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
60046                 if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
60047                     var namespaceName = getJsxNamespace(location);
60048                     resolvedNamespace = resolveName(location, namespaceName, 1920, undefined, namespaceName, false);
60049                 }
60050                 if (resolvedNamespace) {
60051                     var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920));
60052                     if (candidate && candidate !== unknownSymbol) {
60053                         if (links) {
60054                             links.jsxNamespace = candidate;
60055                         }
60056                         return candidate;
60057                     }
60058                 }
60059                 if (links) {
60060                     links.jsxNamespace = false;
60061                 }
60062             }
60063             var s = resolveSymbol(getGlobalSymbol(JsxNames.JSX, 1920, undefined));
60064             if (s === unknownSymbol) {
60065                 return undefined;
60066             }
60067             return s;
60068         }
60069         function getNameFromJsxElementAttributesContainer(nameOfAttribPropContainer, jsxNamespace) {
60070             var jsxElementAttribPropInterfaceSym = jsxNamespace && getSymbol(jsxNamespace.exports, nameOfAttribPropContainer, 788968);
60071             var jsxElementAttribPropInterfaceType = jsxElementAttribPropInterfaceSym && getDeclaredTypeOfSymbol(jsxElementAttribPropInterfaceSym);
60072             var propertiesOfJsxElementAttribPropInterface = jsxElementAttribPropInterfaceType && getPropertiesOfType(jsxElementAttribPropInterfaceType);
60073             if (propertiesOfJsxElementAttribPropInterface) {
60074                 if (propertiesOfJsxElementAttribPropInterface.length === 0) {
60075                     return "";
60076                 }
60077                 else if (propertiesOfJsxElementAttribPropInterface.length === 1) {
60078                     return propertiesOfJsxElementAttribPropInterface[0].escapedName;
60079                 }
60080                 else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) {
60081                     error(jsxElementAttribPropInterfaceSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, ts.unescapeLeadingUnderscores(nameOfAttribPropContainer));
60082                 }
60083             }
60084             return undefined;
60085         }
60086         function getJsxLibraryManagedAttributes(jsxNamespace) {
60087             return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968);
60088         }
60089         function getJsxElementPropertiesName(jsxNamespace) {
60090             return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
60091         }
60092         function getJsxElementChildrenPropertyName(jsxNamespace) {
60093             return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
60094         }
60095         function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
60096             if (elementType.flags & 4) {
60097                 return [anySignature];
60098             }
60099             else if (elementType.flags & 128) {
60100                 var intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
60101                 if (!intrinsicType) {
60102                     error(caller, ts.Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
60103                     return ts.emptyArray;
60104                 }
60105                 else {
60106                     var fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
60107                     return [fakeSignature];
60108                 }
60109             }
60110             var apparentElemType = getApparentType(elementType);
60111             var signatures = getSignaturesOfType(apparentElemType, 1);
60112             if (signatures.length === 0) {
60113                 signatures = getSignaturesOfType(apparentElemType, 0);
60114             }
60115             if (signatures.length === 0 && apparentElemType.flags & 1048576) {
60116                 signatures = getUnionSignatures(ts.map(apparentElemType.types, function (t) { return getUninstantiatedJsxSignaturesOfType(t, caller); }));
60117             }
60118             return signatures;
60119         }
60120         function getIntrinsicAttributesTypeFromStringLiteralType(type, location) {
60121             var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, location);
60122             if (!isErrorType(intrinsicElementsType)) {
60123                 var stringLiteralTypeName = type.value;
60124                 var intrinsicProp = getPropertyOfType(intrinsicElementsType, ts.escapeLeadingUnderscores(stringLiteralTypeName));
60125                 if (intrinsicProp) {
60126                     return getTypeOfSymbol(intrinsicProp);
60127                 }
60128                 var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, stringType);
60129                 if (indexSignatureType) {
60130                     return indexSignatureType;
60131                 }
60132                 return undefined;
60133             }
60134             return anyType;
60135         }
60136         function checkJsxReturnAssignableToAppropriateBound(refKind, elemInstanceType, openingLikeElement) {
60137             if (refKind === 1) {
60138                 var sfcReturnConstraint = getJsxStatelessElementTypeAt(openingLikeElement);
60139                 if (sfcReturnConstraint) {
60140                     checkTypeRelatedTo(elemInstanceType, sfcReturnConstraint, assignableRelation, openingLikeElement.tagName, ts.Diagnostics.Its_return_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain);
60141                 }
60142             }
60143             else if (refKind === 0) {
60144                 var classConstraint = getJsxElementClassTypeAt(openingLikeElement);
60145                 if (classConstraint) {
60146                     checkTypeRelatedTo(elemInstanceType, classConstraint, assignableRelation, openingLikeElement.tagName, ts.Diagnostics.Its_instance_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain);
60147                 }
60148             }
60149             else {
60150                 var sfcReturnConstraint = getJsxStatelessElementTypeAt(openingLikeElement);
60151                 var classConstraint = getJsxElementClassTypeAt(openingLikeElement);
60152                 if (!sfcReturnConstraint || !classConstraint) {
60153                     return;
60154                 }
60155                 var combined = getUnionType([sfcReturnConstraint, classConstraint]);
60156                 checkTypeRelatedTo(elemInstanceType, combined, assignableRelation, openingLikeElement.tagName, ts.Diagnostics.Its_element_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain);
60157             }
60158             function generateInitialErrorChain() {
60159                 var componentName = ts.getTextOfNode(openingLikeElement.tagName);
60160                 return ts.chainDiagnosticMessages(undefined, ts.Diagnostics._0_cannot_be_used_as_a_JSX_component, componentName);
60161             }
60162         }
60163         function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) {
60164             ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName));
60165             var links = getNodeLinks(node);
60166             if (!links.resolvedJsxElementAttributesType) {
60167                 var symbol = getIntrinsicTagSymbol(node);
60168                 if (links.jsxFlags & 1) {
60169                     return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType;
60170                 }
60171                 else if (links.jsxFlags & 2) {
60172                     return links.resolvedJsxElementAttributesType =
60173                         getIndexTypeOfType(getJsxType(JsxNames.IntrinsicElements, node), stringType) || errorType;
60174                 }
60175                 else {
60176                     return links.resolvedJsxElementAttributesType = errorType;
60177                 }
60178             }
60179             return links.resolvedJsxElementAttributesType;
60180         }
60181         function getJsxElementClassTypeAt(location) {
60182             var type = getJsxType(JsxNames.ElementClass, location);
60183             if (isErrorType(type))
60184                 return undefined;
60185             return type;
60186         }
60187         function getJsxElementTypeAt(location) {
60188             return getJsxType(JsxNames.Element, location);
60189         }
60190         function getJsxStatelessElementTypeAt(location) {
60191             var jsxElementType = getJsxElementTypeAt(location);
60192             if (jsxElementType) {
60193                 return getUnionType([jsxElementType, nullType]);
60194             }
60195         }
60196         function getJsxIntrinsicTagNamesAt(location) {
60197             var intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
60198             return intrinsics ? getPropertiesOfType(intrinsics) : ts.emptyArray;
60199         }
60200         function checkJsxPreconditions(errorNode) {
60201             if ((compilerOptions.jsx || 0) === 0) {
60202                 error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
60203             }
60204             if (getJsxElementTypeAt(errorNode) === undefined) {
60205                 if (noImplicitAny) {
60206                     error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
60207                 }
60208             }
60209         }
60210         function checkJsxOpeningLikeElementOrOpeningFragment(node) {
60211             var isNodeOpeningLikeElement = ts.isJsxOpeningLikeElement(node);
60212             if (isNodeOpeningLikeElement) {
60213                 checkGrammarJsxElement(node);
60214             }
60215             checkJsxPreconditions(node);
60216             if (!getJsxNamespaceContainerForImplicitImport(node)) {
60217                 var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 ? ts.Diagnostics.Cannot_find_name_0 : undefined;
60218                 var jsxFactoryNamespace = getJsxNamespace(node);
60219                 var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
60220                 var jsxFactorySym = void 0;
60221                 if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
60222                     jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551, jsxFactoryRefErr, jsxFactoryNamespace, true);
60223                 }
60224                 if (jsxFactorySym) {
60225                     jsxFactorySym.isReferenced = 67108863;
60226                     if (jsxFactorySym.flags & 2097152 && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
60227                         markAliasSymbolAsReferenced(jsxFactorySym);
60228                     }
60229                 }
60230                 if (ts.isJsxOpeningFragment(node)) {
60231                     var file = ts.getSourceFileOfNode(node);
60232                     var localJsxNamespace = getLocalJsxNamespace(file);
60233                     if (localJsxNamespace) {
60234                         resolveName(jsxFactoryLocation, localJsxNamespace, 111551, jsxFactoryRefErr, localJsxNamespace, true);
60235                     }
60236                 }
60237             }
60238             if (isNodeOpeningLikeElement) {
60239                 var jsxOpeningLikeNode = node;
60240                 var sig = getResolvedSignature(jsxOpeningLikeNode);
60241                 checkDeprecatedSignature(sig, node);
60242                 checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
60243             }
60244         }
60245         function isKnownProperty(targetType, name, isComparingJsxAttributes) {
60246             if (targetType.flags & 524288) {
60247                 if (getPropertyOfObjectType(targetType, name) ||
60248                     getApplicableIndexInfoForName(targetType, name) ||
60249                     isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) ||
60250                     isComparingJsxAttributes && isHyphenatedJsxName(name)) {
60251                     return true;
60252                 }
60253             }
60254             else if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType)) {
60255                 for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) {
60256                     var t = _a[_i];
60257                     if (isKnownProperty(t, name, isComparingJsxAttributes)) {
60258                         return true;
60259                     }
60260                 }
60261             }
60262             return false;
60263         }
60264         function isExcessPropertyCheckTarget(type) {
60265             return !!(type.flags & 524288 && !(ts.getObjectFlags(type) & 512) ||
60266                 type.flags & 67108864 ||
60267                 type.flags & 1048576 && ts.some(type.types, isExcessPropertyCheckTarget) ||
60268                 type.flags & 2097152 && ts.every(type.types, isExcessPropertyCheckTarget));
60269         }
60270         function checkJsxExpression(node, checkMode) {
60271             checkGrammarJsxExpression(node);
60272             if (node.expression) {
60273                 var type = checkExpression(node.expression, checkMode);
60274                 if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) {
60275                     error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type);
60276                 }
60277                 return type;
60278             }
60279             else {
60280                 return errorType;
60281             }
60282         }
60283         function getDeclarationNodeFlagsFromSymbol(s) {
60284             return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0;
60285         }
60286         function isPrototypeProperty(symbol) {
60287             if (symbol.flags & 8192 || ts.getCheckFlags(symbol) & 4) {
60288                 return true;
60289             }
60290             if (ts.isInJSFile(symbol.valueDeclaration)) {
60291                 var parent = symbol.valueDeclaration.parent;
60292                 return parent && ts.isBinaryExpression(parent) &&
60293                     ts.getAssignmentDeclarationKind(parent) === 3;
60294             }
60295         }
60296         function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) {
60297             if (reportError === void 0) { reportError = true; }
60298             var errorNode = !reportError ? undefined :
60299                 node.kind === 160 ? node.right :
60300                     node.kind === 199 ? node :
60301                         node.kind === 202 && node.propertyName ? node.propertyName : node.name;
60302             return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
60303         }
60304         function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
60305             var flags = ts.getDeclarationModifierFlagsFromSymbol(prop, writing);
60306             if (isSuper) {
60307                 if (languageVersion < 2) {
60308                     if (symbolHasNonMethodDeclaration(prop)) {
60309                         if (errorNode) {
60310                             error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
60311                         }
60312                         return false;
60313                     }
60314                 }
60315                 if (flags & 128) {
60316                     if (errorNode) {
60317                         error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
60318                     }
60319                     return false;
60320                 }
60321             }
60322             if ((flags & 128) && symbolHasNonMethodDeclaration(prop) &&
60323                 (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) {
60324                 var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
60325                 if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
60326                     if (errorNode) {
60327                         error(errorNode, ts.Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), ts.getTextOfIdentifierOrLiteral(declaringClassDeclaration.name));
60328                     }
60329                     return false;
60330                 }
60331             }
60332             if (!(flags & 24)) {
60333                 return true;
60334             }
60335             if (flags & 8) {
60336                 var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
60337                 if (!isNodeWithinClass(location, declaringClassDeclaration)) {
60338                     if (errorNode) {
60339                         error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop)));
60340                     }
60341                     return false;
60342                 }
60343                 return true;
60344             }
60345             if (isSuper) {
60346                 return true;
60347             }
60348             var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
60349                 var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
60350                 return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing) ? enclosingClass : undefined;
60351             });
60352             if (!enclosingClass) {
60353                 var thisParameter = void 0;
60354                 if (flags & 32 || !(thisParameter = getThisParameterFromNodeContext(location)) || !thisParameter.type) {
60355                     if (errorNode) {
60356                         error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
60357                     }
60358                     return false;
60359                 }
60360                 var thisType = getTypeFromTypeNode(thisParameter.type);
60361                 enclosingClass = ((thisType.flags & 262144) ? getConstraintOfTypeParameter(thisType) : thisType).target;
60362             }
60363             if (flags & 32) {
60364                 return true;
60365             }
60366             if (containingType.flags & 262144) {
60367                 containingType = containingType.isThisType ? getConstraintOfTypeParameter(containingType) : getBaseConstraintOfType(containingType);
60368             }
60369             if (!containingType || !hasBaseType(containingType, enclosingClass)) {
60370                 if (errorNode) {
60371                     error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, symbolToString(prop), typeToString(enclosingClass), typeToString(containingType));
60372                 }
60373                 return false;
60374             }
60375             return true;
60376         }
60377         function getThisParameterFromNodeContext(node) {
60378             var thisContainer = ts.getThisContainer(node, false);
60379             return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
60380         }
60381         function symbolHasNonMethodDeclaration(symbol) {
60382             return !!forEachProperty(symbol, function (prop) { return !(prop.flags & 8192); });
60383         }
60384         function checkNonNullExpression(node) {
60385             return checkNonNullType(checkExpression(node), node);
60386         }
60387         function isNullableType(type) {
60388             return !!((strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304);
60389         }
60390         function getNonNullableTypeIfNeeded(type) {
60391             return isNullableType(type) ? getNonNullableType(type) : type;
60392         }
60393         function reportObjectPossiblyNullOrUndefinedError(node, flags) {
60394             error(node, flags & 32768 ? flags & 65536 ?
60395                 ts.Diagnostics.Object_is_possibly_null_or_undefined :
60396                 ts.Diagnostics.Object_is_possibly_undefined :
60397                 ts.Diagnostics.Object_is_possibly_null);
60398         }
60399         function reportCannotInvokePossiblyNullOrUndefinedError(node, flags) {
60400             error(node, flags & 32768 ? flags & 65536 ?
60401                 ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
60402                 ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
60403                 ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
60404         }
60405         function checkNonNullTypeWithReporter(type, node, reportError) {
60406             if (strictNullChecks && type.flags & 2) {
60407                 error(node, ts.Diagnostics.Object_is_of_type_unknown);
60408                 return errorType;
60409             }
60410             var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304;
60411             if (kind) {
60412                 reportError(node, kind);
60413                 var t = getNonNullableType(type);
60414                 return t.flags & (98304 | 131072) ? errorType : t;
60415             }
60416             return type;
60417         }
60418         function checkNonNullType(type, node) {
60419             return checkNonNullTypeWithReporter(type, node, reportObjectPossiblyNullOrUndefinedError);
60420         }
60421         function checkNonNullNonVoidType(type, node) {
60422             var nonNullType = checkNonNullType(type, node);
60423             if (nonNullType.flags & 16384) {
60424                 error(node, ts.Diagnostics.Object_is_possibly_undefined);
60425             }
60426             return nonNullType;
60427         }
60428         function checkPropertyAccessExpression(node, checkMode) {
60429             return node.flags & 32 ? checkPropertyAccessChain(node, checkMode) :
60430                 checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode);
60431         }
60432         function checkPropertyAccessChain(node, checkMode) {
60433             var leftType = checkExpression(node.expression);
60434             var nonOptionalType = getOptionalExpressionType(leftType, node.expression);
60435             return propagateOptionalTypeMarker(checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullType(nonOptionalType, node.expression), node.name, checkMode), node, nonOptionalType !== leftType);
60436         }
60437         function checkQualifiedName(node, checkMode) {
60438             var leftType = ts.isPartOfTypeQuery(node) && ts.isThisIdentifier(node.left) ? checkNonNullType(checkThisExpression(node.left), node.left) : checkNonNullExpression(node.left);
60439             return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode);
60440         }
60441         function isMethodAccessForCall(node) {
60442             while (node.parent.kind === 211) {
60443                 node = node.parent;
60444             }
60445             return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node;
60446         }
60447         function lookupSymbolForPrivateIdentifierDeclaration(propName, location) {
60448             for (var containingClass = ts.getContainingClass(location); !!containingClass; containingClass = ts.getContainingClass(containingClass)) {
60449                 var symbol = containingClass.symbol;
60450                 var name = ts.getSymbolNameForPrivateIdentifier(symbol, propName);
60451                 var prop = (symbol.members && symbol.members.get(name)) || (symbol.exports && symbol.exports.get(name));
60452                 if (prop) {
60453                     return prop;
60454                 }
60455             }
60456         }
60457         function checkGrammarPrivateIdentifierExpression(privId) {
60458             if (!ts.getContainingClass(privId)) {
60459                 return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
60460             }
60461             if (!ts.isExpressionNode(privId)) {
60462                 return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
60463             }
60464             if (!getSymbolForPrivateIdentifierExpression(privId)) {
60465                 return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
60466             }
60467             return false;
60468         }
60469         function checkPrivateIdentifierExpression(privId) {
60470             checkGrammarPrivateIdentifierExpression(privId);
60471             var symbol = getSymbolForPrivateIdentifierExpression(privId);
60472             if (symbol) {
60473                 markPropertyAsReferenced(symbol, undefined, false);
60474             }
60475             return anyType;
60476         }
60477         function getSymbolForPrivateIdentifierExpression(privId) {
60478             if (!ts.isExpressionNode(privId)) {
60479                 return undefined;
60480             }
60481             var links = getNodeLinks(privId);
60482             if (links.resolvedSymbol === undefined) {
60483                 links.resolvedSymbol = lookupSymbolForPrivateIdentifierDeclaration(privId.escapedText, privId);
60484             }
60485             return links.resolvedSymbol;
60486         }
60487         function getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) {
60488             return getPropertyOfType(leftType, lexicallyScopedIdentifier.escapedName);
60489         }
60490         function checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedIdentifier) {
60491             var propertyOnType;
60492             var properties = getPropertiesOfType(leftType);
60493             if (properties) {
60494                 ts.forEach(properties, function (symbol) {
60495                     var decl = symbol.valueDeclaration;
60496                     if (decl && ts.isNamedDeclaration(decl) && ts.isPrivateIdentifier(decl.name) && decl.name.escapedText === right.escapedText) {
60497                         propertyOnType = symbol;
60498                         return true;
60499                     }
60500                 });
60501             }
60502             var diagName = diagnosticName(right);
60503             if (propertyOnType) {
60504                 var typeValueDecl = ts.Debug.checkDefined(propertyOnType.valueDeclaration);
60505                 var typeClass_1 = ts.Debug.checkDefined(ts.getContainingClass(typeValueDecl));
60506                 if (lexicallyScopedIdentifier === null || lexicallyScopedIdentifier === void 0 ? void 0 : lexicallyScopedIdentifier.valueDeclaration) {
60507                     var lexicalValueDecl = lexicallyScopedIdentifier.valueDeclaration;
60508                     var lexicalClass = ts.getContainingClass(lexicalValueDecl);
60509                     ts.Debug.assert(!!lexicalClass);
60510                     if (ts.findAncestor(lexicalClass, function (n) { return typeClass_1 === n; })) {
60511                         var diagnostic = error(right, ts.Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling, diagName, typeToString(leftType));
60512                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(lexicalValueDecl, ts.Diagnostics.The_shadowing_declaration_of_0_is_defined_here, diagName), ts.createDiagnosticForNode(typeValueDecl, ts.Diagnostics.The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here, diagName));
60513                         return true;
60514                     }
60515                 }
60516                 error(right, ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier, diagName, diagnosticName(typeClass_1.name || anon));
60517                 return true;
60518             }
60519             return false;
60520         }
60521         function isThisPropertyAccessInConstructor(node, prop) {
60522             return (isConstructorDeclaredProperty(prop) || ts.isThisProperty(node) && isAutoTypedProperty(prop))
60523                 && ts.getThisContainer(node, true) === getDeclaringConstructor(prop);
60524         }
60525         function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) {
60526             var parentSymbol = getNodeLinks(left).resolvedSymbol;
60527             var assignmentKind = ts.getAssignmentTargetKind(node);
60528             var apparentType = getApparentType(assignmentKind !== 0 || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType);
60529             var isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType;
60530             var prop;
60531             if (ts.isPrivateIdentifier(right)) {
60532                 if (languageVersion < 99) {
60533                     if (assignmentKind !== 0) {
60534                         checkExternalEmitHelpers(node, 1048576);
60535                     }
60536                     if (assignmentKind !== 1) {
60537                         checkExternalEmitHelpers(node, 524288);
60538                     }
60539                 }
60540                 var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
60541                 if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
60542                     grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
60543                 }
60544                 if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (ts.getEmitScriptTarget(compilerOptions) === 99 && !useDefineForClassFields)) {
60545                     var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
60546                     var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
60547                         if (n === lexicalClass_1)
60548                             return "quit";
60549                         if (ts.isPropertyDeclaration(n.parent) && ts.hasStaticModifier(n.parent) && n.parent.initializer === n && n.parent.parent === lexicalClass_1) {
60550                             return true;
60551                         }
60552                         return false;
60553                     });
60554                     if (parentStaticFieldInitializer) {
60555                         var parentStaticFieldInitializerSymbol = getSymbolOfNode(parentStaticFieldInitializer.parent);
60556                         ts.Debug.assert(parentStaticFieldInitializerSymbol, "Initializer without declaration symbol");
60557                         var diagnostic = error(node, ts.Diagnostics.Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false, ts.symbolName(lexicallyScopedSymbol));
60558                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(parentStaticFieldInitializer.parent, ts.Diagnostics.Initializer_for_property_0, ts.symbolName(parentStaticFieldInitializerSymbol)));
60559                     }
60560                 }
60561                 if (isAnyLike) {
60562                     if (lexicallyScopedSymbol) {
60563                         return isErrorType(apparentType) ? errorType : apparentType;
60564                     }
60565                     if (!ts.getContainingClass(right)) {
60566                         grammarErrorOnNode(right, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
60567                         return anyType;
60568                     }
60569                 }
60570                 prop = lexicallyScopedSymbol ? getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol) : undefined;
60571                 if (!prop && checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) {
60572                     return errorType;
60573                 }
60574                 else {
60575                     var isSetonlyAccessor = prop && prop.flags & 65536 && !(prop.flags & 32768);
60576                     if (isSetonlyAccessor && assignmentKind !== 1) {
60577                         error(node, ts.Diagnostics.Private_accessor_was_defined_without_a_getter);
60578                     }
60579                 }
60580             }
60581             else {
60582                 if (isAnyLike) {
60583                     if (ts.isIdentifier(left) && parentSymbol) {
60584                         markAliasReferenced(parentSymbol, node);
60585                     }
60586                     return isErrorType(apparentType) ? errorType : apparentType;
60587                     ;
60588                 }
60589                 prop = getPropertyOfType(apparentType, right.escapedText);
60590             }
60591             if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || !(prop && isConstEnumOrConstEnumOnlyModule(prop)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
60592                 markAliasReferenced(parentSymbol, node);
60593             }
60594             var propType;
60595             if (!prop) {
60596                 var indexInfo = !ts.isPrivateIdentifier(right) && (assignmentKind === 0 || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ?
60597                     getApplicableIndexInfoForName(apparentType, right.escapedText) : undefined;
60598                 if (!(indexInfo && indexInfo.type)) {
60599                     var isUncheckedJS = isUncheckedJSSuggestion(node, leftType.symbol, true);
60600                     if (!isUncheckedJS && isJSLiteralType(leftType)) {
60601                         return anyType;
60602                     }
60603                     if (leftType.symbol === globalThisSymbol) {
60604                         if (globalThisSymbol.exports.has(right.escapedText) && (globalThisSymbol.exports.get(right.escapedText).flags & 418)) {
60605                             error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
60606                         }
60607                         else if (noImplicitAny) {
60608                             error(right, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
60609                         }
60610                         return anyType;
60611                     }
60612                     if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
60613                         reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType, isUncheckedJS);
60614                     }
60615                     return errorType;
60616                 }
60617                 if (indexInfo.isReadonly && (ts.isAssignmentTarget(node) || ts.isDeleteTarget(node))) {
60618                     error(node, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
60619                 }
60620                 propType = (compilerOptions.noUncheckedIndexedAccess && !ts.isAssignmentTarget(node)) ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
60621                 if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
60622                     error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
60623                 }
60624             }
60625             else {
60626                 if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(node, prop)) {
60627                     addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
60628                 }
60629                 checkPropertyNotUsedBeforeDeclaration(prop, node, right);
60630                 markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
60631                 getNodeLinks(node).resolvedSymbol = prop;
60632                 var writing = ts.isWriteAccess(node);
60633                 checkPropertyAccessibility(node, left.kind === 106, writing, apparentType, prop);
60634                 if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
60635                     error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
60636                     return errorType;
60637                 }
60638                 propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getSetAccessorTypeOfSymbol(prop) : getTypeOfSymbol(prop);
60639             }
60640             return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
60641         }
60642         function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
60643             var file = ts.getSourceFileOfNode(node);
60644             if (file) {
60645                 if (compilerOptions.checkJs === undefined && file.checkJsDirective === undefined && (file.scriptKind === 1 || file.scriptKind === 2)) {
60646                     var declarationFile = ts.forEach(suggestion === null || suggestion === void 0 ? void 0 : suggestion.declarations, ts.getSourceFileOfNode);
60647                     return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile))
60648                         && !(excludeClasses && suggestion && suggestion.flags & 32)
60649                         && !(!!node && excludeClasses && ts.isPropertyAccessExpression(node) && node.expression.kind === 108);
60650                 }
60651             }
60652             return false;
60653         }
60654         function getFlowTypeOfAccessExpression(node, prop, propType, errorNode, checkMode) {
60655             var assignmentKind = ts.getAssignmentTargetKind(node);
60656             if (assignmentKind === 1) {
60657                 return removeMissingType(propType, !!(prop && prop.flags & 16777216));
60658             }
60659             if (prop &&
60660                 !(prop.flags & (3 | 4 | 98304))
60661                 && !(prop.flags & 8192 && propType.flags & 1048576)
60662                 && !isDuplicatedCommonJSExport(prop.declarations)) {
60663                 return propType;
60664             }
60665             if (propType === autoType) {
60666                 return getFlowTypeOfProperty(node, prop);
60667             }
60668             propType = getNarrowableTypeForReference(propType, node, checkMode);
60669             var assumeUninitialized = false;
60670             if (strictNullChecks && strictPropertyInitialization && ts.isAccessExpression(node) && node.expression.kind === 108) {
60671                 var declaration = prop && prop.valueDeclaration;
60672                 if (declaration && isPropertyWithoutInitializer(declaration)) {
60673                     if (!ts.isStatic(declaration)) {
60674                         var flowContainer = getControlFlowContainer(node);
60675                         if (flowContainer.kind === 170 && flowContainer.parent === declaration.parent && !(declaration.flags & 8388608)) {
60676                             assumeUninitialized = true;
60677                         }
60678                     }
60679                 }
60680             }
60681             else if (strictNullChecks && prop && prop.valueDeclaration &&
60682                 ts.isPropertyAccessExpression(prop.valueDeclaration) &&
60683                 ts.getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration) &&
60684                 getControlFlowContainer(node) === getControlFlowContainer(prop.valueDeclaration)) {
60685                 assumeUninitialized = true;
60686             }
60687             var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
60688             if (assumeUninitialized && !(getFalsyFlags(propType) & 32768) && getFalsyFlags(flowType) & 32768) {
60689                 error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
60690                 return propType;
60691             }
60692             return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
60693         }
60694         function checkPropertyNotUsedBeforeDeclaration(prop, node, right) {
60695             var valueDeclaration = prop.valueDeclaration;
60696             if (!valueDeclaration || ts.getSourceFileOfNode(node).isDeclarationFile) {
60697                 return;
60698             }
60699             var diagnosticMessage;
60700             var declarationName = ts.idText(right);
60701             if (isInPropertyInitializerOrClassStaticBlock(node)
60702                 && !isOptionalPropertyDeclaration(valueDeclaration)
60703                 && !(ts.isAccessExpression(node) && ts.isAccessExpression(node.expression))
60704                 && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)
60705                 && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
60706                 diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
60707             }
60708             else if (valueDeclaration.kind === 256 &&
60709                 node.parent.kind !== 177 &&
60710                 !(valueDeclaration.flags & 8388608) &&
60711                 !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
60712                 diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
60713             }
60714             if (diagnosticMessage) {
60715                 ts.addRelatedInfo(diagnosticMessage, ts.createDiagnosticForNode(valueDeclaration, ts.Diagnostics._0_is_declared_here, declarationName));
60716             }
60717         }
60718         function isInPropertyInitializerOrClassStaticBlock(node) {
60719             return !!ts.findAncestor(node, function (node) {
60720                 switch (node.kind) {
60721                     case 166:
60722                         return true;
60723                     case 294:
60724                     case 168:
60725                     case 171:
60726                     case 172:
60727                     case 296:
60728                     case 161:
60729                     case 232:
60730                     case 287:
60731                     case 284:
60732                     case 285:
60733                     case 286:
60734                     case 279:
60735                     case 227:
60736                     case 290:
60737                         return false;
60738                     case 213:
60739                     case 237:
60740                         return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit";
60741                     default:
60742                         return ts.isExpressionNode(node) ? false : "quit";
60743                 }
60744             });
60745         }
60746         function isPropertyDeclaredInAncestorClass(prop) {
60747             if (!(prop.parent.flags & 32)) {
60748                 return false;
60749             }
60750             var classType = getTypeOfSymbol(prop.parent);
60751             while (true) {
60752                 classType = classType.symbol && getSuperClass(classType);
60753                 if (!classType) {
60754                     return false;
60755                 }
60756                 var superProperty = getPropertyOfType(classType, prop.escapedName);
60757                 if (superProperty && superProperty.valueDeclaration) {
60758                     return true;
60759                 }
60760             }
60761         }
60762         function getSuperClass(classType) {
60763             var x = getBaseTypes(classType);
60764             if (x.length === 0) {
60765                 return undefined;
60766             }
60767             return getIntersectionType(x);
60768         }
60769         function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
60770             var errorInfo;
60771             var relatedInfo;
60772             if (!ts.isPrivateIdentifier(propNode) && containingType.flags & 1048576 && !(containingType.flags & 131068)) {
60773                 for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
60774                     var subtype = _a[_i];
60775                     if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
60776                         errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype));
60777                         break;
60778                     }
60779                 }
60780             }
60781             if (typeHasStaticProperty(propNode.escapedText, containingType)) {
60782                 var propName = ts.declarationNameToString(propNode);
60783                 var typeName = typeToString(containingType);
60784                 errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "." + propName);
60785             }
60786             else {
60787                 var promisedType = getPromisedTypeOfPromise(containingType);
60788                 if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) {
60789                     errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType));
60790                     relatedInfo = ts.createDiagnosticForNode(propNode, ts.Diagnostics.Did_you_forget_to_use_await);
60791                 }
60792                 else {
60793                     var missingProperty = ts.declarationNameToString(propNode);
60794                     var container = typeToString(containingType);
60795                     var libSuggestion = getSuggestedLibForNonExistentProperty(missingProperty, containingType);
60796                     if (libSuggestion !== undefined) {
60797                         errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later, missingProperty, container, libSuggestion);
60798                     }
60799                     else {
60800                         var suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType);
60801                         if (suggestion !== undefined) {
60802                             var suggestedName = ts.symbolName(suggestion);
60803                             var message = isUncheckedJS ? ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2 : ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2;
60804                             errorInfo = ts.chainDiagnosticMessages(errorInfo, message, missingProperty, container, suggestedName);
60805                             relatedInfo = suggestion.valueDeclaration && ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestedName);
60806                         }
60807                         else {
60808                             var diagnostic = containerSeemsToBeEmptyDomElement(containingType)
60809                                 ? ts.Diagnostics.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom
60810                                 : ts.Diagnostics.Property_0_does_not_exist_on_type_1;
60811                             errorInfo = ts.chainDiagnosticMessages(elaborateNeverIntersection(errorInfo, containingType), diagnostic, missingProperty, container);
60812                         }
60813                     }
60814                 }
60815             }
60816             var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo);
60817             if (relatedInfo) {
60818                 ts.addRelatedInfo(resultDiagnostic, relatedInfo);
60819             }
60820             addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
60821         }
60822         function containerSeemsToBeEmptyDomElement(containingType) {
60823             return (compilerOptions.lib && !compilerOptions.lib.includes("dom")) &&
60824                 everyContainedType(containingType, function (type) { return type.symbol && /^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(ts.unescapeLeadingUnderscores(type.symbol.escapedName)); }) &&
60825                 isEmptyObjectType(containingType);
60826         }
60827         function typeHasStaticProperty(propName, containingType) {
60828             var prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
60829             return prop !== undefined && !!prop.valueDeclaration && ts.isStatic(prop.valueDeclaration);
60830         }
60831         function getSuggestedLibForNonExistentName(name) {
60832             var missingName = diagnosticName(name);
60833             var allFeatures = ts.getScriptTargetFeatures();
60834             var libTargets = ts.getOwnKeys(allFeatures);
60835             for (var _i = 0, libTargets_1 = libTargets; _i < libTargets_1.length; _i++) {
60836                 var libTarget = libTargets_1[_i];
60837                 var containingTypes = ts.getOwnKeys(allFeatures[libTarget]);
60838                 if (containingTypes !== undefined && ts.contains(containingTypes, missingName)) {
60839                     return libTarget;
60840                 }
60841             }
60842         }
60843         function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
60844             var container = getApparentType(containingType).symbol;
60845             if (!container) {
60846                 return undefined;
60847             }
60848             var allFeatures = ts.getScriptTargetFeatures();
60849             var libTargets = ts.getOwnKeys(allFeatures);
60850             for (var _i = 0, libTargets_2 = libTargets; _i < libTargets_2.length; _i++) {
60851                 var libTarget = libTargets_2[_i];
60852                 var featuresOfLib = allFeatures[libTarget];
60853                 var featuresOfContainingType = featuresOfLib[ts.symbolName(container)];
60854                 if (featuresOfContainingType !== undefined && ts.contains(featuresOfContainingType, missingProperty)) {
60855                     return libTarget;
60856                 }
60857             }
60858         }
60859         function getSuggestedSymbolForNonexistentClassMember(name, baseType) {
60860             return getSpellingSuggestionForName(name, getPropertiesOfType(baseType), 106500);
60861         }
60862         function getSuggestedSymbolForNonexistentProperty(name, containingType) {
60863             var props = getPropertiesOfType(containingType);
60864             if (typeof name !== "string") {
60865                 var parent_2 = name.parent;
60866                 if (ts.isPropertyAccessExpression(parent_2)) {
60867                     props = ts.filter(props, function (prop) { return isValidPropertyAccessForCompletions(parent_2, containingType, prop); });
60868                 }
60869                 name = ts.idText(name);
60870             }
60871             return getSpellingSuggestionForName(name, props, 111551);
60872         }
60873         function getSuggestedSymbolForNonexistentJSXAttribute(name, containingType) {
60874             var strName = ts.isString(name) ? name : ts.idText(name);
60875             var properties = getPropertiesOfType(containingType);
60876             var jsxSpecific = strName === "for" ? ts.find(properties, function (x) { return ts.symbolName(x) === "htmlFor"; })
60877                 : strName === "class" ? ts.find(properties, function (x) { return ts.symbolName(x) === "className"; })
60878                     : undefined;
60879             return jsxSpecific !== null && jsxSpecific !== void 0 ? jsxSpecific : getSpellingSuggestionForName(strName, properties, 111551);
60880         }
60881         function getSuggestionForNonexistentProperty(name, containingType) {
60882             var suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
60883             return suggestion && ts.symbolName(suggestion);
60884         }
60885         function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
60886             ts.Debug.assert(outerName !== undefined, "outername should always be defined");
60887             var result = resolveNameHelper(location, outerName, meaning, undefined, outerName, false, false, function (symbols, name, meaning) {
60888                 ts.Debug.assertEqual(outerName, name, "name should equal outerName");
60889                 var symbol = getSymbol(symbols, name, meaning);
60890                 if (symbol)
60891                     return symbol;
60892                 var candidates;
60893                 if (symbols === globals) {
60894                     var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1)))
60895                         ? createSymbol(524288, s)
60896                         : undefined; });
60897                     candidates = primitives.concat(ts.arrayFrom(symbols.values()));
60898                 }
60899                 else {
60900                     candidates = ts.arrayFrom(symbols.values());
60901                 }
60902                 return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), candidates, meaning);
60903             });
60904             return result;
60905         }
60906         function getSuggestionForNonexistentSymbol(location, outerName, meaning) {
60907             var symbolResult = getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning);
60908             return symbolResult && ts.symbolName(symbolResult);
60909         }
60910         function getSuggestedSymbolForNonexistentModule(name, targetModule) {
60911             return targetModule.exports && getSpellingSuggestionForName(ts.idText(name), getExportsOfModuleAsArray(targetModule), 2623475);
60912         }
60913         function getSuggestionForNonexistentExport(name, targetModule) {
60914             var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
60915             return suggestion && ts.symbolName(suggestion);
60916         }
60917         function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
60918             function hasProp(name) {
60919                 var prop = getPropertyOfObjectType(objectType, name);
60920                 if (prop) {
60921                     var s = getSingleCallSignature(getTypeOfSymbol(prop));
60922                     return !!s && getMinArgumentCount(s) >= 1 && isTypeAssignableTo(keyedType, getTypeAtPosition(s, 0));
60923                 }
60924                 return false;
60925             }
60926             ;
60927             var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
60928             if (!hasProp(suggestedMethod)) {
60929                 return undefined;
60930             }
60931             var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr.expression);
60932             if (suggestion === undefined) {
60933                 suggestion = suggestedMethod;
60934             }
60935             else {
60936                 suggestion += "." + suggestedMethod;
60937             }
60938             return suggestion;
60939         }
60940         function getSuggestedTypeForNonexistentStringLiteralType(source, target) {
60941             var candidates = target.types.filter(function (type) { return !!(type.flags & 128); });
60942             return ts.getSpellingSuggestion(source.value, candidates, function (type) { return type.value; });
60943         }
60944         function getSpellingSuggestionForName(name, symbols, meaning) {
60945             return ts.getSpellingSuggestion(name, symbols, getCandidateName);
60946             function getCandidateName(candidate) {
60947                 var candidateName = ts.symbolName(candidate);
60948                 if (ts.startsWith(candidateName, "\"")) {
60949                     return undefined;
60950                 }
60951                 if (candidate.flags & meaning) {
60952                     return candidateName;
60953                 }
60954                 if (candidate.flags & 2097152) {
60955                     var alias = tryResolveAlias(candidate);
60956                     if (alias && alias.flags & meaning) {
60957                         return candidateName;
60958                     }
60959                 }
60960                 return undefined;
60961             }
60962         }
60963         function markPropertyAsReferenced(prop, nodeForCheckWriteOnly, isSelfTypeAccess) {
60964             var valueDeclaration = prop && (prop.flags & 106500) && prop.valueDeclaration;
60965             if (!valueDeclaration) {
60966                 return;
60967             }
60968             var hasPrivateModifier = ts.hasEffectiveModifier(valueDeclaration, 8);
60969             var hasPrivateIdentifier = prop.valueDeclaration && ts.isNamedDeclaration(prop.valueDeclaration) && ts.isPrivateIdentifier(prop.valueDeclaration.name);
60970             if (!hasPrivateModifier && !hasPrivateIdentifier) {
60971                 return;
60972             }
60973             if (nodeForCheckWriteOnly && ts.isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & 65536)) {
60974                 return;
60975             }
60976             if (isSelfTypeAccess) {
60977                 var containingMethod = ts.findAncestor(nodeForCheckWriteOnly, ts.isFunctionLikeDeclaration);
60978                 if (containingMethod && containingMethod.symbol === prop) {
60979                     return;
60980                 }
60981             }
60982             (ts.getCheckFlags(prop) & 1 ? getSymbolLinks(prop).target : prop).isReferenced = 67108863;
60983         }
60984         function isSelfTypeAccess(name, parent) {
60985             return name.kind === 108
60986                 || !!parent && ts.isEntityNameExpression(name) && parent === getResolvedSymbol(ts.getFirstIdentifier(name));
60987         }
60988         function isValidPropertyAccess(node, propertyName) {
60989             switch (node.kind) {
60990                 case 205:
60991                     return isValidPropertyAccessWithType(node, node.expression.kind === 106, propertyName, getWidenedType(checkExpression(node.expression)));
60992                 case 160:
60993                     return isValidPropertyAccessWithType(node, false, propertyName, getWidenedType(checkExpression(node.left)));
60994                 case 199:
60995                     return isValidPropertyAccessWithType(node, false, propertyName, getTypeFromTypeNode(node));
60996             }
60997         }
60998         function isValidPropertyAccessForCompletions(node, type, property) {
60999             return isPropertyAccessible(node, node.kind === 205 && node.expression.kind === 106, false, type, property);
61000         }
61001         function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
61002             if (isTypeAny(type)) {
61003                 return true;
61004             }
61005             var prop = getPropertyOfType(type, propertyName);
61006             return !!prop && isPropertyAccessible(node, isSuper, false, type, prop);
61007         }
61008         function isPropertyAccessible(node, isSuper, isWrite, containingType, property) {
61009             if (isTypeAny(containingType)) {
61010                 return true;
61011             }
61012             if (property.valueDeclaration && ts.isPrivateIdentifierClassElementDeclaration(property.valueDeclaration)) {
61013                 var declClass_1 = ts.getContainingClass(property.valueDeclaration);
61014                 return !ts.isOptionalChain(node) && !!ts.findAncestor(node, function (parent) { return parent === declClass_1; });
61015             }
61016             return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType, property);
61017         }
61018         function getForInVariableSymbol(node) {
61019             var initializer = node.initializer;
61020             if (initializer.kind === 254) {
61021                 var variable = initializer.declarations[0];
61022                 if (variable && !ts.isBindingPattern(variable.name)) {
61023                     return getSymbolOfNode(variable);
61024                 }
61025             }
61026             else if (initializer.kind === 79) {
61027                 return getResolvedSymbol(initializer);
61028             }
61029             return undefined;
61030         }
61031         function hasNumericPropertyNames(type) {
61032             return getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, numberType);
61033         }
61034         function isForInVariableForNumericPropertyNames(expr) {
61035             var e = ts.skipParentheses(expr);
61036             if (e.kind === 79) {
61037                 var symbol = getResolvedSymbol(e);
61038                 if (symbol.flags & 3) {
61039                     var child = expr;
61040                     var node = expr.parent;
61041                     while (node) {
61042                         if (node.kind === 242 &&
61043                             child === node.statement &&
61044                             getForInVariableSymbol(node) === symbol &&
61045                             hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
61046                             return true;
61047                         }
61048                         child = node;
61049                         node = node.parent;
61050                     }
61051                 }
61052             }
61053             return false;
61054         }
61055         function checkIndexedAccess(node, checkMode) {
61056             return node.flags & 32 ? checkElementAccessChain(node, checkMode) :
61057                 checkElementAccessExpression(node, checkNonNullExpression(node.expression), checkMode);
61058         }
61059         function checkElementAccessChain(node, checkMode) {
61060             var exprType = checkExpression(node.expression);
61061             var nonOptionalType = getOptionalExpressionType(exprType, node.expression);
61062             return propagateOptionalTypeMarker(checkElementAccessExpression(node, checkNonNullType(nonOptionalType, node.expression), checkMode), node, nonOptionalType !== exprType);
61063         }
61064         function checkElementAccessExpression(node, exprType, checkMode) {
61065             var objectType = ts.getAssignmentTargetKind(node) !== 0 || isMethodAccessForCall(node) ? getWidenedType(exprType) : exprType;
61066             var indexExpression = node.argumentExpression;
61067             var indexType = checkExpression(indexExpression);
61068             if (isErrorType(objectType) || objectType === silentNeverType) {
61069                 return objectType;
61070             }
61071             if (isConstEnumObjectType(objectType) && !ts.isStringLiteralLike(indexExpression)) {
61072                 error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
61073                 return errorType;
61074             }
61075             var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
61076             var accessFlags = ts.isAssignmentTarget(node) ?
61077                 4 | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 2 : 0) :
61078                 32;
61079             var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
61080             return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
61081         }
61082         function callLikeExpressionMayHaveTypeArguments(node) {
61083             return ts.isCallOrNewExpression(node) || ts.isTaggedTemplateExpression(node) || ts.isJsxOpeningLikeElement(node);
61084         }
61085         function resolveUntypedCall(node) {
61086             if (callLikeExpressionMayHaveTypeArguments(node)) {
61087                 ts.forEach(node.typeArguments, checkSourceElement);
61088             }
61089             if (node.kind === 209) {
61090                 checkExpression(node.template);
61091             }
61092             else if (ts.isJsxOpeningLikeElement(node)) {
61093                 checkExpression(node.attributes);
61094             }
61095             else if (node.kind !== 164) {
61096                 ts.forEach(node.arguments, function (argument) {
61097                     checkExpression(argument);
61098                 });
61099             }
61100             return anySignature;
61101         }
61102         function resolveErrorCall(node) {
61103             resolveUntypedCall(node);
61104             return unknownSignature;
61105         }
61106         function reorderCandidates(signatures, result, callChainFlags) {
61107             var lastParent;
61108             var lastSymbol;
61109             var cutoffIndex = 0;
61110             var index;
61111             var specializedIndex = -1;
61112             var spliceIndex;
61113             ts.Debug.assert(!result.length);
61114             for (var _i = 0, signatures_7 = signatures; _i < signatures_7.length; _i++) {
61115                 var signature = signatures_7[_i];
61116                 var symbol = signature.declaration && getSymbolOfNode(signature.declaration);
61117                 var parent = signature.declaration && signature.declaration.parent;
61118                 if (!lastSymbol || symbol === lastSymbol) {
61119                     if (lastParent && parent === lastParent) {
61120                         index = index + 1;
61121                     }
61122                     else {
61123                         lastParent = parent;
61124                         index = cutoffIndex;
61125                     }
61126                 }
61127                 else {
61128                     index = cutoffIndex = result.length;
61129                     lastParent = parent;
61130                 }
61131                 lastSymbol = symbol;
61132                 if (signatureHasLiteralTypes(signature)) {
61133                     specializedIndex++;
61134                     spliceIndex = specializedIndex;
61135                     cutoffIndex++;
61136                 }
61137                 else {
61138                     spliceIndex = index;
61139                 }
61140                 result.splice(spliceIndex, 0, callChainFlags ? getOptionalCallSignature(signature, callChainFlags) : signature);
61141             }
61142         }
61143         function isSpreadArgument(arg) {
61144             return !!arg && (arg.kind === 224 || arg.kind === 231 && arg.isSpread);
61145         }
61146         function getSpreadArgumentIndex(args) {
61147             return ts.findIndex(args, isSpreadArgument);
61148         }
61149         function acceptsVoid(t) {
61150             return !!(t.flags & 16384);
61151         }
61152         function acceptsVoidUndefinedUnknownOrAny(t) {
61153             return !!(t.flags & (16384 | 32768 | 2 | 1));
61154         }
61155         function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) {
61156             if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }
61157             var argCount;
61158             var callIsIncomplete = false;
61159             var effectiveParameterCount = getParameterCount(signature);
61160             var effectiveMinimumArguments = getMinArgumentCount(signature);
61161             if (node.kind === 209) {
61162                 argCount = args.length;
61163                 if (node.template.kind === 222) {
61164                     var lastSpan = ts.last(node.template.templateSpans);
61165                     callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;
61166                 }
61167                 else {
61168                     var templateLiteral = node.template;
61169                     ts.Debug.assert(templateLiteral.kind === 14);
61170                     callIsIncomplete = !!templateLiteral.isUnterminated;
61171                 }
61172             }
61173             else if (node.kind === 164) {
61174                 argCount = getDecoratorArgumentCount(node, signature);
61175             }
61176             else if (ts.isJsxOpeningLikeElement(node)) {
61177                 callIsIncomplete = node.attributes.end === node.end;
61178                 if (callIsIncomplete) {
61179                     return true;
61180                 }
61181                 argCount = effectiveMinimumArguments === 0 ? args.length : 1;
61182                 effectiveParameterCount = args.length === 0 ? effectiveParameterCount : 1;
61183                 effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1);
61184             }
61185             else if (!node.arguments) {
61186                 ts.Debug.assert(node.kind === 208);
61187                 return getMinArgumentCount(signature) === 0;
61188             }
61189             else {
61190                 argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
61191                 callIsIncomplete = node.arguments.end === node.end;
61192                 var spreadArgIndex = getSpreadArgumentIndex(args);
61193                 if (spreadArgIndex >= 0) {
61194                     return spreadArgIndex >= getMinArgumentCount(signature) && (hasEffectiveRestParameter(signature) || spreadArgIndex < getParameterCount(signature));
61195                 }
61196             }
61197             if (!hasEffectiveRestParameter(signature) && argCount > effectiveParameterCount) {
61198                 return false;
61199             }
61200             if (callIsIncomplete || argCount >= effectiveMinimumArguments) {
61201                 return true;
61202             }
61203             for (var i = argCount; i < effectiveMinimumArguments; i++) {
61204                 var type = getTypeAtPosition(signature, i);
61205                 if (filterType(type, ts.isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 131072) {
61206                     return false;
61207                 }
61208             }
61209             return true;
61210         }
61211         function hasCorrectTypeArgumentArity(signature, typeArguments) {
61212             var numTypeParameters = ts.length(signature.typeParameters);
61213             var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
61214             return !ts.some(typeArguments) ||
61215                 (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters);
61216         }
61217         function getSingleCallSignature(type) {
61218             return getSingleSignature(type, 0, false);
61219         }
61220         function getSingleCallOrConstructSignature(type) {
61221             return getSingleSignature(type, 0, false) ||
61222                 getSingleSignature(type, 1, false);
61223         }
61224         function getSingleSignature(type, kind, allowMembers) {
61225             if (type.flags & 524288) {
61226                 var resolved = resolveStructuredTypeMembers(type);
61227                 if (allowMembers || resolved.properties.length === 0 && resolved.indexInfos.length === 0) {
61228                     if (kind === 0 && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
61229                         return resolved.callSignatures[0];
61230                     }
61231                     if (kind === 1 && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
61232                         return resolved.constructSignatures[0];
61233                     }
61234                 }
61235             }
61236             return undefined;
61237         }
61238         function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
61239             var context = createInferenceContext(signature.typeParameters, signature, 0, compareTypes);
61240             var restType = getEffectiveRestType(contextualSignature);
61241             var mapper = inferenceContext && (restType && restType.flags & 262144 ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
61242             var sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
61243             applyToParameterTypes(sourceSignature, signature, function (source, target) {
61244                 inferTypes(context.inferences, source, target);
61245             });
61246             if (!inferenceContext) {
61247                 applyToReturnTypes(contextualSignature, signature, function (source, target) {
61248                     inferTypes(context.inferences, source, target, 128);
61249                 });
61250             }
61251             return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
61252         }
61253         function inferJsxTypeArguments(node, signature, checkMode, context) {
61254             var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
61255             var checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
61256             inferTypes(context.inferences, checkAttrType, paramType);
61257             return getInferredTypes(context);
61258         }
61259         function getThisArgumentType(thisArgumentNode) {
61260             if (!thisArgumentNode) {
61261                 return voidType;
61262             }
61263             var thisArgumentType = checkExpression(thisArgumentNode);
61264             return ts.isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) :
61265                 ts.isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) :
61266                     thisArgumentType;
61267         }
61268         function inferTypeArguments(node, signature, args, checkMode, context) {
61269             if (ts.isJsxOpeningLikeElement(node)) {
61270                 return inferJsxTypeArguments(node, signature, checkMode, context);
61271             }
61272             if (node.kind !== 164) {
61273                 var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 : 0);
61274                 if (contextualType) {
61275                     var outerContext = getInferenceContext(node);
61276                     var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1));
61277                     var instantiatedType = instantiateType(contextualType, outerMapper);
61278                     var contextualSignature = getSingleCallSignature(instantiatedType);
61279                     var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
61280                         getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
61281                         instantiatedType;
61282                     var inferenceTargetType = getReturnTypeOfSignature(signature);
61283                     inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128);
61284                     var returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
61285                     var returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
61286                     inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
61287                     context.returnMapper = ts.some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined;
61288                 }
61289             }
61290             var restType = getNonArrayRestType(signature);
61291             var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
61292             if (restType && restType.flags & 262144) {
61293                 var info = ts.find(context.inferences, function (info) { return info.typeParameter === restType; });
61294                 if (info) {
61295                     info.impliedArity = ts.findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : undefined;
61296                 }
61297             }
61298             var thisType = getThisTypeOfSignature(signature);
61299             if (thisType) {
61300                 var thisArgumentNode = getThisArgumentOfCall(node);
61301                 inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
61302             }
61303             for (var i = 0; i < argCount; i++) {
61304                 var arg = args[i];
61305                 if (arg.kind !== 226) {
61306                     var paramType = getTypeAtPosition(signature, i);
61307                     var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
61308                     inferTypes(context.inferences, argType, paramType);
61309                 }
61310             }
61311             if (restType) {
61312                 var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
61313                 inferTypes(context.inferences, spreadType, restType);
61314             }
61315             return getInferredTypes(context);
61316         }
61317         function getMutableArrayOrTupleType(type) {
61318             return type.flags & 1048576 ? mapType(type, getMutableArrayOrTupleType) :
61319                 type.flags & 1 || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type :
61320                     isTupleType(type) ? createTupleType(getTypeArguments(type), type.target.elementFlags, false, type.target.labeledElementDeclarations) :
61321                         createTupleType([type], [8]);
61322         }
61323         function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
61324             if (index >= argCount - 1) {
61325                 var arg = args[argCount - 1];
61326                 if (isSpreadArgument(arg)) {
61327                     return getMutableArrayOrTupleType(arg.kind === 231 ? arg.type :
61328                         checkExpressionWithContextualType(arg.expression, restType, context, checkMode));
61329                 }
61330             }
61331             var types = [];
61332             var flags = [];
61333             var names = [];
61334             for (var i = index; i < argCount; i++) {
61335                 var arg = args[i];
61336                 if (isSpreadArgument(arg)) {
61337                     var spreadType = arg.kind === 231 ? arg.type : checkExpression(arg.expression);
61338                     if (isArrayLikeType(spreadType)) {
61339                         types.push(spreadType);
61340                         flags.push(8);
61341                     }
61342                     else {
61343                         types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 224 ? arg.expression : arg));
61344                         flags.push(4);
61345                     }
61346                 }
61347                 else {
61348                     var contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256);
61349                     var argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
61350                     var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 | 4194304 | 134217728 | 268435456);
61351                     types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
61352                     flags.push(1);
61353                 }
61354                 if (arg.kind === 231 && arg.tupleNameSource) {
61355                     names.push(arg.tupleNameSource);
61356                 }
61357             }
61358             return createTupleType(types, flags, false, ts.length(names) === ts.length(types) ? names : undefined);
61359         }
61360         function checkTypeArguments(signature, typeArgumentNodes, reportErrors, headMessage) {
61361             var isJavascript = ts.isInJSFile(signature.declaration);
61362             var typeParameters = signature.typeParameters;
61363             var typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isJavascript);
61364             var mapper;
61365             for (var i = 0; i < typeArgumentNodes.length; i++) {
61366                 ts.Debug.assert(typeParameters[i] !== undefined, "Should not call checkTypeArguments with too many type arguments");
61367                 var constraint = getConstraintOfTypeParameter(typeParameters[i]);
61368                 if (constraint) {
61369                     var errorInfo = reportErrors && headMessage ? (function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); }) : undefined;
61370                     var typeArgumentHeadMessage = headMessage || ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;
61371                     if (!mapper) {
61372                         mapper = createTypeMapper(typeParameters, typeArgumentTypes);
61373                     }
61374                     var typeArgument = typeArgumentTypes[i];
61375                     if (!checkTypeAssignableTo(typeArgument, getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument), reportErrors ? typeArgumentNodes[i] : undefined, typeArgumentHeadMessage, errorInfo)) {
61376                         return undefined;
61377                     }
61378                 }
61379             }
61380             return typeArgumentTypes;
61381         }
61382         function getJsxReferenceKind(node) {
61383             if (isJsxIntrinsicIdentifier(node.tagName)) {
61384                 return 2;
61385             }
61386             var tagType = getApparentType(checkExpression(node.tagName));
61387             if (ts.length(getSignaturesOfType(tagType, 1))) {
61388                 return 0;
61389             }
61390             if (ts.length(getSignaturesOfType(tagType, 0))) {
61391                 return 1;
61392             }
61393             return 2;
61394         }
61395         function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer) {
61396             var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
61397             var attributesType = checkExpressionWithContextualType(node.attributes, paramType, undefined, checkMode);
61398             return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(attributesType, paramType, relation, reportErrors ? node.tagName : undefined, node.attributes, undefined, containingMessageChain, errorOutputContainer);
61399             function checkTagNameDoesNotExpectTooManyArguments() {
61400                 var _a;
61401                 if (getJsxNamespaceContainerForImplicitImport(node)) {
61402                     return true;
61403                 }
61404                 var tagType = ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node) && !isJsxIntrinsicIdentifier(node.tagName) ? checkExpression(node.tagName) : undefined;
61405                 if (!tagType) {
61406                     return true;
61407                 }
61408                 var tagCallSignatures = getSignaturesOfType(tagType, 0);
61409                 if (!ts.length(tagCallSignatures)) {
61410                     return true;
61411                 }
61412                 var factory = getJsxFactoryEntity(node);
61413                 if (!factory) {
61414                     return true;
61415                 }
61416                 var factorySymbol = resolveEntityName(factory, 111551, true, false, node);
61417                 if (!factorySymbol) {
61418                     return true;
61419                 }
61420                 var factoryType = getTypeOfSymbol(factorySymbol);
61421                 var callSignatures = getSignaturesOfType(factoryType, 0);
61422                 if (!ts.length(callSignatures)) {
61423                     return true;
61424                 }
61425                 var hasFirstParamSignatures = false;
61426                 var maxParamCount = 0;
61427                 for (var _i = 0, callSignatures_1 = callSignatures; _i < callSignatures_1.length; _i++) {
61428                     var sig = callSignatures_1[_i];
61429                     var firstparam = getTypeAtPosition(sig, 0);
61430                     var signaturesOfParam = getSignaturesOfType(firstparam, 0);
61431                     if (!ts.length(signaturesOfParam))
61432                         continue;
61433                     for (var _b = 0, signaturesOfParam_1 = signaturesOfParam; _b < signaturesOfParam_1.length; _b++) {
61434                         var paramSig = signaturesOfParam_1[_b];
61435                         hasFirstParamSignatures = true;
61436                         if (hasEffectiveRestParameter(paramSig)) {
61437                             return true;
61438                         }
61439                         var paramCount = getParameterCount(paramSig);
61440                         if (paramCount > maxParamCount) {
61441                             maxParamCount = paramCount;
61442                         }
61443                     }
61444                 }
61445                 if (!hasFirstParamSignatures) {
61446                     return true;
61447                 }
61448                 var absoluteMinArgCount = Infinity;
61449                 for (var _c = 0, tagCallSignatures_1 = tagCallSignatures; _c < tagCallSignatures_1.length; _c++) {
61450                     var tagSig = tagCallSignatures_1[_c];
61451                     var tagRequiredArgCount = getMinArgumentCount(tagSig);
61452                     if (tagRequiredArgCount < absoluteMinArgCount) {
61453                         absoluteMinArgCount = tagRequiredArgCount;
61454                     }
61455                 }
61456                 if (absoluteMinArgCount <= maxParamCount) {
61457                     return true;
61458                 }
61459                 if (reportErrors) {
61460                     var diag = ts.createDiagnosticForNode(node.tagName, ts.Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, ts.entityNameToString(node.tagName), absoluteMinArgCount, ts.entityNameToString(factory), maxParamCount);
61461                     var tagNameDeclaration = (_a = getSymbolAtLocation(node.tagName)) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61462                     if (tagNameDeclaration) {
61463                         ts.addRelatedInfo(diag, ts.createDiagnosticForNode(tagNameDeclaration, ts.Diagnostics._0_is_declared_here, ts.entityNameToString(node.tagName)));
61464                     }
61465                     if (errorOutputContainer && errorOutputContainer.skipLogging) {
61466                         (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
61467                     }
61468                     if (!errorOutputContainer.skipLogging) {
61469                         diagnostics.add(diag);
61470                     }
61471                 }
61472                 return false;
61473             }
61474         }
61475         function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors, containingMessageChain) {
61476             var errorOutputContainer = { errors: undefined, skipLogging: true };
61477             if (ts.isJsxOpeningLikeElement(node)) {
61478                 if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
61479                     ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
61480                     return errorOutputContainer.errors || ts.emptyArray;
61481                 }
61482                 return undefined;
61483             }
61484             var thisType = getThisTypeOfSignature(signature);
61485             if (thisType && thisType !== voidType && node.kind !== 208) {
61486                 var thisArgumentNode = getThisArgumentOfCall(node);
61487                 var thisArgumentType = getThisArgumentType(thisArgumentNode);
61488                 var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
61489                 var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
61490                 if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
61491                     ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
61492                     return errorOutputContainer.errors || ts.emptyArray;
61493                 }
61494             }
61495             var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
61496             var restType = getNonArrayRestType(signature);
61497             var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
61498             for (var i = 0; i < argCount; i++) {
61499                 var arg = args[i];
61500                 if (arg.kind !== 226) {
61501                     var paramType = getTypeAtPosition(signature, i);
61502                     var argType = checkExpressionWithContextualType(arg, paramType, undefined, checkMode);
61503                     var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType;
61504                     if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
61505                         ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
61506                         maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
61507                         return errorOutputContainer.errors || ts.emptyArray;
61508                     }
61509                 }
61510             }
61511             if (restType) {
61512                 var spreadType = getSpreadArgumentType(args, argCount, args.length, restType, undefined, checkMode);
61513                 var restArgCount = args.length - argCount;
61514                 var errorNode = !reportErrors ? undefined :
61515                     restArgCount === 0 ? node :
61516                         restArgCount === 1 ? args[argCount] :
61517                             ts.setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
61518                 if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer)) {
61519                     ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
61520                     maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
61521                     return errorOutputContainer.errors || ts.emptyArray;
61522                 }
61523             }
61524             return undefined;
61525             function maybeAddMissingAwaitInfo(errorNode, source, target) {
61526                 if (errorNode && reportErrors && errorOutputContainer.errors && errorOutputContainer.errors.length) {
61527                     if (getAwaitedTypeOfPromise(target)) {
61528                         return;
61529                     }
61530                     var awaitedTypeOfSource = getAwaitedTypeOfPromise(source);
61531                     if (awaitedTypeOfSource && isTypeRelatedTo(awaitedTypeOfSource, target, relation)) {
61532                         ts.addRelatedInfo(errorOutputContainer.errors[0], ts.createDiagnosticForNode(errorNode, ts.Diagnostics.Did_you_forget_to_use_await));
61533                     }
61534                 }
61535             }
61536         }
61537         function getThisArgumentOfCall(node) {
61538             var expression = node.kind === 207 ? node.expression :
61539                 node.kind === 209 ? node.tag : undefined;
61540             if (expression) {
61541                 var callee = ts.skipOuterExpressions(expression);
61542                 if (ts.isAccessExpression(callee)) {
61543                     return callee.expression;
61544                 }
61545             }
61546         }
61547         function createSyntheticExpression(parent, type, isSpread, tupleNameSource) {
61548             var result = ts.parseNodeFactory.createSyntheticExpression(type, isSpread, tupleNameSource);
61549             ts.setTextRange(result, parent);
61550             ts.setParent(result, parent);
61551             return result;
61552         }
61553         function getEffectiveCallArguments(node) {
61554             if (node.kind === 209) {
61555                 var template = node.template;
61556                 var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
61557                 if (template.kind === 222) {
61558                     ts.forEach(template.templateSpans, function (span) {
61559                         args_3.push(span.expression);
61560                     });
61561                 }
61562                 return args_3;
61563             }
61564             if (node.kind === 164) {
61565                 return getEffectiveDecoratorArguments(node);
61566             }
61567             if (ts.isJsxOpeningLikeElement(node)) {
61568                 return node.attributes.properties.length > 0 || (ts.isJsxOpeningElement(node) && node.parent.children.length > 0) ? [node.attributes] : ts.emptyArray;
61569             }
61570             var args = node.arguments || ts.emptyArray;
61571             var spreadIndex = getSpreadArgumentIndex(args);
61572             if (spreadIndex >= 0) {
61573                 var effectiveArgs_1 = args.slice(0, spreadIndex);
61574                 var _loop_23 = function (i) {
61575                     var arg = args[i];
61576                     var spreadType = arg.kind === 224 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
61577                     if (spreadType && isTupleType(spreadType)) {
61578                         ts.forEach(getTypeArguments(spreadType), function (t, i) {
61579                             var _a;
61580                             var flags = spreadType.target.elementFlags[i];
61581                             var syntheticArg = createSyntheticExpression(arg, flags & 4 ? createArrayType(t) : t, !!(flags & 12), (_a = spreadType.target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[i]);
61582                             effectiveArgs_1.push(syntheticArg);
61583                         });
61584                     }
61585                     else {
61586                         effectiveArgs_1.push(arg);
61587                     }
61588                 };
61589                 for (var i = spreadIndex; i < args.length; i++) {
61590                     _loop_23(i);
61591                 }
61592                 return effectiveArgs_1;
61593             }
61594             return args;
61595         }
61596         function getEffectiveDecoratorArguments(node) {
61597             var parent = node.parent;
61598             var expr = node.expression;
61599             switch (parent.kind) {
61600                 case 256:
61601                 case 225:
61602                     return [
61603                         createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
61604                     ];
61605                 case 163:
61606                     var func = parent.parent;
61607                     return [
61608                         createSyntheticExpression(expr, parent.parent.kind === 170 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
61609                         createSyntheticExpression(expr, anyType),
61610                         createSyntheticExpression(expr, numberType)
61611                     ];
61612                 case 166:
61613                 case 168:
61614                 case 171:
61615                 case 172:
61616                     var hasPropDesc = parent.kind !== 166 && languageVersion !== 0;
61617                     return [
61618                         createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
61619                         createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
61620                         createSyntheticExpression(expr, hasPropDesc ? createTypedPropertyDescriptorType(getTypeOfNode(parent)) : anyType)
61621                     ];
61622             }
61623             return ts.Debug.fail();
61624         }
61625         function getDecoratorArgumentCount(node, signature) {
61626             switch (node.parent.kind) {
61627                 case 256:
61628                 case 225:
61629                     return 1;
61630                 case 166:
61631                     return 2;
61632                 case 168:
61633                 case 171:
61634                 case 172:
61635                     return languageVersion === 0 || signature.parameters.length <= 2 ? 2 : 3;
61636                 case 163:
61637                     return 3;
61638                 default:
61639                     return ts.Debug.fail();
61640             }
61641         }
61642         function getDiagnosticSpanForCallNode(node, doNotIncludeArguments) {
61643             var start;
61644             var length;
61645             var sourceFile = ts.getSourceFileOfNode(node);
61646             if (ts.isPropertyAccessExpression(node.expression)) {
61647                 var nameSpan = ts.getErrorSpanForNode(sourceFile, node.expression.name);
61648                 start = nameSpan.start;
61649                 length = doNotIncludeArguments ? nameSpan.length : node.end - start;
61650             }
61651             else {
61652                 var expressionSpan = ts.getErrorSpanForNode(sourceFile, node.expression);
61653                 start = expressionSpan.start;
61654                 length = doNotIncludeArguments ? expressionSpan.length : node.end - start;
61655             }
61656             return { start: start, length: length, sourceFile: sourceFile };
61657         }
61658         function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) {
61659             if (ts.isCallExpression(node)) {
61660                 var _a = getDiagnosticSpanForCallNode(node), sourceFile = _a.sourceFile, start = _a.start, length_6 = _a.length;
61661                 return ts.createFileDiagnostic(sourceFile, start, length_6, message, arg0, arg1, arg2, arg3);
61662             }
61663             else {
61664                 return ts.createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3);
61665             }
61666         }
61667         function isPromiseResolveArityError(node) {
61668             if (!ts.isCallExpression(node) || !ts.isIdentifier(node.expression))
61669                 return false;
61670             var symbol = resolveName(node.expression, node.expression.escapedText, 111551, undefined, undefined, false);
61671             var decl = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration;
61672             if (!decl || !ts.isParameter(decl) || !ts.isFunctionExpressionOrArrowFunction(decl.parent) || !ts.isNewExpression(decl.parent.parent) || !ts.isIdentifier(decl.parent.parent.expression)) {
61673                 return false;
61674             }
61675             var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false);
61676             if (!globalPromiseSymbol)
61677                 return false;
61678             var constructorSymbol = getSymbolAtLocation(decl.parent.parent.expression, true);
61679             return constructorSymbol === globalPromiseSymbol;
61680         }
61681         function getArgumentArityError(node, signatures, args) {
61682             var _a;
61683             var spreadIndex = getSpreadArgumentIndex(args);
61684             if (spreadIndex > -1) {
61685                 return ts.createDiagnosticForNode(args[spreadIndex], ts.Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter);
61686             }
61687             var min = Number.POSITIVE_INFINITY;
61688             var max = Number.NEGATIVE_INFINITY;
61689             var maxBelow = Number.NEGATIVE_INFINITY;
61690             var minAbove = Number.POSITIVE_INFINITY;
61691             var closestSignature;
61692             for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) {
61693                 var sig = signatures_8[_i];
61694                 var minParameter = getMinArgumentCount(sig);
61695                 var maxParameter = getParameterCount(sig);
61696                 if (minParameter < min) {
61697                     min = minParameter;
61698                     closestSignature = sig;
61699                 }
61700                 max = Math.max(max, maxParameter);
61701                 if (minParameter < args.length && minParameter > maxBelow)
61702                     maxBelow = minParameter;
61703                 if (args.length < maxParameter && maxParameter < minAbove)
61704                     minAbove = maxParameter;
61705             }
61706             var hasRestParameter = ts.some(signatures, hasEffectiveRestParameter);
61707             var parameterRange = hasRestParameter ? min
61708                 : min < max ? min + "-" + max
61709                     : min;
61710             var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
61711                 : parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node) ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
61712                     : ts.Diagnostics.Expected_0_arguments_but_got_1;
61713             if (min < args.length && args.length < max) {
61714                 return getDiagnosticForCallNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove);
61715             }
61716             else if (args.length < min) {
61717                 var diagnostic = getDiagnosticForCallNode(node, error, parameterRange, args.length);
61718                 var parameter = (_a = closestSignature === null || closestSignature === void 0 ? void 0 : closestSignature.declaration) === null || _a === void 0 ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
61719                 if (parameter) {
61720                     var parameterError = ts.createDiagnosticForNode(parameter, ts.isBindingPattern(parameter.name) ? ts.Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided
61721                         : ts.isRestParameter(parameter) ? ts.Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided
61722                             : ts.Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : !ts.isBindingPattern(parameter.name) ? ts.idText(ts.getFirstIdentifier(parameter.name)) : undefined);
61723                     return ts.addRelatedInfo(diagnostic, parameterError);
61724                 }
61725                 return diagnostic;
61726             }
61727             else {
61728                 var errorSpan = ts.factory.createNodeArray(args.slice(max));
61729                 var pos = ts.first(errorSpan).pos;
61730                 var end = ts.last(errorSpan).end;
61731                 if (end === pos) {
61732                     end++;
61733                 }
61734                 ts.setTextRangePosEnd(errorSpan, pos, end);
61735                 return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), errorSpan, error, parameterRange, args.length);
61736             }
61737         }
61738         function getTypeArgumentArityError(node, signatures, typeArguments) {
61739             var argCount = typeArguments.length;
61740             if (signatures.length === 1) {
61741                 var sig = signatures[0];
61742                 var min_1 = getMinTypeArgumentCount(sig.typeParameters);
61743                 var max = ts.length(sig.typeParameters);
61744                 return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, min_1 < max ? min_1 + "-" + max : min_1, argCount);
61745             }
61746             var belowArgCount = -Infinity;
61747             var aboveArgCount = Infinity;
61748             for (var _i = 0, signatures_9 = signatures; _i < signatures_9.length; _i++) {
61749                 var sig = signatures_9[_i];
61750                 var min_2 = getMinTypeArgumentCount(sig.typeParameters);
61751                 var max = ts.length(sig.typeParameters);
61752                 if (min_2 > argCount) {
61753                     aboveArgCount = Math.min(aboveArgCount, min_2);
61754                 }
61755                 else if (max < argCount) {
61756                     belowArgCount = Math.max(belowArgCount, max);
61757                 }
61758             }
61759             if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) {
61760                 return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount);
61761             }
61762             return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
61763         }
61764         function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) {
61765             var isTaggedTemplate = node.kind === 209;
61766             var isDecorator = node.kind === 164;
61767             var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
61768             var reportErrors = !candidatesOutArray && produceDiagnostics;
61769             var typeArguments;
61770             if (!isDecorator) {
61771                 typeArguments = node.typeArguments;
61772                 if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) {
61773                     ts.forEach(typeArguments, checkSourceElement);
61774                 }
61775             }
61776             var candidates = candidatesOutArray || [];
61777             reorderCandidates(signatures, candidates, callChainFlags);
61778             if (!candidates.length) {
61779                 if (reportErrors) {
61780                     diagnostics.add(getDiagnosticForCallNode(node, ts.Diagnostics.Call_target_does_not_contain_any_signatures));
61781                 }
61782                 return resolveErrorCall(node);
61783             }
61784             var args = getEffectiveCallArguments(node);
61785             var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
61786             var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 : 0;
61787             var candidatesForArgumentError;
61788             var candidateForArgumentArityError;
61789             var candidateForTypeArgumentError;
61790             var result;
61791             var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 207 && node.arguments.hasTrailingComma;
61792             if (candidates.length > 1) {
61793                 result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
61794             }
61795             if (!result) {
61796                 result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
61797             }
61798             if (result) {
61799                 return result;
61800             }
61801             if (reportErrors) {
61802                 if (candidatesForArgumentError) {
61803                     if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
61804                         var last_2 = candidatesForArgumentError[candidatesForArgumentError.length - 1];
61805                         var chain_1;
61806                         if (candidatesForArgumentError.length > 3) {
61807                             chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.The_last_overload_gave_the_following_error);
61808                             chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.No_overload_matches_this_call);
61809                         }
61810                         var diags = getSignatureApplicabilityError(node, args, last_2, assignableRelation, 0, true, function () { return chain_1; });
61811                         if (diags) {
61812                             for (var _i = 0, diags_1 = diags; _i < diags_1.length; _i++) {
61813                                 var d = diags_1[_i];
61814                                 if (last_2.declaration && candidatesForArgumentError.length > 3) {
61815                                     ts.addRelatedInfo(d, ts.createDiagnosticForNode(last_2.declaration, ts.Diagnostics.The_last_overload_is_declared_here));
61816                                 }
61817                                 addImplementationSuccessElaboration(last_2, d);
61818                                 diagnostics.add(d);
61819                             }
61820                         }
61821                         else {
61822                             ts.Debug.fail("No error for last overload signature");
61823                         }
61824                     }
61825                     else {
61826                         var allDiagnostics = [];
61827                         var max = 0;
61828                         var min_3 = Number.MAX_VALUE;
61829                         var minIndex = 0;
61830                         var i_1 = 0;
61831                         var _loop_24 = function (c) {
61832                             var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
61833                             var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
61834                             if (diags_2) {
61835                                 if (diags_2.length <= min_3) {
61836                                     min_3 = diags_2.length;
61837                                     minIndex = i_1;
61838                                 }
61839                                 max = Math.max(max, diags_2.length);
61840                                 allDiagnostics.push(diags_2);
61841                             }
61842                             else {
61843                                 ts.Debug.fail("No error for 3 or fewer overload signatures");
61844                             }
61845                             i_1++;
61846                         };
61847                         for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
61848                             var c = candidatesForArgumentError_1[_a];
61849                             _loop_24(c);
61850                         }
61851                         var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
61852                         ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
61853                         var chain = ts.chainDiagnosticMessages(ts.map(diags_3, function (d) { return typeof d.messageText === "string" ? d : d.messageText; }), ts.Diagnostics.No_overload_matches_this_call);
61854                         var related = __spreadArray([], ts.flatMap(diags_3, function (d) { return d.relatedInformation; }), true);
61855                         var diag = void 0;
61856                         if (ts.every(diags_3, function (d) { return d.start === diags_3[0].start && d.length === diags_3[0].length && d.file === diags_3[0].file; })) {
61857                             var _b = diags_3[0], file = _b.file, start = _b.start, length_7 = _b.length;
61858                             diag = { file: file, start: start, length: length_7, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
61859                         }
61860                         else {
61861                             diag = ts.createDiagnosticForNodeFromMessageChain(node, chain, related);
61862                         }
61863                         addImplementationSuccessElaboration(candidatesForArgumentError[0], diag);
61864                         diagnostics.add(diag);
61865                     }
61866                 }
61867                 else if (candidateForArgumentArityError) {
61868                     diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args));
61869                 }
61870                 else if (candidateForTypeArgumentError) {
61871                     checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, true, fallbackError);
61872                 }
61873                 else {
61874                     var signaturesWithCorrectTypeArgumentArity = ts.filter(signatures, function (s) { return hasCorrectTypeArgumentArity(s, typeArguments); });
61875                     if (signaturesWithCorrectTypeArgumentArity.length === 0) {
61876                         diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments));
61877                     }
61878                     else if (!isDecorator) {
61879                         diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args));
61880                     }
61881                     else if (fallbackError) {
61882                         diagnostics.add(getDiagnosticForCallNode(node, fallbackError));
61883                     }
61884                 }
61885             }
61886             return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
61887             function addImplementationSuccessElaboration(failed, diagnostic) {
61888                 var _a, _b;
61889                 var oldCandidatesForArgumentError = candidatesForArgumentError;
61890                 var oldCandidateForArgumentArityError = candidateForArgumentArityError;
61891                 var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
61892                 var failedSignatureDeclarations = ((_b = (_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.declarations) || ts.emptyArray;
61893                 var isOverload = failedSignatureDeclarations.length > 1;
61894                 var implDecl = isOverload ? ts.find(failedSignatureDeclarations, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
61895                 if (implDecl) {
61896                     var candidate = getSignatureFromDeclaration(implDecl);
61897                     var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
61898                     if (chooseOverload([candidate], assignableRelation, isSingleNonGenericCandidate_1)) {
61899                         ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(implDecl, ts.Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible));
61900                     }
61901                 }
61902                 candidatesForArgumentError = oldCandidatesForArgumentError;
61903                 candidateForArgumentArityError = oldCandidateForArgumentArityError;
61904                 candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
61905             }
61906             function chooseOverload(candidates, relation, isSingleNonGenericCandidate, signatureHelpTrailingComma) {
61907                 if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; }
61908                 candidatesForArgumentError = undefined;
61909                 candidateForArgumentArityError = undefined;
61910                 candidateForTypeArgumentError = undefined;
61911                 if (isSingleNonGenericCandidate) {
61912                     var candidate = candidates[0];
61913                     if (ts.some(typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
61914                         return undefined;
61915                     }
61916                     if (getSignatureApplicabilityError(node, args, candidate, relation, 0, false, undefined)) {
61917                         candidatesForArgumentError = [candidate];
61918                         return undefined;
61919                     }
61920                     return candidate;
61921                 }
61922                 for (var candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) {
61923                     var candidate = candidates[candidateIndex];
61924                     if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
61925                         continue;
61926                     }
61927                     var checkCandidate = void 0;
61928                     var inferenceContext = void 0;
61929                     if (candidate.typeParameters) {
61930                         var typeArgumentTypes = void 0;
61931                         if (ts.some(typeArguments)) {
61932                             typeArgumentTypes = checkTypeArguments(candidate, typeArguments, false);
61933                             if (!typeArgumentTypes) {
61934                                 candidateForTypeArgumentError = candidate;
61935                                 continue;
61936                             }
61937                         }
61938                         else {
61939                             inferenceContext = createInferenceContext(candidate.typeParameters, candidate, ts.isInJSFile(node) ? 2 : 0);
61940                             typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8, inferenceContext);
61941                             argCheckMode |= inferenceContext.flags & 4 ? 8 : 0;
61942                         }
61943                         checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
61944                         if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
61945                             candidateForArgumentArityError = checkCandidate;
61946                             continue;
61947                         }
61948                     }
61949                     else {
61950                         checkCandidate = candidate;
61951                     }
61952                     if (getSignatureApplicabilityError(node, args, checkCandidate, relation, argCheckMode, false, undefined)) {
61953                         (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
61954                         continue;
61955                     }
61956                     if (argCheckMode) {
61957                         argCheckMode = 0;
61958                         if (inferenceContext) {
61959                             var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
61960                             checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
61961                             if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
61962                                 candidateForArgumentArityError = checkCandidate;
61963                                 continue;
61964                             }
61965                         }
61966                         if (getSignatureApplicabilityError(node, args, checkCandidate, relation, argCheckMode, false, undefined)) {
61967                             (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
61968                             continue;
61969                         }
61970                     }
61971                     candidates[candidateIndex] = checkCandidate;
61972                     return checkCandidate;
61973                 }
61974                 return undefined;
61975             }
61976         }
61977         function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray) {
61978             ts.Debug.assert(candidates.length > 0);
61979             checkNodeDeferred(node);
61980             return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function (c) { return !!c.typeParameters; })
61981                 ? pickLongestCandidateSignature(node, candidates, args)
61982                 : createUnionOfSignaturesForOverloadFailure(candidates);
61983         }
61984         function createUnionOfSignaturesForOverloadFailure(candidates) {
61985             var thisParameters = ts.mapDefined(candidates, function (c) { return c.thisParameter; });
61986             var thisParameter;
61987             if (thisParameters.length) {
61988                 thisParameter = createCombinedSymbolFromTypes(thisParameters, thisParameters.map(getTypeOfParameter));
61989             }
61990             var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
61991             var parameters = [];
61992             var _loop_25 = function (i) {
61993                 var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
61994                     i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
61995                     i < s.parameters.length ? s.parameters[i] : undefined; });
61996                 ts.Debug.assert(symbols.length !== 0);
61997                 parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
61998             };
61999             for (var i = 0; i < maxNonRestParam; i++) {
62000                 _loop_25(i);
62001             }
62002             var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
62003             var flags = 0;
62004             if (restParameterSymbols.length !== 0) {
62005                 var type = createArrayType(getUnionType(ts.mapDefined(candidates, tryGetRestTypeOfSignature), 2));
62006                 parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
62007                 flags |= 1;
62008             }
62009             if (candidates.some(signatureHasLiteralTypes)) {
62010                 flags |= 2;
62011             }
62012             return createSignature(candidates[0].declaration, undefined, thisParameter, parameters, getIntersectionType(candidates.map(getReturnTypeOfSignature)), undefined, minArgumentCount, flags);
62013         }
62014         function getNumNonRestParameters(signature) {
62015             var numParams = signature.parameters.length;
62016             return signatureHasRestParameter(signature) ? numParams - 1 : numParams;
62017         }
62018         function createCombinedSymbolFromTypes(sources, types) {
62019             return createCombinedSymbolForOverloadFailure(sources, getUnionType(types, 2));
62020         }
62021         function createCombinedSymbolForOverloadFailure(sources, type) {
62022             return createSymbolWithType(ts.first(sources), type);
62023         }
62024         function pickLongestCandidateSignature(node, candidates, args) {
62025             var bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args.length : apparentArgumentCount);
62026             var candidate = candidates[bestIndex];
62027             var typeParameters = candidate.typeParameters;
62028             if (!typeParameters) {
62029                 return candidate;
62030             }
62031             var typeArgumentNodes = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments : undefined;
62032             var instantiated = typeArgumentNodes
62033                 ? createSignatureInstantiation(candidate, getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, ts.isInJSFile(node)))
62034                 : inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args);
62035             candidates[bestIndex] = instantiated;
62036             return instantiated;
62037         }
62038         function getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, isJs) {
62039             var typeArguments = typeArgumentNodes.map(getTypeOfNode);
62040             while (typeArguments.length > typeParameters.length) {
62041                 typeArguments.pop();
62042             }
62043             while (typeArguments.length < typeParameters.length) {
62044                 typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
62045             }
62046             return typeArguments;
62047         }
62048         function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args) {
62049             var inferenceContext = createInferenceContext(typeParameters, candidate, ts.isInJSFile(node) ? 2 : 0);
62050             var typeArgumentTypes = inferTypeArguments(node, candidate, args, 4 | 8, inferenceContext);
62051             return createSignatureInstantiation(candidate, typeArgumentTypes);
62052         }
62053         function getLongestCandidateIndex(candidates, argsCount) {
62054             var maxParamsIndex = -1;
62055             var maxParams = -1;
62056             for (var i = 0; i < candidates.length; i++) {
62057                 var candidate = candidates[i];
62058                 var paramCount = getParameterCount(candidate);
62059                 if (hasEffectiveRestParameter(candidate) || paramCount >= argsCount) {
62060                     return i;
62061                 }
62062                 if (paramCount > maxParams) {
62063                     maxParams = paramCount;
62064                     maxParamsIndex = i;
62065                 }
62066             }
62067             return maxParamsIndex;
62068         }
62069         function resolveCallExpression(node, candidatesOutArray, checkMode) {
62070             if (node.expression.kind === 106) {
62071                 var superType = checkSuperExpression(node.expression);
62072                 if (isTypeAny(superType)) {
62073                     for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
62074                         var arg = _a[_i];
62075                         checkExpression(arg);
62076                     }
62077                     return anySignature;
62078                 }
62079                 if (!isErrorType(superType)) {
62080                     var baseTypeNode = ts.getEffectiveBaseTypeNode(ts.getContainingClass(node));
62081                     if (baseTypeNode) {
62082                         var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode);
62083                         return resolveCall(node, baseConstructors, candidatesOutArray, checkMode, 0);
62084                     }
62085                 }
62086                 return resolveUntypedCall(node);
62087             }
62088             var callChainFlags;
62089             var funcType = checkExpression(node.expression);
62090             if (ts.isCallChain(node)) {
62091                 var nonOptionalType = getOptionalExpressionType(funcType, node.expression);
62092                 callChainFlags = nonOptionalType === funcType ? 0 :
62093                     ts.isOutermostOptionalChain(node) ? 16 :
62094                         8;
62095                 funcType = nonOptionalType;
62096             }
62097             else {
62098                 callChainFlags = 0;
62099             }
62100             funcType = checkNonNullTypeWithReporter(funcType, node.expression, reportCannotInvokePossiblyNullOrUndefinedError);
62101             if (funcType === silentNeverType) {
62102                 return silentNeverSignature;
62103             }
62104             var apparentType = getApparentType(funcType);
62105             if (isErrorType(apparentType)) {
62106                 return resolveErrorCall(node);
62107             }
62108             var callSignatures = getSignaturesOfType(apparentType, 0);
62109             var numConstructSignatures = getSignaturesOfType(apparentType, 1).length;
62110             if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
62111                 if (!isErrorType(funcType) && node.typeArguments) {
62112                     error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
62113                 }
62114                 return resolveUntypedCall(node);
62115             }
62116             if (!callSignatures.length) {
62117                 if (numConstructSignatures) {
62118                     error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
62119                 }
62120                 else {
62121                     var relatedInformation = void 0;
62122                     if (node.arguments.length === 1) {
62123                         var text = ts.getSourceFileOfNode(node).text;
62124                         if (ts.isLineBreak(text.charCodeAt(ts.skipTrivia(text, node.expression.end, true) - 1))) {
62125                             relatedInformation = ts.createDiagnosticForNode(node.expression, ts.Diagnostics.Are_you_missing_a_semicolon);
62126                         }
62127                     }
62128                     invocationError(node.expression, apparentType, 0, relatedInformation);
62129                 }
62130                 return resolveErrorCall(node);
62131             }
62132             if (checkMode & 8 && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
62133                 skippedGenericFunction(node, checkMode);
62134                 return resolvingSignature;
62135             }
62136             if (callSignatures.some(function (sig) { return ts.isInJSFile(sig.declaration) && !!ts.getJSDocClassTag(sig.declaration); })) {
62137                 error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
62138                 return resolveErrorCall(node);
62139             }
62140             return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
62141         }
62142         function isGenericFunctionReturningFunction(signature) {
62143             return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
62144         }
62145         function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
62146             return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144) ||
62147                 !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576) && !(getReducedType(apparentFuncType).flags & 131072) && isTypeAssignableTo(funcType, globalFunctionType);
62148         }
62149         function resolveNewExpression(node, candidatesOutArray, checkMode) {
62150             if (node.arguments && languageVersion < 1) {
62151                 var spreadIndex = getSpreadArgumentIndex(node.arguments);
62152                 if (spreadIndex >= 0) {
62153                     error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher);
62154                 }
62155             }
62156             var expressionType = checkNonNullExpression(node.expression);
62157             if (expressionType === silentNeverType) {
62158                 return silentNeverSignature;
62159             }
62160             expressionType = getApparentType(expressionType);
62161             if (isErrorType(expressionType)) {
62162                 return resolveErrorCall(node);
62163             }
62164             if (isTypeAny(expressionType)) {
62165                 if (node.typeArguments) {
62166                     error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
62167                 }
62168                 return resolveUntypedCall(node);
62169             }
62170             var constructSignatures = getSignaturesOfType(expressionType, 1);
62171             if (constructSignatures.length) {
62172                 if (!isConstructorAccessible(node, constructSignatures[0])) {
62173                     return resolveErrorCall(node);
62174                 }
62175                 if (constructSignatures.some(function (signature) { return signature.flags & 4; })) {
62176                     error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
62177                     return resolveErrorCall(node);
62178                 }
62179                 var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol);
62180                 if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128)) {
62181                     error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
62182                     return resolveErrorCall(node);
62183                 }
62184                 return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0);
62185             }
62186             var callSignatures = getSignaturesOfType(expressionType, 0);
62187             if (callSignatures.length) {
62188                 var signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0);
62189                 if (!noImplicitAny) {
62190                     if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
62191                         error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
62192                     }
62193                     if (getThisTypeOfSignature(signature) === voidType) {
62194                         error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void);
62195                     }
62196                 }
62197                 return signature;
62198             }
62199             invocationError(node.expression, expressionType, 1);
62200             return resolveErrorCall(node);
62201         }
62202         function typeHasProtectedAccessibleBase(target, type) {
62203             var baseTypes = getBaseTypes(type);
62204             if (!ts.length(baseTypes)) {
62205                 return false;
62206             }
62207             var firstBase = baseTypes[0];
62208             if (firstBase.flags & 2097152) {
62209                 var types = firstBase.types;
62210                 var mixinFlags = findMixins(types);
62211                 var i = 0;
62212                 for (var _i = 0, _a = firstBase.types; _i < _a.length; _i++) {
62213                     var intersectionMember = _a[_i];
62214                     if (!mixinFlags[i]) {
62215                         if (ts.getObjectFlags(intersectionMember) & (1 | 2)) {
62216                             if (intersectionMember.symbol === target) {
62217                                 return true;
62218                             }
62219                             if (typeHasProtectedAccessibleBase(target, intersectionMember)) {
62220                                 return true;
62221                             }
62222                         }
62223                     }
62224                     i++;
62225                 }
62226                 return false;
62227             }
62228             if (firstBase.symbol === target) {
62229                 return true;
62230             }
62231             return typeHasProtectedAccessibleBase(target, firstBase);
62232         }
62233         function isConstructorAccessible(node, signature) {
62234             if (!signature || !signature.declaration) {
62235                 return true;
62236             }
62237             var declaration = signature.declaration;
62238             var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24);
62239             if (!modifiers || declaration.kind !== 170) {
62240                 return true;
62241             }
62242             var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol);
62243             var declaringClass = getDeclaredTypeOfSymbol(declaration.parent.symbol);
62244             if (!isNodeWithinClass(node, declaringClassDeclaration)) {
62245                 var containingClass = ts.getContainingClass(node);
62246                 if (containingClass && modifiers & 16) {
62247                     var containingType = getTypeOfNode(containingClass);
62248                     if (typeHasProtectedAccessibleBase(declaration.parent.symbol, containingType)) {
62249                         return true;
62250                     }
62251                 }
62252                 if (modifiers & 8) {
62253                     error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
62254                 }
62255                 if (modifiers & 16) {
62256                     error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass));
62257                 }
62258                 return false;
62259             }
62260             return true;
62261         }
62262         function invocationErrorDetails(errorTarget, apparentType, kind) {
62263             var errorInfo;
62264             var isCall = kind === 0;
62265             var awaitedType = getAwaitedType(apparentType);
62266             var maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0;
62267             if (apparentType.flags & 1048576) {
62268                 var types = apparentType.types;
62269                 var hasSignatures = false;
62270                 for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
62271                     var constituent = types_20[_i];
62272                     var signatures = getSignaturesOfType(constituent, kind);
62273                     if (signatures.length !== 0) {
62274                         hasSignatures = true;
62275                         if (errorInfo) {
62276                             break;
62277                         }
62278                     }
62279                     else {
62280                         if (!errorInfo) {
62281                             errorInfo = ts.chainDiagnosticMessages(errorInfo, isCall ?
62282                                 ts.Diagnostics.Type_0_has_no_call_signatures :
62283                                 ts.Diagnostics.Type_0_has_no_construct_signatures, typeToString(constituent));
62284                             errorInfo = ts.chainDiagnosticMessages(errorInfo, isCall ?
62285                                 ts.Diagnostics.Not_all_constituents_of_type_0_are_callable :
62286                                 ts.Diagnostics.Not_all_constituents_of_type_0_are_constructable, typeToString(apparentType));
62287                         }
62288                         if (hasSignatures) {
62289                             break;
62290                         }
62291                     }
62292                 }
62293                 if (!hasSignatures) {
62294                     errorInfo = ts.chainDiagnosticMessages(undefined, isCall ?
62295                         ts.Diagnostics.No_constituent_of_type_0_is_callable :
62296                         ts.Diagnostics.No_constituent_of_type_0_is_constructable, typeToString(apparentType));
62297                 }
62298                 if (!errorInfo) {
62299                     errorInfo = ts.chainDiagnosticMessages(errorInfo, isCall ?
62300                         ts.Diagnostics.Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other :
62301                         ts.Diagnostics.Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other, typeToString(apparentType));
62302                 }
62303             }
62304             else {
62305                 errorInfo = ts.chainDiagnosticMessages(errorInfo, isCall ?
62306                     ts.Diagnostics.Type_0_has_no_call_signatures :
62307                     ts.Diagnostics.Type_0_has_no_construct_signatures, typeToString(apparentType));
62308             }
62309             var headMessage = isCall ? ts.Diagnostics.This_expression_is_not_callable : ts.Diagnostics.This_expression_is_not_constructable;
62310             if (ts.isCallExpression(errorTarget.parent) && errorTarget.parent.arguments.length === 0) {
62311                 var resolvedSymbol = getNodeLinks(errorTarget).resolvedSymbol;
62312                 if (resolvedSymbol && resolvedSymbol.flags & 32768) {
62313                     headMessage = ts.Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without;
62314                 }
62315             }
62316             return {
62317                 messageChain: ts.chainDiagnosticMessages(errorInfo, headMessage),
62318                 relatedMessage: maybeMissingAwait ? ts.Diagnostics.Did_you_forget_to_use_await : undefined,
62319             };
62320         }
62321         function invocationError(errorTarget, apparentType, kind, relatedInformation) {
62322             var _a = invocationErrorDetails(errorTarget, apparentType, kind), messageChain = _a.messageChain, relatedInfo = _a.relatedMessage;
62323             var diagnostic = ts.createDiagnosticForNodeFromMessageChain(errorTarget, messageChain);
62324             if (relatedInfo) {
62325                 ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(errorTarget, relatedInfo));
62326             }
62327             if (ts.isCallExpression(errorTarget.parent)) {
62328                 var _b = getDiagnosticSpanForCallNode(errorTarget.parent, true), start = _b.start, length_8 = _b.length;
62329                 diagnostic.start = start;
62330                 diagnostic.length = length_8;
62331             }
62332             diagnostics.add(diagnostic);
62333             invocationErrorRecovery(apparentType, kind, relatedInformation ? ts.addRelatedInfo(diagnostic, relatedInformation) : diagnostic);
62334         }
62335         function invocationErrorRecovery(apparentType, kind, diagnostic) {
62336             if (!apparentType.symbol) {
62337                 return;
62338             }
62339             var importNode = getSymbolLinks(apparentType.symbol).originatingImport;
62340             if (importNode && !ts.isImportCall(importNode)) {
62341                 var sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
62342                 if (!sigs || !sigs.length)
62343                     return;
62344                 ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
62345             }
62346         }
62347         function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
62348             var tagType = checkExpression(node.tag);
62349             var apparentType = getApparentType(tagType);
62350             if (isErrorType(apparentType)) {
62351                 return resolveErrorCall(node);
62352             }
62353             var callSignatures = getSignaturesOfType(apparentType, 0);
62354             var numConstructSignatures = getSignaturesOfType(apparentType, 1).length;
62355             if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, numConstructSignatures)) {
62356                 return resolveUntypedCall(node);
62357             }
62358             if (!callSignatures.length) {
62359                 if (ts.isArrayLiteralExpression(node.parent)) {
62360                     var diagnostic = ts.createDiagnosticForNode(node.tag, ts.Diagnostics.It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked);
62361                     diagnostics.add(diagnostic);
62362                     return resolveErrorCall(node);
62363                 }
62364                 invocationError(node.tag, apparentType, 0);
62365                 return resolveErrorCall(node);
62366             }
62367             return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0);
62368         }
62369         function getDiagnosticHeadMessageForDecoratorResolution(node) {
62370             switch (node.parent.kind) {
62371                 case 256:
62372                 case 225:
62373                     return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
62374                 case 163:
62375                     return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
62376                 case 166:
62377                     return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
62378                 case 168:
62379                 case 171:
62380                 case 172:
62381                     return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
62382                 default:
62383                     return ts.Debug.fail();
62384             }
62385         }
62386         function resolveDecorator(node, candidatesOutArray, checkMode) {
62387             var funcType = checkExpression(node.expression);
62388             var apparentType = getApparentType(funcType);
62389             if (isErrorType(apparentType)) {
62390                 return resolveErrorCall(node);
62391             }
62392             var callSignatures = getSignaturesOfType(apparentType, 0);
62393             var numConstructSignatures = getSignaturesOfType(apparentType, 1).length;
62394             if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
62395                 return resolveUntypedCall(node);
62396             }
62397             if (isPotentiallyUncalledDecorator(node, callSignatures)) {
62398                 var nodeStr = ts.getTextOfNode(node.expression, false);
62399                 error(node, ts.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr);
62400                 return resolveErrorCall(node);
62401             }
62402             var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
62403             if (!callSignatures.length) {
62404                 var errorDetails = invocationErrorDetails(node.expression, apparentType, 0);
62405                 var messageChain = ts.chainDiagnosticMessages(errorDetails.messageChain, headMessage);
62406                 var diag = ts.createDiagnosticForNodeFromMessageChain(node.expression, messageChain);
62407                 if (errorDetails.relatedMessage) {
62408                     ts.addRelatedInfo(diag, ts.createDiagnosticForNode(node.expression, errorDetails.relatedMessage));
62409                 }
62410                 diagnostics.add(diag);
62411                 invocationErrorRecovery(apparentType, 0, diag);
62412                 return resolveErrorCall(node);
62413             }
62414             return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0, headMessage);
62415         }
62416         function createSignatureForJSXIntrinsic(node, result) {
62417             var namespace = getJsxNamespaceAt(node);
62418             var exports = namespace && getExportsOfSymbol(namespace);
62419             var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968);
62420             var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968, node);
62421             var declaration = ts.factory.createFunctionTypeNode(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, undefined) : ts.factory.createKeywordTypeNode(130));
62422             var parameterSymbol = createSymbol(1, "props");
62423             parameterSymbol.type = result;
62424             return createSignature(declaration, undefined, undefined, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, undefined, 1, 0);
62425         }
62426         function resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode) {
62427             if (isJsxIntrinsicIdentifier(node.tagName)) {
62428                 var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node);
62429                 var fakeSignature = createSignatureForJSXIntrinsic(node, result);
62430                 checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType(node.attributes, getEffectiveFirstArgumentForJsxSignature(fakeSignature, node), undefined, 0), result, node.tagName, node.attributes);
62431                 if (ts.length(node.typeArguments)) {
62432                     ts.forEach(node.typeArguments, checkSourceElement);
62433                     diagnostics.add(ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), node.typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, 0, ts.length(node.typeArguments)));
62434                 }
62435                 return fakeSignature;
62436             }
62437             var exprTypes = checkExpression(node.tagName);
62438             var apparentType = getApparentType(exprTypes);
62439             if (isErrorType(apparentType)) {
62440                 return resolveErrorCall(node);
62441             }
62442             var signatures = getUninstantiatedJsxSignaturesOfType(exprTypes, node);
62443             if (isUntypedFunctionCall(exprTypes, apparentType, signatures.length, 0)) {
62444                 return resolveUntypedCall(node);
62445             }
62446             if (signatures.length === 0) {
62447                 error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName));
62448                 return resolveErrorCall(node);
62449             }
62450             return resolveCall(node, signatures, candidatesOutArray, checkMode, 0);
62451         }
62452         function isPotentiallyUncalledDecorator(decorator, signatures) {
62453             return signatures.length && ts.every(signatures, function (signature) {
62454                 return signature.minArgumentCount === 0 &&
62455                     !signatureHasRestParameter(signature) &&
62456                     signature.parameters.length < getDecoratorArgumentCount(decorator, signature);
62457             });
62458         }
62459         function resolveSignature(node, candidatesOutArray, checkMode) {
62460             switch (node.kind) {
62461                 case 207:
62462                     return resolveCallExpression(node, candidatesOutArray, checkMode);
62463                 case 208:
62464                     return resolveNewExpression(node, candidatesOutArray, checkMode);
62465                 case 209:
62466                     return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
62467                 case 164:
62468                     return resolveDecorator(node, candidatesOutArray, checkMode);
62469                 case 279:
62470                 case 278:
62471                     return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
62472             }
62473             throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
62474         }
62475         function getResolvedSignature(node, candidatesOutArray, checkMode) {
62476             var links = getNodeLinks(node);
62477             var cached = links.resolvedSignature;
62478             if (cached && cached !== resolvingSignature && !candidatesOutArray) {
62479                 return cached;
62480             }
62481             links.resolvedSignature = resolvingSignature;
62482             var result = resolveSignature(node, candidatesOutArray, checkMode || 0);
62483             if (result !== resolvingSignature) {
62484                 links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
62485             }
62486             return result;
62487         }
62488         function isJSConstructor(node) {
62489             var _a;
62490             if (!node || !ts.isInJSFile(node)) {
62491                 return false;
62492             }
62493             var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
62494                 ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
62495                     undefined;
62496             if (func) {
62497                 if (ts.getJSDocClassTag(node))
62498                     return true;
62499                 var symbol = getSymbolOfNode(func);
62500                 return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
62501             }
62502             return false;
62503         }
62504         function mergeJSSymbols(target, source) {
62505             var _a, _b;
62506             if (source) {
62507                 var links = getSymbolLinks(source);
62508                 if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) {
62509                     var inferred = ts.isTransientSymbol(target) ? target : cloneSymbol(target);
62510                     inferred.exports = inferred.exports || ts.createSymbolTable();
62511                     inferred.members = inferred.members || ts.createSymbolTable();
62512                     inferred.flags |= source.flags & 32;
62513                     if ((_a = source.exports) === null || _a === void 0 ? void 0 : _a.size) {
62514                         mergeSymbolTable(inferred.exports, source.exports);
62515                     }
62516                     if ((_b = source.members) === null || _b === void 0 ? void 0 : _b.size) {
62517                         mergeSymbolTable(inferred.members, source.members);
62518                     }
62519                     (links.inferredClassSymbol || (links.inferredClassSymbol = new ts.Map())).set(getSymbolId(inferred), inferred);
62520                     return inferred;
62521                 }
62522                 return links.inferredClassSymbol.get(getSymbolId(target));
62523             }
62524         }
62525         function getAssignedClassSymbol(decl) {
62526             var _a;
62527             var assignmentSymbol = decl && getSymbolOfExpando(decl, true);
62528             var prototype = (_a = assignmentSymbol === null || assignmentSymbol === void 0 ? void 0 : assignmentSymbol.exports) === null || _a === void 0 ? void 0 : _a.get("prototype");
62529             var init = (prototype === null || prototype === void 0 ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
62530             return init ? getSymbolOfNode(init) : undefined;
62531         }
62532         function getSymbolOfExpando(node, allowDeclaration) {
62533             if (!node.parent) {
62534                 return undefined;
62535             }
62536             var name;
62537             var decl;
62538             if (ts.isVariableDeclaration(node.parent) && node.parent.initializer === node) {
62539                 if (!ts.isInJSFile(node) && !(ts.isVarConst(node.parent) && ts.isFunctionLikeDeclaration(node))) {
62540                     return undefined;
62541                 }
62542                 name = node.parent.name;
62543                 decl = node.parent;
62544             }
62545             else if (ts.isBinaryExpression(node.parent)) {
62546                 var parentNode = node.parent;
62547                 var parentNodeOperator = node.parent.operatorToken.kind;
62548                 if (parentNodeOperator === 63 && (allowDeclaration || parentNode.right === node)) {
62549                     name = parentNode.left;
62550                     decl = name;
62551                 }
62552                 else if (parentNodeOperator === 56 || parentNodeOperator === 60) {
62553                     if (ts.isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) {
62554                         name = parentNode.parent.name;
62555                         decl = parentNode.parent;
62556                     }
62557                     else if (ts.isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === 63 && (allowDeclaration || parentNode.parent.right === parentNode)) {
62558                         name = parentNode.parent.left;
62559                         decl = name;
62560                     }
62561                     if (!name || !ts.isBindableStaticNameExpression(name) || !ts.isSameEntityName(name, parentNode.left)) {
62562                         return undefined;
62563                     }
62564                 }
62565             }
62566             else if (allowDeclaration && ts.isFunctionDeclaration(node)) {
62567                 name = node.name;
62568                 decl = node;
62569             }
62570             if (!decl || !name || (!allowDeclaration && !ts.getExpandoInitializer(node, ts.isPrototypeAccess(name)))) {
62571                 return undefined;
62572             }
62573             return getSymbolOfNode(decl);
62574         }
62575         function getAssignedJSPrototype(node) {
62576             if (!node.parent) {
62577                 return false;
62578             }
62579             var parent = node.parent;
62580             while (parent && parent.kind === 205) {
62581                 parent = parent.parent;
62582             }
62583             if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63) {
62584                 var right = ts.getInitializerOfBinaryExpression(parent);
62585                 return ts.isObjectLiteralExpression(right) && right;
62586             }
62587         }
62588         function checkCallExpression(node, checkMode) {
62589             var _a;
62590             if (!checkGrammarTypeArguments(node, node.typeArguments))
62591                 checkGrammarArguments(node.arguments);
62592             var signature = getResolvedSignature(node, undefined, checkMode);
62593             if (signature === resolvingSignature) {
62594                 return nonInferrableType;
62595             }
62596             checkDeprecatedSignature(signature, node);
62597             if (node.expression.kind === 106) {
62598                 return voidType;
62599             }
62600             if (node.kind === 208) {
62601                 var declaration = signature.declaration;
62602                 if (declaration &&
62603                     declaration.kind !== 170 &&
62604                     declaration.kind !== 174 &&
62605                     declaration.kind !== 179 &&
62606                     !ts.isJSDocConstructSignature(declaration) &&
62607                     !isJSConstructor(declaration)) {
62608                     if (noImplicitAny) {
62609                         error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
62610                     }
62611                     return anyType;
62612                 }
62613             }
62614             if (ts.isInJSFile(node) && isCommonJsRequire(node)) {
62615                 return resolveExternalModuleTypeByLiteral(node.arguments[0]);
62616             }
62617             var returnType = getReturnTypeOfSignature(signature);
62618             if (returnType.flags & 12288 && isSymbolOrSymbolForCall(node)) {
62619                 return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent));
62620             }
62621             if (node.kind === 207 && !node.questionDotToken && node.parent.kind === 237 &&
62622                 returnType.flags & 16384 && getTypePredicateOfSignature(signature)) {
62623                 if (!ts.isDottedName(node.expression)) {
62624                     error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name);
62625                 }
62626                 else if (!getEffectsSignature(node)) {
62627                     var diagnostic = error(node.expression, ts.Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation);
62628                     getTypeOfDottedName(node.expression, diagnostic);
62629                 }
62630             }
62631             if (ts.isInJSFile(node)) {
62632                 var jsSymbol = getSymbolOfExpando(node, false);
62633                 if ((_a = jsSymbol === null || jsSymbol === void 0 ? void 0 : jsSymbol.exports) === null || _a === void 0 ? void 0 : _a.size) {
62634                     var jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, ts.emptyArray, ts.emptyArray, ts.emptyArray);
62635                     jsAssignmentType.objectFlags |= 8192;
62636                     return getIntersectionType([returnType, jsAssignmentType]);
62637                 }
62638             }
62639             return returnType;
62640         }
62641         function checkDeprecatedSignature(signature, node) {
62642             if (signature.declaration && signature.declaration.flags & 134217728) {
62643                 var suggestionNode = getDeprecatedSuggestionNode(node);
62644                 var name = ts.tryGetPropertyAccessOrIdentifierToString(ts.getInvokedExpression(node));
62645                 addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature));
62646             }
62647         }
62648         function getDeprecatedSuggestionNode(node) {
62649             node = ts.skipParentheses(node);
62650             switch (node.kind) {
62651                 case 207:
62652                 case 164:
62653                 case 208:
62654                     return getDeprecatedSuggestionNode(node.expression);
62655                 case 209:
62656                     return getDeprecatedSuggestionNode(node.tag);
62657                 case 279:
62658                 case 278:
62659                     return getDeprecatedSuggestionNode(node.tagName);
62660                 case 206:
62661                     return node.argumentExpression;
62662                 case 205:
62663                     return node.name;
62664                 case 177:
62665                     var typeReference = node;
62666                     return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference;
62667                 default:
62668                     return node;
62669             }
62670         }
62671         function isSymbolOrSymbolForCall(node) {
62672             if (!ts.isCallExpression(node))
62673                 return false;
62674             var left = node.expression;
62675             if (ts.isPropertyAccessExpression(left) && left.name.escapedText === "for") {
62676                 left = left.expression;
62677             }
62678             if (!ts.isIdentifier(left) || left.escapedText !== "Symbol") {
62679                 return false;
62680             }
62681             var globalESSymbol = getGlobalESSymbolConstructorSymbol(false);
62682             if (!globalESSymbol) {
62683                 return false;
62684             }
62685             return globalESSymbol === resolveName(left, "Symbol", 111551, undefined, undefined, false);
62686         }
62687         function checkImportCallExpression(node) {
62688             if (!checkGrammarArguments(node.arguments))
62689                 checkGrammarImportCallExpression(node);
62690             if (node.arguments.length === 0) {
62691                 return createPromiseReturnType(node, anyType);
62692             }
62693             var specifier = node.arguments[0];
62694             var specifierType = checkExpressionCached(specifier);
62695             var optionsType = node.arguments.length > 1 ? checkExpressionCached(node.arguments[1]) : undefined;
62696             for (var i = 2; i < node.arguments.length; ++i) {
62697                 checkExpressionCached(node.arguments[i]);
62698             }
62699             if (specifierType.flags & 32768 || specifierType.flags & 65536 || !isTypeAssignableTo(specifierType, stringType)) {
62700                 error(specifier, ts.Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
62701             }
62702             if (optionsType) {
62703                 var importCallOptionsType = getGlobalImportCallOptionsType(true);
62704                 if (importCallOptionsType !== emptyObjectType) {
62705                     checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 32768), node.arguments[1]);
62706                 }
62707             }
62708             var moduleSymbol = resolveExternalModuleName(node, specifier);
62709             if (moduleSymbol) {
62710                 var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, true, false);
62711                 if (esModuleSymbol) {
62712                     return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
62713                         getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
62714                 }
62715             }
62716             return createPromiseReturnType(node, anyType);
62717         }
62718         function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
62719             var memberTable = ts.createSymbolTable();
62720             var newSymbol = createSymbol(2097152, "default");
62721             newSymbol.parent = originalSymbol;
62722             newSymbol.nameType = getStringLiteralType("default");
62723             newSymbol.target = resolveSymbol(symbol);
62724             memberTable.set("default", newSymbol);
62725             return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
62726         }
62727         function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
62728             var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
62729             if (hasDefaultOnly && type && !isErrorType(type)) {
62730                 var synthType = type;
62731                 if (!synthType.defaultOnlyType) {
62732                     var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
62733                     synthType.defaultOnlyType = type_4;
62734                 }
62735                 return synthType.defaultOnlyType;
62736             }
62737             return undefined;
62738         }
62739         function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
62740             var _a;
62741             if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
62742                 var synthType = type;
62743                 if (!synthType.syntheticType) {
62744                     var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
62745                     var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, false, moduleSpecifier);
62746                     if (hasSyntheticDefault) {
62747                         var anonymousSymbol = createSymbol(2048, "__type");
62748                         var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
62749                         anonymousSymbol.type = defaultContainingObject;
62750                         synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, 0, false) : defaultContainingObject;
62751                     }
62752                     else {
62753                         synthType.syntheticType = type;
62754                     }
62755                 }
62756                 return synthType.syntheticType;
62757             }
62758             return type;
62759         }
62760         function isCommonJsRequire(node) {
62761             if (!ts.isRequireCall(node, true)) {
62762                 return false;
62763             }
62764             if (!ts.isIdentifier(node.expression))
62765                 return ts.Debug.fail();
62766             var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 111551, undefined, undefined, true);
62767             if (resolvedRequire === requireSymbol) {
62768                 return true;
62769             }
62770             if (resolvedRequire.flags & 2097152) {
62771                 return false;
62772             }
62773             var targetDeclarationKind = resolvedRequire.flags & 16
62774                 ? 255
62775                 : resolvedRequire.flags & 3
62776                     ? 253
62777                     : 0;
62778             if (targetDeclarationKind !== 0) {
62779                 var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
62780                 return !!decl && !!(decl.flags & 8388608);
62781             }
62782             return false;
62783         }
62784         function checkTaggedTemplateExpression(node) {
62785             if (!checkGrammarTaggedTemplateChain(node))
62786                 checkGrammarTypeArguments(node, node.typeArguments);
62787             if (languageVersion < 2) {
62788                 checkExternalEmitHelpers(node, 262144);
62789             }
62790             var signature = getResolvedSignature(node);
62791             checkDeprecatedSignature(signature, node);
62792             return getReturnTypeOfSignature(signature);
62793         }
62794         function checkAssertion(node) {
62795             if (node.kind === 210) {
62796                 var file = ts.getSourceFileOfNode(node);
62797                 if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts", ".mts"])) {
62798                     grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
62799                 }
62800             }
62801             return checkAssertionWorker(node, node.type, node.expression);
62802         }
62803         function isValidConstAssertionArgument(node) {
62804             switch (node.kind) {
62805                 case 10:
62806                 case 14:
62807                 case 8:
62808                 case 9:
62809                 case 110:
62810                 case 95:
62811                 case 203:
62812                 case 204:
62813                 case 222:
62814                     return true;
62815                 case 211:
62816                     return isValidConstAssertionArgument(node.expression);
62817                 case 218:
62818                     var op = node.operator;
62819                     var arg = node.operand;
62820                     return op === 40 && (arg.kind === 8 || arg.kind === 9) ||
62821                         op === 39 && arg.kind === 8;
62822                 case 205:
62823                 case 206:
62824                     var expr = node.expression;
62825                     var symbol = getTypeOfNode(expr).symbol;
62826                     if (symbol && symbol.flags & 2097152) {
62827                         symbol = resolveAlias(symbol);
62828                     }
62829                     return !!(symbol && (symbol.flags & 384) && getEnumKind(symbol) === 1);
62830             }
62831             return false;
62832         }
62833         function checkAssertionWorker(errNode, type, expression, checkMode) {
62834             var exprType = checkExpression(expression, checkMode);
62835             if (ts.isConstTypeReference(type)) {
62836                 if (!isValidConstAssertionArgument(expression)) {
62837                     error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
62838                 }
62839                 return getRegularTypeOfLiteralType(exprType);
62840             }
62841             checkSourceElement(type);
62842             exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType));
62843             var targetType = getTypeFromTypeNode(type);
62844             if (produceDiagnostics && !isErrorType(targetType)) {
62845                 var widenedType = getWidenedType(exprType);
62846                 if (!isTypeComparableTo(targetType, widenedType)) {
62847                     checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
62848                 }
62849             }
62850             return targetType;
62851         }
62852         function checkNonNullChain(node) {
62853             var leftType = checkExpression(node.expression);
62854             var nonOptionalType = getOptionalExpressionType(leftType, node.expression);
62855             return propagateOptionalTypeMarker(getNonNullableType(nonOptionalType), node, nonOptionalType !== leftType);
62856         }
62857         function checkNonNullAssertion(node) {
62858             return node.flags & 32 ? checkNonNullChain(node) :
62859                 getNonNullableType(checkExpression(node.expression));
62860         }
62861         function checkMetaProperty(node) {
62862             checkGrammarMetaProperty(node);
62863             if (node.keywordToken === 103) {
62864                 return checkNewTargetMetaProperty(node);
62865             }
62866             if (node.keywordToken === 100) {
62867                 return checkImportMetaProperty(node);
62868             }
62869             return ts.Debug.assertNever(node.keywordToken);
62870         }
62871         function checkMetaPropertyKeyword(node) {
62872             switch (node.keywordToken) {
62873                 case 100:
62874                     return getGlobalImportMetaExpressionType();
62875                 case 103:
62876                     var type = checkNewTargetMetaProperty(node);
62877                     return isErrorType(type) ? errorType : createNewTargetExpressionType(type);
62878                 default:
62879                     ts.Debug.assertNever(node.keywordToken);
62880             }
62881         }
62882         function checkNewTargetMetaProperty(node) {
62883             var container = ts.getNewTargetContainer(node);
62884             if (!container) {
62885                 error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
62886                 return errorType;
62887             }
62888             else if (container.kind === 170) {
62889                 var symbol = getSymbolOfNode(container.parent);
62890                 return getTypeOfSymbol(symbol);
62891             }
62892             else {
62893                 var symbol = getSymbolOfNode(container);
62894                 return getTypeOfSymbol(symbol);
62895             }
62896         }
62897         function checkImportMetaProperty(node) {
62898             if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
62899                 if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
62900                     error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
62901                 }
62902             }
62903             else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
62904                 error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
62905             }
62906             var file = ts.getSourceFileOfNode(node);
62907             ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
62908             return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
62909         }
62910         function getTypeOfParameter(symbol) {
62911             var type = getTypeOfSymbol(symbol);
62912             if (strictNullChecks) {
62913                 var declaration = symbol.valueDeclaration;
62914                 if (declaration && ts.hasInitializer(declaration)) {
62915                     return getOptionalType(type);
62916                 }
62917             }
62918             return type;
62919         }
62920         function getTupleElementLabel(d) {
62921             ts.Debug.assert(ts.isIdentifier(d.name));
62922             return d.name.escapedText;
62923         }
62924         function getParameterNameAtPosition(signature, pos, overrideRestType) {
62925             var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
62926             if (pos < paramCount) {
62927                 return signature.parameters[pos].escapedName;
62928             }
62929             var restParameter = signature.parameters[paramCount] || unknownSymbol;
62930             var restType = overrideRestType || getTypeOfSymbol(restParameter);
62931             if (isTupleType(restType)) {
62932                 var associatedNames = restType.target.labeledElementDeclarations;
62933                 var index = pos - paramCount;
62934                 return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
62935             }
62936             return restParameter.escapedName;
62937         }
62938         function getParameterIdentifierNameAtPosition(signature, pos) {
62939             var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
62940             if (pos < paramCount) {
62941                 var param = signature.parameters[pos];
62942                 return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : undefined;
62943             }
62944             var restParameter = signature.parameters[paramCount] || unknownSymbol;
62945             if (!isParameterDeclarationWithIdentifierName(restParameter)) {
62946                 return undefined;
62947             }
62948             var restType = getTypeOfSymbol(restParameter);
62949             if (isTupleType(restType)) {
62950                 var associatedNames = restType.target.labeledElementDeclarations;
62951                 var index = pos - paramCount;
62952                 var associatedName = associatedNames === null || associatedNames === void 0 ? void 0 : associatedNames[index];
62953                 var isRestTupleElement = !!(associatedName === null || associatedName === void 0 ? void 0 : associatedName.dotDotDotToken);
62954                 return associatedName ? [
62955                     getTupleElementLabel(associatedName),
62956                     isRestTupleElement
62957                 ] : undefined;
62958             }
62959             if (pos === paramCount) {
62960                 return [restParameter.escapedName, true];
62961             }
62962             return undefined;
62963         }
62964         function isParameterDeclarationWithIdentifierName(symbol) {
62965             return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name);
62966         }
62967         function isValidDeclarationForTupleLabel(d) {
62968             return d.kind === 196 || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name));
62969         }
62970         function getNameableDeclarationAtPosition(signature, pos) {
62971             var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
62972             if (pos < paramCount) {
62973                 var decl = signature.parameters[pos].valueDeclaration;
62974                 return decl && isValidDeclarationForTupleLabel(decl) ? decl : undefined;
62975             }
62976             var restParameter = signature.parameters[paramCount] || unknownSymbol;
62977             var restType = getTypeOfSymbol(restParameter);
62978             if (isTupleType(restType)) {
62979                 var associatedNames = restType.target.labeledElementDeclarations;
62980                 var index = pos - paramCount;
62981                 return associatedNames && associatedNames[index];
62982             }
62983             return restParameter.valueDeclaration && isValidDeclarationForTupleLabel(restParameter.valueDeclaration) ? restParameter.valueDeclaration : undefined;
62984         }
62985         function getTypeAtPosition(signature, pos) {
62986             return tryGetTypeAtPosition(signature, pos) || anyType;
62987         }
62988         function tryGetTypeAtPosition(signature, pos) {
62989             var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
62990             if (pos < paramCount) {
62991                 return getTypeOfParameter(signature.parameters[pos]);
62992             }
62993             if (signatureHasRestParameter(signature)) {
62994                 var restType = getTypeOfSymbol(signature.parameters[paramCount]);
62995                 var index = pos - paramCount;
62996                 if (!isTupleType(restType) || restType.target.hasRestElement || index < restType.target.fixedLength) {
62997                     return getIndexedAccessType(restType, getNumberLiteralType(index));
62998                 }
62999             }
63000             return undefined;
63001         }
63002         function getRestTypeAtPosition(source, pos) {
63003             var parameterCount = getParameterCount(source);
63004             var minArgumentCount = getMinArgumentCount(source);
63005             var restType = getEffectiveRestType(source);
63006             if (restType && pos >= parameterCount - 1) {
63007                 return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
63008             }
63009             var types = [];
63010             var flags = [];
63011             var names = [];
63012             for (var i = pos; i < parameterCount; i++) {
63013                 if (!restType || i < parameterCount - 1) {
63014                     types.push(getTypeAtPosition(source, i));
63015                     flags.push(i < minArgumentCount ? 1 : 2);
63016                 }
63017                 else {
63018                     types.push(restType);
63019                     flags.push(8);
63020                 }
63021                 var name = getNameableDeclarationAtPosition(source, i);
63022                 if (name) {
63023                     names.push(name);
63024                 }
63025             }
63026             return createTupleType(types, flags, false, ts.length(names) === ts.length(types) ? names : undefined);
63027         }
63028         function getParameterCount(signature) {
63029             var length = signature.parameters.length;
63030             if (signatureHasRestParameter(signature)) {
63031                 var restType = getTypeOfSymbol(signature.parameters[length - 1]);
63032                 if (isTupleType(restType)) {
63033                     return length + restType.target.fixedLength - (restType.target.hasRestElement ? 0 : 1);
63034                 }
63035             }
63036             return length;
63037         }
63038         function getMinArgumentCount(signature, flags) {
63039             var strongArityForUntypedJS = flags & 1;
63040             var voidIsNonOptional = flags & 2;
63041             if (voidIsNonOptional || signature.resolvedMinArgumentCount === undefined) {
63042                 var minArgumentCount = void 0;
63043                 if (signatureHasRestParameter(signature)) {
63044                     var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
63045                     if (isTupleType(restType)) {
63046                         var firstOptionalIndex = ts.findIndex(restType.target.elementFlags, function (f) { return !(f & 1); });
63047                         var requiredCount = firstOptionalIndex < 0 ? restType.target.fixedLength : firstOptionalIndex;
63048                         if (requiredCount > 0) {
63049                             minArgumentCount = signature.parameters.length - 1 + requiredCount;
63050                         }
63051                     }
63052                 }
63053                 if (minArgumentCount === undefined) {
63054                     if (!strongArityForUntypedJS && signature.flags & 32) {
63055                         return 0;
63056                     }
63057                     minArgumentCount = signature.minArgumentCount;
63058                 }
63059                 if (voidIsNonOptional) {
63060                     return minArgumentCount;
63061                 }
63062                 for (var i = minArgumentCount - 1; i >= 0; i--) {
63063                     var type = getTypeAtPosition(signature, i);
63064                     if (filterType(type, acceptsVoid).flags & 131072) {
63065                         break;
63066                     }
63067                     minArgumentCount = i;
63068                 }
63069                 signature.resolvedMinArgumentCount = minArgumentCount;
63070             }
63071             return signature.resolvedMinArgumentCount;
63072         }
63073         function hasEffectiveRestParameter(signature) {
63074             if (signatureHasRestParameter(signature)) {
63075                 var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
63076                 return !isTupleType(restType) || restType.target.hasRestElement;
63077             }
63078             return false;
63079         }
63080         function getEffectiveRestType(signature) {
63081             if (signatureHasRestParameter(signature)) {
63082                 var restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
63083                 if (!isTupleType(restType)) {
63084                     return restType;
63085                 }
63086                 if (restType.target.hasRestElement) {
63087                     return sliceTupleType(restType, restType.target.fixedLength);
63088                 }
63089             }
63090             return undefined;
63091         }
63092         function getNonArrayRestType(signature) {
63093             var restType = getEffectiveRestType(signature);
63094             return restType && !isArrayType(restType) && !isTypeAny(restType) && (getReducedType(restType).flags & 131072) === 0 ? restType : undefined;
63095         }
63096         function getTypeOfFirstParameterOfSignature(signature) {
63097             return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
63098         }
63099         function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
63100             return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
63101         }
63102         function inferFromAnnotatedParameters(signature, context, inferenceContext) {
63103             var len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
63104             for (var i = 0; i < len; i++) {
63105                 var declaration = signature.parameters[i].valueDeclaration;
63106                 if (declaration.type) {
63107                     var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
63108                     if (typeNode) {
63109                         inferTypes(inferenceContext.inferences, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i));
63110                     }
63111                 }
63112             }
63113             var restType = getEffectiveRestType(context);
63114             if (restType && restType.flags & 262144) {
63115                 var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
63116                 assignContextualParameterTypes(signature, instantiatedContext);
63117                 var restPos = getParameterCount(context) - 1;
63118                 inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
63119             }
63120         }
63121         function assignContextualParameterTypes(signature, context) {
63122             if (context.typeParameters) {
63123                 if (!signature.typeParameters) {
63124                     signature.typeParameters = context.typeParameters;
63125                 }
63126                 else {
63127                     return;
63128                 }
63129             }
63130             if (context.thisParameter) {
63131                 var parameter = signature.thisParameter;
63132                 if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) {
63133                     if (!parameter) {
63134                         signature.thisParameter = createSymbolWithType(context.thisParameter, undefined);
63135                     }
63136                     assignParameterType(signature.thisParameter, getTypeOfSymbol(context.thisParameter));
63137                 }
63138             }
63139             var len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
63140             for (var i = 0; i < len; i++) {
63141                 var parameter = signature.parameters[i];
63142                 if (!ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
63143                     var contextualParameterType = tryGetTypeAtPosition(context, i);
63144                     assignParameterType(parameter, contextualParameterType);
63145                 }
63146             }
63147             if (signatureHasRestParameter(signature)) {
63148                 var parameter = ts.last(signature.parameters);
63149                 if (ts.isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
63150                     var contextualParameterType = getRestTypeAtPosition(context, len);
63151                     assignParameterType(parameter, contextualParameterType);
63152                 }
63153             }
63154         }
63155         function assignNonContextualParameterTypes(signature) {
63156             if (signature.thisParameter) {
63157                 assignParameterType(signature.thisParameter);
63158             }
63159             for (var _i = 0, _a = signature.parameters; _i < _a.length; _i++) {
63160                 var parameter = _a[_i];
63161                 assignParameterType(parameter);
63162             }
63163         }
63164         function assignParameterType(parameter, type) {
63165             var links = getSymbolLinks(parameter);
63166             if (!links.type) {
63167                 var declaration = parameter.valueDeclaration;
63168                 links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, true);
63169                 if (declaration.name.kind !== 79) {
63170                     if (links.type === unknownType) {
63171                         links.type = getTypeFromBindingPattern(declaration.name);
63172                     }
63173                     assignBindingElementTypes(declaration.name);
63174                 }
63175             }
63176         }
63177         function assignBindingElementTypes(pattern) {
63178             for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
63179                 var element = _a[_i];
63180                 if (!ts.isOmittedExpression(element)) {
63181                     if (element.name.kind === 79) {
63182                         getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
63183                     }
63184                     else {
63185                         assignBindingElementTypes(element.name);
63186                     }
63187                 }
63188             }
63189         }
63190         function createPromiseType(promisedType) {
63191             var globalPromiseType = getGlobalPromiseType(true);
63192             if (globalPromiseType !== emptyGenericType) {
63193                 promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType;
63194                 return createTypeReference(globalPromiseType, [promisedType]);
63195             }
63196             return unknownType;
63197         }
63198         function createPromiseLikeType(promisedType) {
63199             var globalPromiseLikeType = getGlobalPromiseLikeType(true);
63200             if (globalPromiseLikeType !== emptyGenericType) {
63201                 promisedType = getAwaitedTypeNoAlias(unwrapAwaitedType(promisedType)) || unknownType;
63202                 return createTypeReference(globalPromiseLikeType, [promisedType]);
63203             }
63204             return unknownType;
63205         }
63206         function createPromiseReturnType(func, promisedType) {
63207             var promiseType = createPromiseType(promisedType);
63208             if (promiseType === unknownType) {
63209                 error(func, ts.isImportCall(func) ?
63210                     ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
63211                     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);
63212                 return errorType;
63213             }
63214             else if (!getGlobalPromiseConstructorSymbol(true)) {
63215                 error(func, ts.isImportCall(func) ?
63216                     ts.Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option :
63217                     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);
63218             }
63219             return promiseType;
63220         }
63221         function createNewTargetExpressionType(targetType) {
63222             var symbol = createSymbol(0, "NewTargetExpression");
63223             var targetPropertySymbol = createSymbol(4, "target", 8);
63224             targetPropertySymbol.parent = symbol;
63225             targetPropertySymbol.type = targetType;
63226             var members = ts.createSymbolTable([targetPropertySymbol]);
63227             symbol.members = members;
63228             return createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, ts.emptyArray);
63229         }
63230         function getReturnTypeFromBody(func, checkMode) {
63231             if (!func.body) {
63232                 return errorType;
63233             }
63234             var functionFlags = ts.getFunctionFlags(func);
63235             var isAsync = (functionFlags & 2) !== 0;
63236             var isGenerator = (functionFlags & 1) !== 0;
63237             var returnType;
63238             var yieldType;
63239             var nextType;
63240             var fallbackReturnType = voidType;
63241             if (func.body.kind !== 234) {
63242                 returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8);
63243                 if (isAsync) {
63244                     returnType = unwrapAwaitedType(checkAwaitedType(returnType, false, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member));
63245                 }
63246             }
63247             else if (isGenerator) {
63248                 var returnTypes = checkAndAggregateReturnExpressionTypes(func, checkMode);
63249                 if (!returnTypes) {
63250                     fallbackReturnType = neverType;
63251                 }
63252                 else if (returnTypes.length > 0) {
63253                     returnType = getUnionType(returnTypes, 2);
63254                 }
63255                 var _a = checkAndAggregateYieldOperandTypes(func, checkMode), yieldTypes = _a.yieldTypes, nextTypes = _a.nextTypes;
63256                 yieldType = ts.some(yieldTypes) ? getUnionType(yieldTypes, 2) : undefined;
63257                 nextType = ts.some(nextTypes) ? getIntersectionType(nextTypes) : undefined;
63258             }
63259             else {
63260                 var types = checkAndAggregateReturnExpressionTypes(func, checkMode);
63261                 if (!types) {
63262                     return functionFlags & 2
63263                         ? createPromiseReturnType(func, neverType)
63264                         : neverType;
63265                 }
63266                 if (types.length === 0) {
63267                     return functionFlags & 2
63268                         ? createPromiseReturnType(func, voidType)
63269                         : voidType;
63270                 }
63271                 returnType = getUnionType(types, 2);
63272             }
63273             if (returnType || yieldType || nextType) {
63274                 if (yieldType)
63275                     reportErrorsFromWidening(func, yieldType, 3);
63276                 if (returnType)
63277                     reportErrorsFromWidening(func, returnType, 1);
63278                 if (nextType)
63279                     reportErrorsFromWidening(func, nextType, 2);
63280                 if (returnType && isUnitType(returnType) ||
63281                     yieldType && isUnitType(yieldType) ||
63282                     nextType && isUnitType(nextType)) {
63283                     var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
63284                     var contextualType = !contextualSignature ? undefined :
63285                         contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
63286                             instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
63287                     if (isGenerator) {
63288                         yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
63289                         returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
63290                         nextType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(nextType, contextualType, 2, isAsync);
63291                     }
63292                     else {
63293                         returnType = getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(returnType, contextualType, isAsync);
63294                     }
63295                 }
63296                 if (yieldType)
63297                     yieldType = getWidenedType(yieldType);
63298                 if (returnType)
63299                     returnType = getWidenedType(returnType);
63300                 if (nextType)
63301                     nextType = getWidenedType(nextType);
63302             }
63303             if (isGenerator) {
63304                 return createGeneratorReturnType(yieldType || neverType, returnType || fallbackReturnType, nextType || getContextualIterationType(2, func) || unknownType, isAsync);
63305             }
63306             else {
63307                 return isAsync
63308                     ? createPromiseType(returnType || fallbackReturnType)
63309                     : returnType || fallbackReturnType;
63310             }
63311         }
63312         function createGeneratorReturnType(yieldType, returnType, nextType, isAsyncGenerator) {
63313             var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
63314             var globalGeneratorType = resolver.getGlobalGeneratorType(false);
63315             yieldType = resolver.resolveIterationType(yieldType, undefined) || unknownType;
63316             returnType = resolver.resolveIterationType(returnType, undefined) || unknownType;
63317             nextType = resolver.resolveIterationType(nextType, undefined) || unknownType;
63318             if (globalGeneratorType === emptyGenericType) {
63319                 var globalType = resolver.getGlobalIterableIteratorType(false);
63320                 var iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : undefined;
63321                 var iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
63322                 var iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
63323                 if (isTypeAssignableTo(returnType, iterableIteratorReturnType) &&
63324                     isTypeAssignableTo(iterableIteratorNextType, nextType)) {
63325                     if (globalType !== emptyGenericType) {
63326                         return createTypeFromGenericGlobalType(globalType, [yieldType]);
63327                     }
63328                     resolver.getGlobalIterableIteratorType(true);
63329                     return emptyObjectType;
63330                 }
63331                 resolver.getGlobalGeneratorType(true);
63332                 return emptyObjectType;
63333             }
63334             return createTypeFromGenericGlobalType(globalGeneratorType, [yieldType, returnType, nextType]);
63335         }
63336         function checkAndAggregateYieldOperandTypes(func, checkMode) {
63337             var yieldTypes = [];
63338             var nextTypes = [];
63339             var isAsync = (ts.getFunctionFlags(func) & 2) !== 0;
63340             ts.forEachYieldExpression(func.body, function (yieldExpression) {
63341                 var yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType;
63342                 ts.pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync));
63343                 var nextType;
63344                 if (yieldExpression.asteriskToken) {
63345                     var iterationTypes = getIterationTypesOfIterable(yieldExpressionType, isAsync ? 19 : 17, yieldExpression.expression);
63346                     nextType = iterationTypes && iterationTypes.nextType;
63347                 }
63348                 else {
63349                     nextType = getContextualType(yieldExpression);
63350                 }
63351                 if (nextType)
63352                     ts.pushIfUnique(nextTypes, nextType);
63353             });
63354             return { yieldTypes: yieldTypes, nextTypes: nextTypes };
63355         }
63356         function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
63357             var errorNode = node.expression || node;
63358             var yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 : 17, expressionType, sentType, errorNode) : expressionType;
63359             return !isAsync ? yieldedType : getAwaitedType(yieldedType, errorNode, node.asteriskToken
63360                 ? 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
63361                 : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
63362         }
63363         function getFactsFromTypeofSwitch(start, end, witnesses, hasDefault) {
63364             var facts = 0;
63365             if (hasDefault) {
63366                 for (var i = end; i < witnesses.length; i++) {
63367                     facts |= typeofNEFacts.get(witnesses[i]) || 32768;
63368                 }
63369                 for (var i = start; i < end; i++) {
63370                     facts &= ~(typeofNEFacts.get(witnesses[i]) || 0);
63371                 }
63372                 for (var i = 0; i < start; i++) {
63373                     facts |= typeofNEFacts.get(witnesses[i]) || 32768;
63374                 }
63375             }
63376             else {
63377                 for (var i = start; i < end; i++) {
63378                     facts |= typeofEQFacts.get(witnesses[i]) || 128;
63379                 }
63380                 for (var i = 0; i < start; i++) {
63381                     facts &= ~(typeofEQFacts.get(witnesses[i]) || 0);
63382                 }
63383             }
63384             return facts;
63385         }
63386         function isExhaustiveSwitchStatement(node) {
63387             var links = getNodeLinks(node);
63388             return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
63389         }
63390         function computeExhaustiveSwitchStatement(node) {
63391             if (node.expression.kind === 215) {
63392                 var operandType = getTypeOfExpression(node.expression.expression);
63393                 var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
63394                 var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
63395                 var type_5 = getBaseConstraintOfType(operandType) || operandType;
63396                 if (type_5.flags & 3) {
63397                     return (556800 & notEqualFacts_1) === 556800;
63398                 }
63399                 return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
63400             }
63401             var type = getTypeOfExpression(node.expression);
63402             if (!isLiteralType(type)) {
63403                 return false;
63404             }
63405             var switchTypes = getSwitchClauseTypes(node);
63406             if (!switchTypes.length || ts.some(switchTypes, isNeitherUnitTypeNorNever)) {
63407                 return false;
63408             }
63409             return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes);
63410         }
63411         function functionHasImplicitReturn(func) {
63412             return func.endFlowNode && isReachableFlowNode(func.endFlowNode);
63413         }
63414         function checkAndAggregateReturnExpressionTypes(func, checkMode) {
63415             var functionFlags = ts.getFunctionFlags(func);
63416             var aggregatedTypes = [];
63417             var hasReturnWithNoExpression = functionHasImplicitReturn(func);
63418             var hasReturnOfTypeNever = false;
63419             ts.forEachReturnStatement(func.body, function (returnStatement) {
63420                 var expr = returnStatement.expression;
63421                 if (expr) {
63422                     var type = checkExpressionCached(expr, checkMode && checkMode & ~8);
63423                     if (functionFlags & 2) {
63424                         type = unwrapAwaitedType(checkAwaitedType(type, false, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member));
63425                     }
63426                     if (type.flags & 131072) {
63427                         hasReturnOfTypeNever = true;
63428                     }
63429                     ts.pushIfUnique(aggregatedTypes, type);
63430                 }
63431                 else {
63432                     hasReturnWithNoExpression = true;
63433                 }
63434             });
63435             if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || mayReturnNever(func))) {
63436                 return undefined;
63437             }
63438             if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression &&
63439                 !(isJSConstructor(func) && aggregatedTypes.some(function (t) { return t.symbol === func.symbol; }))) {
63440                 ts.pushIfUnique(aggregatedTypes, undefinedType);
63441             }
63442             return aggregatedTypes;
63443         }
63444         function mayReturnNever(func) {
63445             switch (func.kind) {
63446                 case 212:
63447                 case 213:
63448                     return true;
63449                 case 168:
63450                     return func.parent.kind === 204;
63451                 default:
63452                     return false;
63453             }
63454         }
63455         function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
63456             if (!produceDiagnostics) {
63457                 return;
63458             }
63459             var functionFlags = ts.getFunctionFlags(func);
63460             var type = returnType && unwrapReturnType(returnType, functionFlags);
63461             if (type && maybeTypeOfKind(type, 1 | 16384)) {
63462                 return;
63463             }
63464             if (func.kind === 167 || ts.nodeIsMissing(func.body) || func.body.kind !== 234 || !functionHasImplicitReturn(func)) {
63465                 return;
63466             }
63467             var hasExplicitReturn = func.flags & 512;
63468             var errorNode = ts.getEffectiveReturnTypeNode(func) || func;
63469             if (type && type.flags & 131072) {
63470                 error(errorNode, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
63471             }
63472             else if (type && !hasExplicitReturn) {
63473                 error(errorNode, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
63474             }
63475             else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
63476                 error(errorNode, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
63477             }
63478             else if (compilerOptions.noImplicitReturns) {
63479                 if (!type) {
63480                     if (!hasExplicitReturn) {
63481                         return;
63482                     }
63483                     var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));
63484                     if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {
63485                         return;
63486                     }
63487                 }
63488                 error(errorNode, ts.Diagnostics.Not_all_code_paths_return_a_value);
63489             }
63490         }
63491         function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
63492             ts.Debug.assert(node.kind !== 168 || ts.isObjectLiteralMethod(node));
63493             checkNodeDeferred(node);
63494             if (ts.isFunctionExpression(node)) {
63495                 checkCollisionsForDeclarationName(node, node.name);
63496             }
63497             if (checkMode && checkMode & 4 && isContextSensitive(node)) {
63498                 if (!ts.getEffectiveReturnTypeNode(node) && !ts.hasContextSensitiveParameters(node)) {
63499                     var contextualSignature = getContextualSignature(node);
63500                     if (contextualSignature && couldContainTypeVariables(getReturnTypeOfSignature(contextualSignature))) {
63501                         var links = getNodeLinks(node);
63502                         if (links.contextFreeType) {
63503                             return links.contextFreeType;
63504                         }
63505                         var returnType = getReturnTypeFromBody(node, checkMode);
63506                         var returnOnlySignature = createSignature(undefined, undefined, undefined, ts.emptyArray, returnType, undefined, 0, 0);
63507                         var returnOnlyType = createAnonymousType(node.symbol, emptySymbols, [returnOnlySignature], ts.emptyArray, ts.emptyArray);
63508                         returnOnlyType.objectFlags |= 524288;
63509                         return links.contextFreeType = returnOnlyType;
63510                     }
63511                 }
63512                 return anyFunctionType;
63513             }
63514             var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
63515             if (!hasGrammarError && node.kind === 212) {
63516                 checkGrammarForGenerator(node);
63517             }
63518             contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode);
63519             return getTypeOfSymbol(getSymbolOfNode(node));
63520         }
63521         function contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
63522             var links = getNodeLinks(node);
63523             if (!(links.flags & 1024)) {
63524                 var contextualSignature = getContextualSignature(node);
63525                 if (!(links.flags & 1024)) {
63526                     links.flags |= 1024;
63527                     var signature = ts.firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfNode(node)), 0));
63528                     if (!signature) {
63529                         return;
63530                     }
63531                     if (isContextSensitive(node)) {
63532                         if (contextualSignature) {
63533                             var inferenceContext = getInferenceContext(node);
63534                             if (checkMode && checkMode & 2) {
63535                                 inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
63536                             }
63537                             var instantiatedContextualSignature = inferenceContext ?
63538                                 instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
63539                             assignContextualParameterTypes(signature, instantiatedContextualSignature);
63540                         }
63541                         else {
63542                             assignNonContextualParameterTypes(signature);
63543                         }
63544                     }
63545                     if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
63546                         var returnType = getReturnTypeFromBody(node, checkMode);
63547                         if (!signature.resolvedReturnType) {
63548                             signature.resolvedReturnType = returnType;
63549                         }
63550                     }
63551                     checkSignatureDeclaration(node);
63552                 }
63553             }
63554         }
63555         function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
63556             ts.Debug.assert(node.kind !== 168 || ts.isObjectLiteralMethod(node));
63557             var functionFlags = ts.getFunctionFlags(node);
63558             var returnType = getReturnTypeFromAnnotation(node);
63559             checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
63560             if (node.body) {
63561                 if (!ts.getEffectiveReturnTypeNode(node)) {
63562                     getReturnTypeOfSignature(getSignatureFromDeclaration(node));
63563                 }
63564                 if (node.body.kind === 234) {
63565                     checkSourceElement(node.body);
63566                 }
63567                 else {
63568                     var exprType = checkExpression(node.body);
63569                     var returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
63570                     if (returnOrPromisedType) {
63571                         if ((functionFlags & 3) === 2) {
63572                             var awaitedType = checkAwaitedType(exprType, false, 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);
63573                             checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, node.body, node.body);
63574                         }
63575                         else {
63576                             checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, node.body, node.body);
63577                         }
63578                     }
63579                 }
63580             }
63581         }
63582         function checkArithmeticOperandType(operand, type, diagnostic, isAwaitValid) {
63583             if (isAwaitValid === void 0) { isAwaitValid = false; }
63584             if (!isTypeAssignableTo(type, numberOrBigIntType)) {
63585                 var awaitedType = isAwaitValid && getAwaitedTypeOfPromise(type);
63586                 errorAndMaybeSuggestAwait(operand, !!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType), diagnostic);
63587                 return false;
63588             }
63589             return true;
63590         }
63591         function isReadonlyAssignmentDeclaration(d) {
63592             if (!ts.isCallExpression(d)) {
63593                 return false;
63594             }
63595             if (!ts.isBindableObjectDefinePropertyCall(d)) {
63596                 return false;
63597             }
63598             var objectLitType = checkExpressionCached(d.arguments[2]);
63599             var valueType = getTypeOfPropertyOfType(objectLitType, "value");
63600             if (valueType) {
63601                 var writableProp = getPropertyOfType(objectLitType, "writable");
63602                 var writableType = writableProp && getTypeOfSymbol(writableProp);
63603                 if (!writableType || writableType === falseType || writableType === regularFalseType) {
63604                     return true;
63605                 }
63606                 if (writableProp && writableProp.valueDeclaration && ts.isPropertyAssignment(writableProp.valueDeclaration)) {
63607                     var initializer = writableProp.valueDeclaration.initializer;
63608                     var rawOriginalType = checkExpression(initializer);
63609                     if (rawOriginalType === falseType || rawOriginalType === regularFalseType) {
63610                         return true;
63611                     }
63612                 }
63613                 return false;
63614             }
63615             var setProp = getPropertyOfType(objectLitType, "set");
63616             return !setProp;
63617         }
63618         function isReadonlySymbol(symbol) {
63619             return !!(ts.getCheckFlags(symbol) & 8 ||
63620                 symbol.flags & 4 && ts.getDeclarationModifierFlagsFromSymbol(symbol) & 64 ||
63621                 symbol.flags & 3 && getDeclarationNodeFlagsFromSymbol(symbol) & 2 ||
63622                 symbol.flags & 98304 && !(symbol.flags & 65536) ||
63623                 symbol.flags & 8 ||
63624                 ts.some(symbol.declarations, isReadonlyAssignmentDeclaration));
63625         }
63626         function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
63627             var _a, _b;
63628             if (assignmentKind === 0) {
63629                 return false;
63630             }
63631             if (isReadonlySymbol(symbol)) {
63632                 if (symbol.flags & 4 &&
63633                     ts.isAccessExpression(expr) &&
63634                     expr.expression.kind === 108) {
63635                     var ctor = ts.getContainingFunction(expr);
63636                     if (!(ctor && (ctor.kind === 170 || isJSConstructor(ctor)))) {
63637                         return true;
63638                     }
63639                     if (symbol.valueDeclaration) {
63640                         var isAssignmentDeclaration_1 = ts.isBinaryExpression(symbol.valueDeclaration);
63641                         var isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent;
63642                         var isLocalParameterProperty = ctor === symbol.valueDeclaration.parent;
63643                         var isLocalThisPropertyAssignment = isAssignmentDeclaration_1 && ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) === ctor.parent;
63644                         var isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration_1 && ((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration) === ctor;
63645                         var isWriteableSymbol = isLocalPropertyDeclaration
63646                             || isLocalParameterProperty
63647                             || isLocalThisPropertyAssignment
63648                             || isLocalThisPropertyAssignmentConstructorFunction;
63649                         return !isWriteableSymbol;
63650                     }
63651                 }
63652                 return true;
63653             }
63654             if (ts.isAccessExpression(expr)) {
63655                 var node = ts.skipParentheses(expr.expression);
63656                 if (node.kind === 79) {
63657                     var symbol_2 = getNodeLinks(node).resolvedSymbol;
63658                     if (symbol_2.flags & 2097152) {
63659                         var declaration = getDeclarationOfAliasSymbol(symbol_2);
63660                         return !!declaration && declaration.kind === 267;
63661                     }
63662                 }
63663             }
63664             return false;
63665         }
63666         function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
63667             var node = ts.skipOuterExpressions(expr, 6 | 1);
63668             if (node.kind !== 79 && !ts.isAccessExpression(node)) {
63669                 error(expr, invalidReferenceMessage);
63670                 return false;
63671             }
63672             if (node.flags & 32) {
63673                 error(expr, invalidOptionalChainMessage);
63674                 return false;
63675             }
63676             return true;
63677         }
63678         function checkDeleteExpression(node) {
63679             checkExpression(node.expression);
63680             var expr = ts.skipParentheses(node.expression);
63681             if (!ts.isAccessExpression(expr)) {
63682                 error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
63683                 return booleanType;
63684             }
63685             if (ts.isPropertyAccessExpression(expr) && ts.isPrivateIdentifier(expr.name)) {
63686                 error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier);
63687             }
63688             var links = getNodeLinks(expr);
63689             var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
63690             if (symbol) {
63691                 if (isReadonlySymbol(symbol)) {
63692                     error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
63693                 }
63694                 checkDeleteExpressionMustBeOptional(expr, symbol);
63695             }
63696             return booleanType;
63697         }
63698         function checkDeleteExpressionMustBeOptional(expr, symbol) {
63699             var type = getTypeOfSymbol(symbol);
63700             if (strictNullChecks &&
63701                 !(type.flags & (3 | 131072)) &&
63702                 !(exactOptionalPropertyTypes ? symbol.flags & 16777216 : getFalsyFlags(type) & 32768)) {
63703                 error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
63704             }
63705         }
63706         function checkTypeOfExpression(node) {
63707             checkExpression(node.expression);
63708             return typeofType;
63709         }
63710         function checkVoidExpression(node) {
63711             checkExpression(node.expression);
63712             return undefinedWideningType;
63713         }
63714         function checkAwaitExpression(node) {
63715             if (produceDiagnostics) {
63716                 var container = ts.getContainingFunctionOrClassStaticBlock(node);
63717                 if (container && ts.isClassStaticBlockDeclaration(container)) {
63718                     error(node, ts.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
63719                 }
63720                 else if (!(node.flags & 32768)) {
63721                     if (ts.isInTopLevelContext(node)) {
63722                         var sourceFile = ts.getSourceFileOfNode(node);
63723                         if (!hasParseDiagnostics(sourceFile)) {
63724                             var span = void 0;
63725                             if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
63726                                 if (!span)
63727                                     span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
63728                                 var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
63729                                 diagnostics.add(diagnostic);
63730                             }
63731                             if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
63732                                 span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
63733                                 var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
63734                                 diagnostics.add(diagnostic);
63735                             }
63736                         }
63737                     }
63738                     else {
63739                         var sourceFile = ts.getSourceFileOfNode(node);
63740                         if (!hasParseDiagnostics(sourceFile)) {
63741                             var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
63742                             var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
63743                             if (container && container.kind !== 170 && (ts.getFunctionFlags(container) & 2) === 0) {
63744                                 var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
63745                                 ts.addRelatedInfo(diagnostic, relatedInfo);
63746                             }
63747                             diagnostics.add(diagnostic);
63748                         }
63749                     }
63750                 }
63751                 if (isInParameterInitializerBeforeContainingFunction(node)) {
63752                     error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
63753                 }
63754             }
63755             var operandType = checkExpression(node.expression);
63756             var awaitedType = checkAwaitedType(operandType, true, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
63757             if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3)) {
63758                 addErrorOrSuggestion(false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
63759             }
63760             return awaitedType;
63761         }
63762         function checkPrefixUnaryExpression(node) {
63763             var operandType = checkExpression(node.operand);
63764             if (operandType === silentNeverType) {
63765                 return silentNeverType;
63766             }
63767             switch (node.operand.kind) {
63768                 case 8:
63769                     switch (node.operator) {
63770                         case 40:
63771                             return getFreshTypeOfLiteralType(getNumberLiteralType(-node.operand.text));
63772                         case 39:
63773                             return getFreshTypeOfLiteralType(getNumberLiteralType(+node.operand.text));
63774                     }
63775                     break;
63776                 case 9:
63777                     if (node.operator === 40) {
63778                         return getFreshTypeOfLiteralType(getBigIntLiteralType({
63779                             negative: true,
63780                             base10Value: ts.parsePseudoBigInt(node.operand.text)
63781                         }));
63782                     }
63783             }
63784             switch (node.operator) {
63785                 case 39:
63786                 case 40:
63787                 case 54:
63788                     checkNonNullType(operandType, node.operand);
63789                     if (maybeTypeOfKind(operandType, 12288)) {
63790                         error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
63791                     }
63792                     if (node.operator === 39) {
63793                         if (maybeTypeOfKind(operandType, 2112)) {
63794                             error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
63795                         }
63796                         return numberType;
63797                     }
63798                     return getUnaryResultType(operandType);
63799                 case 53:
63800                     checkTruthinessExpression(node.operand);
63801                     var facts = getTypeFacts(operandType) & (4194304 | 8388608);
63802                     return facts === 4194304 ? falseType :
63803                         facts === 8388608 ? trueType :
63804                             booleanType;
63805                 case 45:
63806                 case 46:
63807                     var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type);
63808                     if (ok) {
63809                         checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access);
63810                     }
63811                     return getUnaryResultType(operandType);
63812             }
63813             return errorType;
63814         }
63815         function checkPostfixUnaryExpression(node) {
63816             var operandType = checkExpression(node.operand);
63817             if (operandType === silentNeverType) {
63818                 return silentNeverType;
63819             }
63820             var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type);
63821             if (ok) {
63822                 checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access);
63823             }
63824             return getUnaryResultType(operandType);
63825         }
63826         function getUnaryResultType(operandType) {
63827             if (maybeTypeOfKind(operandType, 2112)) {
63828                 return isTypeAssignableToKind(operandType, 3) || maybeTypeOfKind(operandType, 296)
63829                     ? numberOrBigIntType
63830                     : bigintType;
63831             }
63832             return numberType;
63833         }
63834         function maybeTypeOfKind(type, kind) {
63835             if (type.flags & kind) {
63836                 return true;
63837             }
63838             if (type.flags & 3145728) {
63839                 var types = type.types;
63840                 for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
63841                     var t = types_21[_i];
63842                     if (maybeTypeOfKind(t, kind)) {
63843                         return true;
63844                     }
63845                 }
63846             }
63847             return false;
63848         }
63849         function isTypeAssignableToKind(source, kind, strict) {
63850             if (source.flags & kind) {
63851                 return true;
63852             }
63853             if (strict && source.flags & (3 | 16384 | 32768 | 65536)) {
63854                 return false;
63855             }
63856             return !!(kind & 296) && isTypeAssignableTo(source, numberType) ||
63857                 !!(kind & 2112) && isTypeAssignableTo(source, bigintType) ||
63858                 !!(kind & 402653316) && isTypeAssignableTo(source, stringType) ||
63859                 !!(kind & 528) && isTypeAssignableTo(source, booleanType) ||
63860                 !!(kind & 16384) && isTypeAssignableTo(source, voidType) ||
63861                 !!(kind & 131072) && isTypeAssignableTo(source, neverType) ||
63862                 !!(kind & 65536) && isTypeAssignableTo(source, nullType) ||
63863                 !!(kind & 32768) && isTypeAssignableTo(source, undefinedType) ||
63864                 !!(kind & 4096) && isTypeAssignableTo(source, esSymbolType) ||
63865                 !!(kind & 67108864) && isTypeAssignableTo(source, nonPrimitiveType);
63866         }
63867         function allTypesAssignableToKind(source, kind, strict) {
63868             return source.flags & 1048576 ?
63869                 ts.every(source.types, function (subType) { return allTypesAssignableToKind(subType, kind, strict); }) :
63870                 isTypeAssignableToKind(source, kind, strict);
63871         }
63872         function isConstEnumObjectType(type) {
63873             return !!(ts.getObjectFlags(type) & 16) && !!type.symbol && isConstEnumSymbol(type.symbol);
63874         }
63875         function isConstEnumSymbol(symbol) {
63876             return (symbol.flags & 128) !== 0;
63877         }
63878         function checkInstanceOfExpression(left, right, leftType, rightType) {
63879             if (leftType === silentNeverType || rightType === silentNeverType) {
63880                 return silentNeverType;
63881             }
63882             if (!isTypeAny(leftType) &&
63883                 allTypesAssignableToKind(leftType, 131068)) {
63884                 error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
63885             }
63886             if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
63887                 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);
63888             }
63889             return booleanType;
63890         }
63891         function checkInExpression(left, right, leftType, rightType) {
63892             if (leftType === silentNeverType || rightType === silentNeverType) {
63893                 return silentNeverType;
63894             }
63895             if (ts.isPrivateIdentifier(left)) {
63896                 if (languageVersion < 99) {
63897                     checkExternalEmitHelpers(left, 2097152);
63898                 }
63899                 if (!getNodeLinks(left).resolvedSymbol && ts.getContainingClass(left)) {
63900                     var isUncheckedJS = isUncheckedJSSuggestion(left, rightType.symbol, true);
63901                     reportNonexistentProperty(left, rightType, isUncheckedJS);
63902                 }
63903             }
63904             else {
63905                 leftType = checkNonNullType(leftType, left);
63906                 if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) ||
63907                     isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) {
63908                     error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
63909                 }
63910             }
63911             rightType = checkNonNullType(rightType, right);
63912             var rightTypeConstraint = getConstraintOfType(rightType);
63913             if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) ||
63914                 rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) ||
63915                     !maybeTypeOfKind(rightTypeConstraint, 67108864 | 58982400 | 524288))) {
63916                 error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
63917             }
63918             return booleanType;
63919         }
63920         function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
63921             var properties = node.properties;
63922             if (strictNullChecks && properties.length === 0) {
63923                 return checkNonNullType(sourceType, node);
63924             }
63925             for (var i = 0; i < properties.length; i++) {
63926                 checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
63927             }
63928             return sourceType;
63929         }
63930         function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
63931             if (rightIsThis === void 0) { rightIsThis = false; }
63932             var properties = node.properties;
63933             var property = properties[propertyIndex];
63934             if (property.kind === 294 || property.kind === 295) {
63935                 var name = property.name;
63936                 var exprType = getLiteralTypeFromPropertyName(name);
63937                 if (isTypeUsableAsPropertyName(exprType)) {
63938                     var text = getPropertyNameFromType(exprType);
63939                     var prop = getPropertyOfType(objectLiteralType, text);
63940                     if (prop) {
63941                         markPropertyAsReferenced(prop, property, rightIsThis);
63942                         checkPropertyAccessibility(property, false, true, objectLiteralType, prop);
63943                     }
63944                 }
63945                 var elementType = getIndexedAccessType(objectLiteralType, exprType, 32, name);
63946                 var type = getFlowTypeOfDestructuring(property, elementType);
63947                 return checkDestructuringAssignment(property.kind === 295 ? property : property.initializer, type);
63948             }
63949             else if (property.kind === 296) {
63950                 if (propertyIndex < properties.length - 1) {
63951                     error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
63952                 }
63953                 else {
63954                     if (languageVersion < 99) {
63955                         checkExternalEmitHelpers(property, 4);
63956                     }
63957                     var nonRestNames = [];
63958                     if (allProperties) {
63959                         for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
63960                             var otherProperty = allProperties_1[_i];
63961                             if (!ts.isSpreadAssignment(otherProperty)) {
63962                                 nonRestNames.push(otherProperty.name);
63963                             }
63964                         }
63965                     }
63966                     var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
63967                     checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
63968                     return checkDestructuringAssignment(property.expression, type);
63969                 }
63970             }
63971             else {
63972                 error(property, ts.Diagnostics.Property_assignment_expected);
63973             }
63974         }
63975         function checkArrayLiteralAssignment(node, sourceType, checkMode) {
63976             var elements = node.elements;
63977             if (languageVersion < 2 && compilerOptions.downlevelIteration) {
63978                 checkExternalEmitHelpers(node, 512);
63979             }
63980             var possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 | 128, sourceType, undefinedType, node) || errorType;
63981             var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType;
63982             for (var i = 0; i < elements.length; i++) {
63983                 var type = possiblyOutOfBoundsType;
63984                 if (node.elements[i].kind === 224) {
63985                     type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65, sourceType, undefinedType, node) || errorType);
63986                 }
63987                 checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode);
63988             }
63989             return sourceType;
63990         }
63991         function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
63992             var elements = node.elements;
63993             var element = elements[elementIndex];
63994             if (element.kind !== 226) {
63995                 if (element.kind !== 224) {
63996                     var indexType = getNumberLiteralType(elementIndex);
63997                     if (isArrayLikeType(sourceType)) {
63998                         var accessFlags = 32 | (hasDefaultValue(element) ? 16 : 0);
63999                         var elementType_2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
64000                         var assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType_2, 524288) : elementType_2;
64001                         var type = getFlowTypeOfDestructuring(element, assignedType);
64002                         return checkDestructuringAssignment(element, type, checkMode);
64003                     }
64004                     return checkDestructuringAssignment(element, elementType, checkMode);
64005                 }
64006                 if (elementIndex < elements.length - 1) {
64007                     error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
64008                 }
64009                 else {
64010                     var restExpression = element.expression;
64011                     if (restExpression.kind === 220 && restExpression.operatorToken.kind === 63) {
64012                         error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
64013                     }
64014                     else {
64015                         checkGrammarForDisallowedTrailingComma(node.elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
64016                         var type = everyType(sourceType, isTupleType) ?
64017                             mapType(sourceType, function (t) { return sliceTupleType(t, elementIndex); }) :
64018                             createArrayType(elementType);
64019                         return checkDestructuringAssignment(restExpression, type, checkMode);
64020                     }
64021                 }
64022             }
64023             return undefined;
64024         }
64025         function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
64026             var target;
64027             if (exprOrAssignment.kind === 295) {
64028                 var prop = exprOrAssignment;
64029                 if (prop.objectAssignmentInitializer) {
64030                     if (strictNullChecks &&
64031                         !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 32768)) {
64032                         sourceType = getTypeWithFacts(sourceType, 524288);
64033                     }
64034                     checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
64035                 }
64036                 target = exprOrAssignment.name;
64037             }
64038             else {
64039                 target = exprOrAssignment;
64040             }
64041             if (target.kind === 220 && target.operatorToken.kind === 63) {
64042                 checkBinaryExpression(target, checkMode);
64043                 target = target.left;
64044             }
64045             if (target.kind === 204) {
64046                 return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
64047             }
64048             if (target.kind === 203) {
64049                 return checkArrayLiteralAssignment(target, sourceType, checkMode);
64050             }
64051             return checkReferenceAssignment(target, sourceType, checkMode);
64052         }
64053         function checkReferenceAssignment(target, sourceType, checkMode) {
64054             var targetType = checkExpression(target, checkMode);
64055             var error = target.parent.kind === 296 ?
64056                 ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
64057                 ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
64058             var optionalError = target.parent.kind === 296 ?
64059                 ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access :
64060                 ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access;
64061             if (checkReferenceExpression(target, error, optionalError)) {
64062                 checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
64063             }
64064             if (ts.isPrivateIdentifierPropertyAccessExpression(target)) {
64065                 checkExternalEmitHelpers(target.parent, 1048576);
64066             }
64067             return sourceType;
64068         }
64069         function isSideEffectFree(node) {
64070             node = ts.skipParentheses(node);
64071             switch (node.kind) {
64072                 case 79:
64073                 case 10:
64074                 case 13:
64075                 case 209:
64076                 case 222:
64077                 case 14:
64078                 case 8:
64079                 case 9:
64080                 case 110:
64081                 case 95:
64082                 case 104:
64083                 case 152:
64084                 case 212:
64085                 case 225:
64086                 case 213:
64087                 case 203:
64088                 case 204:
64089                 case 215:
64090                 case 229:
64091                 case 278:
64092                 case 277:
64093                     return true;
64094                 case 221:
64095                     return isSideEffectFree(node.whenTrue) &&
64096                         isSideEffectFree(node.whenFalse);
64097                 case 220:
64098                     if (ts.isAssignmentOperator(node.operatorToken.kind)) {
64099                         return false;
64100                     }
64101                     return isSideEffectFree(node.left) &&
64102                         isSideEffectFree(node.right);
64103                 case 218:
64104                 case 219:
64105                     switch (node.operator) {
64106                         case 53:
64107                         case 39:
64108                         case 40:
64109                         case 54:
64110                             return true;
64111                     }
64112                     return false;
64113                 case 216:
64114                 case 210:
64115                 case 228:
64116                 default:
64117                     return false;
64118             }
64119         }
64120         function isTypeEqualityComparableTo(source, target) {
64121             return (target.flags & 98304) !== 0 || isTypeComparableTo(source, target);
64122         }
64123         function createCheckBinaryExpression() {
64124             var trampoline = ts.createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState);
64125             return function (node, checkMode) {
64126                 var result = trampoline(node, checkMode);
64127                 ts.Debug.assertIsDefined(result);
64128                 return result;
64129             };
64130             function onEnter(node, state, checkMode) {
64131                 if (state) {
64132                     state.stackIndex++;
64133                     state.skip = false;
64134                     setLeftType(state, undefined);
64135                     setLastResult(state, undefined);
64136                 }
64137                 else {
64138                     state = {
64139                         checkMode: checkMode,
64140                         skip: false,
64141                         stackIndex: 0,
64142                         typeStack: [undefined, undefined],
64143                     };
64144                 }
64145                 if (ts.isInJSFile(node) && ts.getAssignedExpandoInitializer(node)) {
64146                     state.skip = true;
64147                     setLastResult(state, checkExpression(node.right, checkMode));
64148                     return state;
64149                 }
64150                 checkGrammarNullishCoalesceWithLogicalExpression(node);
64151                 var operator = node.operatorToken.kind;
64152                 if (operator === 63 && (node.left.kind === 204 || node.left.kind === 203)) {
64153                     state.skip = true;
64154                     setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108));
64155                     return state;
64156                 }
64157                 return state;
64158             }
64159             function onLeft(left, state, _node) {
64160                 if (!state.skip) {
64161                     return maybeCheckExpression(state, left);
64162                 }
64163             }
64164             function onOperator(operatorToken, state, node) {
64165                 if (!state.skip) {
64166                     var leftType = getLastResult(state);
64167                     ts.Debug.assertIsDefined(leftType);
64168                     setLeftType(state, leftType);
64169                     setLastResult(state, undefined);
64170                     var operator = operatorToken.kind;
64171                     if (operator === 55 || operator === 56 || operator === 60) {
64172                         if (operator === 55) {
64173                             var parent = ts.walkUpParenthesizedExpressions(node.parent);
64174                             checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
64175                         }
64176                         checkTruthinessOfType(leftType, node.left);
64177                     }
64178                 }
64179             }
64180             function onRight(right, state, _node) {
64181                 if (!state.skip) {
64182                     return maybeCheckExpression(state, right);
64183                 }
64184             }
64185             function onExit(node, state) {
64186                 var result;
64187                 if (state.skip) {
64188                     result = getLastResult(state);
64189                 }
64190                 else {
64191                     var leftType = getLeftType(state);
64192                     ts.Debug.assertIsDefined(leftType);
64193                     var rightType = getLastResult(state);
64194                     ts.Debug.assertIsDefined(rightType);
64195                     result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node);
64196                 }
64197                 state.skip = false;
64198                 setLeftType(state, undefined);
64199                 setLastResult(state, undefined);
64200                 state.stackIndex--;
64201                 return result;
64202             }
64203             function foldState(state, result, _side) {
64204                 setLastResult(state, result);
64205                 return state;
64206             }
64207             function maybeCheckExpression(state, node) {
64208                 if (ts.isBinaryExpression(node)) {
64209                     return node;
64210                 }
64211                 setLastResult(state, checkExpression(node, state.checkMode));
64212             }
64213             function getLeftType(state) {
64214                 return state.typeStack[state.stackIndex];
64215             }
64216             function setLeftType(state, type) {
64217                 state.typeStack[state.stackIndex] = type;
64218             }
64219             function getLastResult(state) {
64220                 return state.typeStack[state.stackIndex + 1];
64221             }
64222             function setLastResult(state, type) {
64223                 state.typeStack[state.stackIndex + 1] = type;
64224             }
64225         }
64226         function checkGrammarNullishCoalesceWithLogicalExpression(node) {
64227             var left = node.left, operatorToken = node.operatorToken, right = node.right;
64228             if (operatorToken.kind === 60) {
64229                 if (ts.isBinaryExpression(left) && (left.operatorToken.kind === 56 || left.operatorToken.kind === 55)) {
64230                     grammarErrorOnNode(left, ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, ts.tokenToString(left.operatorToken.kind), ts.tokenToString(operatorToken.kind));
64231                 }
64232                 if (ts.isBinaryExpression(right) && (right.operatorToken.kind === 56 || right.operatorToken.kind === 55)) {
64233                     grammarErrorOnNode(right, ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, ts.tokenToString(right.operatorToken.kind), ts.tokenToString(operatorToken.kind));
64234                 }
64235             }
64236         }
64237         function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
64238             var operator = operatorToken.kind;
64239             if (operator === 63 && (left.kind === 204 || left.kind === 203)) {
64240                 return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108);
64241             }
64242             var leftType;
64243             if (operator === 55 || operator === 56 || operator === 60) {
64244                 leftType = checkTruthinessExpression(left, checkMode);
64245             }
64246             else {
64247                 leftType = checkExpression(left, checkMode);
64248             }
64249             var rightType = checkExpression(right, checkMode);
64250             return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode);
64251         }
64252         function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) {
64253             var operator = operatorToken.kind;
64254             switch (operator) {
64255                 case 41:
64256                 case 42:
64257                 case 66:
64258                 case 67:
64259                 case 43:
64260                 case 68:
64261                 case 44:
64262                 case 69:
64263                 case 40:
64264                 case 65:
64265                 case 47:
64266                 case 70:
64267                 case 48:
64268                 case 71:
64269                 case 49:
64270                 case 72:
64271                 case 51:
64272                 case 74:
64273                 case 52:
64274                 case 78:
64275                 case 50:
64276                 case 73:
64277                     if (leftType === silentNeverType || rightType === silentNeverType) {
64278                         return silentNeverType;
64279                     }
64280                     leftType = checkNonNullType(leftType, left);
64281                     rightType = checkNonNullType(rightType, right);
64282                     var suggestedOperator = void 0;
64283                     if ((leftType.flags & 528) &&
64284                         (rightType.flags & 528) &&
64285                         (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) {
64286                         error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator));
64287                         return numberType;
64288                     }
64289                     else {
64290                         var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, true);
64291                         var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, true);
64292                         var resultType_1;
64293                         if ((isTypeAssignableToKind(leftType, 3) && isTypeAssignableToKind(rightType, 3)) ||
64294                             !(maybeTypeOfKind(leftType, 2112) || maybeTypeOfKind(rightType, 2112))) {
64295                             resultType_1 = numberType;
64296                         }
64297                         else if (bothAreBigIntLike(leftType, rightType)) {
64298                             switch (operator) {
64299                                 case 49:
64300                                 case 72:
64301                                     reportOperatorError();
64302                                     break;
64303                                 case 42:
64304                                 case 67:
64305                                     if (languageVersion < 3) {
64306                                         error(errorNode, ts.Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later);
64307                                     }
64308                             }
64309                             resultType_1 = bigintType;
64310                         }
64311                         else {
64312                             reportOperatorError(bothAreBigIntLike);
64313                             resultType_1 = errorType;
64314                         }
64315                         if (leftOk && rightOk) {
64316                             checkAssignmentOperator(resultType_1);
64317                         }
64318                         return resultType_1;
64319                     }
64320                 case 39:
64321                 case 64:
64322                     if (leftType === silentNeverType || rightType === silentNeverType) {
64323                         return silentNeverType;
64324                     }
64325                     if (!isTypeAssignableToKind(leftType, 402653316) && !isTypeAssignableToKind(rightType, 402653316)) {
64326                         leftType = checkNonNullType(leftType, left);
64327                         rightType = checkNonNullType(rightType, right);
64328                     }
64329                     var resultType = void 0;
64330                     if (isTypeAssignableToKind(leftType, 296, true) && isTypeAssignableToKind(rightType, 296, true)) {
64331                         resultType = numberType;
64332                     }
64333                     else if (isTypeAssignableToKind(leftType, 2112, true) && isTypeAssignableToKind(rightType, 2112, true)) {
64334                         resultType = bigintType;
64335                     }
64336                     else if (isTypeAssignableToKind(leftType, 402653316, true) || isTypeAssignableToKind(rightType, 402653316, true)) {
64337                         resultType = stringType;
64338                     }
64339                     else if (isTypeAny(leftType) || isTypeAny(rightType)) {
64340                         resultType = isErrorType(leftType) || isErrorType(rightType) ? errorType : anyType;
64341                     }
64342                     if (resultType && !checkForDisallowedESSymbolOperand(operator)) {
64343                         return resultType;
64344                     }
64345                     if (!resultType) {
64346                         var closeEnoughKind_1 = 296 | 2112 | 402653316 | 3;
64347                         reportOperatorError(function (left, right) {
64348                             return isTypeAssignableToKind(left, closeEnoughKind_1) &&
64349                                 isTypeAssignableToKind(right, closeEnoughKind_1);
64350                         });
64351                         return anyType;
64352                     }
64353                     if (operator === 64) {
64354                         checkAssignmentOperator(resultType);
64355                     }
64356                     return resultType;
64357                 case 29:
64358                 case 31:
64359                 case 32:
64360                 case 33:
64361                     if (checkForDisallowedESSymbolOperand(operator)) {
64362                         leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
64363                         rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
64364                         reportOperatorErrorUnless(function (left, right) {
64365                             return isTypeComparableTo(left, right) || isTypeComparableTo(right, left) || (isTypeAssignableTo(left, numberOrBigIntType) && isTypeAssignableTo(right, numberOrBigIntType));
64366                         });
64367                     }
64368                     return booleanType;
64369                 case 34:
64370                 case 35:
64371                 case 36:
64372                 case 37:
64373                     reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
64374                     return booleanType;
64375                 case 102:
64376                     return checkInstanceOfExpression(left, right, leftType, rightType);
64377                 case 101:
64378                     return checkInExpression(left, right, leftType, rightType);
64379                 case 55:
64380                 case 76: {
64381                     var resultType_2 = getTypeFacts(leftType) & 4194304 ?
64382                         getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) :
64383                         leftType;
64384                     if (operator === 76) {
64385                         checkAssignmentOperator(rightType);
64386                     }
64387                     return resultType_2;
64388                 }
64389                 case 56:
64390                 case 75: {
64391                     var resultType_3 = getTypeFacts(leftType) & 8388608 ?
64392                         getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2) :
64393                         leftType;
64394                     if (operator === 75) {
64395                         checkAssignmentOperator(rightType);
64396                     }
64397                     return resultType_3;
64398                 }
64399                 case 60:
64400                 case 77: {
64401                     var resultType_4 = getTypeFacts(leftType) & 262144 ?
64402                         getUnionType([getNonNullableType(leftType), rightType], 2) :
64403                         leftType;
64404                     if (operator === 77) {
64405                         checkAssignmentOperator(rightType);
64406                     }
64407                     return resultType_4;
64408                 }
64409                 case 63:
64410                     var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0;
64411                     checkAssignmentDeclaration(declKind, rightType);
64412                     if (isAssignmentDeclaration(declKind)) {
64413                         if (!(rightType.flags & 524288) ||
64414                             declKind !== 2 &&
64415                                 declKind !== 6 &&
64416                                 !isEmptyObjectType(rightType) &&
64417                                 !isFunctionObjectType(rightType) &&
64418                                 !(ts.getObjectFlags(rightType) & 1)) {
64419                             checkAssignmentOperator(rightType);
64420                         }
64421                         return leftType;
64422                     }
64423                     else {
64424                         checkAssignmentOperator(rightType);
64425                         return getRegularTypeOfObjectLiteral(rightType);
64426                     }
64427                 case 27:
64428                     if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) {
64429                         var sf = ts.getSourceFileOfNode(left);
64430                         var sourceText = sf.text;
64431                         var start_3 = ts.skipTrivia(sourceText, left.pos);
64432                         var isInDiag2657 = sf.parseDiagnostics.some(function (diag) {
64433                             if (diag.code !== ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code)
64434                                 return false;
64435                             return ts.textSpanContainsPosition(diag, start_3);
64436                         });
64437                         if (!isInDiag2657)
64438                             error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
64439                     }
64440                     return rightType;
64441                 default:
64442                     return ts.Debug.fail();
64443             }
64444             function bothAreBigIntLike(left, right) {
64445                 return isTypeAssignableToKind(left, 2112) && isTypeAssignableToKind(right, 2112);
64446             }
64447             function checkAssignmentDeclaration(kind, rightType) {
64448                 if (kind === 2) {
64449                     for (var _i = 0, _a = getPropertiesOfObjectType(rightType); _i < _a.length; _i++) {
64450                         var prop = _a[_i];
64451                         var propType = getTypeOfSymbol(prop);
64452                         if (propType.symbol && propType.symbol.flags & 32) {
64453                             var name = prop.escapedName;
64454                             var symbol = resolveName(prop.valueDeclaration, name, 788968, undefined, name, false);
64455                             if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.declarations.some(ts.isJSDocTypedefTag)) {
64456                                 addDuplicateDeclarationErrorsForSymbols(symbol, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name), prop);
64457                                 addDuplicateDeclarationErrorsForSymbols(prop, ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(name), symbol);
64458                             }
64459                         }
64460                     }
64461                 }
64462             }
64463             function isEvalNode(node) {
64464                 return node.kind === 79 && node.escapedText === "eval";
64465             }
64466             function checkForDisallowedESSymbolOperand(operator) {
64467                 var offendingSymbolOperand = maybeTypeOfKind(leftType, 12288) ? left :
64468                     maybeTypeOfKind(rightType, 12288) ? right :
64469                         undefined;
64470                 if (offendingSymbolOperand) {
64471                     error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
64472                     return false;
64473                 }
64474                 return true;
64475             }
64476             function getSuggestedBooleanOperator(operator) {
64477                 switch (operator) {
64478                     case 51:
64479                     case 74:
64480                         return 56;
64481                     case 52:
64482                     case 78:
64483                         return 37;
64484                     case 50:
64485                     case 73:
64486                         return 55;
64487                     default:
64488                         return undefined;
64489                 }
64490             }
64491             function checkAssignmentOperator(valueType) {
64492                 if (produceDiagnostics && ts.isAssignmentOperator(operator)) {
64493                     if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)
64494                         && (!ts.isIdentifier(left) || ts.unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
64495                         var headMessage = void 0;
64496                         if (exactOptionalPropertyTypes && ts.isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768)) {
64497                             var target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText);
64498                             if (isExactOptionalPropertyMismatch(valueType, target)) {
64499                                 headMessage = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target;
64500                             }
64501                         }
64502                         checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage);
64503                     }
64504                 }
64505             }
64506             function isAssignmentDeclaration(kind) {
64507                 var _a;
64508                 switch (kind) {
64509                     case 2:
64510                         return true;
64511                     case 1:
64512                     case 5:
64513                     case 6:
64514                     case 3:
64515                     case 4:
64516                         var symbol = getSymbolOfNode(left);
64517                         var init = ts.getAssignedExpandoInitializer(right);
64518                         return !!init && ts.isObjectLiteralExpression(init) &&
64519                             !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.exports) === null || _a === void 0 ? void 0 : _a.size);
64520                     default:
64521                         return false;
64522                 }
64523             }
64524             function reportOperatorErrorUnless(typesAreCompatible) {
64525                 if (!typesAreCompatible(leftType, rightType)) {
64526                     reportOperatorError(typesAreCompatible);
64527                     return true;
64528                 }
64529                 return false;
64530             }
64531             function reportOperatorError(isRelated) {
64532                 var _a;
64533                 var wouldWorkWithAwait = false;
64534                 var errNode = errorNode || operatorToken;
64535                 if (isRelated) {
64536                     var awaitedLeftType = getAwaitedTypeNoAlias(leftType);
64537                     var awaitedRightType = getAwaitedTypeNoAlias(rightType);
64538                     wouldWorkWithAwait = !(awaitedLeftType === leftType && awaitedRightType === rightType)
64539                         && !!(awaitedLeftType && awaitedRightType)
64540                         && isRelated(awaitedLeftType, awaitedRightType);
64541                 }
64542                 var effectiveLeft = leftType;
64543                 var effectiveRight = rightType;
64544                 if (!wouldWorkWithAwait && isRelated) {
64545                     _a = getBaseTypesIfUnrelated(leftType, rightType, isRelated), effectiveLeft = _a[0], effectiveRight = _a[1];
64546                 }
64547                 var _b = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight), leftStr = _b[0], rightStr = _b[1];
64548                 if (!tryGiveBetterPrimaryError(errNode, wouldWorkWithAwait, leftStr, rightStr)) {
64549                     errorAndMaybeSuggestAwait(errNode, wouldWorkWithAwait, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
64550                 }
64551             }
64552             function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) {
64553                 var typeName;
64554                 switch (operatorToken.kind) {
64555                     case 36:
64556                     case 34:
64557                         typeName = "false";
64558                         break;
64559                     case 37:
64560                     case 35:
64561                         typeName = "true";
64562                 }
64563                 if (typeName) {
64564                     return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr);
64565                 }
64566                 return undefined;
64567             }
64568         }
64569         function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
64570             var effectiveLeft = leftType;
64571             var effectiveRight = rightType;
64572             var leftBase = getBaseTypeOfLiteralType(leftType);
64573             var rightBase = getBaseTypeOfLiteralType(rightType);
64574             if (!isRelated(leftBase, rightBase)) {
64575                 effectiveLeft = leftBase;
64576                 effectiveRight = rightBase;
64577             }
64578             return [effectiveLeft, effectiveRight];
64579         }
64580         function checkYieldExpression(node) {
64581             if (produceDiagnostics) {
64582                 if (!(node.flags & 8192)) {
64583                     grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
64584                 }
64585                 if (isInParameterInitializerBeforeContainingFunction(node)) {
64586                     error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
64587                 }
64588             }
64589             var func = ts.getContainingFunction(node);
64590             if (!func)
64591                 return anyType;
64592             var functionFlags = ts.getFunctionFlags(func);
64593             if (!(functionFlags & 1)) {
64594                 return anyType;
64595             }
64596             var isAsync = (functionFlags & 2) !== 0;
64597             if (node.asteriskToken) {
64598                 if (isAsync && languageVersion < 99) {
64599                     checkExternalEmitHelpers(node, 26624);
64600                 }
64601                 if (!isAsync && languageVersion < 2 && compilerOptions.downlevelIteration) {
64602                     checkExternalEmitHelpers(node, 256);
64603                 }
64604             }
64605             var returnType = getReturnTypeFromAnnotation(func);
64606             var iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
64607             var signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
64608             var signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
64609             var resolvedSignatureNextType = isAsync ? getAwaitedType(signatureNextType) || anyType : signatureNextType;
64610             var yieldExpressionType = node.expression ? checkExpression(node.expression) : undefinedWideningType;
64611             var yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType, resolvedSignatureNextType, isAsync);
64612             if (returnType && yieldedType) {
64613                 checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureYieldType, node.expression || node, node.expression);
64614             }
64615             if (node.asteriskToken) {
64616                 var use = isAsync ? 19 : 17;
64617                 return getIterationTypeOfIterable(use, 1, yieldExpressionType, node.expression)
64618                     || anyType;
64619             }
64620             else if (returnType) {
64621                 return getIterationTypeOfGeneratorFunctionReturnType(2, returnType, isAsync)
64622                     || anyType;
64623             }
64624             var type = getContextualIterationType(2, func);
64625             if (!type) {
64626                 type = anyType;
64627                 if (produceDiagnostics && noImplicitAny && !ts.expressionResultIsUnused(node)) {
64628                     var contextualType = getContextualType(node);
64629                     if (!contextualType || isTypeAny(contextualType)) {
64630                         error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
64631                     }
64632                 }
64633             }
64634             return type;
64635         }
64636         function checkConditionalExpression(node, checkMode) {
64637             var type = checkTruthinessExpression(node.condition);
64638             checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
64639             var type1 = checkExpression(node.whenTrue, checkMode);
64640             var type2 = checkExpression(node.whenFalse, checkMode);
64641             return getUnionType([type1, type2], 2);
64642         }
64643         function isTemplateLiteralContext(node) {
64644             var parent = node.parent;
64645             return ts.isParenthesizedExpression(parent) && isTemplateLiteralContext(parent) ||
64646                 ts.isElementAccessExpression(parent) && parent.argumentExpression === node;
64647         }
64648         function checkTemplateExpression(node) {
64649             var texts = [node.head.text];
64650             var types = [];
64651             for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
64652                 var span = _a[_i];
64653                 var type = checkExpression(span.expression);
64654                 if (maybeTypeOfKind(type, 12288)) {
64655                     error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
64656                 }
64657                 texts.push(span.literal.text);
64658                 types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
64659             }
64660             return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
64661         }
64662         function isTemplateLiteralContextualType(type) {
64663             return !!(type.flags & (128 | 134217728) ||
64664                 type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316));
64665         }
64666         function getContextNode(node) {
64667             if (node.kind === 285 && !ts.isJsxSelfClosingElement(node.parent)) {
64668                 return node.parent.parent;
64669             }
64670             return node;
64671         }
64672         function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
64673             var context = getContextNode(node);
64674             var saveContextualType = context.contextualType;
64675             var saveInferenceContext = context.inferenceContext;
64676             try {
64677                 context.contextualType = contextualType;
64678                 context.inferenceContext = inferenceContext;
64679                 var type = checkExpression(node, checkMode | 1 | (inferenceContext ? 2 : 0));
64680                 var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
64681                     getRegularTypeOfLiteralType(type) : type;
64682                 return result;
64683             }
64684             finally {
64685                 context.contextualType = saveContextualType;
64686                 context.inferenceContext = saveInferenceContext;
64687             }
64688         }
64689         function checkExpressionCached(node, checkMode) {
64690             var links = getNodeLinks(node);
64691             if (!links.resolvedType) {
64692                 if (checkMode && checkMode !== 0) {
64693                     return checkExpression(node, checkMode);
64694                 }
64695                 var saveFlowLoopStart = flowLoopStart;
64696                 var saveFlowTypeCache = flowTypeCache;
64697                 flowLoopStart = flowLoopCount;
64698                 flowTypeCache = undefined;
64699                 links.resolvedType = checkExpression(node, checkMode);
64700                 flowTypeCache = saveFlowTypeCache;
64701                 flowLoopStart = saveFlowLoopStart;
64702             }
64703             return links.resolvedType;
64704         }
64705         function isTypeAssertion(node) {
64706             node = ts.skipParentheses(node, true);
64707             return node.kind === 210 ||
64708                 node.kind === 228 ||
64709                 ts.isJSDocTypeAssertion(node);
64710         }
64711         function checkDeclarationInitializer(declaration, contextualType) {
64712             var initializer = ts.getEffectiveInitializer(declaration);
64713             var type = getQuickTypeOfExpression(initializer) ||
64714                 (contextualType ? checkExpressionWithContextualType(initializer, contextualType, undefined, 0) : checkExpressionCached(initializer));
64715             return ts.isParameter(declaration) && declaration.name.kind === 201 &&
64716                 isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
64717                 padTupleType(type, declaration.name) : type;
64718         }
64719         function padTupleType(type, pattern) {
64720             var patternElements = pattern.elements;
64721             var elementTypes = getTypeArguments(type).slice();
64722             var elementFlags = type.target.elementFlags.slice();
64723             for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) {
64724                 var e = patternElements[i];
64725                 if (i < patternElements.length - 1 || !(e.kind === 202 && e.dotDotDotToken)) {
64726                     elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, false, false) : anyType);
64727                     elementFlags.push(2);
64728                     if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) {
64729                         reportImplicitAny(e, anyType);
64730                     }
64731                 }
64732             }
64733             return createTupleType(elementTypes, elementFlags, type.target.readonly);
64734         }
64735         function widenTypeInferredFromInitializer(declaration, type) {
64736             var widened = ts.getCombinedNodeFlags(declaration) & 2 || ts.isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type);
64737             if (ts.isInJSFile(declaration)) {
64738                 if (isEmptyLiteralType(widened)) {
64739                     reportImplicitAny(declaration, anyType);
64740                     return anyType;
64741                 }
64742                 else if (isEmptyArrayLiteralType(widened)) {
64743                     reportImplicitAny(declaration, anyArrayType);
64744                     return anyArrayType;
64745                 }
64746             }
64747             return widened;
64748         }
64749         function isLiteralOfContextualType(candidateType, contextualType) {
64750             if (contextualType) {
64751                 if (contextualType.flags & 3145728) {
64752                     var types = contextualType.types;
64753                     return ts.some(types, function (t) { return isLiteralOfContextualType(candidateType, t); });
64754                 }
64755                 if (contextualType.flags & 58982400) {
64756                     var constraint = getBaseConstraintOfType(contextualType) || unknownType;
64757                     return maybeTypeOfKind(constraint, 4) && maybeTypeOfKind(candidateType, 128) ||
64758                         maybeTypeOfKind(constraint, 8) && maybeTypeOfKind(candidateType, 256) ||
64759                         maybeTypeOfKind(constraint, 64) && maybeTypeOfKind(candidateType, 2048) ||
64760                         maybeTypeOfKind(constraint, 4096) && maybeTypeOfKind(candidateType, 8192) ||
64761                         isLiteralOfContextualType(candidateType, constraint);
64762                 }
64763                 return !!(contextualType.flags & (128 | 4194304 | 134217728 | 268435456) && maybeTypeOfKind(candidateType, 128) ||
64764                     contextualType.flags & 256 && maybeTypeOfKind(candidateType, 256) ||
64765                     contextualType.flags & 2048 && maybeTypeOfKind(candidateType, 2048) ||
64766                     contextualType.flags & 512 && maybeTypeOfKind(candidateType, 512) ||
64767                     contextualType.flags & 8192 && maybeTypeOfKind(candidateType, 8192));
64768             }
64769             return false;
64770         }
64771         function isConstContext(node) {
64772             var parent = node.parent;
64773             return ts.isAssertionExpression(parent) && ts.isConstTypeReference(parent.type) ||
64774                 ts.isJSDocTypeAssertion(parent) && ts.isConstTypeReference(ts.getJSDocTypeAssertionType(parent)) ||
64775                 (ts.isParenthesizedExpression(parent) || ts.isArrayLiteralExpression(parent) || ts.isSpreadElement(parent)) && isConstContext(parent) ||
64776                 (ts.isPropertyAssignment(parent) || ts.isShorthandPropertyAssignment(parent) || ts.isTemplateSpan(parent)) && isConstContext(parent.parent);
64777         }
64778         function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) {
64779             var type = checkExpression(node, checkMode, forceTuple);
64780             return isConstContext(node) ? getRegularTypeOfLiteralType(type) :
64781                 isTypeAssertion(node) ? type :
64782                     getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
64783         }
64784         function checkPropertyAssignment(node, checkMode) {
64785             if (node.name.kind === 161) {
64786                 checkComputedPropertyName(node.name);
64787             }
64788             return checkExpressionForMutableLocation(node.initializer, checkMode);
64789         }
64790         function checkObjectLiteralMethod(node, checkMode) {
64791             checkGrammarMethod(node);
64792             if (node.name.kind === 161) {
64793                 checkComputedPropertyName(node.name);
64794             }
64795             var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
64796             return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode);
64797         }
64798         function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
64799             if (checkMode && checkMode & (2 | 8)) {
64800                 var callSignature = getSingleSignature(type, 0, true);
64801                 var constructSignature = getSingleSignature(type, 1, true);
64802                 var signature = callSignature || constructSignature;
64803                 if (signature && signature.typeParameters) {
64804                     var contextualType = getApparentTypeOfContextualType(node, 2);
64805                     if (contextualType) {
64806                         var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 : 1, false);
64807                         if (contextualSignature && !contextualSignature.typeParameters) {
64808                             if (checkMode & 8) {
64809                                 skippedGenericFunction(node, checkMode);
64810                                 return anyFunctionType;
64811                             }
64812                             var context = getInferenceContext(node);
64813                             var returnType = context.signature && getReturnTypeOfSignature(context.signature);
64814                             var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
64815                             if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
64816                                 var uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
64817                                 var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters);
64818                                 var inferences_3 = ts.map(context.inferences, function (info) { return createInferenceInfo(info.typeParameter); });
64819                                 applyToParameterTypes(instantiatedSignature, contextualSignature, function (source, target) {
64820                                     inferTypes(inferences_3, source, target, 0, true);
64821                                 });
64822                                 if (ts.some(inferences_3, hasInferenceCandidates)) {
64823                                     applyToReturnTypes(instantiatedSignature, contextualSignature, function (source, target) {
64824                                         inferTypes(inferences_3, source, target);
64825                                     });
64826                                     if (!hasOverlappingInferences(context.inferences, inferences_3)) {
64827                                         mergeInferences(context.inferences, inferences_3);
64828                                         context.inferredTypeParameters = ts.concatenate(context.inferredTypeParameters, uniqueTypeParameters);
64829                                         return getOrCreateTypeFromSignature(instantiatedSignature);
64830                                     }
64831                                 }
64832                             }
64833                             return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
64834                         }
64835                     }
64836                 }
64837             }
64838             return type;
64839         }
64840         function skippedGenericFunction(node, checkMode) {
64841             if (checkMode & 2) {
64842                 var context = getInferenceContext(node);
64843                 context.flags |= 4;
64844             }
64845         }
64846         function hasInferenceCandidates(info) {
64847             return !!(info.candidates || info.contraCandidates);
64848         }
64849         function hasOverlappingInferences(a, b) {
64850             for (var i = 0; i < a.length; i++) {
64851                 if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
64852                     return true;
64853                 }
64854             }
64855             return false;
64856         }
64857         function mergeInferences(target, source) {
64858             for (var i = 0; i < target.length; i++) {
64859                 if (!hasInferenceCandidates(target[i]) && hasInferenceCandidates(source[i])) {
64860                     target[i] = source[i];
64861                 }
64862             }
64863         }
64864         function getUniqueTypeParameters(context, typeParameters) {
64865             var result = [];
64866             var oldTypeParameters;
64867             var newTypeParameters;
64868             for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
64869                 var tp = typeParameters_2[_i];
64870                 var name = tp.symbol.escapedName;
64871                 if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
64872                     var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
64873                     var symbol = createSymbol(262144, newName);
64874                     var newTypeParameter = createTypeParameter(symbol);
64875                     newTypeParameter.target = tp;
64876                     oldTypeParameters = ts.append(oldTypeParameters, tp);
64877                     newTypeParameters = ts.append(newTypeParameters, newTypeParameter);
64878                     result.push(newTypeParameter);
64879                 }
64880                 else {
64881                     result.push(tp);
64882                 }
64883             }
64884             if (newTypeParameters) {
64885                 var mapper = createTypeMapper(oldTypeParameters, newTypeParameters);
64886                 for (var _a = 0, newTypeParameters_1 = newTypeParameters; _a < newTypeParameters_1.length; _a++) {
64887                     var tp = newTypeParameters_1[_a];
64888                     tp.mapper = mapper;
64889                 }
64890             }
64891             return result;
64892         }
64893         function hasTypeParameterByName(typeParameters, name) {
64894             return ts.some(typeParameters, function (tp) { return tp.symbol.escapedName === name; });
64895         }
64896         function getUniqueTypeParameterName(typeParameters, baseName) {
64897             var len = baseName.length;
64898             while (len > 1 && baseName.charCodeAt(len - 1) >= 48 && baseName.charCodeAt(len - 1) <= 57)
64899                 len--;
64900             var s = baseName.slice(0, len);
64901             for (var index = 1; true; index++) {
64902                 var augmentedName = s + index;
64903                 if (!hasTypeParameterByName(typeParameters, augmentedName)) {
64904                     return augmentedName;
64905                 }
64906             }
64907         }
64908         function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
64909             var signature = getSingleCallSignature(funcType);
64910             if (signature && !signature.typeParameters) {
64911                 return getReturnTypeOfSignature(signature);
64912             }
64913         }
64914         function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
64915             var funcType = checkExpression(expr.expression);
64916             var nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
64917             var returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
64918             return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
64919         }
64920         function getTypeOfExpression(node) {
64921             var quickType = getQuickTypeOfExpression(node);
64922             if (quickType) {
64923                 return quickType;
64924             }
64925             if (node.flags & 67108864 && flowTypeCache) {
64926                 var cachedType = flowTypeCache[getNodeId(node)];
64927                 if (cachedType) {
64928                     return cachedType;
64929                 }
64930             }
64931             var startInvocationCount = flowInvocationCount;
64932             var type = checkExpression(node);
64933             if (flowInvocationCount !== startInvocationCount) {
64934                 var cache = flowTypeCache || (flowTypeCache = []);
64935                 cache[getNodeId(node)] = type;
64936                 ts.setNodeFlags(node, node.flags | 67108864);
64937             }
64938             return type;
64939         }
64940         function getQuickTypeOfExpression(node) {
64941             var expr = ts.skipParentheses(node, true);
64942             if (ts.isJSDocTypeAssertion(expr)) {
64943                 var type = ts.getJSDocTypeAssertionType(expr);
64944                 if (!ts.isConstTypeReference(type)) {
64945                     return getTypeFromTypeNode(type);
64946                 }
64947             }
64948             expr = ts.skipParentheses(node);
64949             if (ts.isCallExpression(expr) && expr.expression.kind !== 106 && !ts.isRequireCall(expr, true) && !isSymbolOrSymbolForCall(expr)) {
64950                 var type = ts.isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) :
64951                     getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
64952                 if (type) {
64953                     return type;
64954                 }
64955             }
64956             else if (ts.isAssertionExpression(expr) && !ts.isConstTypeReference(expr.type)) {
64957                 return getTypeFromTypeNode(expr.type);
64958             }
64959             else if (node.kind === 8 || node.kind === 10 ||
64960                 node.kind === 110 || node.kind === 95) {
64961                 return checkExpression(node);
64962             }
64963             return undefined;
64964         }
64965         function getContextFreeTypeOfExpression(node) {
64966             var links = getNodeLinks(node);
64967             if (links.contextFreeType) {
64968                 return links.contextFreeType;
64969             }
64970             var saveContextualType = node.contextualType;
64971             node.contextualType = anyType;
64972             try {
64973                 var type = links.contextFreeType = checkExpression(node, 4);
64974                 return type;
64975             }
64976             finally {
64977                 node.contextualType = saveContextualType;
64978             }
64979         }
64980         function checkExpression(node, checkMode, forceTuple) {
64981             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
64982             var saveCurrentNode = currentNode;
64983             currentNode = node;
64984             instantiationCount = 0;
64985             var uninstantiatedType = checkExpressionWorker(node, checkMode, forceTuple);
64986             var type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode);
64987             if (isConstEnumObjectType(type)) {
64988                 checkConstEnumAccess(node, type);
64989             }
64990             currentNode = saveCurrentNode;
64991             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
64992             return type;
64993         }
64994         function checkConstEnumAccess(node, type) {
64995             var ok = (node.parent.kind === 205 && node.parent.expression === node) ||
64996                 (node.parent.kind === 206 && node.parent.expression === node) ||
64997                 ((node.kind === 79 || node.kind === 160) && isInRightSideOfImportOrExportAssignment(node) ||
64998                     (node.parent.kind === 180 && node.parent.exprName === node)) ||
64999                 (node.parent.kind === 274);
65000             if (!ok) {
65001                 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_or_type_query);
65002             }
65003             if (compilerOptions.isolatedModules) {
65004                 ts.Debug.assert(!!(type.symbol.flags & 128));
65005                 var constEnumDeclaration = type.symbol.valueDeclaration;
65006                 if (constEnumDeclaration.flags & 8388608) {
65007                     error(node, ts.Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided);
65008                 }
65009             }
65010         }
65011         function checkParenthesizedExpression(node, checkMode) {
65012             if (ts.hasJSDocNodes(node) && ts.isJSDocTypeAssertion(node)) {
65013                 var type = ts.getJSDocTypeAssertionType(node);
65014                 return checkAssertionWorker(type, type, node.expression, checkMode);
65015             }
65016             return checkExpression(node.expression, checkMode);
65017         }
65018         function checkExpressionWorker(node, checkMode, forceTuple) {
65019             var kind = node.kind;
65020             if (cancellationToken) {
65021                 switch (kind) {
65022                     case 225:
65023                     case 212:
65024                     case 213:
65025                         cancellationToken.throwIfCancellationRequested();
65026                 }
65027             }
65028             switch (kind) {
65029                 case 79:
65030                     return checkIdentifier(node, checkMode);
65031                 case 80:
65032                     return checkPrivateIdentifierExpression(node);
65033                 case 108:
65034                     return checkThisExpression(node);
65035                 case 106:
65036                     return checkSuperExpression(node);
65037                 case 104:
65038                     return nullWideningType;
65039                 case 14:
65040                 case 10:
65041                     return getFreshTypeOfLiteralType(getStringLiteralType(node.text));
65042                 case 8:
65043                     checkGrammarNumericLiteral(node);
65044                     return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
65045                 case 9:
65046                     checkGrammarBigIntLiteral(node);
65047                     return getFreshTypeOfLiteralType(getBigIntLiteralType({
65048                         negative: false,
65049                         base10Value: ts.parsePseudoBigInt(node.text)
65050                     }));
65051                 case 110:
65052                     return trueType;
65053                 case 95:
65054                     return falseType;
65055                 case 222:
65056                     return checkTemplateExpression(node);
65057                 case 13:
65058                     return globalRegExpType;
65059                 case 203:
65060                     return checkArrayLiteral(node, checkMode, forceTuple);
65061                 case 204:
65062                     return checkObjectLiteral(node, checkMode);
65063                 case 205:
65064                     return checkPropertyAccessExpression(node, checkMode);
65065                 case 160:
65066                     return checkQualifiedName(node, checkMode);
65067                 case 206:
65068                     return checkIndexedAccess(node, checkMode);
65069                 case 207:
65070                     if (node.expression.kind === 100) {
65071                         return checkImportCallExpression(node);
65072                     }
65073                 case 208:
65074                     return checkCallExpression(node, checkMode);
65075                 case 209:
65076                     return checkTaggedTemplateExpression(node);
65077                 case 211:
65078                     return checkParenthesizedExpression(node, checkMode);
65079                 case 225:
65080                     return checkClassExpression(node);
65081                 case 212:
65082                 case 213:
65083                     return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
65084                 case 215:
65085                     return checkTypeOfExpression(node);
65086                 case 210:
65087                 case 228:
65088                     return checkAssertion(node);
65089                 case 229:
65090                     return checkNonNullAssertion(node);
65091                 case 230:
65092                     return checkMetaProperty(node);
65093                 case 214:
65094                     return checkDeleteExpression(node);
65095                 case 216:
65096                     return checkVoidExpression(node);
65097                 case 217:
65098                     return checkAwaitExpression(node);
65099                 case 218:
65100                     return checkPrefixUnaryExpression(node);
65101                 case 219:
65102                     return checkPostfixUnaryExpression(node);
65103                 case 220:
65104                     return checkBinaryExpression(node, checkMode);
65105                 case 221:
65106                     return checkConditionalExpression(node, checkMode);
65107                 case 224:
65108                     return checkSpreadExpression(node, checkMode);
65109                 case 226:
65110                     return undefinedWideningType;
65111                 case 223:
65112                     return checkYieldExpression(node);
65113                 case 231:
65114                     return checkSyntheticExpression(node);
65115                 case 287:
65116                     return checkJsxExpression(node, checkMode);
65117                 case 277:
65118                     return checkJsxElement(node, checkMode);
65119                 case 278:
65120                     return checkJsxSelfClosingElement(node, checkMode);
65121                 case 281:
65122                     return checkJsxFragment(node);
65123                 case 285:
65124                     return checkJsxAttributes(node, checkMode);
65125                 case 279:
65126                     ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
65127             }
65128             return errorType;
65129         }
65130         function checkTypeParameter(node) {
65131             if (node.expression) {
65132                 grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);
65133             }
65134             checkSourceElement(node.constraint);
65135             checkSourceElement(node.default);
65136             var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
65137             getBaseConstraintOfType(typeParameter);
65138             if (!hasNonCircularTypeParameterDefault(typeParameter)) {
65139                 error(node.default, ts.Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
65140             }
65141             var constraintType = getConstraintOfTypeParameter(typeParameter);
65142             var defaultType = getDefaultFromTypeParameter(typeParameter);
65143             if (constraintType && defaultType) {
65144                 checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
65145             }
65146             if (produceDiagnostics) {
65147                 checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
65148             }
65149         }
65150         function checkParameter(node) {
65151             checkGrammarDecoratorsAndModifiers(node);
65152             checkVariableLikeDeclaration(node);
65153             var func = ts.getContainingFunction(node);
65154             if (ts.hasSyntacticModifier(node, 16476)) {
65155                 if (!(func.kind === 170 && ts.nodeIsPresent(func.body))) {
65156                     error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
65157                 }
65158                 if (func.kind === 170 && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") {
65159                     error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
65160                 }
65161             }
65162             if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
65163                 error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
65164             }
65165             if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
65166                 if (func.parameters.indexOf(node) !== 0) {
65167                     error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
65168                 }
65169                 if (func.kind === 170 || func.kind === 174 || func.kind === 179) {
65170                     error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
65171                 }
65172                 if (func.kind === 213) {
65173                     error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
65174                 }
65175                 if (func.kind === 171 || func.kind === 172) {
65176                     error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters);
65177                 }
65178             }
65179             if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) {
65180                 error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type);
65181             }
65182         }
65183         function checkTypePredicate(node) {
65184             var parent = getTypePredicateParent(node);
65185             if (!parent) {
65186                 error(node, ts.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
65187                 return;
65188             }
65189             var signature = getSignatureFromDeclaration(parent);
65190             var typePredicate = getTypePredicateOfSignature(signature);
65191             if (!typePredicate) {
65192                 return;
65193             }
65194             checkSourceElement(node.type);
65195             var parameterName = node.parameterName;
65196             if (typePredicate.kind === 0 || typePredicate.kind === 2) {
65197                 getTypeFromThisTypeNode(parameterName);
65198             }
65199             else {
65200                 if (typePredicate.parameterIndex >= 0) {
65201                     if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
65202                         error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
65203                     }
65204                     else {
65205                         if (typePredicate.type) {
65206                             var leadingError = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); };
65207                             checkTypeAssignableTo(typePredicate.type, getTypeOfSymbol(signature.parameters[typePredicate.parameterIndex]), node.type, undefined, leadingError);
65208                         }
65209                     }
65210                 }
65211                 else if (parameterName) {
65212                     var hasReportedError = false;
65213                     for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) {
65214                         var name = _a[_i].name;
65215                         if (ts.isBindingPattern(name) &&
65216                             checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) {
65217                             hasReportedError = true;
65218                             break;
65219                         }
65220                     }
65221                     if (!hasReportedError) {
65222                         error(node.parameterName, ts.Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName);
65223                     }
65224                 }
65225             }
65226         }
65227         function getTypePredicateParent(node) {
65228             switch (node.parent.kind) {
65229                 case 213:
65230                 case 173:
65231                 case 255:
65232                 case 212:
65233                 case 178:
65234                 case 168:
65235                 case 167:
65236                     var parent = node.parent;
65237                     if (node === parent.type) {
65238                         return parent;
65239                     }
65240             }
65241         }
65242         function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) {
65243             for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
65244                 var element = _a[_i];
65245                 if (ts.isOmittedExpression(element)) {
65246                     continue;
65247                 }
65248                 var name = element.name;
65249                 if (name.kind === 79 && name.escapedText === predicateVariableName) {
65250                     error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
65251                     return true;
65252                 }
65253                 else if (name.kind === 201 || name.kind === 200) {
65254                     if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
65255                         return true;
65256                     }
65257                 }
65258             }
65259         }
65260         function checkSignatureDeclaration(node) {
65261             if (node.kind === 175) {
65262                 checkGrammarIndexSignature(node);
65263             }
65264             else if (node.kind === 178 || node.kind === 255 || node.kind === 179 ||
65265                 node.kind === 173 || node.kind === 170 ||
65266                 node.kind === 174) {
65267                 checkGrammarFunctionLikeDeclaration(node);
65268             }
65269             var functionFlags = ts.getFunctionFlags(node);
65270             if (!(functionFlags & 4)) {
65271                 if ((functionFlags & 3) === 3 && languageVersion < 99) {
65272                     checkExternalEmitHelpers(node, 6144);
65273                 }
65274                 if ((functionFlags & 3) === 2 && languageVersion < 4) {
65275                     checkExternalEmitHelpers(node, 64);
65276                 }
65277                 if ((functionFlags & 3) !== 0 && languageVersion < 2) {
65278                     checkExternalEmitHelpers(node, 128);
65279                 }
65280             }
65281             checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
65282             ts.forEach(node.parameters, checkParameter);
65283             if (node.type) {
65284                 checkSourceElement(node.type);
65285             }
65286             if (produceDiagnostics) {
65287                 checkCollisionWithArgumentsInGeneratedCode(node);
65288                 var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
65289                 if (noImplicitAny && !returnTypeNode) {
65290                     switch (node.kind) {
65291                         case 174:
65292                             error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
65293                             break;
65294                         case 173:
65295                             error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
65296                             break;
65297                     }
65298                 }
65299                 if (returnTypeNode) {
65300                     var functionFlags_1 = ts.getFunctionFlags(node);
65301                     if ((functionFlags_1 & (4 | 1)) === 1) {
65302                         var returnType = getTypeFromTypeNode(returnTypeNode);
65303                         if (returnType === voidType) {
65304                             error(returnTypeNode, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation);
65305                         }
65306                         else {
65307                             var generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0, returnType, (functionFlags_1 & 2) !== 0) || anyType;
65308                             var generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, (functionFlags_1 & 2) !== 0) || generatorYieldType;
65309                             var generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2, returnType, (functionFlags_1 & 2) !== 0) || unknownType;
65310                             var generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags_1 & 2));
65311                             checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
65312                         }
65313                     }
65314                     else if ((functionFlags_1 & 3) === 2) {
65315                         checkAsyncFunctionReturnType(node, returnTypeNode);
65316                     }
65317                 }
65318                 if (node.kind !== 175 && node.kind !== 315) {
65319                     registerForUnusedIdentifiersCheck(node);
65320                 }
65321             }
65322         }
65323         function checkClassForDuplicateDeclarations(node) {
65324             var instanceNames = new ts.Map();
65325             var staticNames = new ts.Map();
65326             var privateIdentifiers = new ts.Map();
65327             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
65328                 var member = _a[_i];
65329                 if (member.kind === 170) {
65330                     for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
65331                         var param = _c[_b];
65332                         if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) {
65333                             addName(instanceNames, param.name, param.name.escapedText, 3);
65334                         }
65335                     }
65336                 }
65337                 else {
65338                     var isStaticMember = ts.isStatic(member);
65339                     var name = member.name;
65340                     if (!name) {
65341                         continue;
65342                     }
65343                     var isPrivate = ts.isPrivateIdentifier(name);
65344                     var privateStaticFlags = isPrivate && isStaticMember ? 16 : 0;
65345                     var names = isPrivate ? privateIdentifiers :
65346                         isStaticMember ? staticNames :
65347                             instanceNames;
65348                     var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
65349                     if (memberName) {
65350                         switch (member.kind) {
65351                             case 171:
65352                                 addName(names, name, memberName, 1 | privateStaticFlags);
65353                                 break;
65354                             case 172:
65355                                 addName(names, name, memberName, 2 | privateStaticFlags);
65356                                 break;
65357                             case 166:
65358                                 addName(names, name, memberName, 3 | privateStaticFlags);
65359                                 break;
65360                             case 168:
65361                                 addName(names, name, memberName, 8 | privateStaticFlags);
65362                                 break;
65363                         }
65364                     }
65365                 }
65366             }
65367             function addName(names, location, name, meaning) {
65368                 var prev = names.get(name);
65369                 if (prev) {
65370                     if ((prev & 16) !== (meaning & 16)) {
65371                         error(location, ts.Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, ts.getTextOfNode(location));
65372                     }
65373                     else {
65374                         var prevIsMethod = !!(prev & 8);
65375                         var isMethod = !!(meaning & 8);
65376                         if (prevIsMethod || isMethod) {
65377                             if (prevIsMethod !== isMethod) {
65378                                 error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
65379                             }
65380                         }
65381                         else if (prev & meaning & ~16) {
65382                             error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location));
65383                         }
65384                         else {
65385                             names.set(name, prev | meaning);
65386                         }
65387                     }
65388                 }
65389                 else {
65390                     names.set(name, meaning);
65391                 }
65392             }
65393         }
65394         function checkClassForStaticPropertyNameConflicts(node) {
65395             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
65396                 var member = _a[_i];
65397                 var memberNameNode = member.name;
65398                 var isStaticMember = ts.isStatic(member);
65399                 if (isStaticMember && memberNameNode) {
65400                     var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode);
65401                     switch (memberName) {
65402                         case "name":
65403                         case "length":
65404                         case "caller":
65405                         case "arguments":
65406                         case "prototype":
65407                             var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
65408                             var className = getNameOfSymbolAsWritten(getSymbolOfNode(node));
65409                             error(memberNameNode, message, memberName, className);
65410                             break;
65411                     }
65412                 }
65413             }
65414         }
65415         function checkObjectTypeForDuplicateDeclarations(node) {
65416             var names = new ts.Map();
65417             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
65418                 var member = _a[_i];
65419                 if (member.kind === 165) {
65420                     var memberName = void 0;
65421                     var name = member.name;
65422                     switch (name.kind) {
65423                         case 10:
65424                         case 8:
65425                             memberName = name.text;
65426                             break;
65427                         case 79:
65428                             memberName = ts.idText(name);
65429                             break;
65430                         default:
65431                             continue;
65432                     }
65433                     if (names.get(memberName)) {
65434                         error(ts.getNameOfDeclaration(member.symbol.valueDeclaration), ts.Diagnostics.Duplicate_identifier_0, memberName);
65435                         error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName);
65436                     }
65437                     else {
65438                         names.set(memberName, true);
65439                     }
65440                 }
65441             }
65442         }
65443         function checkTypeForDuplicateIndexSignatures(node) {
65444             if (node.kind === 257) {
65445                 var nodeSymbol = getSymbolOfNode(node);
65446                 if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {
65447                     return;
65448                 }
65449             }
65450             var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
65451             if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
65452                 var indexSignatureMap_1 = new ts.Map();
65453                 var _loop_26 = function (declaration) {
65454                     if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
65455                         forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
65456                             var entry = indexSignatureMap_1.get(getTypeId(type));
65457                             if (entry) {
65458                                 entry.declarations.push(declaration);
65459                             }
65460                             else {
65461                                 indexSignatureMap_1.set(getTypeId(type), { type: type, declarations: [declaration] });
65462                             }
65463                         });
65464                     }
65465                 };
65466                 for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
65467                     var declaration = _a[_i];
65468                     _loop_26(declaration);
65469                 }
65470                 indexSignatureMap_1.forEach(function (entry) {
65471                     if (entry.declarations.length > 1) {
65472                         for (var _i = 0, _a = entry.declarations; _i < _a.length; _i++) {
65473                             var declaration = _a[_i];
65474                             error(declaration, ts.Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type));
65475                         }
65476                     }
65477                 });
65478             }
65479         }
65480         function checkPropertyDeclaration(node) {
65481             if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarProperty(node))
65482                 checkGrammarComputedPropertyName(node.name);
65483             checkVariableLikeDeclaration(node);
65484             setNodeLinksForPrivateIdentifierScope(node);
65485             if (ts.isPrivateIdentifier(node.name) && ts.hasStaticModifier(node) && node.initializer && languageVersion === 99 && !compilerOptions.useDefineForClassFields) {
65486                 error(node.initializer, ts.Diagnostics.Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag);
65487             }
65488             if (ts.hasSyntacticModifier(node, 128) && node.kind === 166 && node.initializer) {
65489                 error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
65490             }
65491         }
65492         function checkPropertySignature(node) {
65493             if (ts.isPrivateIdentifier(node.name)) {
65494                 error(node, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
65495             }
65496             return checkPropertyDeclaration(node);
65497         }
65498         function checkMethodDeclaration(node) {
65499             if (!checkGrammarMethod(node))
65500                 checkGrammarComputedPropertyName(node.name);
65501             checkFunctionOrMethodDeclaration(node);
65502             if (ts.hasSyntacticModifier(node, 128) && node.kind === 168 && node.body) {
65503                 error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
65504             }
65505             if (ts.isPrivateIdentifier(node.name) && !ts.getContainingClass(node)) {
65506                 error(node, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
65507             }
65508             setNodeLinksForPrivateIdentifierScope(node);
65509         }
65510         function setNodeLinksForPrivateIdentifierScope(node) {
65511             if (ts.isPrivateIdentifier(node.name) && languageVersion < 99) {
65512                 for (var lexicalScope = ts.getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = ts.getEnclosingBlockScopeContainer(lexicalScope)) {
65513                     getNodeLinks(lexicalScope).flags |= 67108864;
65514                 }
65515                 if (ts.isClassExpression(node.parent)) {
65516                     var enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
65517                     if (enclosingIterationStatement) {
65518                         getNodeLinks(node.name).flags |= 524288;
65519                         getNodeLinks(enclosingIterationStatement).flags |= 65536;
65520                     }
65521                 }
65522             }
65523         }
65524         function checkClassStaticBlockDeclaration(node) {
65525             checkGrammarDecoratorsAndModifiers(node);
65526             ts.forEachChild(node, checkSourceElement);
65527         }
65528         function checkConstructorDeclaration(node) {
65529             checkSignatureDeclaration(node);
65530             if (!checkGrammarConstructorTypeParameters(node))
65531                 checkGrammarConstructorTypeAnnotation(node);
65532             checkSourceElement(node.body);
65533             var symbol = getSymbolOfNode(node);
65534             var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind);
65535             if (node === firstDeclaration) {
65536                 checkFunctionOrConstructorSymbol(symbol);
65537             }
65538             if (ts.nodeIsMissing(node.body)) {
65539                 return;
65540             }
65541             if (!produceDiagnostics) {
65542                 return;
65543             }
65544             function isInstancePropertyWithInitializerOrPrivateIdentifierProperty(n) {
65545                 if (ts.isPrivateIdentifierClassElementDeclaration(n)) {
65546                     return true;
65547                 }
65548                 return n.kind === 166 &&
65549                     !ts.isStatic(n) &&
65550                     !!n.initializer;
65551             }
65552             var containingClassDecl = node.parent;
65553             if (ts.getClassExtendsHeritageElement(containingClassDecl)) {
65554                 captureLexicalThis(node.parent, containingClassDecl);
65555                 var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
65556                 var superCall = findFirstSuperCall(node.body);
65557                 if (superCall) {
65558                     if (classExtendsNull) {
65559                         error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
65560                     }
65561                     var superCallShouldBeFirst = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
65562                         (ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
65563                             ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
65564                     if (superCallShouldBeFirst) {
65565                         var statements = node.body.statements;
65566                         var superCallStatement = void 0;
65567                         for (var _i = 0, statements_4 = statements; _i < statements_4.length; _i++) {
65568                             var statement = statements_4[_i];
65569                             if (statement.kind === 237 && ts.isSuperCall(statement.expression)) {
65570                                 superCallStatement = statement;
65571                                 break;
65572                             }
65573                             if (!ts.isPrologueDirective(statement)) {
65574                                 break;
65575                             }
65576                         }
65577                         if (!superCallStatement) {
65578                             error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
65579                         }
65580                     }
65581                 }
65582                 else if (!classExtendsNull) {
65583                     error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
65584                 }
65585             }
65586         }
65587         function checkAccessorDeclaration(node) {
65588             if (produceDiagnostics) {
65589                 if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node))
65590                     checkGrammarComputedPropertyName(node.name);
65591                 checkDecorators(node);
65592                 checkSignatureDeclaration(node);
65593                 if (node.kind === 171) {
65594                     if (!(node.flags & 8388608) && ts.nodeIsPresent(node.body) && (node.flags & 256)) {
65595                         if (!(node.flags & 512)) {
65596                             error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
65597                         }
65598                     }
65599                 }
65600                 if (node.name.kind === 161) {
65601                     checkComputedPropertyName(node.name);
65602                 }
65603                 if (hasBindableName(node)) {
65604                     var symbol = getSymbolOfNode(node);
65605                     var getter = ts.getDeclarationOfKind(symbol, 171);
65606                     var setter = ts.getDeclarationOfKind(symbol, 172);
65607                     if (getter && setter && !(getNodeCheckFlags(getter) & 1)) {
65608                         getNodeLinks(getter).flags |= 1;
65609                         var getterFlags = ts.getEffectiveModifierFlags(getter);
65610                         var setterFlags = ts.getEffectiveModifierFlags(setter);
65611                         if ((getterFlags & 128) !== (setterFlags & 128)) {
65612                             error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
65613                             error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
65614                         }
65615                         if (((getterFlags & 16) && !(setterFlags & (16 | 8))) ||
65616                             ((getterFlags & 8) && !(setterFlags & 8))) {
65617                             error(getter.name, ts.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
65618                             error(setter.name, ts.Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
65619                         }
65620                         var getterType = getAnnotatedAccessorType(getter);
65621                         var setterType = getAnnotatedAccessorType(setter);
65622                         if (getterType && setterType) {
65623                             checkTypeAssignableTo(getterType, setterType, getter, ts.Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
65624                         }
65625                     }
65626                 }
65627                 var returnType = getTypeOfAccessors(getSymbolOfNode(node));
65628                 if (node.kind === 171) {
65629                     checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
65630                 }
65631             }
65632             checkSourceElement(node.body);
65633             setNodeLinksForPrivateIdentifierScope(node);
65634         }
65635         function checkMissingDeclaration(node) {
65636             checkDecorators(node);
65637         }
65638         function getEffectiveTypeArguments(node, typeParameters) {
65639             return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
65640         }
65641         function checkTypeArgumentConstraints(node, typeParameters) {
65642             var typeArguments;
65643             var mapper;
65644             var result = true;
65645             for (var i = 0; i < typeParameters.length; i++) {
65646                 var constraint = getConstraintOfTypeParameter(typeParameters[i]);
65647                 if (constraint) {
65648                     if (!typeArguments) {
65649                         typeArguments = getEffectiveTypeArguments(node, typeParameters);
65650                         mapper = createTypeMapper(typeParameters, typeArguments);
65651                     }
65652                     result = result && checkTypeAssignableTo(typeArguments[i], instantiateType(constraint, mapper), node.typeArguments[i], ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
65653                 }
65654             }
65655             return result;
65656         }
65657         function getTypeParametersForTypeReference(node) {
65658             var type = getTypeFromTypeReference(node);
65659             if (!isErrorType(type)) {
65660                 var symbol = getNodeLinks(node).resolvedSymbol;
65661                 if (symbol) {
65662                     return symbol.flags & 524288 && getSymbolLinks(symbol).typeParameters ||
65663                         (ts.getObjectFlags(type) & 4 ? type.target.localTypeParameters : undefined);
65664                 }
65665             }
65666             return undefined;
65667         }
65668         function checkTypeReferenceNode(node) {
65669             checkGrammarTypeArguments(node, node.typeArguments);
65670             if (node.kind === 177 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
65671                 grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
65672             }
65673             ts.forEach(node.typeArguments, checkSourceElement);
65674             var type = getTypeFromTypeReference(node);
65675             if (!isErrorType(type)) {
65676                 if (node.typeArguments && produceDiagnostics) {
65677                     var typeParameters = getTypeParametersForTypeReference(node);
65678                     if (typeParameters) {
65679                         checkTypeArgumentConstraints(node, typeParameters);
65680                     }
65681                 }
65682                 var symbol = getNodeLinks(node).resolvedSymbol;
65683                 if (symbol) {
65684                     if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 134217728); })) {
65685                         addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
65686                     }
65687                     if (type.flags & 32 && symbol.flags & 8) {
65688                         error(node, ts.Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
65689                     }
65690                 }
65691             }
65692         }
65693         function getTypeArgumentConstraint(node) {
65694             var typeReferenceNode = ts.tryCast(node.parent, ts.isTypeReferenceType);
65695             if (!typeReferenceNode)
65696                 return undefined;
65697             var typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
65698             if (!typeParameters)
65699                 return undefined;
65700             var constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
65701             return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
65702         }
65703         function checkTypeQuery(node) {
65704             getTypeFromTypeQueryNode(node);
65705         }
65706         function checkTypeLiteral(node) {
65707             ts.forEach(node.members, checkSourceElement);
65708             if (produceDiagnostics) {
65709                 var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
65710                 checkIndexConstraints(type, type.symbol);
65711                 checkTypeForDuplicateIndexSignatures(node);
65712                 checkObjectTypeForDuplicateDeclarations(node);
65713             }
65714         }
65715         function checkArrayType(node) {
65716             checkSourceElement(node.elementType);
65717         }
65718         function checkTupleType(node) {
65719             var elementTypes = node.elements;
65720             var seenOptionalElement = false;
65721             var seenRestElement = false;
65722             var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
65723             for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) {
65724                 var e = elementTypes_1[_i];
65725                 if (e.kind !== 196 && hasNamedElement) {
65726                     grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
65727                     break;
65728                 }
65729                 var flags = getTupleElementFlags(e);
65730                 if (flags & 8) {
65731                     var type = getTypeFromTypeNode(e.type);
65732                     if (!isArrayLikeType(type)) {
65733                         error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
65734                         break;
65735                     }
65736                     if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4) {
65737                         seenRestElement = true;
65738                     }
65739                 }
65740                 else if (flags & 4) {
65741                     if (seenRestElement) {
65742                         grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_cannot_follow_another_rest_element);
65743                         break;
65744                     }
65745                     seenRestElement = true;
65746                 }
65747                 else if (flags & 2) {
65748                     if (seenRestElement) {
65749                         grammarErrorOnNode(e, ts.Diagnostics.An_optional_element_cannot_follow_a_rest_element);
65750                         break;
65751                     }
65752                     seenOptionalElement = true;
65753                 }
65754                 else if (seenOptionalElement) {
65755                     grammarErrorOnNode(e, ts.Diagnostics.A_required_element_cannot_follow_an_optional_element);
65756                     break;
65757                 }
65758             }
65759             ts.forEach(node.elements, checkSourceElement);
65760             getTypeFromTypeNode(node);
65761         }
65762         function checkUnionOrIntersectionType(node) {
65763             ts.forEach(node.types, checkSourceElement);
65764             getTypeFromTypeNode(node);
65765         }
65766         function checkIndexedAccessIndexType(type, accessNode) {
65767             if (!(type.flags & 8388608)) {
65768                 return type;
65769             }
65770             var objectType = type.objectType;
65771             var indexType = type.indexType;
65772             if (isTypeAssignableTo(indexType, getIndexType(objectType, false))) {
65773                 if (accessNode.kind === 206 && ts.isAssignmentTarget(accessNode) &&
65774                     ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) {
65775                     error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
65776                 }
65777                 return type;
65778             }
65779             var apparentObjectType = getApparentType(objectType);
65780             if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296)) {
65781                 return type;
65782             }
65783             if (isGenericObjectType(objectType)) {
65784                 var propertyName_1 = getPropertyNameFromIndex(indexType, accessNode);
65785                 if (propertyName_1) {
65786                     var propertySymbol = forEachType(apparentObjectType, function (t) { return getPropertyOfType(t, propertyName_1); });
65787                     if (propertySymbol && ts.getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24) {
65788                         error(accessNode, ts.Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, ts.unescapeLeadingUnderscores(propertyName_1));
65789                         return errorType;
65790                     }
65791                 }
65792             }
65793             error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
65794             return errorType;
65795         }
65796         function checkIndexedAccessType(node) {
65797             checkSourceElement(node.objectType);
65798             checkSourceElement(node.indexType);
65799             checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node);
65800         }
65801         function checkMappedType(node) {
65802             checkGrammarMappedType(node);
65803             checkSourceElement(node.typeParameter);
65804             checkSourceElement(node.nameType);
65805             checkSourceElement(node.type);
65806             if (!node.type) {
65807                 reportImplicitAny(node, anyType);
65808             }
65809             var type = getTypeFromMappedTypeNode(node);
65810             var nameType = getNameTypeFromMappedType(type);
65811             if (nameType) {
65812                 checkTypeAssignableTo(nameType, keyofConstraintType, node.nameType);
65813             }
65814             else {
65815                 var constraintType = getConstraintTypeFromMappedType(type);
65816                 checkTypeAssignableTo(constraintType, keyofConstraintType, ts.getEffectiveConstraintOfTypeParameter(node.typeParameter));
65817             }
65818         }
65819         function checkGrammarMappedType(node) {
65820             var _a;
65821             if ((_a = node.members) === null || _a === void 0 ? void 0 : _a.length) {
65822                 return grammarErrorOnNode(node.members[0], ts.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);
65823             }
65824         }
65825         function checkThisType(node) {
65826             getTypeFromThisTypeNode(node);
65827         }
65828         function checkTypeOperator(node) {
65829             checkGrammarTypeOperatorNode(node);
65830             checkSourceElement(node.type);
65831         }
65832         function checkConditionalType(node) {
65833             ts.forEachChild(node, checkSourceElement);
65834         }
65835         function checkInferType(node) {
65836             if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 188 && n.parent.extendsType === n; })) {
65837                 grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
65838             }
65839             checkSourceElement(node.typeParameter);
65840             registerForUnusedIdentifiersCheck(node);
65841         }
65842         function checkTemplateLiteralType(node) {
65843             for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
65844                 var span = _a[_i];
65845                 checkSourceElement(span.type);
65846                 var type = getTypeFromTypeNode(span.type);
65847                 checkTypeAssignableTo(type, templateConstraintType, span.type);
65848             }
65849             getTypeFromTypeNode(node);
65850         }
65851         function checkImportType(node) {
65852             checkSourceElement(node.argument);
65853             getTypeFromTypeNode(node);
65854         }
65855         function checkNamedTupleMember(node) {
65856             if (node.dotDotDotToken && node.questionToken) {
65857                 grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest);
65858             }
65859             if (node.type.kind === 184) {
65860                 grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type);
65861             }
65862             if (node.type.kind === 185) {
65863                 grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type);
65864             }
65865             checkSourceElement(node.type);
65866             getTypeFromTypeNode(node);
65867         }
65868         function isPrivateWithinAmbient(node) {
65869             return (ts.hasEffectiveModifier(node, 8) || ts.isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 8388608);
65870         }
65871         function getEffectiveDeclarationFlags(n, flagsToCheck) {
65872             var flags = ts.getCombinedModifierFlags(n);
65873             if (n.parent.kind !== 257 &&
65874                 n.parent.kind !== 256 &&
65875                 n.parent.kind !== 225 &&
65876                 n.flags & 8388608) {
65877                 if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
65878                     flags |= 1;
65879                 }
65880                 flags |= 2;
65881             }
65882             return flags & flagsToCheck;
65883         }
65884         function checkFunctionOrConstructorSymbol(symbol) {
65885             if (!produceDiagnostics) {
65886                 return;
65887             }
65888             function getCanonicalOverload(overloads, implementation) {
65889                 var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
65890                 return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];
65891             }
65892             function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) {
65893                 var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
65894                 if (someButNotAllOverloadFlags !== 0) {
65895                     var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);
65896                     ts.forEach(overloads, function (o) {
65897                         var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1;
65898                         if (deviation & 1) {
65899                             error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
65900                         }
65901                         else if (deviation & 2) {
65902                             error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
65903                         }
65904                         else if (deviation & (8 | 16)) {
65905                             error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
65906                         }
65907                         else if (deviation & 128) {
65908                             error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
65909                         }
65910                     });
65911                 }
65912             }
65913             function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) {
65914                 if (someHaveQuestionToken !== allHaveQuestionToken) {
65915                     var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation));
65916                     ts.forEach(overloads, function (o) {
65917                         var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1;
65918                         if (deviation) {
65919                             error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required);
65920                         }
65921                     });
65922                 }
65923             }
65924             var flagsToCheck = 1 | 2 | 8 | 16 | 128;
65925             var someNodeFlags = 0;
65926             var allNodeFlags = flagsToCheck;
65927             var someHaveQuestionToken = false;
65928             var allHaveQuestionToken = true;
65929             var hasOverloads = false;
65930             var bodyDeclaration;
65931             var lastSeenNonAmbientDeclaration;
65932             var previousDeclaration;
65933             var declarations = symbol.declarations;
65934             var isConstructor = (symbol.flags & 16384) !== 0;
65935             function reportImplementationExpectedError(node) {
65936                 if (node.name && ts.nodeIsMissing(node.name)) {
65937                     return;
65938                 }
65939                 var seen = false;
65940                 var subsequentNode = ts.forEachChild(node.parent, function (c) {
65941                     if (seen) {
65942                         return c;
65943                     }
65944                     else {
65945                         seen = c === node;
65946                     }
65947                 });
65948                 if (subsequentNode && subsequentNode.pos === node.end) {
65949                     if (subsequentNode.kind === node.kind) {
65950                         var errorNode_1 = subsequentNode.name || subsequentNode;
65951                         var subsequentName = subsequentNode.name;
65952                         if (node.name && subsequentName && (ts.isPrivateIdentifier(node.name) && ts.isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText ||
65953                             ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
65954                             ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) &&
65955                                 ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
65956                             var reportError = (node.kind === 168 || node.kind === 167) &&
65957                                 ts.isStatic(node) !== ts.isStatic(subsequentNode);
65958                             if (reportError) {
65959                                 var diagnostic = ts.isStatic(node) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;
65960                                 error(errorNode_1, diagnostic);
65961                             }
65962                             return;
65963                         }
65964                         if (ts.nodeIsPresent(subsequentNode.body)) {
65965                             error(errorNode_1, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name));
65966                             return;
65967                         }
65968                     }
65969                 }
65970                 var errorNode = node.name || node;
65971                 if (isConstructor) {
65972                     error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing);
65973                 }
65974                 else {
65975                     if (ts.hasSyntacticModifier(node, 128)) {
65976                         error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive);
65977                     }
65978                     else {
65979                         error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration);
65980                     }
65981                 }
65982             }
65983             var duplicateFunctionDeclaration = false;
65984             var multipleConstructorImplementation = false;
65985             var hasNonAmbientClass = false;
65986             var functionDeclarations = [];
65987             if (declarations) {
65988                 for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
65989                     var current = declarations_4[_i];
65990                     var node = current;
65991                     var inAmbientContext = node.flags & 8388608;
65992                     var inAmbientContextOrInterface = node.parent && (node.parent.kind === 257 || node.parent.kind === 181) || inAmbientContext;
65993                     if (inAmbientContextOrInterface) {
65994                         previousDeclaration = undefined;
65995                     }
65996                     if ((node.kind === 256 || node.kind === 225) && !inAmbientContext) {
65997                         hasNonAmbientClass = true;
65998                     }
65999                     if (node.kind === 255 || node.kind === 168 || node.kind === 167 || node.kind === 170) {
66000                         functionDeclarations.push(node);
66001                         var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
66002                         someNodeFlags |= currentNodeFlags;
66003                         allNodeFlags &= currentNodeFlags;
66004                         someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node);
66005                         allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node);
66006                         var bodyIsPresent = ts.nodeIsPresent(node.body);
66007                         if (bodyIsPresent && bodyDeclaration) {
66008                             if (isConstructor) {
66009                                 multipleConstructorImplementation = true;
66010                             }
66011                             else {
66012                                 duplicateFunctionDeclaration = true;
66013                             }
66014                         }
66015                         else if ((previousDeclaration === null || previousDeclaration === void 0 ? void 0 : previousDeclaration.parent) === node.parent && previousDeclaration.end !== node.pos) {
66016                             reportImplementationExpectedError(previousDeclaration);
66017                         }
66018                         if (bodyIsPresent) {
66019                             if (!bodyDeclaration) {
66020                                 bodyDeclaration = node;
66021                             }
66022                         }
66023                         else {
66024                             hasOverloads = true;
66025                         }
66026                         previousDeclaration = node;
66027                         if (!inAmbientContextOrInterface) {
66028                             lastSeenNonAmbientDeclaration = node;
66029                         }
66030                     }
66031                 }
66032             }
66033             if (multipleConstructorImplementation) {
66034                 ts.forEach(functionDeclarations, function (declaration) {
66035                     error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed);
66036                 });
66037             }
66038             if (duplicateFunctionDeclaration) {
66039                 ts.forEach(functionDeclarations, function (declaration) {
66040                     error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Duplicate_function_implementation);
66041                 });
66042             }
66043             if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 && declarations) {
66044                 var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 256; })
66045                     .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); });
66046                 ts.forEach(declarations, function (declaration) {
66047                     var diagnostic = declaration.kind === 256
66048                         ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0
66049                         : declaration.kind === 255
66050                             ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient
66051                             : undefined;
66052                     if (diagnostic) {
66053                         ts.addRelatedInfo.apply(void 0, __spreadArray([error(ts.getNameOfDeclaration(declaration) || declaration, diagnostic, ts.symbolName(symbol))], relatedDiagnostics_1, false));
66054                     }
66055                 });
66056             }
66057             if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
66058                 !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128) && !lastSeenNonAmbientDeclaration.questionToken) {
66059                 reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
66060             }
66061             if (hasOverloads) {
66062                 if (declarations) {
66063                     checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);
66064                     checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);
66065                 }
66066                 if (bodyDeclaration) {
66067                     var signatures = getSignaturesOfSymbol(symbol);
66068                     var bodySignature = getSignatureFromDeclaration(bodyDeclaration);
66069                     for (var _a = 0, signatures_10 = signatures; _a < signatures_10.length; _a++) {
66070                         var signature = signatures_10[_a];
66071                         if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
66072                             ts.addRelatedInfo(error(signature.declaration, ts.Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), ts.createDiagnosticForNode(bodyDeclaration, ts.Diagnostics.The_implementation_signature_is_declared_here));
66073                             break;
66074                         }
66075                     }
66076                 }
66077             }
66078         }
66079         function checkExportsOnMergedDeclarations(node) {
66080             if (!produceDiagnostics) {
66081                 return;
66082             }
66083             var symbol = node.localSymbol;
66084             if (!symbol) {
66085                 symbol = getSymbolOfNode(node);
66086                 if (!symbol.exportSymbol) {
66087                     return;
66088                 }
66089             }
66090             if (ts.getDeclarationOfKind(symbol, node.kind) !== node) {
66091                 return;
66092             }
66093             var exportedDeclarationSpaces = 0;
66094             var nonExportedDeclarationSpaces = 0;
66095             var defaultExportedDeclarationSpaces = 0;
66096             for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
66097                 var d = _a[_i];
66098                 var declarationSpaces = getDeclarationSpaces(d);
66099                 var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512);
66100                 if (effectiveDeclarationFlags & 1) {
66101                     if (effectiveDeclarationFlags & 512) {
66102                         defaultExportedDeclarationSpaces |= declarationSpaces;
66103                     }
66104                     else {
66105                         exportedDeclarationSpaces |= declarationSpaces;
66106                     }
66107                 }
66108                 else {
66109                     nonExportedDeclarationSpaces |= declarationSpaces;
66110                 }
66111             }
66112             var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;
66113             var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;
66114             var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;
66115             if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) {
66116                 for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {
66117                     var d = _c[_b];
66118                     var declarationSpaces = getDeclarationSpaces(d);
66119                     var name = ts.getNameOfDeclaration(d);
66120                     if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
66121                         error(name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(name));
66122                     }
66123                     else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) {
66124                         error(name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(name));
66125                     }
66126                 }
66127             }
66128             function getDeclarationSpaces(decl) {
66129                 var d = decl;
66130                 switch (d.kind) {
66131                     case 257:
66132                     case 258:
66133                     case 343:
66134                     case 336:
66135                     case 337:
66136                         return 2;
66137                     case 260:
66138                         return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0
66139                             ? 4 | 1
66140                             : 4;
66141                     case 256:
66142                     case 259:
66143                     case 297:
66144                         return 2 | 1;
66145                     case 303:
66146                         return 2 | 1 | 4;
66147                     case 270:
66148                     case 220:
66149                         var node_2 = d;
66150                         var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right;
66151                         if (!ts.isEntityNameExpression(expression)) {
66152                             return 1;
66153                         }
66154                         d = expression;
66155                     case 264:
66156                     case 267:
66157                     case 266:
66158                         var result_11 = 0;
66159                         var target = resolveAlias(getSymbolOfNode(d));
66160                         ts.forEach(target.declarations, function (d) {
66161                             result_11 |= getDeclarationSpaces(d);
66162                         });
66163                         return result_11;
66164                     case 253:
66165                     case 202:
66166                     case 255:
66167                     case 269:
66168                     case 79:
66169                         return 1;
66170                     default:
66171                         return ts.Debug.failBadSyntaxKind(d);
66172                 }
66173             }
66174         }
66175         function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) {
66176             var promisedType = getPromisedTypeOfPromise(type, errorNode);
66177             return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0);
66178         }
66179         function getPromisedTypeOfPromise(type, errorNode) {
66180             if (isTypeAny(type)) {
66181                 return undefined;
66182             }
66183             var typeAsPromise = type;
66184             if (typeAsPromise.promisedTypeOfPromise) {
66185                 return typeAsPromise.promisedTypeOfPromise;
66186             }
66187             if (isReferenceToType(type, getGlobalPromiseType(false))) {
66188                 return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
66189             }
66190             if (allTypesAssignableToKind(type, 131068 | 131072)) {
66191                 return undefined;
66192             }
66193             var thenFunction = getTypeOfPropertyOfType(type, "then");
66194             if (isTypeAny(thenFunction)) {
66195                 return undefined;
66196             }
66197             var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : ts.emptyArray;
66198             if (thenSignatures.length === 0) {
66199                 if (errorNode) {
66200                     error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method);
66201                 }
66202                 return undefined;
66203             }
66204             var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 2097152);
66205             if (isTypeAny(onfulfilledParameterType)) {
66206                 return undefined;
66207             }
66208             var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0);
66209             if (onfulfilledParameterSignatures.length === 0) {
66210                 if (errorNode) {
66211                     error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback);
66212                 }
66213                 return undefined;
66214             }
66215             return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2);
66216         }
66217         function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) {
66218             var awaitedType = withAlias ?
66219                 getAwaitedType(type, errorNode, diagnosticMessage, arg0) :
66220                 getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
66221             return awaitedType || errorType;
66222         }
66223         function isThenableType(type) {
66224             if (allTypesAssignableToKind(type, 131068 | 131072)) {
66225                 return false;
66226             }
66227             var thenFunction = getTypeOfPropertyOfType(type, "then");
66228             return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152), 0).length > 0;
66229         }
66230         function isAwaitedTypeInstantiation(type) {
66231             var _a;
66232             if (type.flags & 16777216) {
66233                 var awaitedSymbol = getGlobalAwaitedSymbol(false);
66234                 return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a = type.aliasTypeArguments) === null || _a === void 0 ? void 0 : _a.length) === 1;
66235             }
66236             return false;
66237         }
66238         function unwrapAwaitedType(type) {
66239             return type.flags & 1048576 ? mapType(type, unwrapAwaitedType) :
66240                 isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
66241                     type;
66242         }
66243         function createAwaitedTypeIfNeeded(type) {
66244             if (isTypeAny(type)) {
66245                 return type;
66246             }
66247             if (isAwaitedTypeInstantiation(type)) {
66248                 return type;
66249             }
66250             if (isGenericObjectType(type)) {
66251                 var baseConstraint = getBaseConstraintOfType(type);
66252                 if (!baseConstraint || (baseConstraint.flags & 3) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
66253                     var awaitedSymbol = getGlobalAwaitedSymbol(true);
66254                     if (awaitedSymbol) {
66255                         return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
66256                     }
66257                 }
66258             }
66259             ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
66260             return type;
66261         }
66262         function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
66263             var awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0);
66264             return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
66265         }
66266         function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) {
66267             if (isTypeAny(type)) {
66268                 return type;
66269             }
66270             if (isAwaitedTypeInstantiation(type)) {
66271                 return type;
66272             }
66273             var typeAsAwaitable = type;
66274             if (typeAsAwaitable.awaitedTypeOfType) {
66275                 return typeAsAwaitable.awaitedTypeOfType;
66276             }
66277             if (type.flags & 1048576) {
66278                 var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
66279                 return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
66280             }
66281             var promisedType = getPromisedTypeOfPromise(type);
66282             if (promisedType) {
66283                 if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) {
66284                     if (errorNode) {
66285                         error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
66286                     }
66287                     return undefined;
66288                 }
66289                 awaitedTypeStack.push(type.id);
66290                 var awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0);
66291                 awaitedTypeStack.pop();
66292                 if (!awaitedType) {
66293                     return undefined;
66294                 }
66295                 return typeAsAwaitable.awaitedTypeOfType = awaitedType;
66296             }
66297             if (isThenableType(type)) {
66298                 if (errorNode) {
66299                     ts.Debug.assertIsDefined(diagnosticMessage);
66300                     error(errorNode, diagnosticMessage, arg0);
66301                 }
66302                 return undefined;
66303             }
66304             return typeAsAwaitable.awaitedTypeOfType = type;
66305         }
66306         function checkAsyncFunctionReturnType(node, returnTypeNode) {
66307             var returnType = getTypeFromTypeNode(returnTypeNode);
66308             if (languageVersion >= 2) {
66309                 if (isErrorType(returnType)) {
66310                     return;
66311                 }
66312                 var globalPromiseType = getGlobalPromiseType(true);
66313                 if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) {
66314                     error(returnTypeNode, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType));
66315                     return;
66316                 }
66317             }
66318             else {
66319                 markTypeNodeAsReferenced(returnTypeNode);
66320                 if (isErrorType(returnType)) {
66321                     return;
66322                 }
66323                 var promiseConstructorName = ts.getEntityNameFromTypeNode(returnTypeNode);
66324                 if (promiseConstructorName === undefined) {
66325                     error(returnTypeNode, 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, typeToString(returnType));
66326                     return;
66327                 }
66328                 var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551, true);
66329                 var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
66330                 if (isErrorType(promiseConstructorType)) {
66331                     if (promiseConstructorName.kind === 79 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) {
66332                         error(returnTypeNode, 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);
66333                     }
66334                     else {
66335                         error(returnTypeNode, 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));
66336                     }
66337                     return;
66338                 }
66339                 var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(true);
66340                 if (globalPromiseConstructorLikeType === emptyObjectType) {
66341                     error(returnTypeNode, 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));
66342                     return;
66343                 }
66344                 if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeNode, 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)) {
66345                     return;
66346                 }
66347                 var rootName = promiseConstructorName && ts.getFirstIdentifier(promiseConstructorName);
66348                 var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551);
66349                 if (collidingSymbol) {
66350                     error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.idText(rootName), ts.entityNameToString(promiseConstructorName));
66351                     return;
66352                 }
66353             }
66354             checkAwaitedType(returnType, false, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
66355         }
66356         function checkDecorator(node) {
66357             var signature = getResolvedSignature(node);
66358             checkDeprecatedSignature(signature, node);
66359             var returnType = getReturnTypeOfSignature(signature);
66360             if (returnType.flags & 1) {
66361                 return;
66362             }
66363             var expectedReturnType;
66364             var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
66365             var errorInfo;
66366             switch (node.parent.kind) {
66367                 case 256:
66368                     var classSymbol = getSymbolOfNode(node.parent);
66369                     var classConstructorType = getTypeOfSymbol(classSymbol);
66370                     expectedReturnType = getUnionType([classConstructorType, voidType]);
66371                     break;
66372                 case 163:
66373                     expectedReturnType = voidType;
66374                     errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
66375                     break;
66376                 case 166:
66377                     expectedReturnType = voidType;
66378                     errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
66379                     break;
66380                 case 168:
66381                 case 171:
66382                 case 172:
66383                     var methodType = getTypeOfNode(node.parent);
66384                     var descriptorType = createTypedPropertyDescriptorType(methodType);
66385                     expectedReturnType = getUnionType([descriptorType, voidType]);
66386                     break;
66387                 default:
66388                     return ts.Debug.fail();
66389             }
66390             checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, function () { return errorInfo; });
66391         }
66392         function markTypeNodeAsReferenced(node) {
66393             markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
66394         }
66395         function markEntityNameOrEntityExpressionAsReference(typeName) {
66396             if (!typeName)
66397                 return;
66398             var rootName = ts.getFirstIdentifier(typeName);
66399             var meaning = (typeName.kind === 79 ? 788968 : 1920) | 2097152;
66400             var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
66401             if (rootSymbol
66402                 && rootSymbol.flags & 2097152
66403                 && symbolIsValue(rootSymbol)
66404                 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
66405                 && !getTypeOnlyAliasDeclaration(rootSymbol)) {
66406                 markAliasSymbolAsReferenced(rootSymbol);
66407             }
66408         }
66409         function markDecoratorMedataDataTypeNodeAsReferenced(node) {
66410             var entityName = getEntityNameForDecoratorMetadata(node);
66411             if (entityName && ts.isEntityName(entityName)) {
66412                 markEntityNameOrEntityExpressionAsReference(entityName);
66413             }
66414         }
66415         function getEntityNameForDecoratorMetadata(node) {
66416             if (node) {
66417                 switch (node.kind) {
66418                     case 187:
66419                     case 186:
66420                         return getEntityNameForDecoratorMetadataFromTypeList(node.types);
66421                     case 188:
66422                         return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
66423                     case 190:
66424                     case 196:
66425                         return getEntityNameForDecoratorMetadata(node.type);
66426                     case 177:
66427                         return node.typeName;
66428                 }
66429             }
66430         }
66431         function getEntityNameForDecoratorMetadataFromTypeList(types) {
66432             var commonEntityName;
66433             for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
66434                 var typeNode = types_22[_i];
66435                 while (typeNode.kind === 190 || typeNode.kind === 196) {
66436                     typeNode = typeNode.type;
66437                 }
66438                 if (typeNode.kind === 143) {
66439                     continue;
66440                 }
66441                 if (!strictNullChecks && (typeNode.kind === 195 && typeNode.literal.kind === 104 || typeNode.kind === 152)) {
66442                     continue;
66443                 }
66444                 var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
66445                 if (!individualEntityName) {
66446                     return undefined;
66447                 }
66448                 if (commonEntityName) {
66449                     if (!ts.isIdentifier(commonEntityName) ||
66450                         !ts.isIdentifier(individualEntityName) ||
66451                         commonEntityName.escapedText !== individualEntityName.escapedText) {
66452                         return undefined;
66453                     }
66454                 }
66455                 else {
66456                     commonEntityName = individualEntityName;
66457                 }
66458             }
66459             return commonEntityName;
66460         }
66461         function getParameterTypeNodeForDecoratorCheck(node) {
66462             var typeNode = ts.getEffectiveTypeAnnotationNode(node);
66463             return ts.isRestParameter(node) ? ts.getRestParameterElementType(typeNode) : typeNode;
66464         }
66465         function checkDecorators(node) {
66466             if (!node.decorators) {
66467                 return;
66468             }
66469             if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
66470                 return;
66471             }
66472             if (!compilerOptions.experimentalDecorators) {
66473                 error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
66474             }
66475             var firstDecorator = node.decorators[0];
66476             checkExternalEmitHelpers(firstDecorator, 8);
66477             if (node.kind === 163) {
66478                 checkExternalEmitHelpers(firstDecorator, 32);
66479             }
66480             if (compilerOptions.emitDecoratorMetadata) {
66481                 checkExternalEmitHelpers(firstDecorator, 16);
66482                 switch (node.kind) {
66483                     case 256:
66484                         var constructor = ts.getFirstConstructorWithBody(node);
66485                         if (constructor) {
66486                             for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
66487                                 var parameter = _a[_i];
66488                                 markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
66489                             }
66490                         }
66491                         break;
66492                     case 171:
66493                     case 172:
66494                         var otherKind = node.kind === 171 ? 172 : 171;
66495                         var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
66496                         markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
66497                         break;
66498                     case 168:
66499                         for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
66500                             var parameter = _c[_b];
66501                             markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
66502                         }
66503                         markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
66504                         break;
66505                     case 166:
66506                         markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
66507                         break;
66508                     case 163:
66509                         markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
66510                         var containingSignature = node.parent;
66511                         for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
66512                             var parameter = _e[_d];
66513                             markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
66514                         }
66515                         break;
66516                 }
66517             }
66518             ts.forEach(node.decorators, checkDecorator);
66519         }
66520         function checkFunctionDeclaration(node) {
66521             if (produceDiagnostics) {
66522                 checkFunctionOrMethodDeclaration(node);
66523                 checkGrammarForGenerator(node);
66524                 checkCollisionsForDeclarationName(node, node.name);
66525             }
66526         }
66527         function checkJSDocTypeAliasTag(node) {
66528             if (!node.typeExpression) {
66529                 error(node.name, ts.Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
66530             }
66531             if (node.name) {
66532                 checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0);
66533             }
66534             checkSourceElement(node.typeExpression);
66535             checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
66536         }
66537         function checkJSDocTemplateTag(node) {
66538             checkSourceElement(node.constraint);
66539             for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) {
66540                 var tp = _a[_i];
66541                 checkSourceElement(tp);
66542             }
66543         }
66544         function checkJSDocTypeTag(node) {
66545             checkSourceElement(node.typeExpression);
66546         }
66547         function checkJSDocParameterTag(node) {
66548             checkSourceElement(node.typeExpression);
66549             if (!ts.getParameterSymbolFromJSDoc(node)) {
66550                 var decl = ts.getHostSignatureFromJSDoc(node);
66551                 if (decl) {
66552                     var i = ts.getJSDocTags(decl).filter(ts.isJSDocParameterTag).indexOf(node);
66553                     if (i > -1 && i < decl.parameters.length && ts.isBindingPattern(decl.parameters[i].name)) {
66554                         return;
66555                     }
66556                     if (!containsArgumentsReference(decl)) {
66557                         if (ts.isQualifiedName(node.name)) {
66558                             error(node.name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(node.name), ts.entityNameToString(node.name.left));
66559                         }
66560                         else {
66561                             error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(node.name));
66562                         }
66563                     }
66564                     else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
66565                         node.typeExpression && node.typeExpression.type &&
66566                         !isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
66567                         error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 160 ? node.name.right : node.name));
66568                     }
66569                 }
66570             }
66571         }
66572         function checkJSDocPropertyTag(node) {
66573             checkSourceElement(node.typeExpression);
66574         }
66575         function checkJSDocFunctionType(node) {
66576             if (produceDiagnostics && !node.type && !ts.isJSDocConstructSignature(node)) {
66577                 reportImplicitAny(node, anyType);
66578             }
66579             checkSignatureDeclaration(node);
66580         }
66581         function checkJSDocImplementsTag(node) {
66582             var classLike = ts.getEffectiveJSDocHost(node);
66583             if (!classLike || !ts.isClassDeclaration(classLike) && !ts.isClassExpression(classLike)) {
66584                 error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName));
66585             }
66586         }
66587         function checkJSDocAugmentsTag(node) {
66588             var classLike = ts.getEffectiveJSDocHost(node);
66589             if (!classLike || !ts.isClassDeclaration(classLike) && !ts.isClassExpression(classLike)) {
66590                 error(classLike, ts.Diagnostics.JSDoc_0_is_not_attached_to_a_class, ts.idText(node.tagName));
66591                 return;
66592             }
66593             var augmentsTags = ts.getJSDocTags(classLike).filter(ts.isJSDocAugmentsTag);
66594             ts.Debug.assert(augmentsTags.length > 0);
66595             if (augmentsTags.length > 1) {
66596                 error(augmentsTags[1], ts.Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag);
66597             }
66598             var name = getIdentifierFromEntityNameExpression(node.class.expression);
66599             var extend = ts.getClassExtendsHeritageElement(classLike);
66600             if (extend) {
66601                 var className = getIdentifierFromEntityNameExpression(extend.expression);
66602                 if (className && name.escapedText !== className.escapedText) {
66603                     error(name, ts.Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, ts.idText(node.tagName), ts.idText(name), ts.idText(className));
66604                 }
66605             }
66606         }
66607         function checkJSDocAccessibilityModifiers(node) {
66608             var host = ts.getJSDocHost(node);
66609             if (host && ts.isPrivateIdentifierClassElementDeclaration(host)) {
66610                 error(node, ts.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
66611             }
66612         }
66613         function getIdentifierFromEntityNameExpression(node) {
66614             switch (node.kind) {
66615                 case 79:
66616                     return node;
66617                 case 205:
66618                     return node.name;
66619                 default:
66620                     return undefined;
66621             }
66622         }
66623         function checkFunctionOrMethodDeclaration(node) {
66624             var _a;
66625             checkDecorators(node);
66626             checkSignatureDeclaration(node);
66627             var functionFlags = ts.getFunctionFlags(node);
66628             if (node.name && node.name.kind === 161) {
66629                 checkComputedPropertyName(node.name);
66630             }
66631             if (hasBindableName(node)) {
66632                 var symbol = getSymbolOfNode(node);
66633                 var localSymbol = node.localSymbol || symbol;
66634                 var firstDeclaration = (_a = localSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (declaration) { return declaration.kind === node.kind && !(declaration.flags & 131072); });
66635                 if (node === firstDeclaration) {
66636                     checkFunctionOrConstructorSymbol(localSymbol);
66637                 }
66638                 if (symbol.parent) {
66639                     checkFunctionOrConstructorSymbol(symbol);
66640                 }
66641             }
66642             var body = node.kind === 167 ? undefined : node.body;
66643             checkSourceElement(body);
66644             checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node));
66645             if (produceDiagnostics && !ts.getEffectiveReturnTypeNode(node)) {
66646                 if (ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
66647                     reportImplicitAny(node, anyType);
66648                 }
66649                 if (functionFlags & 1 && ts.nodeIsPresent(body)) {
66650                     getReturnTypeOfSignature(getSignatureFromDeclaration(node));
66651                 }
66652             }
66653             if (ts.isInJSFile(node)) {
66654                 var typeTag = ts.getJSDocTypeTag(node);
66655                 if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
66656                     error(typeTag.typeExpression.type, ts.Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
66657                 }
66658             }
66659         }
66660         function registerForUnusedIdentifiersCheck(node) {
66661             if (produceDiagnostics) {
66662                 var sourceFile = ts.getSourceFileOfNode(node);
66663                 var potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
66664                 if (!potentiallyUnusedIdentifiers) {
66665                     potentiallyUnusedIdentifiers = [];
66666                     allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
66667                 }
66668                 potentiallyUnusedIdentifiers.push(node);
66669             }
66670         }
66671         function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
66672             for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
66673                 var node = potentiallyUnusedIdentifiers_1[_i];
66674                 switch (node.kind) {
66675                     case 256:
66676                     case 225:
66677                         checkUnusedClassMembers(node, addDiagnostic);
66678                         checkUnusedTypeParameters(node, addDiagnostic);
66679                         break;
66680                     case 303:
66681                     case 260:
66682                     case 234:
66683                     case 262:
66684                     case 241:
66685                     case 242:
66686                     case 243:
66687                         checkUnusedLocalsAndParameters(node, addDiagnostic);
66688                         break;
66689                     case 170:
66690                     case 212:
66691                     case 255:
66692                     case 213:
66693                     case 168:
66694                     case 171:
66695                     case 172:
66696                         if (node.body) {
66697                             checkUnusedLocalsAndParameters(node, addDiagnostic);
66698                         }
66699                         checkUnusedTypeParameters(node, addDiagnostic);
66700                         break;
66701                     case 167:
66702                     case 173:
66703                     case 174:
66704                     case 178:
66705                     case 179:
66706                     case 258:
66707                     case 257:
66708                         checkUnusedTypeParameters(node, addDiagnostic);
66709                         break;
66710                     case 189:
66711                         checkUnusedInferTypeParameter(node, addDiagnostic);
66712                         break;
66713                     default:
66714                         ts.Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
66715                 }
66716             }
66717         }
66718         function errorUnusedLocal(declaration, name, addDiagnostic) {
66719             var node = ts.getNameOfDeclaration(declaration) || declaration;
66720             var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
66721             addDiagnostic(declaration, 0, ts.createDiagnosticForNode(node, message, name));
66722         }
66723         function isIdentifierThatStartsWithUnderscore(node) {
66724             return ts.isIdentifier(node) && ts.idText(node).charCodeAt(0) === 95;
66725         }
66726         function checkUnusedClassMembers(node, addDiagnostic) {
66727             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
66728                 var member = _a[_i];
66729                 switch (member.kind) {
66730                     case 168:
66731                     case 166:
66732                     case 171:
66733                     case 172:
66734                         if (member.kind === 172 && member.symbol.flags & 32768) {
66735                             break;
66736                         }
66737                         var symbol = getSymbolOfNode(member);
66738                         if (!symbol.isReferenced
66739                             && (ts.hasEffectiveModifier(member, 8) || ts.isNamedDeclaration(member) && ts.isPrivateIdentifier(member.name))
66740                             && !(member.flags & 8388608)) {
66741                             addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
66742                         }
66743                         break;
66744                     case 170:
66745                         for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
66746                             var parameter = _c[_b];
66747                             if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8)) {
66748                                 addDiagnostic(parameter, 0, ts.createDiagnosticForNode(parameter.name, ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read, ts.symbolName(parameter.symbol)));
66749                             }
66750                         }
66751                         break;
66752                     case 175:
66753                     case 233:
66754                     case 169:
66755                         break;
66756                     default:
66757                         ts.Debug.fail("Unexpected class member");
66758                 }
66759             }
66760         }
66761         function checkUnusedInferTypeParameter(node, addDiagnostic) {
66762             var typeParameter = node.typeParameter;
66763             if (isTypeParameterUnused(typeParameter)) {
66764                 addDiagnostic(node, 1, ts.createDiagnosticForNode(node, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(typeParameter.name)));
66765             }
66766         }
66767         function checkUnusedTypeParameters(node, addDiagnostic) {
66768             var declarations = getSymbolOfNode(node).declarations;
66769             if (!declarations || ts.last(declarations) !== node)
66770                 return;
66771             var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
66772             var seenParentsWithEveryUnused = new ts.Set();
66773             for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
66774                 var typeParameter = typeParameters_3[_i];
66775                 if (!isTypeParameterUnused(typeParameter))
66776                     continue;
66777                 var name = ts.idText(typeParameter.name);
66778                 var parent = typeParameter.parent;
66779                 if (parent.kind !== 189 && parent.typeParameters.every(isTypeParameterUnused)) {
66780                     if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) {
66781                         var sourceFile = ts.getSourceFileOfNode(parent);
66782                         var range = ts.isJSDocTemplateTag(parent)
66783                             ? ts.rangeOfNode(parent)
66784                             : ts.rangeOfTypeParameters(sourceFile, parent.typeParameters);
66785                         var only = parent.typeParameters.length === 1;
66786                         var message = only ? ts.Diagnostics._0_is_declared_but_its_value_is_never_read : ts.Diagnostics.All_type_parameters_are_unused;
66787                         var arg0 = only ? name : undefined;
66788                         addDiagnostic(typeParameter, 1, ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
66789                     }
66790                 }
66791                 else {
66792                     addDiagnostic(typeParameter, 1, ts.createDiagnosticForNode(typeParameter, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, name));
66793                 }
66794             }
66795         }
66796         function isTypeParameterUnused(typeParameter) {
66797             return !(getMergedSymbol(typeParameter.symbol).isReferenced & 262144) && !isIdentifierThatStartsWithUnderscore(typeParameter.name);
66798         }
66799         function addToGroup(map, key, value, getKey) {
66800             var keyString = String(getKey(key));
66801             var group = map.get(keyString);
66802             if (group) {
66803                 group[1].push(value);
66804             }
66805             else {
66806                 map.set(keyString, [key, [value]]);
66807             }
66808         }
66809         function tryGetRootParameterDeclaration(node) {
66810             return ts.tryCast(ts.getRootDeclaration(node), ts.isParameter);
66811         }
66812         function isValidUnusedLocalDeclaration(declaration) {
66813             if (ts.isBindingElement(declaration)) {
66814                 if (ts.isObjectBindingPattern(declaration.parent)) {
66815                     return !!(declaration.propertyName && isIdentifierThatStartsWithUnderscore(declaration.name));
66816                 }
66817                 return isIdentifierThatStartsWithUnderscore(declaration.name);
66818             }
66819             return ts.isAmbientModule(declaration) ||
66820                 (ts.isVariableDeclaration(declaration) && ts.isForInOrOfStatement(declaration.parent.parent) || isImportedDeclaration(declaration)) && isIdentifierThatStartsWithUnderscore(declaration.name);
66821         }
66822         function checkUnusedLocalsAndParameters(nodeWithLocals, addDiagnostic) {
66823             var unusedImports = new ts.Map();
66824             var unusedDestructures = new ts.Map();
66825             var unusedVariables = new ts.Map();
66826             nodeWithLocals.locals.forEach(function (local) {
66827                 if (local.flags & 262144 ? !(local.flags & 3 && !(local.isReferenced & 3)) : local.isReferenced || local.exportSymbol) {
66828                     return;
66829                 }
66830                 if (local.declarations) {
66831                     for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) {
66832                         var declaration = _a[_i];
66833                         if (isValidUnusedLocalDeclaration(declaration)) {
66834                             continue;
66835                         }
66836                         if (isImportedDeclaration(declaration)) {
66837                             addToGroup(unusedImports, importClauseFromImported(declaration), declaration, getNodeId);
66838                         }
66839                         else if (ts.isBindingElement(declaration) && ts.isObjectBindingPattern(declaration.parent)) {
66840                             var lastElement = ts.last(declaration.parent.elements);
66841                             if (declaration === lastElement || !ts.last(declaration.parent.elements).dotDotDotToken) {
66842                                 addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId);
66843                             }
66844                         }
66845                         else if (ts.isVariableDeclaration(declaration)) {
66846                             addToGroup(unusedVariables, declaration.parent, declaration, getNodeId);
66847                         }
66848                         else {
66849                             var parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration);
66850                             var name = local.valueDeclaration && ts.getNameOfDeclaration(local.valueDeclaration);
66851                             if (parameter && name) {
66852                                 if (!ts.isParameterPropertyDeclaration(parameter, parameter.parent) && !ts.parameterIsThisKeyword(parameter) && !isIdentifierThatStartsWithUnderscore(name)) {
66853                                     if (ts.isBindingElement(declaration) && ts.isArrayBindingPattern(declaration.parent)) {
66854                                         addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId);
66855                                     }
66856                                     else {
66857                                         addDiagnostic(parameter, 1, ts.createDiagnosticForNode(name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.symbolName(local)));
66858                                     }
66859                                 }
66860                             }
66861                             else {
66862                                 errorUnusedLocal(declaration, ts.symbolName(local), addDiagnostic);
66863                             }
66864                         }
66865                     }
66866                 }
66867             });
66868             unusedImports.forEach(function (_a) {
66869                 var importClause = _a[0], unuseds = _a[1];
66870                 var importDecl = importClause.parent;
66871                 var nDeclarations = (importClause.name ? 1 : 0) +
66872                     (importClause.namedBindings ?
66873                         (importClause.namedBindings.kind === 267 ? 1 : importClause.namedBindings.elements.length)
66874                         : 0);
66875                 if (nDeclarations === unuseds.length) {
66876                     addDiagnostic(importDecl, 0, unuseds.length === 1
66877                         ? ts.createDiagnosticForNode(importDecl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, ts.idText(ts.first(unuseds).name))
66878                         : ts.createDiagnosticForNode(importDecl, ts.Diagnostics.All_imports_in_import_declaration_are_unused));
66879                 }
66880                 else {
66881                     for (var _i = 0, unuseds_1 = unuseds; _i < unuseds_1.length; _i++) {
66882                         var unused = unuseds_1[_i];
66883                         errorUnusedLocal(unused, ts.idText(unused.name), addDiagnostic);
66884                     }
66885                 }
66886             });
66887             unusedDestructures.forEach(function (_a) {
66888                 var bindingPattern = _a[0], bindingElements = _a[1];
66889                 var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0;
66890                 if (bindingPattern.elements.length === bindingElements.length) {
66891                     if (bindingElements.length === 1 && bindingPattern.parent.kind === 253 && bindingPattern.parent.parent.kind === 254) {
66892                         addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
66893                     }
66894                     else {
66895                         addDiagnostic(bindingPattern, kind, bindingElements.length === 1
66896                             ? ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(bindingElements).name))
66897                             : ts.createDiagnosticForNode(bindingPattern, ts.Diagnostics.All_destructured_elements_are_unused));
66898                     }
66899                 }
66900                 else {
66901                     for (var _i = 0, bindingElements_1 = bindingElements; _i < bindingElements_1.length; _i++) {
66902                         var e = bindingElements_1[_i];
66903                         addDiagnostic(e, kind, ts.createDiagnosticForNode(e, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(e.name)));
66904                     }
66905                 }
66906             });
66907             unusedVariables.forEach(function (_a) {
66908                 var declarationList = _a[0], declarations = _a[1];
66909                 if (declarationList.declarations.length === declarations.length) {
66910                     addDiagnostic(declarationList, 0, declarations.length === 1
66911                         ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
66912                         : ts.createDiagnosticForNode(declarationList.parent.kind === 236 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
66913                 }
66914                 else {
66915                     for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
66916                         var decl = declarations_5[_i];
66917                         addDiagnostic(decl, 0, ts.createDiagnosticForNode(decl, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
66918                     }
66919                 }
66920             });
66921         }
66922         function bindingNameText(name) {
66923             switch (name.kind) {
66924                 case 79:
66925                     return ts.idText(name);
66926                 case 201:
66927                 case 200:
66928                     return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
66929                 default:
66930                     return ts.Debug.assertNever(name);
66931             }
66932         }
66933         function isImportedDeclaration(node) {
66934             return node.kind === 266 || node.kind === 269 || node.kind === 267;
66935         }
66936         function importClauseFromImported(decl) {
66937             return decl.kind === 266 ? decl : decl.kind === 267 ? decl.parent : decl.parent.parent;
66938         }
66939         function checkBlock(node) {
66940             if (node.kind === 234) {
66941                 checkGrammarStatementInAmbientContext(node);
66942             }
66943             if (ts.isFunctionOrModuleBlock(node)) {
66944                 var saveFlowAnalysisDisabled = flowAnalysisDisabled;
66945                 ts.forEach(node.statements, checkSourceElement);
66946                 flowAnalysisDisabled = saveFlowAnalysisDisabled;
66947             }
66948             else {
66949                 ts.forEach(node.statements, checkSourceElement);
66950             }
66951             if (node.locals) {
66952                 registerForUnusedIdentifiersCheck(node);
66953             }
66954         }
66955         function checkCollisionWithArgumentsInGeneratedCode(node) {
66956             if (languageVersion >= 2 || !ts.hasRestParameter(node) || node.flags & 8388608 || ts.nodeIsMissing(node.body)) {
66957                 return;
66958             }
66959             ts.forEach(node.parameters, function (p) {
66960                 if (p.name && !ts.isBindingPattern(p.name) && p.name.escapedText === argumentsSymbol.escapedName) {
66961                     errorSkippedOn("noEmit", p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters);
66962                 }
66963             });
66964         }
66965         function needCollisionCheckForIdentifier(node, identifier, name) {
66966             if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) {
66967                 return false;
66968             }
66969             if (node.kind === 166 ||
66970                 node.kind === 165 ||
66971                 node.kind === 168 ||
66972                 node.kind === 167 ||
66973                 node.kind === 171 ||
66974                 node.kind === 172 ||
66975                 node.kind === 294) {
66976                 return false;
66977             }
66978             if (node.flags & 8388608) {
66979                 return false;
66980             }
66981             if (ts.isImportClause(node) || ts.isImportEqualsDeclaration(node) || ts.isImportSpecifier(node)) {
66982                 if (ts.isTypeOnlyImportOrExportDeclaration(node)) {
66983                     return false;
66984                 }
66985             }
66986             var root = ts.getRootDeclaration(node);
66987             if (ts.isParameter(root) && ts.nodeIsMissing(root.parent.body)) {
66988                 return false;
66989             }
66990             return true;
66991         }
66992         function checkIfThisIsCapturedInEnclosingScope(node) {
66993             ts.findAncestor(node, function (current) {
66994                 if (getNodeCheckFlags(current) & 4) {
66995                     var isDeclaration_1 = node.kind !== 79;
66996                     if (isDeclaration_1) {
66997                         error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
66998                     }
66999                     else {
67000                         error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
67001                     }
67002                     return true;
67003                 }
67004                 return false;
67005             });
67006         }
67007         function checkIfNewTargetIsCapturedInEnclosingScope(node) {
67008             ts.findAncestor(node, function (current) {
67009                 if (getNodeCheckFlags(current) & 8) {
67010                     var isDeclaration_2 = node.kind !== 79;
67011                     if (isDeclaration_2) {
67012                         error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
67013                     }
67014                     else {
67015                         error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference);
67016                     }
67017                     return true;
67018                 }
67019                 return false;
67020             });
67021         }
67022         function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
67023             if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node12 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
67024                 return;
67025             }
67026             if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
67027                 return;
67028             }
67029             if (ts.isModuleDeclaration(node) && ts.getModuleInstanceState(node) !== 1) {
67030                 return;
67031             }
67032             var parent = getDeclarationContainer(node);
67033             if (parent.kind === 303 && ts.isExternalOrCommonJsModule(parent)) {
67034                 errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
67035             }
67036         }
67037         function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {
67038             if (!name || languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) {
67039                 return;
67040             }
67041             if (ts.isModuleDeclaration(node) && ts.getModuleInstanceState(node) !== 1) {
67042                 return;
67043             }
67044             var parent = getDeclarationContainer(node);
67045             if (parent.kind === 303 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048) {
67046                 errorSkippedOn("noEmit", 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));
67047             }
67048         }
67049         function recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name) {
67050             if (languageVersion <= 8
67051                 && (needCollisionCheckForIdentifier(node, name, "WeakMap") || needCollisionCheckForIdentifier(node, name, "WeakSet"))) {
67052                 potentialWeakMapSetCollisions.push(node);
67053             }
67054         }
67055         function checkWeakMapSetCollision(node) {
67056             var enclosingBlockScope = ts.getEnclosingBlockScopeContainer(node);
67057             if (getNodeCheckFlags(enclosingBlockScope) & 67108864) {
67058                 ts.Debug.assert(ts.isNamedDeclaration(node) && ts.isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
67059                 errorSkippedOn("noEmit", node, ts.Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
67060             }
67061         }
67062         function recordPotentialCollisionWithReflectInGeneratedCode(node, name) {
67063             if (name && languageVersion >= 2 && languageVersion <= 8
67064                 && needCollisionCheckForIdentifier(node, name, "Reflect")) {
67065                 potentialReflectCollisions.push(node);
67066             }
67067         }
67068         function checkReflectCollision(node) {
67069             var hasCollision = false;
67070             if (ts.isClassExpression(node)) {
67071                 for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
67072                     var member = _a[_i];
67073                     if (getNodeCheckFlags(member) & 134217728) {
67074                         hasCollision = true;
67075                         break;
67076                     }
67077                 }
67078             }
67079             else if (ts.isFunctionExpression(node)) {
67080                 if (getNodeCheckFlags(node) & 134217728) {
67081                     hasCollision = true;
67082                 }
67083             }
67084             else {
67085                 var container = ts.getEnclosingBlockScopeContainer(node);
67086                 if (container && getNodeCheckFlags(container) & 134217728) {
67087                     hasCollision = true;
67088                 }
67089             }
67090             if (hasCollision) {
67091                 ts.Debug.assert(ts.isNamedDeclaration(node) && ts.isIdentifier(node.name), "The target of a Reflect collision check should be an identifier");
67092                 errorSkippedOn("noEmit", node, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, ts.declarationNameToString(node.name), "Reflect");
67093             }
67094         }
67095         function checkCollisionsForDeclarationName(node, name) {
67096             if (!name)
67097                 return;
67098             checkCollisionWithRequireExportsInGeneratedCode(node, name);
67099             checkCollisionWithGlobalPromiseInGeneratedCode(node, name);
67100             recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name);
67101             recordPotentialCollisionWithReflectInGeneratedCode(node, name);
67102             if (ts.isClassLike(node)) {
67103                 checkTypeNameIsReserved(name, ts.Diagnostics.Class_name_cannot_be_0);
67104                 if (!(node.flags & 8388608)) {
67105                     checkClassNameCollisionWithObject(name);
67106                 }
67107             }
67108             else if (ts.isEnumDeclaration(node)) {
67109                 checkTypeNameIsReserved(name, ts.Diagnostics.Enum_name_cannot_be_0);
67110             }
67111         }
67112         function checkVarDeclaredNamesNotShadowed(node) {
67113             if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {
67114                 return;
67115             }
67116             if (node.kind === 253 && !node.initializer) {
67117                 return;
67118             }
67119             var symbol = getSymbolOfNode(node);
67120             if (symbol.flags & 1) {
67121                 if (!ts.isIdentifier(node.name))
67122                     return ts.Debug.fail();
67123                 var localDeclarationSymbol = resolveName(node, node.name.escapedText, 3, undefined, undefined, false);
67124                 if (localDeclarationSymbol &&
67125                     localDeclarationSymbol !== symbol &&
67126                     localDeclarationSymbol.flags & 2) {
67127                     if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {
67128                         var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 254);
67129                         var container = varDeclList.parent.kind === 236 && varDeclList.parent.parent
67130                             ? varDeclList.parent.parent
67131                             : undefined;
67132                         var namesShareScope = container &&
67133                             (container.kind === 234 && ts.isFunctionLike(container.parent) ||
67134                                 container.kind === 261 ||
67135                                 container.kind === 260 ||
67136                                 container.kind === 303);
67137                         if (!namesShareScope) {
67138                             var name = symbolToString(localDeclarationSymbol);
67139                             error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
67140                         }
67141                     }
67142                 }
67143             }
67144         }
67145         function convertAutoToAny(type) {
67146             return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
67147         }
67148         function checkVariableLikeDeclaration(node) {
67149             var _a;
67150             checkDecorators(node);
67151             if (!ts.isBindingElement(node)) {
67152                 checkSourceElement(node.type);
67153             }
67154             if (!node.name) {
67155                 return;
67156             }
67157             if (node.name.kind === 161) {
67158                 checkComputedPropertyName(node.name);
67159                 if (node.initializer) {
67160                     checkExpressionCached(node.initializer);
67161                 }
67162             }
67163             if (ts.isBindingElement(node)) {
67164                 if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) {
67165                     checkExternalEmitHelpers(node, 4);
67166                 }
67167                 if (node.propertyName && node.propertyName.kind === 161) {
67168                     checkComputedPropertyName(node.propertyName);
67169                 }
67170                 var parent = node.parent.parent;
67171                 var parentType = getTypeForBindingElementParent(parent);
67172                 var name = node.propertyName || node.name;
67173                 if (parentType && !ts.isBindingPattern(name)) {
67174                     var exprType = getLiteralTypeFromPropertyName(name);
67175                     if (isTypeUsableAsPropertyName(exprType)) {
67176                         var nameText = getPropertyNameFromType(exprType);
67177                         var property = getPropertyOfType(parentType, nameText);
67178                         if (property) {
67179                             markPropertyAsReferenced(property, undefined, false);
67180                             checkPropertyAccessibility(node, !!parent.initializer && parent.initializer.kind === 106, false, parentType, property);
67181                         }
67182                     }
67183                 }
67184             }
67185             if (ts.isBindingPattern(node.name)) {
67186                 if (node.name.kind === 201 && languageVersion < 2 && compilerOptions.downlevelIteration) {
67187                     checkExternalEmitHelpers(node, 512);
67188                 }
67189                 ts.forEach(node.name.elements, checkSourceElement);
67190             }
67191             if (node.initializer && ts.isParameterDeclaration(node) && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
67192                 error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
67193                 return;
67194             }
67195             if (ts.isBindingPattern(node.name)) {
67196                 var needCheckInitializer = node.initializer && node.parent.parent.kind !== 242;
67197                 var needCheckWidenedType = node.name.elements.length === 0;
67198                 if (needCheckInitializer || needCheckWidenedType) {
67199                     var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
67200                     if (needCheckInitializer) {
67201                         var initializerType = checkExpressionCached(node.initializer);
67202                         if (strictNullChecks && needCheckWidenedType) {
67203                             checkNonNullNonVoidType(initializerType, node);
67204                         }
67205                         else {
67206                             checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
67207                         }
67208                     }
67209                     if (needCheckWidenedType) {
67210                         if (ts.isArrayBindingPattern(node.name)) {
67211                             checkIteratedTypeOrElementType(65, widenedType, undefinedType, node);
67212                         }
67213                         else if (strictNullChecks) {
67214                             checkNonNullNonVoidType(widenedType, node);
67215                         }
67216                     }
67217                 }
67218                 return;
67219             }
67220             var symbol = getSymbolOfNode(node);
67221             if (symbol.flags & 2097152 && ts.isRequireVariableDeclaration(node)) {
67222                 checkAliasSymbol(node);
67223                 return;
67224             }
67225             var type = convertAutoToAny(getTypeOfSymbol(symbol));
67226             if (node === symbol.valueDeclaration) {
67227                 var initializer = ts.getEffectiveInitializer(node);
67228                 if (initializer) {
67229                     var isJSObjectLiteralInitializer = ts.isInJSFile(node) &&
67230                         ts.isObjectLiteralExpression(initializer) &&
67231                         (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
67232                         !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size);
67233                     if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 242) {
67234                         checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, undefined);
67235                     }
67236                 }
67237                 if (symbol.declarations && symbol.declarations.length > 1) {
67238                     if (ts.some(symbol.declarations, function (d) { return d !== node && ts.isVariableLike(d) && !areDeclarationFlagsIdentical(d, node); })) {
67239                         error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
67240                     }
67241                 }
67242             }
67243             else {
67244                 var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));
67245                 if (!isErrorType(type) && !isErrorType(declarationType) &&
67246                     !isTypeIdenticalTo(type, declarationType) &&
67247                     !(symbol.flags & 67108864)) {
67248                     errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
67249                 }
67250                 if (node.initializer) {
67251                     checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, undefined);
67252                 }
67253                 if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
67254                     error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
67255                 }
67256             }
67257             if (node.kind !== 166 && node.kind !== 165) {
67258                 checkExportsOnMergedDeclarations(node);
67259                 if (node.kind === 253 || node.kind === 202) {
67260                     checkVarDeclaredNamesNotShadowed(node);
67261                 }
67262                 checkCollisionsForDeclarationName(node, node.name);
67263             }
67264         }
67265         function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
67266             var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
67267             var message = nextDeclaration.kind === 166 || nextDeclaration.kind === 165
67268                 ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
67269                 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
67270             var declName = ts.declarationNameToString(nextDeclarationName);
67271             var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
67272             if (firstDeclaration) {
67273                 ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
67274             }
67275         }
67276         function areDeclarationFlagsIdentical(left, right) {
67277             if ((left.kind === 163 && right.kind === 253) ||
67278                 (left.kind === 253 && right.kind === 163)) {
67279                 return true;
67280             }
67281             if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {
67282                 return false;
67283             }
67284             var interestingFlags = 8 |
67285                 16 |
67286                 256 |
67287                 128 |
67288                 64 |
67289                 32;
67290             return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
67291         }
67292         function checkVariableDeclaration(node) {
67293             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
67294             checkGrammarVariableDeclaration(node);
67295             checkVariableLikeDeclaration(node);
67296             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
67297         }
67298         function checkBindingElement(node) {
67299             checkGrammarBindingElement(node);
67300             return checkVariableLikeDeclaration(node);
67301         }
67302         function checkVariableStatement(node) {
67303             if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarVariableDeclarationList(node.declarationList))
67304                 checkGrammarForDisallowedLetOrConstStatement(node);
67305             ts.forEach(node.declarationList.declarations, checkSourceElement);
67306         }
67307         function checkExpressionStatement(node) {
67308             checkGrammarStatementInAmbientContext(node);
67309             checkExpression(node.expression);
67310         }
67311         function checkIfStatement(node) {
67312             checkGrammarStatementInAmbientContext(node);
67313             var type = checkTruthinessExpression(node.expression);
67314             checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
67315             checkSourceElement(node.thenStatement);
67316             if (node.thenStatement.kind === 235) {
67317                 error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
67318             }
67319             checkSourceElement(node.elseStatement);
67320         }
67321         function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, type, body) {
67322             if (!strictNullChecks)
67323                 return;
67324             if (getFalsyFlags(type))
67325                 return;
67326             var location = ts.isBinaryExpression(condExpr) ? condExpr.right : condExpr;
67327             if (ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression)) {
67328                 return;
67329             }
67330             var testedNode = ts.isIdentifier(location) ? location
67331                 : ts.isPropertyAccessExpression(location) ? location.name
67332                     : ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
67333                         : undefined;
67334             var callSignatures = getSignaturesOfType(type, 0);
67335             var isPromise = !!getAwaitedTypeOfPromise(type);
67336             if (callSignatures.length === 0 && !isPromise) {
67337                 return;
67338             }
67339             var testedSymbol = testedNode && getSymbolAtLocation(testedNode);
67340             if (!testedSymbol && !isPromise) {
67341                 return;
67342             }
67343             var isUsed = testedSymbol && ts.isBinaryExpression(condExpr.parent) && isSymbolUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
67344                 || testedSymbol && body && isSymbolUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
67345             if (!isUsed) {
67346                 if (isPromise) {
67347                     errorAndMaybeSuggestAwait(location, true, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, getTypeNameForErrorDisplay(type));
67348                 }
67349                 else {
67350                     error(location, ts.Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead);
67351                 }
67352             }
67353         }
67354         function isSymbolUsedInConditionBody(expr, body, testedNode, testedSymbol) {
67355             return !!ts.forEachChild(body, function check(childNode) {
67356                 if (ts.isIdentifier(childNode)) {
67357                     var childSymbol = getSymbolAtLocation(childNode);
67358                     if (childSymbol && childSymbol === testedSymbol) {
67359                         if (ts.isIdentifier(expr)) {
67360                             return true;
67361                         }
67362                         var testedExpression = testedNode.parent;
67363                         var childExpression = childNode.parent;
67364                         while (testedExpression && childExpression) {
67365                             if (ts.isIdentifier(testedExpression) && ts.isIdentifier(childExpression) ||
67366                                 testedExpression.kind === 108 && childExpression.kind === 108) {
67367                                 return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression);
67368                             }
67369                             else if (ts.isPropertyAccessExpression(testedExpression) && ts.isPropertyAccessExpression(childExpression)) {
67370                                 if (getSymbolAtLocation(testedExpression.name) !== getSymbolAtLocation(childExpression.name)) {
67371                                     return false;
67372                                 }
67373                                 childExpression = childExpression.expression;
67374                                 testedExpression = testedExpression.expression;
67375                             }
67376                             else if (ts.isCallExpression(testedExpression) && ts.isCallExpression(childExpression)) {
67377                                 childExpression = childExpression.expression;
67378                                 testedExpression = testedExpression.expression;
67379                             }
67380                             else {
67381                                 return false;
67382                             }
67383                         }
67384                     }
67385                 }
67386                 return ts.forEachChild(childNode, check);
67387             });
67388         }
67389         function isSymbolUsedInBinaryExpressionChain(node, testedSymbol) {
67390             while (ts.isBinaryExpression(node) && node.operatorToken.kind === 55) {
67391                 var isUsed = ts.forEachChild(node.right, function visit(child) {
67392                     if (ts.isIdentifier(child)) {
67393                         var symbol = getSymbolAtLocation(child);
67394                         if (symbol && symbol === testedSymbol) {
67395                             return true;
67396                         }
67397                     }
67398                     return ts.forEachChild(child, visit);
67399                 });
67400                 if (isUsed) {
67401                     return true;
67402                 }
67403                 node = node.parent;
67404             }
67405             return false;
67406         }
67407         function checkDoStatement(node) {
67408             checkGrammarStatementInAmbientContext(node);
67409             checkSourceElement(node.statement);
67410             checkTruthinessExpression(node.expression);
67411         }
67412         function checkWhileStatement(node) {
67413             checkGrammarStatementInAmbientContext(node);
67414             checkTruthinessExpression(node.expression);
67415             checkSourceElement(node.statement);
67416         }
67417         function checkTruthinessOfType(type, node) {
67418             if (type.flags & 16384) {
67419                 error(node, ts.Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
67420             }
67421             return type;
67422         }
67423         function checkTruthinessExpression(node, checkMode) {
67424             return checkTruthinessOfType(checkExpression(node, checkMode), node);
67425         }
67426         function checkForStatement(node) {
67427             if (!checkGrammarStatementInAmbientContext(node)) {
67428                 if (node.initializer && node.initializer.kind === 254) {
67429                     checkGrammarVariableDeclarationList(node.initializer);
67430                 }
67431             }
67432             if (node.initializer) {
67433                 if (node.initializer.kind === 254) {
67434                     ts.forEach(node.initializer.declarations, checkVariableDeclaration);
67435                 }
67436                 else {
67437                     checkExpression(node.initializer);
67438                 }
67439             }
67440             if (node.condition)
67441                 checkTruthinessExpression(node.condition);
67442             if (node.incrementor)
67443                 checkExpression(node.incrementor);
67444             checkSourceElement(node.statement);
67445             if (node.locals) {
67446                 registerForUnusedIdentifiersCheck(node);
67447             }
67448         }
67449         function checkForOfStatement(node) {
67450             checkGrammarForInOrForOfStatement(node);
67451             var container = ts.getContainingFunctionOrClassStaticBlock(node);
67452             if (node.awaitModifier) {
67453                 if (container && ts.isClassStaticBlockDeclaration(container)) {
67454                     grammarErrorOnNode(node.awaitModifier, ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block);
67455                 }
67456                 else {
67457                     var functionFlags = ts.getFunctionFlags(container);
67458                     if ((functionFlags & (4 | 2)) === 2 && languageVersion < 99) {
67459                         checkExternalEmitHelpers(node, 16384);
67460                     }
67461                 }
67462             }
67463             else if (compilerOptions.downlevelIteration && languageVersion < 2) {
67464                 checkExternalEmitHelpers(node, 256);
67465             }
67466             if (node.initializer.kind === 254) {
67467                 checkForInOrForOfVariableDeclaration(node);
67468             }
67469             else {
67470                 var varExpr = node.initializer;
67471                 var iteratedType = checkRightHandSideOfForOf(node);
67472                 if (varExpr.kind === 203 || varExpr.kind === 204) {
67473                     checkDestructuringAssignment(varExpr, iteratedType || errorType);
67474                 }
67475                 else {
67476                     var leftType = checkExpression(varExpr);
67477                     checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access);
67478                     if (iteratedType) {
67479                         checkTypeAssignableToAndOptionallyElaborate(iteratedType, leftType, varExpr, node.expression);
67480                     }
67481                 }
67482             }
67483             checkSourceElement(node.statement);
67484             if (node.locals) {
67485                 registerForUnusedIdentifiersCheck(node);
67486             }
67487         }
67488         function checkForInStatement(node) {
67489             checkGrammarForInOrForOfStatement(node);
67490             var rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression));
67491             if (node.initializer.kind === 254) {
67492                 var variable = node.initializer.declarations[0];
67493                 if (variable && ts.isBindingPattern(variable.name)) {
67494                     error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
67495                 }
67496                 checkForInOrForOfVariableDeclaration(node);
67497             }
67498             else {
67499                 var varExpr = node.initializer;
67500                 var leftType = checkExpression(varExpr);
67501                 if (varExpr.kind === 203 || varExpr.kind === 204) {
67502                     error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
67503                 }
67504                 else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
67505                     error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any);
67506                 }
67507                 else {
67508                     checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access);
67509                 }
67510             }
67511             if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 | 58982400)) {
67512                 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_but_here_has_type_0, typeToString(rightType));
67513             }
67514             checkSourceElement(node.statement);
67515             if (node.locals) {
67516                 registerForUnusedIdentifiersCheck(node);
67517             }
67518         }
67519         function checkForInOrForOfVariableDeclaration(iterationStatement) {
67520             var variableDeclarationList = iterationStatement.initializer;
67521             if (variableDeclarationList.declarations.length >= 1) {
67522                 var decl = variableDeclarationList.declarations[0];
67523                 checkVariableDeclaration(decl);
67524             }
67525         }
67526         function checkRightHandSideOfForOf(statement) {
67527             var use = statement.awaitModifier ? 15 : 13;
67528             return checkIteratedTypeOrElementType(use, checkNonNullExpression(statement.expression), undefinedType, statement.expression);
67529         }
67530         function checkIteratedTypeOrElementType(use, inputType, sentType, errorNode) {
67531             if (isTypeAny(inputType)) {
67532                 return inputType;
67533             }
67534             return getIteratedTypeOrElementType(use, inputType, sentType, errorNode, true) || anyType;
67535         }
67536         function getIteratedTypeOrElementType(use, inputType, sentType, errorNode, checkAssignability) {
67537             var allowAsyncIterables = (use & 2) !== 0;
67538             if (inputType === neverType) {
67539                 reportTypeNotIterableError(errorNode, inputType, allowAsyncIterables);
67540                 return undefined;
67541             }
67542             var uplevelIteration = languageVersion >= 2;
67543             var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
67544             var possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & 128);
67545             if (uplevelIteration || downlevelIteration || allowAsyncIterables) {
67546                 var iterationTypes = getIterationTypesOfIterable(inputType, use, uplevelIteration ? errorNode : undefined);
67547                 if (checkAssignability) {
67548                     if (iterationTypes) {
67549                         var diagnostic = use & 8 ? ts.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0 :
67550                             use & 32 ? ts.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0 :
67551                                 use & 64 ? ts.Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0 :
67552                                     use & 16 ? ts.Diagnostics.Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0 :
67553                                         undefined;
67554                         if (diagnostic) {
67555                             checkTypeAssignableTo(sentType, iterationTypes.nextType, errorNode, diagnostic);
67556                         }
67557                     }
67558                 }
67559                 if (iterationTypes || uplevelIteration) {
67560                     return possibleOutOfBounds ? includeUndefinedInIndexSignature(iterationTypes && iterationTypes.yieldType) : (iterationTypes && iterationTypes.yieldType);
67561                 }
67562             }
67563             var arrayType = inputType;
67564             var reportedError = false;
67565             var hasStringConstituent = false;
67566             if (use & 4) {
67567                 if (arrayType.flags & 1048576) {
67568                     var arrayTypes = inputType.types;
67569                     var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 402653316); });
67570                     if (filteredTypes !== arrayTypes) {
67571                         arrayType = getUnionType(filteredTypes, 2);
67572                     }
67573                 }
67574                 else if (arrayType.flags & 402653316) {
67575                     arrayType = neverType;
67576                 }
67577                 hasStringConstituent = arrayType !== inputType;
67578                 if (hasStringConstituent) {
67579                     if (languageVersion < 1) {
67580                         if (errorNode) {
67581                             error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
67582                             reportedError = true;
67583                         }
67584                     }
67585                     if (arrayType.flags & 131072) {
67586                         return possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType;
67587                     }
67588                 }
67589             }
67590             if (!isArrayLikeType(arrayType)) {
67591                 if (errorNode && !reportedError) {
67592                     var allowsStrings = !!(use & 4) && !hasStringConstituent;
67593                     var _a = getIterationDiagnosticDetails(allowsStrings, downlevelIteration), defaultDiagnostic = _a[0], maybeMissingAwait = _a[1];
67594                     errorAndMaybeSuggestAwait(errorNode, maybeMissingAwait && !!getAwaitedTypeOfPromise(arrayType), defaultDiagnostic, typeToString(arrayType));
67595                 }
67596                 return hasStringConstituent ? possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType : undefined;
67597             }
67598             var arrayElementType = getIndexTypeOfType(arrayType, numberType);
67599             if (hasStringConstituent && arrayElementType) {
67600                 if (arrayElementType.flags & 402653316 && !compilerOptions.noUncheckedIndexedAccess) {
67601                     return stringType;
67602                 }
67603                 return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2);
67604             }
67605             return (use & 128) ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
67606             function getIterationDiagnosticDetails(allowsStrings, downlevelIteration) {
67607                 var _a;
67608                 if (downlevelIteration) {
67609                     return allowsStrings
67610                         ? [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, true]
67611                         : [ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true];
67612                 }
67613                 var yieldType = getIterationTypeOfIterable(use, 0, inputType, undefined);
67614                 if (yieldType) {
67615                     return [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
67616                 }
67617                 if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
67618                     return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
67619                 }
67620                 return allowsStrings
67621                     ? [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true]
67622                     : [ts.Diagnostics.Type_0_is_not_an_array_type, true];
67623             }
67624         }
67625         function isES2015OrLaterIterable(n) {
67626             switch (n) {
67627                 case "Float32Array":
67628                 case "Float64Array":
67629                 case "Int16Array":
67630                 case "Int32Array":
67631                 case "Int8Array":
67632                 case "NodeList":
67633                 case "Uint16Array":
67634                 case "Uint32Array":
67635                 case "Uint8Array":
67636                 case "Uint8ClampedArray":
67637                     return true;
67638             }
67639             return false;
67640         }
67641         function getIterationTypeOfIterable(use, typeKind, inputType, errorNode) {
67642             if (isTypeAny(inputType)) {
67643                 return undefined;
67644             }
67645             var iterationTypes = getIterationTypesOfIterable(inputType, use, errorNode);
67646             return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)];
67647         }
67648         function createIterationTypes(yieldType, returnType, nextType) {
67649             if (yieldType === void 0) { yieldType = neverType; }
67650             if (returnType === void 0) { returnType = neverType; }
67651             if (nextType === void 0) { nextType = unknownType; }
67652             if (yieldType.flags & 67359327 &&
67653                 returnType.flags & (1 | 131072 | 2 | 16384 | 32768) &&
67654                 nextType.flags & (1 | 131072 | 2 | 16384 | 32768)) {
67655                 var id = getTypeListId([yieldType, returnType, nextType]);
67656                 var iterationTypes = iterationTypesCache.get(id);
67657                 if (!iterationTypes) {
67658                     iterationTypes = { yieldType: yieldType, returnType: returnType, nextType: nextType };
67659                     iterationTypesCache.set(id, iterationTypes);
67660                 }
67661                 return iterationTypes;
67662             }
67663             return { yieldType: yieldType, returnType: returnType, nextType: nextType };
67664         }
67665         function combineIterationTypes(array) {
67666             var yieldTypes;
67667             var returnTypes;
67668             var nextTypes;
67669             for (var _i = 0, array_11 = array; _i < array_11.length; _i++) {
67670                 var iterationTypes = array_11[_i];
67671                 if (iterationTypes === undefined || iterationTypes === noIterationTypes) {
67672                     continue;
67673                 }
67674                 if (iterationTypes === anyIterationTypes) {
67675                     return anyIterationTypes;
67676                 }
67677                 yieldTypes = ts.append(yieldTypes, iterationTypes.yieldType);
67678                 returnTypes = ts.append(returnTypes, iterationTypes.returnType);
67679                 nextTypes = ts.append(nextTypes, iterationTypes.nextType);
67680             }
67681             if (yieldTypes || returnTypes || nextTypes) {
67682                 return createIterationTypes(yieldTypes && getUnionType(yieldTypes), returnTypes && getUnionType(returnTypes), nextTypes && getIntersectionType(nextTypes));
67683             }
67684             return noIterationTypes;
67685         }
67686         function getCachedIterationTypes(type, cacheKey) {
67687             return type[cacheKey];
67688         }
67689         function setCachedIterationTypes(type, cacheKey, cachedTypes) {
67690             return type[cacheKey] = cachedTypes;
67691         }
67692         function getIterationTypesOfIterable(type, use, errorNode) {
67693             if (isTypeAny(type)) {
67694                 return anyIterationTypes;
67695             }
67696             if (!(type.flags & 1048576)) {
67697                 var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode);
67698                 if (iterationTypes_1 === noIterationTypes) {
67699                     if (errorNode) {
67700                         reportTypeNotIterableError(errorNode, type, !!(use & 2));
67701                     }
67702                     return undefined;
67703                 }
67704                 return iterationTypes_1;
67705             }
67706             var cacheKey = use & 2 ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable";
67707             var cachedTypes = getCachedIterationTypes(type, cacheKey);
67708             if (cachedTypes)
67709                 return cachedTypes === noIterationTypes ? undefined : cachedTypes;
67710             var allIterationTypes;
67711             for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
67712                 var constituent = _a[_i];
67713                 var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode);
67714                 if (iterationTypes_2 === noIterationTypes) {
67715                     if (errorNode) {
67716                         reportTypeNotIterableError(errorNode, type, !!(use & 2));
67717                     }
67718                     setCachedIterationTypes(type, cacheKey, noIterationTypes);
67719                     return undefined;
67720                 }
67721                 else {
67722                     allIterationTypes = ts.append(allIterationTypes, iterationTypes_2);
67723                 }
67724             }
67725             var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes;
67726             setCachedIterationTypes(type, cacheKey, iterationTypes);
67727             return iterationTypes === noIterationTypes ? undefined : iterationTypes;
67728         }
67729         function getAsyncFromSyncIterationTypes(iterationTypes, errorNode) {
67730             if (iterationTypes === noIterationTypes)
67731                 return noIterationTypes;
67732             if (iterationTypes === anyIterationTypes)
67733                 return anyIterationTypes;
67734             var yieldType = iterationTypes.yieldType, returnType = iterationTypes.returnType, nextType = iterationTypes.nextType;
67735             if (errorNode) {
67736                 getGlobalAwaitedSymbol(true);
67737             }
67738             return createIterationTypes(getAwaitedType(yieldType, errorNode) || anyType, getAwaitedType(returnType, errorNode) || anyType, nextType);
67739         }
67740         function getIterationTypesOfIterableWorker(type, use, errorNode) {
67741             if (isTypeAny(type)) {
67742                 return anyIterationTypes;
67743             }
67744             if (use & 2) {
67745                 var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) ||
67746                     getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
67747                 if (iterationTypes) {
67748                     return use & 8 ?
67749                         getAsyncFromSyncIterationTypes(iterationTypes, errorNode) :
67750                         iterationTypes;
67751                 }
67752             }
67753             if (use & 1) {
67754                 var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) ||
67755                     getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
67756                 if (iterationTypes) {
67757                     if (use & 2) {
67758                         if (iterationTypes !== noIterationTypes) {
67759                             return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", getAsyncFromSyncIterationTypes(iterationTypes, errorNode));
67760                         }
67761                     }
67762                     else {
67763                         return iterationTypes;
67764                     }
67765                 }
67766             }
67767             if (use & 2) {
67768                 var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode);
67769                 if (iterationTypes !== noIterationTypes) {
67770                     return iterationTypes;
67771                 }
67772             }
67773             if (use & 1) {
67774                 var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode);
67775                 if (iterationTypes !== noIterationTypes) {
67776                     if (use & 2) {
67777                         return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes
67778                             ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode)
67779                             : noIterationTypes);
67780                     }
67781                     else {
67782                         return iterationTypes;
67783                     }
67784                 }
67785             }
67786             return noIterationTypes;
67787         }
67788         function getIterationTypesOfIterableCached(type, resolver) {
67789             return getCachedIterationTypes(type, resolver.iterableCacheKey);
67790         }
67791         function getIterationTypesOfGlobalIterableType(globalType, resolver) {
67792             var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) ||
67793                 getIterationTypesOfIterableSlow(globalType, resolver, undefined);
67794             return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
67795         }
67796         function getIterationTypesOfIterableFast(type, resolver) {
67797             var globalType;
67798             if (isReferenceToType(type, globalType = resolver.getGlobalIterableType(false)) ||
67799                 isReferenceToType(type, globalType = resolver.getGlobalIterableIteratorType(false))) {
67800                 var yieldType = getTypeArguments(type)[0];
67801                 var _a = getIterationTypesOfGlobalIterableType(globalType, resolver), returnType = _a.returnType, nextType = _a.nextType;
67802                 return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(yieldType, undefined) || yieldType, resolver.resolveIterationType(returnType, undefined) || returnType, nextType));
67803             }
67804             if (isReferenceToType(type, resolver.getGlobalGeneratorType(false))) {
67805                 var _b = getTypeArguments(type), yieldType = _b[0], returnType = _b[1], nextType = _b[2];
67806                 return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(yieldType, undefined) || yieldType, resolver.resolveIterationType(returnType, undefined) || returnType, nextType));
67807             }
67808         }
67809         function getPropertyNameForKnownSymbolName(symbolName) {
67810             var ctorType = getGlobalESSymbolConstructorSymbol(false);
67811             var uniqueType = ctorType && getTypeOfPropertyOfType(getTypeOfSymbol(ctorType), ts.escapeLeadingUnderscores(symbolName));
67812             return uniqueType && isTypeUsableAsPropertyName(uniqueType) ? getPropertyNameFromType(uniqueType) : "__@".concat(symbolName);
67813         }
67814         function getIterationTypesOfIterableSlow(type, resolver, errorNode) {
67815             var _a;
67816             var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName));
67817             var methodType = method && !(method.flags & 16777216) ? getTypeOfSymbol(method) : undefined;
67818             if (isTypeAny(methodType)) {
67819                 return setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
67820             }
67821             var signatures = methodType ? getSignaturesOfType(methodType, 0) : undefined;
67822             if (!ts.some(signatures)) {
67823                 return setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
67824             }
67825             var iteratorType = getIntersectionType(ts.map(signatures, getReturnTypeOfSignature));
67826             var iterationTypes = (_a = getIterationTypesOfIterator(iteratorType, resolver, errorNode)) !== null && _a !== void 0 ? _a : noIterationTypes;
67827             return setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
67828         }
67829         function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) {
67830             var message = allowAsyncIterables
67831                 ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
67832                 : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
67833             errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
67834         }
67835         function getIterationTypesOfIterator(type, resolver, errorNode) {
67836             if (isTypeAny(type)) {
67837                 return anyIterationTypes;
67838             }
67839             var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) ||
67840                 getIterationTypesOfIteratorFast(type, resolver) ||
67841                 getIterationTypesOfIteratorSlow(type, resolver, errorNode);
67842             return iterationTypes === noIterationTypes ? undefined : iterationTypes;
67843         }
67844         function getIterationTypesOfIteratorCached(type, resolver) {
67845             return getCachedIterationTypes(type, resolver.iteratorCacheKey);
67846         }
67847         function getIterationTypesOfIteratorFast(type, resolver) {
67848             var globalType = resolver.getGlobalIterableIteratorType(false);
67849             if (isReferenceToType(type, globalType)) {
67850                 var yieldType = getTypeArguments(type)[0];
67851                 var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) ||
67852                     getIterationTypesOfIteratorSlow(globalType, resolver, undefined);
67853                 var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType;
67854                 return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
67855             }
67856             if (isReferenceToType(type, resolver.getGlobalIteratorType(false)) ||
67857                 isReferenceToType(type, resolver.getGlobalGeneratorType(false))) {
67858                 var _b = getTypeArguments(type), yieldType = _b[0], returnType = _b[1], nextType = _b[2];
67859                 return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
67860             }
67861         }
67862         function isIteratorResult(type, kind) {
67863             var doneType = getTypeOfPropertyOfType(type, "done") || falseType;
67864             return isTypeAssignableTo(kind === 0 ? falseType : trueType, doneType);
67865         }
67866         function isYieldIteratorResult(type) {
67867             return isIteratorResult(type, 0);
67868         }
67869         function isReturnIteratorResult(type) {
67870             return isIteratorResult(type, 1);
67871         }
67872         function getIterationTypesOfIteratorResult(type) {
67873             if (isTypeAny(type)) {
67874                 return anyIterationTypes;
67875             }
67876             var cachedTypes = getCachedIterationTypes(type, "iterationTypesOfIteratorResult");
67877             if (cachedTypes) {
67878                 return cachedTypes;
67879             }
67880             if (isReferenceToType(type, getGlobalIteratorYieldResultType(false))) {
67881                 var yieldType_1 = getTypeArguments(type)[0];
67882                 return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes(yieldType_1, undefined, undefined));
67883             }
67884             if (isReferenceToType(type, getGlobalIteratorReturnResultType(false))) {
67885                 var returnType_1 = getTypeArguments(type)[0];
67886                 return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes(undefined, returnType_1, undefined));
67887             }
67888             var yieldIteratorResult = filterType(type, isYieldIteratorResult);
67889             var yieldType = yieldIteratorResult !== neverType ? getTypeOfPropertyOfType(yieldIteratorResult, "value") : undefined;
67890             var returnIteratorResult = filterType(type, isReturnIteratorResult);
67891             var returnType = returnIteratorResult !== neverType ? getTypeOfPropertyOfType(returnIteratorResult, "value") : undefined;
67892             if (!yieldType && !returnType) {
67893                 return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", noIterationTypes);
67894             }
67895             return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes(yieldType, returnType || voidType, undefined));
67896         }
67897         function getIterationTypesOfMethod(type, resolver, methodName, errorNode) {
67898             var _a, _b, _c, _d;
67899             var method = getPropertyOfType(type, methodName);
67900             if (!method && methodName !== "next") {
67901                 return undefined;
67902             }
67903             var methodType = method && !(methodName === "next" && (method.flags & 16777216))
67904                 ? methodName === "next" ? getTypeOfSymbol(method) : getTypeWithFacts(getTypeOfSymbol(method), 2097152)
67905                 : undefined;
67906             if (isTypeAny(methodType)) {
67907                 return methodName === "next" ? anyIterationTypes : anyIterationTypesExceptNext;
67908             }
67909             var methodSignatures = methodType ? getSignaturesOfType(methodType, 0) : ts.emptyArray;
67910             if (methodSignatures.length === 0) {
67911                 if (errorNode) {
67912                     var diagnostic = methodName === "next"
67913                         ? resolver.mustHaveANextMethodDiagnostic
67914                         : resolver.mustBeAMethodDiagnostic;
67915                     error(errorNode, diagnostic, methodName);
67916                 }
67917                 return methodName === "next" ? anyIterationTypes : undefined;
67918             }
67919             if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) {
67920                 var globalGeneratorType = resolver.getGlobalGeneratorType(false);
67921                 var globalIteratorType = resolver.getGlobalIteratorType(false);
67922                 var isGeneratorMethod = ((_b = (_a = globalGeneratorType.symbol) === null || _a === void 0 ? void 0 : _a.members) === null || _b === void 0 ? void 0 : _b.get(methodName)) === methodType.symbol;
67923                 var isIteratorMethod = !isGeneratorMethod && ((_d = (_c = globalIteratorType.symbol) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.get(methodName)) === methodType.symbol;
67924                 if (isGeneratorMethod || isIteratorMethod) {
67925                     var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
67926                     var mapper = methodType.mapper;
67927                     return createIterationTypes(getMappedType(globalType.typeParameters[0], mapper), getMappedType(globalType.typeParameters[1], mapper), methodName === "next" ? getMappedType(globalType.typeParameters[2], mapper) : undefined);
67928                 }
67929             }
67930             var methodParameterTypes;
67931             var methodReturnTypes;
67932             for (var _i = 0, methodSignatures_1 = methodSignatures; _i < methodSignatures_1.length; _i++) {
67933                 var signature = methodSignatures_1[_i];
67934                 if (methodName !== "throw" && ts.some(signature.parameters)) {
67935                     methodParameterTypes = ts.append(methodParameterTypes, getTypeAtPosition(signature, 0));
67936                 }
67937                 methodReturnTypes = ts.append(methodReturnTypes, getReturnTypeOfSignature(signature));
67938             }
67939             var returnTypes;
67940             var nextType;
67941             if (methodName !== "throw") {
67942                 var methodParameterType = methodParameterTypes ? getUnionType(methodParameterTypes) : unknownType;
67943                 if (methodName === "next") {
67944                     nextType = methodParameterType;
67945                 }
67946                 else if (methodName === "return") {
67947                     var resolvedMethodParameterType = resolver.resolveIterationType(methodParameterType, errorNode) || anyType;
67948                     returnTypes = ts.append(returnTypes, resolvedMethodParameterType);
67949                 }
67950             }
67951             var yieldType;
67952             var methodReturnType = methodReturnTypes ? getIntersectionType(methodReturnTypes) : neverType;
67953             var resolvedMethodReturnType = resolver.resolveIterationType(methodReturnType, errorNode) || anyType;
67954             var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType);
67955             if (iterationTypes === noIterationTypes) {
67956                 if (errorNode) {
67957                     error(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
67958                 }
67959                 yieldType = anyType;
67960                 returnTypes = ts.append(returnTypes, anyType);
67961             }
67962             else {
67963                 yieldType = iterationTypes.yieldType;
67964                 returnTypes = ts.append(returnTypes, iterationTypes.returnType);
67965             }
67966             return createIterationTypes(yieldType, getUnionType(returnTypes), nextType);
67967         }
67968         function getIterationTypesOfIteratorSlow(type, resolver, errorNode) {
67969             var iterationTypes = combineIterationTypes([
67970                 getIterationTypesOfMethod(type, resolver, "next", errorNode),
67971                 getIterationTypesOfMethod(type, resolver, "return", errorNode),
67972                 getIterationTypesOfMethod(type, resolver, "throw", errorNode),
67973             ]);
67974             return setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
67975         }
67976         function getIterationTypeOfGeneratorFunctionReturnType(kind, returnType, isAsyncGenerator) {
67977             if (isTypeAny(returnType)) {
67978                 return undefined;
67979             }
67980             var iterationTypes = getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsyncGenerator);
67981             return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(kind)];
67982         }
67983         function getIterationTypesOfGeneratorFunctionReturnType(type, isAsyncGenerator) {
67984             if (isTypeAny(type)) {
67985                 return anyIterationTypes;
67986             }
67987             var use = isAsyncGenerator ? 2 : 1;
67988             var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
67989             return getIterationTypesOfIterable(type, use, undefined) ||
67990                 getIterationTypesOfIterator(type, resolver, undefined);
67991         }
67992         function checkBreakOrContinueStatement(node) {
67993             if (!checkGrammarStatementInAmbientContext(node))
67994                 checkGrammarBreakOrContinueStatement(node);
67995         }
67996         function unwrapReturnType(returnType, functionFlags) {
67997             var isGenerator = !!(functionFlags & 1);
67998             var isAsync = !!(functionFlags & 2);
67999             return isGenerator ? getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync) || errorType :
68000                 isAsync ? getAwaitedTypeNoAlias(returnType) || errorType :
68001                     returnType;
68002         }
68003         function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
68004             var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
68005             return !!unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 16384 | 3);
68006         }
68007         function checkReturnStatement(node) {
68008             var _a;
68009             if (checkGrammarStatementInAmbientContext(node)) {
68010                 return;
68011             }
68012             var container = ts.getContainingFunctionOrClassStaticBlock(node);
68013             if (container && ts.isClassStaticBlockDeclaration(container)) {
68014                 grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block);
68015                 return;
68016             }
68017             if (!container) {
68018                 grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);
68019                 return;
68020             }
68021             var signature = getSignatureFromDeclaration(container);
68022             var returnType = getReturnTypeOfSignature(signature);
68023             var functionFlags = ts.getFunctionFlags(container);
68024             if (strictNullChecks || node.expression || returnType.flags & 131072) {
68025                 var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
68026                 if (container.kind === 172) {
68027                     if (node.expression) {
68028                         error(node, ts.Diagnostics.Setters_cannot_return_a_value);
68029                     }
68030                 }
68031                 else if (container.kind === 170) {
68032                     if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
68033                         error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
68034                     }
68035                 }
68036                 else if (getReturnTypeFromAnnotation(container)) {
68037                     var unwrappedReturnType = (_a = unwrapReturnType(returnType, functionFlags)) !== null && _a !== void 0 ? _a : returnType;
68038                     var unwrappedExprType = functionFlags & 2
68039                         ? checkAwaitedType(exprType, false, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)
68040                         : exprType;
68041                     if (unwrappedReturnType) {
68042                         checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression);
68043                     }
68044                 }
68045             }
68046             else if (container.kind !== 170 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) {
68047                 error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
68048             }
68049         }
68050         function checkWithStatement(node) {
68051             if (!checkGrammarStatementInAmbientContext(node)) {
68052                 if (node.flags & 32768) {
68053                     grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block);
68054                 }
68055             }
68056             checkExpression(node.expression);
68057             var sourceFile = ts.getSourceFileOfNode(node);
68058             if (!hasParseDiagnostics(sourceFile)) {
68059                 var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start;
68060                 var end = node.statement.pos;
68061                 grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any);
68062             }
68063         }
68064         function checkSwitchStatement(node) {
68065             checkGrammarStatementInAmbientContext(node);
68066             var firstDefaultClause;
68067             var hasDuplicateDefaultClause = false;
68068             var expressionType = checkExpression(node.expression);
68069             var expressionIsLiteral = isLiteralType(expressionType);
68070             ts.forEach(node.caseBlock.clauses, function (clause) {
68071                 if (clause.kind === 289 && !hasDuplicateDefaultClause) {
68072                     if (firstDefaultClause === undefined) {
68073                         firstDefaultClause = clause;
68074                     }
68075                     else {
68076                         grammarErrorOnNode(clause, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement);
68077                         hasDuplicateDefaultClause = true;
68078                     }
68079                 }
68080                 if (produceDiagnostics && clause.kind === 288) {
68081                     var caseType = checkExpression(clause.expression);
68082                     var caseIsLiteral = isLiteralType(caseType);
68083                     var comparedExpressionType = expressionType;
68084                     if (!caseIsLiteral || !expressionIsLiteral) {
68085                         caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
68086                         comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
68087                     }
68088                     if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
68089                         checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, undefined);
68090                     }
68091                 }
68092                 ts.forEach(clause.statements, checkSourceElement);
68093                 if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
68094                     error(clause, ts.Diagnostics.Fallthrough_case_in_switch);
68095                 }
68096             });
68097             if (node.caseBlock.locals) {
68098                 registerForUnusedIdentifiersCheck(node.caseBlock);
68099             }
68100         }
68101         function checkLabeledStatement(node) {
68102             if (!checkGrammarStatementInAmbientContext(node)) {
68103                 ts.findAncestor(node.parent, function (current) {
68104                     if (ts.isFunctionLike(current)) {
68105                         return "quit";
68106                     }
68107                     if (current.kind === 249 && current.label.escapedText === node.label.escapedText) {
68108                         grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
68109                         return true;
68110                     }
68111                     return false;
68112                 });
68113             }
68114             checkSourceElement(node.statement);
68115         }
68116         function checkThrowStatement(node) {
68117             if (!checkGrammarStatementInAmbientContext(node)) {
68118                 if (ts.isIdentifier(node.expression) && !node.expression.escapedText) {
68119                     grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here);
68120                 }
68121             }
68122             if (node.expression) {
68123                 checkExpression(node.expression);
68124             }
68125         }
68126         function checkTryStatement(node) {
68127             checkGrammarStatementInAmbientContext(node);
68128             checkBlock(node.tryBlock);
68129             var catchClause = node.catchClause;
68130             if (catchClause) {
68131                 if (catchClause.variableDeclaration) {
68132                     var declaration = catchClause.variableDeclaration;
68133                     var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
68134                     if (typeNode) {
68135                         var type = getTypeForVariableLikeDeclaration(declaration, false);
68136                         if (type && !(type.flags & 3)) {
68137                             grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
68138                         }
68139                     }
68140                     else if (declaration.initializer) {
68141                         grammarErrorOnFirstToken(declaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);
68142                     }
68143                     else {
68144                         var blockLocals_1 = catchClause.block.locals;
68145                         if (blockLocals_1) {
68146                             ts.forEachKey(catchClause.locals, function (caughtName) {
68147                                 var blockLocal = blockLocals_1.get(caughtName);
68148                                 if ((blockLocal === null || blockLocal === void 0 ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2) !== 0) {
68149                                     grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
68150                                 }
68151                             });
68152                         }
68153                     }
68154                 }
68155                 checkBlock(catchClause.block);
68156             }
68157             if (node.finallyBlock) {
68158                 checkBlock(node.finallyBlock);
68159             }
68160         }
68161         function checkIndexConstraints(type, symbol, isStaticIndex) {
68162             var indexInfos = getIndexInfosOfType(type);
68163             if (indexInfos.length === 0) {
68164                 return;
68165             }
68166             for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {
68167                 var prop = _a[_i];
68168                 if (!(isStaticIndex && prop.flags & 4194304)) {
68169                     checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty(prop, 8576, true), getNonMissingTypeOfSymbol(prop));
68170                 }
68171             }
68172             var typeDeclaration = symbol.valueDeclaration;
68173             if (typeDeclaration && ts.isClassLike(typeDeclaration)) {
68174                 for (var _b = 0, _c = typeDeclaration.members; _b < _c.length; _b++) {
68175                     var member = _c[_b];
68176                     if (!ts.isStatic(member) && !hasBindableName(member)) {
68177                         var symbol_3 = getSymbolOfNode(member);
68178                         checkIndexConstraintForProperty(type, symbol_3, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol_3));
68179                     }
68180                 }
68181             }
68182             if (indexInfos.length > 1) {
68183                 for (var _d = 0, indexInfos_6 = indexInfos; _d < indexInfos_6.length; _d++) {
68184                     var info = indexInfos_6[_d];
68185                     checkIndexConstraintForIndexSignature(type, info);
68186                 }
68187             }
68188         }
68189         function checkIndexConstraintForProperty(type, prop, propNameType, propType) {
68190             var declaration = prop.valueDeclaration;
68191             var name = ts.getNameOfDeclaration(declaration);
68192             if (name && ts.isPrivateIdentifier(name)) {
68193                 return;
68194             }
68195             var indexInfos = getApplicableIndexInfos(type, propNameType);
68196             var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 257) : undefined;
68197             var localPropDeclaration = declaration && declaration.kind === 220 ||
68198                 name && name.kind === 161 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
68199             var _loop_27 = function (info) {
68200                 var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
68201                 var errorNode = localPropDeclaration || localIndexDeclaration ||
68202                     (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
68203                 if (errorNode && !isTypeAssignableTo(propType, info.type)) {
68204                     error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
68205                 }
68206             };
68207             for (var _i = 0, indexInfos_7 = indexInfos; _i < indexInfos_7.length; _i++) {
68208                 var info = indexInfos_7[_i];
68209                 _loop_27(info);
68210             }
68211         }
68212         function checkIndexConstraintForIndexSignature(type, checkInfo) {
68213             var declaration = checkInfo.declaration;
68214             var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
68215             var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 257) : undefined;
68216             var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
68217             var _loop_28 = function (info) {
68218                 if (info === checkInfo)
68219                     return "continue";
68220                 var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
68221                 var errorNode = localCheckDeclaration || localIndexDeclaration ||
68222                     (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
68223                 if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
68224                     error(errorNode, ts.Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
68225                 }
68226             };
68227             for (var _i = 0, indexInfos_8 = indexInfos; _i < indexInfos_8.length; _i++) {
68228                 var info = indexInfos_8[_i];
68229                 _loop_28(info);
68230             }
68231         }
68232         function checkTypeNameIsReserved(name, message) {
68233             switch (name.escapedText) {
68234                 case "any":
68235                 case "unknown":
68236                 case "never":
68237                 case "number":
68238                 case "bigint":
68239                 case "boolean":
68240                 case "string":
68241                 case "symbol":
68242                 case "void":
68243                 case "object":
68244                     error(name, message, name.escapedText);
68245             }
68246         }
68247         function checkClassNameCollisionWithObject(name) {
68248             if (languageVersion >= 1 && name.escapedText === "Object"
68249                 && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(name).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
68250                 error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]);
68251             }
68252         }
68253         function checkTypeParameters(typeParameterDeclarations) {
68254             if (typeParameterDeclarations) {
68255                 var seenDefault = false;
68256                 for (var i = 0; i < typeParameterDeclarations.length; i++) {
68257                     var node = typeParameterDeclarations[i];
68258                     checkTypeParameter(node);
68259                     if (produceDiagnostics) {
68260                         if (node.default) {
68261                             seenDefault = true;
68262                             checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
68263                         }
68264                         else if (seenDefault) {
68265                             error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
68266                         }
68267                         for (var j = 0; j < i; j++) {
68268                             if (typeParameterDeclarations[j].symbol === node.symbol) {
68269                                 error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));
68270                             }
68271                         }
68272                     }
68273                 }
68274             }
68275         }
68276         function checkTypeParametersNotReferenced(root, typeParameters, index) {
68277             visit(root);
68278             function visit(node) {
68279                 if (node.kind === 177) {
68280                     var type = getTypeFromTypeReference(node);
68281                     if (type.flags & 262144) {
68282                         for (var i = index; i < typeParameters.length; i++) {
68283                             if (type.symbol === getSymbolOfNode(typeParameters[i])) {
68284                                 error(node, ts.Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
68285                             }
68286                         }
68287                     }
68288                 }
68289                 ts.forEachChild(node, visit);
68290             }
68291         }
68292         function checkTypeParameterListsIdentical(symbol) {
68293             if (symbol.declarations && symbol.declarations.length === 1) {
68294                 return;
68295             }
68296             var links = getSymbolLinks(symbol);
68297             if (!links.typeParametersChecked) {
68298                 links.typeParametersChecked = true;
68299                 var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol);
68300                 if (!declarations || declarations.length <= 1) {
68301                     return;
68302                 }
68303                 var type = getDeclaredTypeOfSymbol(symbol);
68304                 if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) {
68305                     var name = symbolToString(symbol);
68306                     for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
68307                         var declaration = declarations_6[_i];
68308                         error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name);
68309                     }
68310                 }
68311             }
68312         }
68313         function areTypeParametersIdentical(declarations, targetParameters) {
68314             var maxTypeArgumentCount = ts.length(targetParameters);
68315             var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
68316             for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
68317                 var declaration = declarations_7[_i];
68318                 var sourceParameters = ts.getEffectiveTypeParameterDeclarations(declaration);
68319                 var numTypeParameters = sourceParameters.length;
68320                 if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
68321                     return false;
68322                 }
68323                 for (var i = 0; i < numTypeParameters; i++) {
68324                     var source = sourceParameters[i];
68325                     var target = targetParameters[i];
68326                     if (source.name.escapedText !== target.symbol.escapedName) {
68327                         return false;
68328                     }
68329                     var constraint = ts.getEffectiveConstraintOfTypeParameter(source);
68330                     var sourceConstraint = constraint && getTypeFromTypeNode(constraint);
68331                     var targetConstraint = getConstraintOfTypeParameter(target);
68332                     if (sourceConstraint && targetConstraint && !isTypeIdenticalTo(sourceConstraint, targetConstraint)) {
68333                         return false;
68334                     }
68335                     var sourceDefault = source.default && getTypeFromTypeNode(source.default);
68336                     var targetDefault = getDefaultFromTypeParameter(target);
68337                     if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) {
68338                         return false;
68339                     }
68340                 }
68341             }
68342             return true;
68343         }
68344         function checkClassExpression(node) {
68345             checkClassLikeDeclaration(node);
68346             checkNodeDeferred(node);
68347             return getTypeOfSymbol(getSymbolOfNode(node));
68348         }
68349         function checkClassExpressionDeferred(node) {
68350             ts.forEach(node.members, checkSourceElement);
68351             registerForUnusedIdentifiersCheck(node);
68352         }
68353         function checkClassDeclaration(node) {
68354             if (ts.some(node.decorators) && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) {
68355                 grammarErrorOnNode(node.decorators[0], ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator);
68356             }
68357             if (!node.name && !ts.hasSyntacticModifier(node, 512)) {
68358                 grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
68359             }
68360             checkClassLikeDeclaration(node);
68361             ts.forEach(node.members, checkSourceElement);
68362             registerForUnusedIdentifiersCheck(node);
68363         }
68364         function checkClassLikeDeclaration(node) {
68365             checkGrammarClassLikeDeclaration(node);
68366             checkDecorators(node);
68367             checkCollisionsForDeclarationName(node, node.name);
68368             checkTypeParameters(ts.getEffectiveTypeParameterDeclarations(node));
68369             checkExportsOnMergedDeclarations(node);
68370             var symbol = getSymbolOfNode(node);
68371             var type = getDeclaredTypeOfSymbol(symbol);
68372             var typeWithThis = getTypeWithThisArgument(type);
68373             var staticType = getTypeOfSymbol(symbol);
68374             checkTypeParameterListsIdentical(symbol);
68375             checkFunctionOrConstructorSymbol(symbol);
68376             checkClassForDuplicateDeclarations(node);
68377             var nodeInAmbientContext = !!(node.flags & 8388608);
68378             if (!nodeInAmbientContext) {
68379                 checkClassForStaticPropertyNameConflicts(node);
68380             }
68381             var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
68382             if (baseTypeNode) {
68383                 ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
68384                 if (languageVersion < 2) {
68385                     checkExternalEmitHelpers(baseTypeNode.parent, 1);
68386                 }
68387                 var extendsNode = ts.getClassExtendsHeritageElement(node);
68388                 if (extendsNode && extendsNode !== baseTypeNode) {
68389                     checkExpression(extendsNode.expression);
68390                 }
68391                 var baseTypes = getBaseTypes(type);
68392                 if (baseTypes.length && produceDiagnostics) {
68393                     var baseType_1 = baseTypes[0];
68394                     var baseConstructorType = getBaseConstructorTypeOfClass(type);
68395                     var staticBaseType = getApparentType(baseConstructorType);
68396                     checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
68397                     checkSourceElement(baseTypeNode.expression);
68398                     if (ts.some(baseTypeNode.typeArguments)) {
68399                         ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
68400                         for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
68401                             var constructor = _a[_i];
68402                             if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) {
68403                                 break;
68404                             }
68405                         }
68406                     }
68407                     var baseWithThis = getTypeWithThisArgument(baseType_1, type.thisType);
68408                     if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
68409                         issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);
68410                     }
68411                     else {
68412                         checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
68413                     }
68414                     if (baseConstructorType.flags & 8650752) {
68415                         if (!isMixinConstructorType(staticType)) {
68416                             error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
68417                         }
68418                         else {
68419                             var constructSignatures = getSignaturesOfType(baseConstructorType, 1);
68420                             if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 128)) {
68421                                 error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
68422                             }
68423                         }
68424                     }
68425                     if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 8650752)) {
68426                         var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
68427                         if (ts.forEach(constructors, function (sig) { return !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType_1); })) {
68428                             error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);
68429                         }
68430                     }
68431                     checkKindsOfPropertyMemberOverrides(type, baseType_1);
68432                 }
68433             }
68434             checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
68435             var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
68436             if (implementedTypeNodes) {
68437                 for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
68438                     var typeRefNode = implementedTypeNodes_1[_b];
68439                     if (!ts.isEntityNameExpression(typeRefNode.expression) || ts.isOptionalChain(typeRefNode.expression)) {
68440                         error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
68441                     }
68442                     checkTypeReferenceNode(typeRefNode);
68443                     if (produceDiagnostics) {
68444                         var t = getReducedType(getTypeFromTypeNode(typeRefNode));
68445                         if (!isErrorType(t)) {
68446                             if (isValidBaseType(t)) {
68447                                 var genericDiag = t.symbol && t.symbol.flags & 32 ?
68448                                     ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
68449                                     ts.Diagnostics.Class_0_incorrectly_implements_interface_1;
68450                                 var baseWithThis = getTypeWithThisArgument(t, type.thisType);
68451                                 if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
68452                                     issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
68453                                 }
68454                             }
68455                             else {
68456                                 error(typeRefNode, ts.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
68457                             }
68458                         }
68459                     }
68460                 }
68461             }
68462             if (produceDiagnostics) {
68463                 checkIndexConstraints(type, symbol);
68464                 checkIndexConstraints(staticType, symbol, true);
68465                 checkTypeForDuplicateIndexSignatures(node);
68466                 checkPropertyInitialization(node);
68467             }
68468         }
68469         function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
68470             var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
68471             var baseTypes = baseTypeNode && getBaseTypes(type);
68472             var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
68473             var baseStaticType = getBaseConstructorTypeOfClass(type);
68474             var _loop_29 = function (member) {
68475                 if (ts.hasAmbientModifier(member)) {
68476                     return "continue";
68477                 }
68478                 if (ts.isConstructorDeclaration(member)) {
68479                     ts.forEach(member.parameters, function (param) {
68480                         if (ts.isParameterPropertyDeclaration(param, member)) {
68481                             checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param, true);
68482                         }
68483                     });
68484                 }
68485                 checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, false);
68486             };
68487             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
68488                 var member = _a[_i];
68489                 _loop_29(member);
68490             }
68491         }
68492         function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
68493             if (reportErrors === void 0) { reportErrors = true; }
68494             var declaredProp = member.name
68495                 && getSymbolAtLocation(member.name)
68496                 || getSymbolAtLocation(member);
68497             if (!declaredProp) {
68498                 return 0;
68499             }
68500             return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
68501         }
68502         function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
68503             var isJs = ts.isInJSFile(node);
68504             var nodeInAmbientContext = !!(node.flags & 8388608);
68505             if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
68506                 var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
68507                 var thisType = memberIsStatic ? staticType : typeWithThis;
68508                 var baseType = memberIsStatic ? baseStaticType : baseWithThis;
68509                 var prop = getPropertyOfType(thisType, memberEscapedName);
68510                 var baseProp = getPropertyOfType(baseType, memberEscapedName);
68511                 var baseClassName = typeToString(baseWithThis);
68512                 if (prop && !baseProp && memberHasOverrideModifier) {
68513                     if (errorNode) {
68514                         var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
68515                         suggestion ?
68516                             error(errorNode, isJs ?
68517                                 ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
68518                                 ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
68519                             error(errorNode, isJs ?
68520                                 ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
68521                                 ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
68522                     }
68523                     return 2;
68524                 }
68525                 else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
68526                     var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
68527                     if (memberHasOverrideModifier) {
68528                         return 0;
68529                     }
68530                     if (!baseHasAbstract) {
68531                         if (errorNode) {
68532                             var diag = memberIsParameterProperty ?
68533                                 isJs ?
68534                                     ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
68535                                     ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
68536                                 isJs ?
68537                                     ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
68538                                     ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
68539                             error(errorNode, diag, baseClassName);
68540                         }
68541                         return 1;
68542                     }
68543                     else if (memberHasAbstractModifier && baseHasAbstract) {
68544                         if (errorNode) {
68545                             error(errorNode, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
68546                         }
68547                         return 1;
68548                     }
68549                 }
68550             }
68551             else if (memberHasOverrideModifier) {
68552                 if (errorNode) {
68553                     var className = typeToString(type);
68554                     error(errorNode, isJs ?
68555                         ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
68556                         ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
68557                 }
68558                 return 2;
68559             }
68560             return 0;
68561         }
68562         function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
68563             var issuedMemberError = false;
68564             var _loop_30 = function (member) {
68565                 if (ts.isStatic(member)) {
68566                     return "continue";
68567                 }
68568                 var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
68569                 if (declaredProp) {
68570                     var prop = getPropertyOfType(typeWithThis, declaredProp.escapedName);
68571                     var baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName);
68572                     if (prop && baseProp) {
68573                         var rootChain = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)); };
68574                         if (!checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(baseProp), member.name || member, undefined, rootChain)) {
68575                             issuedMemberError = true;
68576                         }
68577                     }
68578                 }
68579             };
68580             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
68581                 var member = _a[_i];
68582                 _loop_30(member);
68583             }
68584             if (!issuedMemberError) {
68585                 checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
68586             }
68587         }
68588         function checkBaseTypeAccessibility(type, node) {
68589             var signatures = getSignaturesOfType(type, 1);
68590             if (signatures.length) {
68591                 var declaration = signatures[0].declaration;
68592                 if (declaration && ts.hasEffectiveModifier(declaration, 8)) {
68593                     var typeClassDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol);
68594                     if (!isNodeWithinClass(node, typeClassDeclaration)) {
68595                         error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol));
68596                     }
68597                 }
68598             }
68599         }
68600         function getMemberOverrideModifierStatus(node, member) {
68601             if (!member.name) {
68602                 return 0;
68603             }
68604             var symbol = getSymbolOfNode(node);
68605             var type = getDeclaredTypeOfSymbol(symbol);
68606             var typeWithThis = getTypeWithThisArgument(type);
68607             var staticType = getTypeOfSymbol(symbol);
68608             var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
68609             var baseTypes = baseTypeNode && getBaseTypes(type);
68610             var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
68611             var baseStaticType = getBaseConstructorTypeOfClass(type);
68612             var memberHasOverrideModifier = member.parent
68613                 ? ts.hasOverrideModifier(member)
68614                 : ts.hasSyntacticModifier(member, 16384);
68615             var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
68616             return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member), false, memberName);
68617         }
68618         function getTargetSymbol(s) {
68619             return ts.getCheckFlags(s) & 1 ? s.target : s;
68620         }
68621         function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
68622             return ts.filter(symbol.declarations, function (d) {
68623                 return d.kind === 256 || d.kind === 257;
68624             });
68625         }
68626         function checkKindsOfPropertyMemberOverrides(type, baseType) {
68627             var _a, _b;
68628             var baseProperties = getPropertiesOfType(baseType);
68629             basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
68630                 var baseProperty = baseProperties_1[_i];
68631                 var base = getTargetSymbol(baseProperty);
68632                 if (base.flags & 4194304) {
68633                     continue;
68634                 }
68635                 var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
68636                 if (!baseSymbol) {
68637                     continue;
68638                 }
68639                 var derived = getTargetSymbol(baseSymbol);
68640                 var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
68641                 ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
68642                 if (derived === base) {
68643                     var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
68644                     if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128))) {
68645                         for (var _c = 0, _d = getBaseTypes(type); _c < _d.length; _c++) {
68646                             var otherBaseType = _d[_c];
68647                             if (otherBaseType === baseType)
68648                                 continue;
68649                             var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
68650                             var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
68651                             if (derivedElsewhere && derivedElsewhere !== base) {
68652                                 continue basePropertyCheck;
68653                             }
68654                         }
68655                         if (derivedClassDecl.kind === 225) {
68656                             error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
68657                         }
68658                         else {
68659                             error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType));
68660                         }
68661                     }
68662                 }
68663                 else {
68664                     var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
68665                     if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) {
68666                         continue;
68667                     }
68668                     var errorMessage = void 0;
68669                     var basePropertyFlags = base.flags & 98308;
68670                     var derivedPropertyFlags = derived.flags & 98308;
68671                     if (basePropertyFlags && derivedPropertyFlags) {
68672                         if (baseDeclarationFlags & 128 && !(base.valueDeclaration && ts.isPropertyDeclaration(base.valueDeclaration) && base.valueDeclaration.initializer)
68673                             || base.valueDeclaration && base.valueDeclaration.parent.kind === 257
68674                             || derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
68675                             continue;
68676                         }
68677                         var overriddenInstanceProperty = basePropertyFlags !== 4 && derivedPropertyFlags === 4;
68678                         var overriddenInstanceAccessor = basePropertyFlags === 4 && derivedPropertyFlags !== 4;
68679                         if (overriddenInstanceProperty || overriddenInstanceAccessor) {
68680                             var errorMessage_1 = overriddenInstanceProperty ?
68681                                 ts.Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property :
68682                                 ts.Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor;
68683                             error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
68684                         }
68685                         else if (useDefineForClassFields) {
68686                             var uninitialized = (_a = derived.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 166 && !d.initializer; });
68687                             if (uninitialized
68688                                 && !(derived.flags & 33554432)
68689                                 && !(baseDeclarationFlags & 128)
68690                                 && !(derivedDeclarationFlags & 128)
68691                                 && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 8388608); }))) {
68692                                 var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
68693                                 var propName = uninitialized.name;
68694                                 if (uninitialized.exclamationToken
68695                                     || !constructor
68696                                     || !ts.isIdentifier(propName)
68697                                     || !strictNullChecks
68698                                     || !isPropertyInitializedInConstructor(propName, type, constructor)) {
68699                                     var errorMessage_2 = ts.Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration;
68700                                     error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_2, symbolToString(base), typeToString(baseType));
68701                                 }
68702                             }
68703                         }
68704                         continue;
68705                     }
68706                     else if (isPrototypeProperty(base)) {
68707                         if (isPrototypeProperty(derived) || derived.flags & 4) {
68708                             continue;
68709                         }
68710                         else {
68711                             ts.Debug.assert(!!(derived.flags & 98304));
68712                             errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
68713                         }
68714                     }
68715                     else if (base.flags & 98304) {
68716                         errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
68717                     }
68718                     else {
68719                         errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
68720                     }
68721                     error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
68722                 }
68723             }
68724         }
68725         function getNonInterhitedProperties(type, baseTypes, properties) {
68726             if (!ts.length(baseTypes)) {
68727                 return properties;
68728             }
68729             var seen = new ts.Map();
68730             ts.forEach(properties, function (p) {
68731                 seen.set(p.escapedName, p);
68732             });
68733             for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
68734                 var base = baseTypes_2[_i];
68735                 var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
68736                 for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
68737                     var prop = properties_4[_a];
68738                     var existing = seen.get(prop.escapedName);
68739                     if (existing && !isPropertyIdenticalTo(existing, prop)) {
68740                         seen.delete(prop.escapedName);
68741                     }
68742                 }
68743             }
68744             return ts.arrayFrom(seen.values());
68745         }
68746         function checkInheritedPropertiesAreIdentical(type, typeNode) {
68747             var baseTypes = getBaseTypes(type);
68748             if (baseTypes.length < 2) {
68749                 return true;
68750             }
68751             var seen = new ts.Map();
68752             ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) {
68753                 seen.set(p.escapedName, { prop: p, containingType: type });
68754             });
68755             var ok = true;
68756             for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
68757                 var base = baseTypes_3[_i];
68758                 var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
68759                 for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
68760                     var prop = properties_6[_a];
68761                     var existing = seen.get(prop.escapedName);
68762                     if (!existing) {
68763                         seen.set(prop.escapedName, { prop: prop, containingType: base });
68764                     }
68765                     else {
68766                         var isInheritedProperty = existing.containingType !== type;
68767                         if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) {
68768                             ok = false;
68769                             var typeName1 = typeToString(existing.containingType);
68770                             var typeName2 = typeToString(base);
68771                             var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2);
68772                             errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2);
68773                             diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo));
68774                         }
68775                     }
68776                 }
68777             }
68778             return ok;
68779         }
68780         function checkPropertyInitialization(node) {
68781             if (!strictNullChecks || !strictPropertyInitialization || node.flags & 8388608) {
68782                 return;
68783             }
68784             var constructor = findConstructorDeclaration(node);
68785             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
68786                 var member = _a[_i];
68787                 if (ts.getEffectiveModifierFlags(member) & 2) {
68788                     continue;
68789                 }
68790                 if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
68791                     var propName = member.name;
68792                     if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
68793                         var type = getTypeOfSymbol(getSymbolOfNode(member));
68794                         if (!(type.flags & 3 || getFalsyFlags(type) & 32768)) {
68795                             if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
68796                                 error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
68797                             }
68798                         }
68799                     }
68800                 }
68801             }
68802         }
68803         function isPropertyWithoutInitializer(node) {
68804             return node.kind === 166 &&
68805                 !ts.hasAbstractModifier(node) &&
68806                 !node.exclamationToken &&
68807                 !node.initializer;
68808         }
68809         function isPropertyInitializedInStaticBlocks(propName, propType, staticBlocks, startPos, endPos) {
68810             for (var _i = 0, staticBlocks_2 = staticBlocks; _i < staticBlocks_2.length; _i++) {
68811                 var staticBlock = staticBlocks_2[_i];
68812                 if (staticBlock.pos >= startPos && staticBlock.pos <= endPos) {
68813                     var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
68814                     ts.setParent(reference.expression, reference);
68815                     ts.setParent(reference, staticBlock);
68816                     reference.flowNode = staticBlock.returnFlowNode;
68817                     var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
68818                     if (!(getFalsyFlags(flowType) & 32768)) {
68819                         return true;
68820                     }
68821                 }
68822             }
68823             return false;
68824         }
68825         function isPropertyInitializedInConstructor(propName, propType, constructor) {
68826             var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
68827             ts.setParent(reference.expression, reference);
68828             ts.setParent(reference, constructor);
68829             reference.flowNode = constructor.returnFlowNode;
68830             var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
68831             return !(getFalsyFlags(flowType) & 32768);
68832         }
68833         function checkInterfaceDeclaration(node) {
68834             if (!checkGrammarDecoratorsAndModifiers(node))
68835                 checkGrammarInterfaceDeclaration(node);
68836             checkTypeParameters(node.typeParameters);
68837             if (produceDiagnostics) {
68838                 checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);
68839                 checkExportsOnMergedDeclarations(node);
68840                 var symbol = getSymbolOfNode(node);
68841                 checkTypeParameterListsIdentical(symbol);
68842                 var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 257);
68843                 if (node === firstInterfaceDecl) {
68844                     var type = getDeclaredTypeOfSymbol(symbol);
68845                     var typeWithThis = getTypeWithThisArgument(type);
68846                     if (checkInheritedPropertiesAreIdentical(type, node.name)) {
68847                         for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) {
68848                             var baseType = _a[_i];
68849                             checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1);
68850                         }
68851                         checkIndexConstraints(type, symbol);
68852                     }
68853                 }
68854                 checkObjectTypeForDuplicateDeclarations(node);
68855             }
68856             ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
68857                 if (!ts.isEntityNameExpression(heritageElement.expression) || ts.isOptionalChain(heritageElement.expression)) {
68858                     error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
68859                 }
68860                 checkTypeReferenceNode(heritageElement);
68861             });
68862             ts.forEach(node.members, checkSourceElement);
68863             if (produceDiagnostics) {
68864                 checkTypeForDuplicateIndexSignatures(node);
68865                 registerForUnusedIdentifiersCheck(node);
68866             }
68867         }
68868         function checkTypeAliasDeclaration(node) {
68869             checkGrammarDecoratorsAndModifiers(node);
68870             checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0);
68871             checkExportsOnMergedDeclarations(node);
68872             checkTypeParameters(node.typeParameters);
68873             if (node.type.kind === 138) {
68874                 if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) {
68875                     error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
68876                 }
68877             }
68878             else {
68879                 checkSourceElement(node.type);
68880                 registerForUnusedIdentifiersCheck(node);
68881             }
68882         }
68883         function computeEnumMemberValues(node) {
68884             var nodeLinks = getNodeLinks(node);
68885             if (!(nodeLinks.flags & 16384)) {
68886                 nodeLinks.flags |= 16384;
68887                 var autoValue = 0;
68888                 for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
68889                     var member = _a[_i];
68890                     var value = computeMemberValue(member, autoValue);
68891                     getNodeLinks(member).enumMemberValue = value;
68892                     autoValue = typeof value === "number" ? value + 1 : undefined;
68893                 }
68894             }
68895         }
68896         function computeMemberValue(member, autoValue) {
68897             if (ts.isComputedNonLiteralName(member.name)) {
68898                 error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums);
68899             }
68900             else {
68901                 var text = ts.getTextOfPropertyName(member.name);
68902                 if (isNumericLiteralName(text) && !ts.isInfinityOrNaNString(text)) {
68903                     error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);
68904                 }
68905             }
68906             if (member.initializer) {
68907                 return computeConstantValue(member);
68908             }
68909             if (member.parent.flags & 8388608 && !ts.isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === 0) {
68910                 return undefined;
68911             }
68912             if (autoValue !== undefined) {
68913                 return autoValue;
68914             }
68915             error(member.name, ts.Diagnostics.Enum_member_must_have_initializer);
68916             return undefined;
68917         }
68918         function computeConstantValue(member) {
68919             var enumKind = getEnumKind(getSymbolOfNode(member.parent));
68920             var isConstEnum = ts.isEnumConst(member.parent);
68921             var initializer = member.initializer;
68922             var value = enumKind === 1 && !isLiteralEnumMember(member) ? undefined : evaluate(initializer);
68923             if (value !== undefined) {
68924                 if (isConstEnum && typeof value === "number" && !isFinite(value)) {
68925                     error(initializer, isNaN(value) ?
68926                         ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN :
68927                         ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);
68928                 }
68929             }
68930             else if (enumKind === 1) {
68931                 error(initializer, ts.Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members);
68932                 return 0;
68933             }
68934             else if (isConstEnum) {
68935                 error(initializer, ts.Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values);
68936             }
68937             else if (member.parent.flags & 8388608) {
68938                 error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
68939             }
68940             else {
68941                 var source = checkExpression(initializer);
68942                 if (!isTypeAssignableToKind(source, 296)) {
68943                     error(initializer, ts.Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead, typeToString(source));
68944                 }
68945                 else {
68946                     checkTypeAssignableTo(source, getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), initializer, undefined);
68947                 }
68948             }
68949             return value;
68950             function evaluate(expr) {
68951                 switch (expr.kind) {
68952                     case 218:
68953                         var value_2 = evaluate(expr.operand);
68954                         if (typeof value_2 === "number") {
68955                             switch (expr.operator) {
68956                                 case 39: return value_2;
68957                                 case 40: return -value_2;
68958                                 case 54: return ~value_2;
68959                             }
68960                         }
68961                         break;
68962                     case 220:
68963                         var left = evaluate(expr.left);
68964                         var right = evaluate(expr.right);
68965                         if (typeof left === "number" && typeof right === "number") {
68966                             switch (expr.operatorToken.kind) {
68967                                 case 51: return left | right;
68968                                 case 50: return left & right;
68969                                 case 48: return left >> right;
68970                                 case 49: return left >>> right;
68971                                 case 47: return left << right;
68972                                 case 52: return left ^ right;
68973                                 case 41: return left * right;
68974                                 case 43: return left / right;
68975                                 case 39: return left + right;
68976                                 case 40: return left - right;
68977                                 case 44: return left % right;
68978                                 case 42: return Math.pow(left, right);
68979                             }
68980                         }
68981                         else if (typeof left === "string" && typeof right === "string" && expr.operatorToken.kind === 39) {
68982                             return left + right;
68983                         }
68984                         break;
68985                     case 10:
68986                     case 14:
68987                         return expr.text;
68988                     case 8:
68989                         checkGrammarNumericLiteral(expr);
68990                         return +expr.text;
68991                     case 211:
68992                         return evaluate(expr.expression);
68993                     case 79:
68994                         var identifier = expr;
68995                         if (ts.isInfinityOrNaNString(identifier.escapedText)) {
68996                             return +(identifier.escapedText);
68997                         }
68998                         return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
68999                     case 206:
69000                     case 205:
69001                         var ex = expr;
69002                         if (isConstantMemberAccess(ex)) {
69003                             var type = getTypeOfExpression(ex.expression);
69004                             if (type.symbol && type.symbol.flags & 384) {
69005                                 var name = void 0;
69006                                 if (ex.kind === 205) {
69007                                     name = ex.name.escapedText;
69008                                 }
69009                                 else {
69010                                     name = ts.escapeLeadingUnderscores(ts.cast(ex.argumentExpression, ts.isLiteralExpression).text);
69011                                 }
69012                                 return evaluateEnumMember(expr, type.symbol, name);
69013                             }
69014                         }
69015                         break;
69016                 }
69017                 return undefined;
69018             }
69019             function evaluateEnumMember(expr, enumSymbol, name) {
69020                 var memberSymbol = enumSymbol.exports.get(name);
69021                 if (memberSymbol) {
69022                     var declaration = memberSymbol.valueDeclaration;
69023                     if (declaration !== member) {
69024                         if (declaration && isBlockScopedNameDeclaredBeforeUse(declaration, member)) {
69025                             return getEnumMemberValue(declaration);
69026                         }
69027                         error(expr, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
69028                         return 0;
69029                     }
69030                     else {
69031                         error(expr, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol));
69032                     }
69033                 }
69034                 return undefined;
69035             }
69036         }
69037         function isConstantMemberAccess(node) {
69038             return node.kind === 79 ||
69039                 node.kind === 205 && isConstantMemberAccess(node.expression) ||
69040                 node.kind === 206 && isConstantMemberAccess(node.expression) &&
69041                     ts.isStringLiteralLike(node.argumentExpression);
69042         }
69043         function checkEnumDeclaration(node) {
69044             if (!produceDiagnostics) {
69045                 return;
69046             }
69047             checkGrammarDecoratorsAndModifiers(node);
69048             checkCollisionsForDeclarationName(node, node.name);
69049             checkExportsOnMergedDeclarations(node);
69050             node.members.forEach(checkEnumMember);
69051             computeEnumMemberValues(node);
69052             var enumSymbol = getSymbolOfNode(node);
69053             var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind);
69054             if (node === firstDeclaration) {
69055                 if (enumSymbol.declarations && enumSymbol.declarations.length > 1) {
69056                     var enumIsConst_1 = ts.isEnumConst(node);
69057                     ts.forEach(enumSymbol.declarations, function (decl) {
69058                         if (ts.isEnumDeclaration(decl) && ts.isEnumConst(decl) !== enumIsConst_1) {
69059                             error(ts.getNameOfDeclaration(decl), ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const);
69060                         }
69061                     });
69062                 }
69063                 var seenEnumMissingInitialInitializer_1 = false;
69064                 ts.forEach(enumSymbol.declarations, function (declaration) {
69065                     if (declaration.kind !== 259) {
69066                         return false;
69067                     }
69068                     var enumDeclaration = declaration;
69069                     if (!enumDeclaration.members.length) {
69070                         return false;
69071                     }
69072                     var firstEnumMember = enumDeclaration.members[0];
69073                     if (!firstEnumMember.initializer) {
69074                         if (seenEnumMissingInitialInitializer_1) {
69075                             error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element);
69076                         }
69077                         else {
69078                             seenEnumMissingInitialInitializer_1 = true;
69079                         }
69080                     }
69081                 });
69082             }
69083         }
69084         function checkEnumMember(node) {
69085             if (ts.isPrivateIdentifier(node.name)) {
69086                 error(node, ts.Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
69087             }
69088         }
69089         function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
69090             var declarations = symbol.declarations;
69091             if (declarations) {
69092                 for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
69093                     var declaration = declarations_8[_i];
69094                     if ((declaration.kind === 256 ||
69095                         (declaration.kind === 255 && ts.nodeIsPresent(declaration.body))) &&
69096                         !(declaration.flags & 8388608)) {
69097                         return declaration;
69098                     }
69099                 }
69100             }
69101             return undefined;
69102         }
69103         function inSameLexicalScope(node1, node2) {
69104             var container1 = ts.getEnclosingBlockScopeContainer(node1);
69105             var container2 = ts.getEnclosingBlockScopeContainer(node2);
69106             if (isGlobalSourceFile(container1)) {
69107                 return isGlobalSourceFile(container2);
69108             }
69109             else if (isGlobalSourceFile(container2)) {
69110                 return false;
69111             }
69112             else {
69113                 return container1 === container2;
69114             }
69115         }
69116         function checkModuleDeclaration(node) {
69117             if (produceDiagnostics) {
69118                 var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
69119                 var inAmbientContext = node.flags & 8388608;
69120                 if (isGlobalAugmentation && !inAmbientContext) {
69121                     error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);
69122                 }
69123                 var isAmbientExternalModule = ts.isAmbientModule(node);
69124                 var contextErrorMessage = isAmbientExternalModule
69125                     ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
69126                     : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;
69127                 if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
69128                     return;
69129                 }
69130                 if (!checkGrammarDecoratorsAndModifiers(node)) {
69131                     if (!inAmbientContext && node.name.kind === 10) {
69132                         grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names);
69133                     }
69134                 }
69135                 if (ts.isIdentifier(node.name)) {
69136                     checkCollisionsForDeclarationName(node, node.name);
69137                 }
69138                 checkExportsOnMergedDeclarations(node);
69139                 var symbol = getSymbolOfNode(node);
69140                 if (symbol.flags & 512
69141                     && !inAmbientContext
69142                     && symbol.declarations
69143                     && symbol.declarations.length > 1
69144                     && isInstantiatedModule(node, ts.shouldPreserveConstEnums(compilerOptions))) {
69145                     var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
69146                     if (firstNonAmbientClassOrFunc) {
69147                         if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
69148                             error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
69149                         }
69150                         else if (node.pos < firstNonAmbientClassOrFunc.pos) {
69151                             error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
69152                         }
69153                     }
69154                     var mergedClass = ts.getDeclarationOfKind(symbol, 256);
69155                     if (mergedClass &&
69156                         inSameLexicalScope(node, mergedClass)) {
69157                         getNodeLinks(node).flags |= 32768;
69158                     }
69159                 }
69160                 if (isAmbientExternalModule) {
69161                     if (ts.isExternalModuleAugmentation(node)) {
69162                         var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432);
69163                         if (checkBody && node.body) {
69164                             for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
69165                                 var statement = _a[_i];
69166                                 checkModuleAugmentationElement(statement, isGlobalAugmentation);
69167                             }
69168                         }
69169                     }
69170                     else if (isGlobalSourceFile(node.parent)) {
69171                         if (isGlobalAugmentation) {
69172                             error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
69173                         }
69174                         else if (ts.isExternalModuleNameRelative(ts.getTextOfIdentifierOrLiteral(node.name))) {
69175                             error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
69176                         }
69177                     }
69178                     else {
69179                         if (isGlobalAugmentation) {
69180                             error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations);
69181                         }
69182                         else {
69183                             error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces);
69184                         }
69185                     }
69186                 }
69187             }
69188             if (node.body) {
69189                 checkSourceElement(node.body);
69190                 if (!ts.isGlobalScopeAugmentation(node)) {
69191                     registerForUnusedIdentifiersCheck(node);
69192                 }
69193             }
69194         }
69195         function checkModuleAugmentationElement(node, isGlobalAugmentation) {
69196             var _a;
69197             switch (node.kind) {
69198                 case 236:
69199                     for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) {
69200                         var decl = _b[_i];
69201                         checkModuleAugmentationElement(decl, isGlobalAugmentation);
69202                     }
69203                     break;
69204                 case 270:
69205                 case 271:
69206                     grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
69207                     break;
69208                 case 264:
69209                 case 265:
69210                     grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
69211                     break;
69212                 case 202:
69213                 case 253:
69214                     var name = node.name;
69215                     if (ts.isBindingPattern(name)) {
69216                         for (var _c = 0, _d = name.elements; _c < _d.length; _c++) {
69217                             var el = _d[_c];
69218                             checkModuleAugmentationElement(el, isGlobalAugmentation);
69219                         }
69220                         break;
69221                     }
69222                 case 256:
69223                 case 259:
69224                 case 255:
69225                 case 257:
69226                 case 260:
69227                 case 258:
69228                     if (isGlobalAugmentation) {
69229                         return;
69230                     }
69231                     var symbol = getSymbolOfNode(node);
69232                     if (symbol) {
69233                         var reportError = !(symbol.flags & 33554432);
69234                         if (!reportError) {
69235                             reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);
69236                         }
69237                     }
69238                     break;
69239             }
69240         }
69241         function getFirstNonModuleExportsIdentifier(node) {
69242             switch (node.kind) {
69243                 case 79:
69244                     return node;
69245                 case 160:
69246                     do {
69247                         node = node.left;
69248                     } while (node.kind !== 79);
69249                     return node;
69250                 case 205:
69251                     do {
69252                         if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) {
69253                             return node.name;
69254                         }
69255                         node = node.expression;
69256                     } while (node.kind !== 79);
69257                     return node;
69258             }
69259         }
69260         function checkExternalImportOrExportDeclaration(node) {
69261             var moduleName = ts.getExternalModuleName(node);
69262             if (!moduleName || ts.nodeIsMissing(moduleName)) {
69263                 return false;
69264             }
69265             if (!ts.isStringLiteral(moduleName)) {
69266                 error(moduleName, ts.Diagnostics.String_literal_expected);
69267                 return false;
69268             }
69269             var inAmbientExternalModule = node.parent.kind === 261 && ts.isAmbientModule(node.parent.parent);
69270             if (node.parent.kind !== 303 && !inAmbientExternalModule) {
69271                 error(moduleName, node.kind === 271 ?
69272                     ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
69273                     ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
69274                 return false;
69275             }
69276             if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) {
69277                 if (!isTopLevelInExternalModuleAugmentation(node)) {
69278                     error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
69279                     return false;
69280                 }
69281             }
69282             return true;
69283         }
69284         function checkAliasSymbol(node) {
69285             var _a;
69286             var symbol = getSymbolOfNode(node);
69287             var target = resolveAlias(symbol);
69288             if (target !== unknownSymbol) {
69289                 symbol = getMergedSymbol(symbol.exportSymbol || symbol);
69290                 var excludedMeanings = (symbol.flags & (111551 | 1048576) ? 111551 : 0) |
69291                     (symbol.flags & 788968 ? 788968 : 0) |
69292                     (symbol.flags & 1920 ? 1920 : 0);
69293                 if (target.flags & excludedMeanings) {
69294                     var message = node.kind === 274 ?
69295                         ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
69296                         ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
69297                     error(node, message, symbolToString(symbol));
69298                 }
69299                 if (compilerOptions.isolatedModules
69300                     && !ts.isTypeOnlyImportOrExportDeclaration(node)
69301                     && !(node.flags & 8388608)) {
69302                     var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
69303                     var isType = !(target.flags & 111551);
69304                     if (isType || typeOnlyAlias) {
69305                         switch (node.kind) {
69306                             case 266:
69307                             case 269:
69308                             case 264: {
69309                                 if (compilerOptions.preserveValueImports) {
69310                                     ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
69311                                     var message = isType
69312                                         ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled
69313                                         : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled;
69314                                     var name = ts.idText(node.kind === 269 ? node.propertyName || node.name : node.name);
69315                                     addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
69316                                 }
69317                                 break;
69318                             }
69319                             case 274: {
69320                                 if (ts.getSourceFileOfNode(typeOnlyAlias) !== ts.getSourceFileOfNode(node)) {
69321                                     var message = isType
69322                                         ? ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type
69323                                         : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled;
69324                                     var name = ts.idText(node.propertyName || node.name);
69325                                     addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name);
69326                                     return;
69327                                 }
69328                             }
69329                         }
69330                     }
69331                 }
69332                 if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); }))) {
69333                     addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
69334                 }
69335             }
69336         }
69337         function checkImportBinding(node) {
69338             checkCollisionsForDeclarationName(node, node.name);
69339             checkAliasSymbol(node);
69340             if (node.kind === 269 &&
69341                 ts.idText(node.propertyName || node.name) === "default" &&
69342                 ts.getESModuleInterop(compilerOptions) &&
69343                 moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
69344                 checkExternalEmitHelpers(node, 131072);
69345             }
69346         }
69347         function checkAssertClause(declaration) {
69348             var _a;
69349             if (declaration.assertClause) {
69350                 if (moduleKind !== ts.ModuleKind.ESNext) {
69351                     return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
69352                 }
69353                 if (ts.isImportDeclaration(declaration) ? (_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
69354                     return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
69355                 }
69356             }
69357         }
69358         function checkImportDeclaration(node) {
69359             if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {
69360                 return;
69361             }
69362             if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
69363                 grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers);
69364             }
69365             if (checkExternalImportOrExportDeclaration(node)) {
69366                 var importClause = node.importClause;
69367                 if (importClause && !checkGrammarImportClause(importClause)) {
69368                     if (importClause.name) {
69369                         checkImportBinding(importClause);
69370                     }
69371                     if (importClause.namedBindings) {
69372                         if (importClause.namedBindings.kind === 267) {
69373                             checkImportBinding(importClause.namedBindings);
69374                             if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) {
69375                                 checkExternalEmitHelpers(node, 65536);
69376                             }
69377                         }
69378                         else {
69379                             var moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
69380                             if (moduleExisted) {
69381                                 ts.forEach(importClause.namedBindings.elements, checkImportBinding);
69382                             }
69383                         }
69384                     }
69385                 }
69386             }
69387             checkAssertClause(node);
69388         }
69389         function checkImportEqualsDeclaration(node) {
69390             if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {
69391                 return;
69392             }
69393             checkGrammarDecoratorsAndModifiers(node);
69394             if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
69395                 checkImportBinding(node);
69396                 if (ts.hasSyntacticModifier(node, 1)) {
69397                     markExportAsReferenced(node);
69398                 }
69399                 if (node.moduleReference.kind !== 276) {
69400                     var target = resolveAlias(getSymbolOfNode(node));
69401                     if (target !== unknownSymbol) {
69402                         if (target.flags & 111551) {
69403                             var moduleName = ts.getFirstIdentifier(node.moduleReference);
69404                             if (!(resolveEntityName(moduleName, 111551 | 1920).flags & 1920)) {
69405                                 error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
69406                             }
69407                         }
69408                         if (target.flags & 788968) {
69409                             checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
69410                         }
69411                     }
69412                     if (node.isTypeOnly) {
69413                         grammarErrorOnNode(node, ts.Diagnostics.An_import_alias_cannot_use_import_type);
69414                     }
69415                 }
69416                 else {
69417                     if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608)) {
69418                         grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
69419                     }
69420                 }
69421             }
69422         }
69423         function checkExportDeclaration(node) {
69424             if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) {
69425                 return;
69426             }
69427             if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
69428                 grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
69429             }
69430             if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0) {
69431                 checkExternalEmitHelpers(node, 4194304);
69432             }
69433             checkGrammarExportDeclaration(node);
69434             if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
69435                 if (node.exportClause && !ts.isNamespaceExport(node.exportClause)) {
69436                     ts.forEach(node.exportClause.elements, checkExportSpecifier);
69437                     var inAmbientExternalModule = node.parent.kind === 261 && ts.isAmbientModule(node.parent.parent);
69438                     var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 261 &&
69439                         !node.moduleSpecifier && node.flags & 8388608;
69440                     if (node.parent.kind !== 303 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
69441                         error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
69442                     }
69443                 }
69444                 else {
69445                     var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
69446                     if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
69447                         error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
69448                     }
69449                     else if (node.exportClause) {
69450                         checkAliasSymbol(node.exportClause);
69451                     }
69452                     if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
69453                         if (node.exportClause) {
69454                             if (ts.getESModuleInterop(compilerOptions)) {
69455                                 checkExternalEmitHelpers(node, 65536);
69456                             }
69457                         }
69458                         else {
69459                             checkExternalEmitHelpers(node, 32768);
69460                         }
69461                     }
69462                 }
69463             }
69464             checkAssertClause(node);
69465         }
69466         function checkGrammarExportDeclaration(node) {
69467             var _a;
69468             if (node.isTypeOnly) {
69469                 if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 272) {
69470                     return checkGrammarNamedImportsOrExports(node.exportClause);
69471                 }
69472                 else {
69473                     return grammarErrorOnNode(node, ts.Diagnostics.Only_named_exports_may_use_export_type);
69474                 }
69475             }
69476             return false;
69477         }
69478         function checkGrammarModuleElementContext(node, errorMessage) {
69479             var isInAppropriateContext = node.parent.kind === 303 || node.parent.kind === 261 || node.parent.kind === 260;
69480             if (!isInAppropriateContext) {
69481                 grammarErrorOnFirstToken(node, errorMessage);
69482             }
69483             return !isInAppropriateContext;
69484         }
69485         function importClauseContainsReferencedImport(importClause) {
69486             return ts.forEachImportClauseDeclaration(importClause, function (declaration) {
69487                 return !!getSymbolOfNode(declaration).isReferenced;
69488             });
69489         }
69490         function importClauseContainsConstEnumUsedAsValue(importClause) {
69491             return ts.forEachImportClauseDeclaration(importClause, function (declaration) {
69492                 return !!getSymbolLinks(getSymbolOfNode(declaration)).constEnumReferenced;
69493             });
69494         }
69495         function canConvertImportDeclarationToTypeOnly(statement) {
69496             return ts.isImportDeclaration(statement) &&
69497                 statement.importClause &&
69498                 !statement.importClause.isTypeOnly &&
69499                 importClauseContainsReferencedImport(statement.importClause) &&
69500                 !isReferencedAliasDeclaration(statement.importClause, true) &&
69501                 !importClauseContainsConstEnumUsedAsValue(statement.importClause);
69502         }
69503         function canConvertImportEqualsDeclarationToTypeOnly(statement) {
69504             return ts.isImportEqualsDeclaration(statement) &&
69505                 ts.isExternalModuleReference(statement.moduleReference) &&
69506                 !statement.isTypeOnly &&
69507                 getSymbolOfNode(statement).isReferenced &&
69508                 !isReferencedAliasDeclaration(statement, false) &&
69509                 !getSymbolLinks(getSymbolOfNode(statement)).constEnumReferenced;
69510         }
69511         function checkImportsForTypeOnlyConversion(sourceFile) {
69512             for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
69513                 var statement = _a[_i];
69514                 if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
69515                     error(statement, ts.Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error);
69516                 }
69517             }
69518         }
69519         function checkExportSpecifier(node) {
69520             checkAliasSymbol(node);
69521             if (ts.getEmitDeclarations(compilerOptions)) {
69522                 collectLinkedAliases(node.propertyName || node.name, true);
69523             }
69524             if (!node.parent.parent.moduleSpecifier) {
69525                 var exportedName = node.propertyName || node.name;
69526                 var symbol = resolveName(exportedName, exportedName.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, undefined, true);
69527                 if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
69528                     error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
69529                 }
69530                 else {
69531                     markExportAsReferenced(node);
69532                     var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
69533                     if (!target || target === unknownSymbol || target.flags & 111551) {
69534                         checkExpressionCached(node.propertyName || node.name);
69535                     }
69536                 }
69537             }
69538             else {
69539                 if (ts.getESModuleInterop(compilerOptions) &&
69540                     moduleKind !== ts.ModuleKind.System &&
69541                     (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) &&
69542                     ts.idText(node.propertyName || node.name) === "default") {
69543                     checkExternalEmitHelpers(node, 131072);
69544                 }
69545             }
69546         }
69547         function checkExportAssignment(node) {
69548             var illegalContextMessage = node.isExportEquals
69549                 ? ts.Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration
69550                 : ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration;
69551             if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
69552                 return;
69553             }
69554             var container = node.parent.kind === 303 ? node.parent : node.parent.parent;
69555             if (container.kind === 260 && !ts.isAmbientModule(container)) {
69556                 if (node.isExportEquals) {
69557                     error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
69558                 }
69559                 else {
69560                     error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
69561                 }
69562                 return;
69563             }
69564             if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
69565                 grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
69566             }
69567             var typeAnnotationNode = ts.getEffectiveTypeAnnotationNode(node);
69568             if (typeAnnotationNode) {
69569                 checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
69570             }
69571             if (node.expression.kind === 79) {
69572                 var id = node.expression;
69573                 var sym = resolveEntityName(id, 67108863, true, true, node);
69574                 if (sym) {
69575                     markAliasReferenced(sym, id);
69576                     var target = sym.flags & 2097152 ? resolveAlias(sym) : sym;
69577                     if (target === unknownSymbol || target.flags & 111551) {
69578                         checkExpressionCached(node.expression);
69579                     }
69580                 }
69581                 else {
69582                     checkExpressionCached(node.expression);
69583                 }
69584                 if (ts.getEmitDeclarations(compilerOptions)) {
69585                     collectLinkedAliases(node.expression, true);
69586                 }
69587             }
69588             else {
69589                 checkExpressionCached(node.expression);
69590             }
69591             checkExternalModuleExports(container);
69592             if ((node.flags & 8388608) && !ts.isEntityNameExpression(node.expression)) {
69593                 grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
69594             }
69595             if (node.isExportEquals && !(node.flags & 8388608)) {
69596                 if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
69597                     grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
69598                 }
69599                 else if (moduleKind === ts.ModuleKind.System) {
69600                     grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
69601                 }
69602             }
69603         }
69604         function hasExportedMembers(moduleSymbol) {
69605             return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; });
69606         }
69607         function checkExternalModuleExports(node) {
69608             var moduleSymbol = getSymbolOfNode(node);
69609             var links = getSymbolLinks(moduleSymbol);
69610             if (!links.exportsChecked) {
69611                 var exportEqualsSymbol = moduleSymbol.exports.get("export=");
69612                 if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
69613                     var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
69614                     if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !ts.isInJSFile(declaration)) {
69615                         error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
69616                     }
69617                 }
69618                 var exports_2 = getExportsOfModule(moduleSymbol);
69619                 if (exports_2) {
69620                     exports_2.forEach(function (_a, id) {
69621                         var declarations = _a.declarations, flags = _a.flags;
69622                         if (id === "__export") {
69623                             return;
69624                         }
69625                         if (flags & (1920 | 64 | 384)) {
69626                             return;
69627                         }
69628                         var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverloadAndNotAccessor);
69629                         if (flags & 524288 && exportedDeclarationsCount <= 2) {
69630                             return;
69631                         }
69632                         if (exportedDeclarationsCount > 1) {
69633                             if (!isDuplicatedCommonJSExport(declarations)) {
69634                                 for (var _i = 0, _b = declarations; _i < _b.length; _i++) {
69635                                     var declaration = _b[_i];
69636                                     if (isNotOverload(declaration)) {
69637                                         diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, ts.unescapeLeadingUnderscores(id)));
69638                                     }
69639                                 }
69640                             }
69641                         }
69642                     });
69643                 }
69644                 links.exportsChecked = true;
69645             }
69646         }
69647         function isDuplicatedCommonJSExport(declarations) {
69648             return declarations
69649                 && declarations.length > 1
69650                 && declarations.every(function (d) { return ts.isInJSFile(d) && ts.isAccessExpression(d) && (ts.isExportsIdentifier(d.expression) || ts.isModuleExportsAccessExpression(d.expression)); });
69651         }
69652         function checkSourceElement(node) {
69653             if (node) {
69654                 var saveCurrentNode = currentNode;
69655                 currentNode = node;
69656                 instantiationCount = 0;
69657                 checkSourceElementWorker(node);
69658                 currentNode = saveCurrentNode;
69659             }
69660         }
69661         function checkSourceElementWorker(node) {
69662             if (ts.isInJSFile(node)) {
69663                 ts.forEach(node.jsDoc, function (_a) {
69664                     var tags = _a.tags;
69665                     return ts.forEach(tags, checkSourceElement);
69666                 });
69667             }
69668             var kind = node.kind;
69669             if (cancellationToken) {
69670                 switch (kind) {
69671                     case 260:
69672                     case 256:
69673                     case 257:
69674                     case 255:
69675                         cancellationToken.throwIfCancellationRequested();
69676                 }
69677             }
69678             if (kind >= 236 && kind <= 252 && node.flowNode && !isReachableFlowNode(node.flowNode)) {
69679                 errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected);
69680             }
69681             switch (kind) {
69682                 case 162:
69683                     return checkTypeParameter(node);
69684                 case 163:
69685                     return checkParameter(node);
69686                 case 166:
69687                     return checkPropertyDeclaration(node);
69688                 case 165:
69689                     return checkPropertySignature(node);
69690                 case 179:
69691                 case 178:
69692                 case 173:
69693                 case 174:
69694                 case 175:
69695                     return checkSignatureDeclaration(node);
69696                 case 168:
69697                 case 167:
69698                     return checkMethodDeclaration(node);
69699                 case 169:
69700                     return checkClassStaticBlockDeclaration(node);
69701                 case 170:
69702                     return checkConstructorDeclaration(node);
69703                 case 171:
69704                 case 172:
69705                     return checkAccessorDeclaration(node);
69706                 case 177:
69707                     return checkTypeReferenceNode(node);
69708                 case 176:
69709                     return checkTypePredicate(node);
69710                 case 180:
69711                     return checkTypeQuery(node);
69712                 case 181:
69713                     return checkTypeLiteral(node);
69714                 case 182:
69715                     return checkArrayType(node);
69716                 case 183:
69717                     return checkTupleType(node);
69718                 case 186:
69719                 case 187:
69720                     return checkUnionOrIntersectionType(node);
69721                 case 190:
69722                 case 184:
69723                 case 185:
69724                     return checkSourceElement(node.type);
69725                 case 191:
69726                     return checkThisType(node);
69727                 case 192:
69728                     return checkTypeOperator(node);
69729                 case 188:
69730                     return checkConditionalType(node);
69731                 case 189:
69732                     return checkInferType(node);
69733                 case 197:
69734                     return checkTemplateLiteralType(node);
69735                 case 199:
69736                     return checkImportType(node);
69737                 case 196:
69738                     return checkNamedTupleMember(node);
69739                 case 326:
69740                     return checkJSDocAugmentsTag(node);
69741                 case 327:
69742                     return checkJSDocImplementsTag(node);
69743                 case 343:
69744                 case 336:
69745                 case 337:
69746                     return checkJSDocTypeAliasTag(node);
69747                 case 342:
69748                     return checkJSDocTemplateTag(node);
69749                 case 341:
69750                     return checkJSDocTypeTag(node);
69751                 case 338:
69752                     return checkJSDocParameterTag(node);
69753                 case 345:
69754                     return checkJSDocPropertyTag(node);
69755                 case 315:
69756                     checkJSDocFunctionType(node);
69757                 case 313:
69758                 case 312:
69759                 case 310:
69760                 case 311:
69761                 case 320:
69762                     checkJSDocTypeIsInJsFile(node);
69763                     ts.forEachChild(node, checkSourceElement);
69764                     return;
69765                 case 316:
69766                     checkJSDocVariadicType(node);
69767                     return;
69768                 case 307:
69769                     return checkSourceElement(node.type);
69770                 case 331:
69771                 case 333:
69772                 case 332:
69773                     return checkJSDocAccessibilityModifiers(node);
69774                 case 193:
69775                     return checkIndexedAccessType(node);
69776                 case 194:
69777                     return checkMappedType(node);
69778                 case 255:
69779                     return checkFunctionDeclaration(node);
69780                 case 234:
69781                 case 261:
69782                     return checkBlock(node);
69783                 case 236:
69784                     return checkVariableStatement(node);
69785                 case 237:
69786                     return checkExpressionStatement(node);
69787                 case 238:
69788                     return checkIfStatement(node);
69789                 case 239:
69790                     return checkDoStatement(node);
69791                 case 240:
69792                     return checkWhileStatement(node);
69793                 case 241:
69794                     return checkForStatement(node);
69795                 case 242:
69796                     return checkForInStatement(node);
69797                 case 243:
69798                     return checkForOfStatement(node);
69799                 case 244:
69800                 case 245:
69801                     return checkBreakOrContinueStatement(node);
69802                 case 246:
69803                     return checkReturnStatement(node);
69804                 case 247:
69805                     return checkWithStatement(node);
69806                 case 248:
69807                     return checkSwitchStatement(node);
69808                 case 249:
69809                     return checkLabeledStatement(node);
69810                 case 250:
69811                     return checkThrowStatement(node);
69812                 case 251:
69813                     return checkTryStatement(node);
69814                 case 253:
69815                     return checkVariableDeclaration(node);
69816                 case 202:
69817                     return checkBindingElement(node);
69818                 case 256:
69819                     return checkClassDeclaration(node);
69820                 case 257:
69821                     return checkInterfaceDeclaration(node);
69822                 case 258:
69823                     return checkTypeAliasDeclaration(node);
69824                 case 259:
69825                     return checkEnumDeclaration(node);
69826                 case 260:
69827                     return checkModuleDeclaration(node);
69828                 case 265:
69829                     return checkImportDeclaration(node);
69830                 case 264:
69831                     return checkImportEqualsDeclaration(node);
69832                 case 271:
69833                     return checkExportDeclaration(node);
69834                 case 270:
69835                     return checkExportAssignment(node);
69836                 case 235:
69837                 case 252:
69838                     checkGrammarStatementInAmbientContext(node);
69839                     return;
69840                 case 275:
69841                     return checkMissingDeclaration(node);
69842             }
69843         }
69844         function checkJSDocTypeIsInJsFile(node) {
69845             if (!ts.isInJSFile(node)) {
69846                 grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
69847             }
69848         }
69849         function checkJSDocVariadicType(node) {
69850             checkJSDocTypeIsInJsFile(node);
69851             checkSourceElement(node.type);
69852             var parent = node.parent;
69853             if (ts.isParameter(parent) && ts.isJSDocFunctionType(parent.parent)) {
69854                 if (ts.last(parent.parent.parameters) !== parent) {
69855                     error(node, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
69856                 }
69857                 return;
69858             }
69859             if (!ts.isJSDocTypeExpression(parent)) {
69860                 error(node, ts.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
69861             }
69862             var paramTag = node.parent.parent;
69863             if (!ts.isJSDocParameterTag(paramTag)) {
69864                 error(node, ts.Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature);
69865                 return;
69866             }
69867             var param = ts.getParameterSymbolFromJSDoc(paramTag);
69868             if (!param) {
69869                 return;
69870             }
69871             var host = ts.getHostSignatureFromJSDoc(paramTag);
69872             if (!host || ts.last(host.parameters).symbol !== param) {
69873                 error(node, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
69874             }
69875         }
69876         function getTypeFromJSDocVariadicType(node) {
69877             var type = getTypeFromTypeNode(node.type);
69878             var parent = node.parent;
69879             var paramTag = node.parent.parent;
69880             if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
69881                 var host_1 = ts.getHostSignatureFromJSDoc(paramTag);
69882                 var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
69883                 if (host_1 || isCallbackTag) {
69884                     var lastParamDeclaration = isCallbackTag
69885                         ? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
69886                         : ts.lastOrUndefined(host_1.parameters);
69887                     var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
69888                     if (!lastParamDeclaration ||
69889                         symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
69890                         return createArrayType(type);
69891                     }
69892                 }
69893             }
69894             if (ts.isParameter(parent) && ts.isJSDocFunctionType(parent.parent)) {
69895                 return createArrayType(type);
69896             }
69897             return addOptionality(type);
69898         }
69899         function checkNodeDeferred(node) {
69900             var enclosingFile = ts.getSourceFileOfNode(node);
69901             var links = getNodeLinks(enclosingFile);
69902             if (!(links.flags & 1)) {
69903                 links.deferredNodes = links.deferredNodes || new ts.Map();
69904                 var id = getNodeId(node);
69905                 links.deferredNodes.set(id, node);
69906             }
69907         }
69908         function checkDeferredNodes(context) {
69909             var links = getNodeLinks(context);
69910             if (links.deferredNodes) {
69911                 links.deferredNodes.forEach(checkDeferredNode);
69912             }
69913         }
69914         function checkDeferredNode(node) {
69915             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
69916             var saveCurrentNode = currentNode;
69917             currentNode = node;
69918             instantiationCount = 0;
69919             switch (node.kind) {
69920                 case 207:
69921                 case 208:
69922                 case 209:
69923                 case 164:
69924                 case 279:
69925                     resolveUntypedCall(node);
69926                     break;
69927                 case 212:
69928                 case 213:
69929                 case 168:
69930                 case 167:
69931                     checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
69932                     break;
69933                 case 171:
69934                 case 172:
69935                     checkAccessorDeclaration(node);
69936                     break;
69937                 case 225:
69938                     checkClassExpressionDeferred(node);
69939                     break;
69940                 case 278:
69941                     checkJsxSelfClosingElementDeferred(node);
69942                     break;
69943                 case 277:
69944                     checkJsxElementDeferred(node);
69945                     break;
69946             }
69947             currentNode = saveCurrentNode;
69948             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
69949         }
69950         function checkSourceFile(node) {
69951             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check", "checkSourceFile", { path: node.path }, true);
69952             ts.performance.mark("beforeCheck");
69953             checkSourceFileWorker(node);
69954             ts.performance.mark("afterCheck");
69955             ts.performance.measure("Check", "beforeCheck", "afterCheck");
69956             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
69957         }
69958         function unusedIsError(kind, isAmbient) {
69959             if (isAmbient) {
69960                 return false;
69961             }
69962             switch (kind) {
69963                 case 0:
69964                     return !!compilerOptions.noUnusedLocals;
69965                 case 1:
69966                     return !!compilerOptions.noUnusedParameters;
69967                 default:
69968                     return ts.Debug.assertNever(kind);
69969             }
69970         }
69971         function getPotentiallyUnusedIdentifiers(sourceFile) {
69972             return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || ts.emptyArray;
69973         }
69974         function checkSourceFileWorker(node) {
69975             var links = getNodeLinks(node);
69976             if (!(links.flags & 1)) {
69977                 if (ts.skipTypeChecking(node, compilerOptions, host)) {
69978                     return;
69979                 }
69980                 checkGrammarSourceFile(node);
69981                 ts.clear(potentialThisCollisions);
69982                 ts.clear(potentialNewTargetCollisions);
69983                 ts.clear(potentialWeakMapSetCollisions);
69984                 ts.clear(potentialReflectCollisions);
69985                 ts.forEach(node.statements, checkSourceElement);
69986                 checkSourceElement(node.endOfFileToken);
69987                 checkDeferredNodes(node);
69988                 if (ts.isExternalOrCommonJsModule(node)) {
69989                     registerForUnusedIdentifiersCheck(node);
69990                 }
69991                 if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
69992                     checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
69993                         if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
69994                             diagnostics.add(diag);
69995                         }
69996                     });
69997                 }
69998                 if (compilerOptions.importsNotUsedAsValues === 2 &&
69999                     !node.isDeclarationFile &&
70000                     ts.isExternalModule(node)) {
70001                     checkImportsForTypeOnlyConversion(node);
70002                 }
70003                 if (ts.isExternalOrCommonJsModule(node)) {
70004                     checkExternalModuleExports(node);
70005                 }
70006                 if (potentialThisCollisions.length) {
70007                     ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);
70008                     ts.clear(potentialThisCollisions);
70009                 }
70010                 if (potentialNewTargetCollisions.length) {
70011                     ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope);
70012                     ts.clear(potentialNewTargetCollisions);
70013                 }
70014                 if (potentialWeakMapSetCollisions.length) {
70015                     ts.forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision);
70016                     ts.clear(potentialWeakMapSetCollisions);
70017                 }
70018                 if (potentialReflectCollisions.length) {
70019                     ts.forEach(potentialReflectCollisions, checkReflectCollision);
70020                     ts.clear(potentialReflectCollisions);
70021                 }
70022                 links.flags |= 1;
70023             }
70024         }
70025         function getDiagnostics(sourceFile, ct) {
70026             try {
70027                 cancellationToken = ct;
70028                 return getDiagnosticsWorker(sourceFile);
70029             }
70030             finally {
70031                 cancellationToken = undefined;
70032             }
70033         }
70034         function getDiagnosticsWorker(sourceFile) {
70035             throwIfNonDiagnosticsProducing();
70036             if (sourceFile) {
70037                 var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
70038                 var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
70039                 checkSourceFile(sourceFile);
70040                 var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
70041                 var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
70042                 if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
70043                     var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics);
70044                     return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics);
70045                 }
70046                 else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) {
70047                     return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics);
70048                 }
70049                 return semanticDiagnostics;
70050             }
70051             ts.forEach(host.getSourceFiles(), checkSourceFile);
70052             return diagnostics.getDiagnostics();
70053         }
70054         function getGlobalDiagnostics() {
70055             throwIfNonDiagnosticsProducing();
70056             return diagnostics.getGlobalDiagnostics();
70057         }
70058         function throwIfNonDiagnosticsProducing() {
70059             if (!produceDiagnostics) {
70060                 throw new Error("Trying to get diagnostics from a type checker that does not produce them.");
70061             }
70062         }
70063         function getSymbolsInScope(location, meaning) {
70064             if (location.flags & 16777216) {
70065                 return [];
70066             }
70067             var symbols = ts.createSymbolTable();
70068             var isStaticSymbol = false;
70069             populateSymbols();
70070             symbols.delete("this");
70071             return symbolsToArray(symbols);
70072             function populateSymbols() {
70073                 while (location) {
70074                     if (location.locals && !isGlobalSourceFile(location)) {
70075                         copySymbols(location.locals, meaning);
70076                     }
70077                     switch (location.kind) {
70078                         case 303:
70079                             if (!ts.isExternalModule(location))
70080                                 break;
70081                         case 260:
70082                             copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475);
70083                             break;
70084                         case 259:
70085                             copySymbols(getSymbolOfNode(location).exports, meaning & 8);
70086                             break;
70087                         case 225:
70088                             var className = location.name;
70089                             if (className) {
70090                                 copySymbol(location.symbol, meaning);
70091                             }
70092                         case 256:
70093                         case 257:
70094                             if (!isStaticSymbol) {
70095                                 copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968);
70096                             }
70097                             break;
70098                         case 212:
70099                             var funcName = location.name;
70100                             if (funcName) {
70101                                 copySymbol(location.symbol, meaning);
70102                             }
70103                             break;
70104                     }
70105                     if (ts.introducesArgumentsExoticObject(location)) {
70106                         copySymbol(argumentsSymbol, meaning);
70107                     }
70108                     isStaticSymbol = ts.isStatic(location);
70109                     location = location.parent;
70110                 }
70111                 copySymbols(globals, meaning);
70112             }
70113             function copySymbol(symbol, meaning) {
70114                 if (ts.getCombinedLocalAndExportSymbolFlags(symbol) & meaning) {
70115                     var id = symbol.escapedName;
70116                     if (!symbols.has(id)) {
70117                         symbols.set(id, symbol);
70118                     }
70119                 }
70120             }
70121             function copySymbols(source, meaning) {
70122                 if (meaning) {
70123                     source.forEach(function (symbol) {
70124                         copySymbol(symbol, meaning);
70125                     });
70126                 }
70127             }
70128             function copyLocallyVisibleExportSymbols(source, meaning) {
70129                 if (meaning) {
70130                     source.forEach(function (symbol) {
70131                         if (!ts.getDeclarationOfKind(symbol, 274) && !ts.getDeclarationOfKind(symbol, 273)) {
70132                             copySymbol(symbol, meaning);
70133                         }
70134                     });
70135                 }
70136             }
70137         }
70138         function isTypeDeclarationName(name) {
70139             return name.kind === 79 &&
70140                 isTypeDeclaration(name.parent) &&
70141                 ts.getNameOfDeclaration(name.parent) === name;
70142         }
70143         function isTypeDeclaration(node) {
70144             switch (node.kind) {
70145                 case 162:
70146                 case 256:
70147                 case 257:
70148                 case 258:
70149                 case 259:
70150                 case 343:
70151                 case 336:
70152                 case 337:
70153                     return true;
70154                 case 266:
70155                     return node.isTypeOnly;
70156                 case 269:
70157                 case 274:
70158                     return node.parent.parent.isTypeOnly;
70159                 default:
70160                     return false;
70161             }
70162         }
70163         function isTypeReferenceIdentifier(node) {
70164             while (node.parent.kind === 160) {
70165                 node = node.parent;
70166             }
70167             return node.parent.kind === 177;
70168         }
70169         function isHeritageClauseElementIdentifier(node) {
70170             while (node.parent.kind === 205) {
70171                 node = node.parent;
70172             }
70173             return node.parent.kind === 227;
70174         }
70175         function forEachEnclosingClass(node, callback) {
70176             var result;
70177             while (true) {
70178                 node = ts.getContainingClass(node);
70179                 if (!node)
70180                     break;
70181                 if (result = callback(node))
70182                     break;
70183             }
70184             return result;
70185         }
70186         function isNodeUsedDuringClassInitialization(node) {
70187             return !!ts.findAncestor(node, function (element) {
70188                 if (ts.isConstructorDeclaration(element) && ts.nodeIsPresent(element.body) || ts.isPropertyDeclaration(element)) {
70189                     return true;
70190                 }
70191                 else if (ts.isClassLike(element) || ts.isFunctionLikeDeclaration(element)) {
70192                     return "quit";
70193                 }
70194                 return false;
70195             });
70196         }
70197         function isNodeWithinClass(node, classDeclaration) {
70198             return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
70199         }
70200         function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
70201             while (nodeOnRightSide.parent.kind === 160) {
70202                 nodeOnRightSide = nodeOnRightSide.parent;
70203             }
70204             if (nodeOnRightSide.parent.kind === 264) {
70205                 return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
70206             }
70207             if (nodeOnRightSide.parent.kind === 270) {
70208                 return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
70209             }
70210             return undefined;
70211         }
70212         function isInRightSideOfImportOrExportAssignment(node) {
70213             return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined;
70214         }
70215         function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) {
70216             var specialPropertyAssignmentKind = ts.getAssignmentDeclarationKind(entityName.parent.parent);
70217             switch (specialPropertyAssignmentKind) {
70218                 case 1:
70219                 case 3:
70220                     return getSymbolOfNode(entityName.parent);
70221                 case 4:
70222                 case 2:
70223                 case 5:
70224                     return getSymbolOfNode(entityName.parent.parent);
70225             }
70226         }
70227         function isImportTypeQualifierPart(node) {
70228             var parent = node.parent;
70229             while (ts.isQualifiedName(parent)) {
70230                 node = parent;
70231                 parent = parent.parent;
70232             }
70233             if (parent && parent.kind === 199 && parent.qualifier === node) {
70234                 return parent;
70235             }
70236             return undefined;
70237         }
70238         function getSymbolOfNameOrPropertyAccessExpression(name) {
70239             if (ts.isDeclarationName(name)) {
70240                 return getSymbolOfNode(name.parent);
70241             }
70242             if (ts.isInJSFile(name) &&
70243                 name.parent.kind === 205 &&
70244                 name.parent === name.parent.parent.left) {
70245                 if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) {
70246                     var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name);
70247                     if (specialPropertyAssignmentSymbol) {
70248                         return specialPropertyAssignmentSymbol;
70249                     }
70250                 }
70251             }
70252             if (name.parent.kind === 270 && ts.isEntityNameExpression(name)) {
70253                 var success = resolveEntityName(name, 111551 | 788968 | 1920 | 2097152, true);
70254                 if (success && success !== unknownSymbol) {
70255                     return success;
70256                 }
70257             }
70258             else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) {
70259                 var importEqualsDeclaration = ts.getAncestor(name, 264);
70260                 ts.Debug.assert(importEqualsDeclaration !== undefined);
70261                 return getSymbolOfPartOfRightHandSideOfImportEquals(name, true);
70262             }
70263             if (ts.isEntityName(name)) {
70264                 var possibleImportNode = isImportTypeQualifierPart(name);
70265                 if (possibleImportNode) {
70266                     getTypeFromTypeNode(possibleImportNode);
70267                     var sym = getNodeLinks(name).resolvedSymbol;
70268                     return sym === unknownSymbol ? undefined : sym;
70269                 }
70270             }
70271             while (ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
70272                 name = name.parent;
70273             }
70274             if (isHeritageClauseElementIdentifier(name)) {
70275                 var meaning = 0;
70276                 if (name.parent.kind === 227) {
70277                     meaning = 788968;
70278                     if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
70279                         meaning |= 111551;
70280                     }
70281                 }
70282                 else {
70283                     meaning = 1920;
70284                 }
70285                 meaning |= 2097152;
70286                 var entityNameSymbol = ts.isEntityNameExpression(name) ? resolveEntityName(name, meaning) : undefined;
70287                 if (entityNameSymbol) {
70288                     return entityNameSymbol;
70289                 }
70290             }
70291             if (name.parent.kind === 338) {
70292                 return ts.getParameterSymbolFromJSDoc(name.parent);
70293             }
70294             if (name.parent.kind === 162 && name.parent.parent.kind === 342) {
70295                 ts.Debug.assert(!ts.isInJSFile(name));
70296                 var typeParameter = ts.getTypeParameterFromJsDoc(name.parent);
70297                 return typeParameter && typeParameter.symbol;
70298             }
70299             if (ts.isExpressionNode(name)) {
70300                 if (ts.nodeIsMissing(name)) {
70301                     return undefined;
70302                 }
70303                 var isJSDoc_1 = ts.findAncestor(name, ts.or(ts.isJSDocLinkLike, ts.isJSDocNameReference, ts.isJSDocMemberName));
70304                 var meaning = isJSDoc_1 ? 788968 | 1920 | 111551 : 111551;
70305                 if (name.kind === 79) {
70306                     if (ts.isJSXTagName(name) && isJsxIntrinsicIdentifier(name)) {
70307                         var symbol = getIntrinsicTagSymbol(name.parent);
70308                         return symbol === unknownSymbol ? undefined : symbol;
70309                     }
70310                     var result = resolveEntityName(name, meaning, false, !isJSDoc_1, ts.getHostSignatureFromJSDoc(name));
70311                     if (!result && isJSDoc_1) {
70312                         var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
70313                         if (container) {
70314                             return resolveJSDocMemberName(name, getSymbolOfNode(container));
70315                         }
70316                     }
70317                     return result;
70318                 }
70319                 else if (ts.isPrivateIdentifier(name)) {
70320                     return getSymbolForPrivateIdentifierExpression(name);
70321                 }
70322                 else if (name.kind === 205 || name.kind === 160) {
70323                     var links = getNodeLinks(name);
70324                     if (links.resolvedSymbol) {
70325                         return links.resolvedSymbol;
70326                     }
70327                     if (name.kind === 205) {
70328                         checkPropertyAccessExpression(name, 0);
70329                     }
70330                     else {
70331                         checkQualifiedName(name, 0);
70332                     }
70333                     if (!links.resolvedSymbol && isJSDoc_1 && ts.isQualifiedName(name)) {
70334                         return resolveJSDocMemberName(name);
70335                     }
70336                     return links.resolvedSymbol;
70337                 }
70338                 else if (ts.isJSDocMemberName(name)) {
70339                     return resolveJSDocMemberName(name);
70340                 }
70341             }
70342             else if (isTypeReferenceIdentifier(name)) {
70343                 var meaning = name.parent.kind === 177 ? 788968 : 1920;
70344                 var symbol = resolveEntityName(name, meaning, false, true);
70345                 return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name);
70346             }
70347             if (name.parent.kind === 176) {
70348                 return resolveEntityName(name, 1);
70349             }
70350             return undefined;
70351         }
70352         function resolveJSDocMemberName(name, container) {
70353             if (ts.isEntityName(name)) {
70354                 var meaning = 788968 | 1920 | 111551;
70355                 var symbol = resolveEntityName(name, meaning, false, true, ts.getHostSignatureFromJSDoc(name));
70356                 if (!symbol && ts.isIdentifier(name) && container) {
70357                     symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
70358                 }
70359                 if (symbol) {
70360                     return symbol;
70361                 }
70362             }
70363             var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
70364             var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
70365             if (left) {
70366                 var proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype");
70367                 var t = proto ? getTypeOfSymbol(proto) : getDeclaredTypeOfSymbol(left);
70368                 return getPropertyOfType(t, right);
70369             }
70370         }
70371         function getSymbolAtLocation(node, ignoreErrors) {
70372             if (node.kind === 303) {
70373                 return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
70374             }
70375             var parent = node.parent;
70376             var grandParent = parent.parent;
70377             if (node.flags & 16777216) {
70378                 return undefined;
70379             }
70380             if (isDeclarationNameOrImportPropertyName(node)) {
70381                 var parentSymbol = getSymbolOfNode(parent);
70382                 return ts.isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node
70383                     ? getImmediateAliasedSymbol(parentSymbol)
70384                     : parentSymbol;
70385             }
70386             else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
70387                 return getSymbolOfNode(parent.parent);
70388             }
70389             if (node.kind === 79) {
70390                 if (isInRightSideOfImportOrExportAssignment(node)) {
70391                     return getSymbolOfNameOrPropertyAccessExpression(node);
70392                 }
70393                 else if (parent.kind === 202 &&
70394                     grandParent.kind === 200 &&
70395                     node === parent.propertyName) {
70396                     var typeOfPattern = getTypeOfNode(grandParent);
70397                     var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
70398                     if (propertyDeclaration) {
70399                         return propertyDeclaration;
70400                     }
70401                 }
70402                 else if (ts.isMetaProperty(parent)) {
70403                     var parentType = getTypeOfNode(parent);
70404                     var propertyDeclaration = getPropertyOfType(parentType, node.escapedText);
70405                     if (propertyDeclaration) {
70406                         return propertyDeclaration;
70407                     }
70408                     if (parent.keywordToken === 103) {
70409                         return checkNewTargetMetaProperty(parent).symbol;
70410                     }
70411                 }
70412             }
70413             switch (node.kind) {
70414                 case 79:
70415                 case 80:
70416                 case 205:
70417                 case 160:
70418                     return getSymbolOfNameOrPropertyAccessExpression(node);
70419                 case 108:
70420                     var container = ts.getThisContainer(node, false);
70421                     if (ts.isFunctionLike(container)) {
70422                         var sig = getSignatureFromDeclaration(container);
70423                         if (sig.thisParameter) {
70424                             return sig.thisParameter;
70425                         }
70426                     }
70427                     if (ts.isInExpressionContext(node)) {
70428                         return checkExpression(node).symbol;
70429                     }
70430                 case 191:
70431                     return getTypeFromThisTypeNode(node).symbol;
70432                 case 106:
70433                     return checkExpression(node).symbol;
70434                 case 134:
70435                     var constructorDeclaration = node.parent;
70436                     if (constructorDeclaration && constructorDeclaration.kind === 170) {
70437                         return constructorDeclaration.parent.symbol;
70438                     }
70439                     return undefined;
70440                 case 10:
70441                 case 14:
70442                     if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
70443                         ((node.parent.kind === 265 || node.parent.kind === 271) && node.parent.moduleSpecifier === node) ||
70444                         ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent)) ||
70445                         (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
70446                         return resolveExternalModuleName(node, node, ignoreErrors);
70447                     }
70448                     if (ts.isCallExpression(parent) && ts.isBindableObjectDefinePropertyCall(parent) && parent.arguments[1] === node) {
70449                         return getSymbolOfNode(parent);
70450                     }
70451                 case 8:
70452                     var objectType = ts.isElementAccessExpression(parent)
70453                         ? parent.argumentExpression === node ? getTypeOfExpression(parent.expression) : undefined
70454                         : ts.isLiteralTypeNode(parent) && ts.isIndexedAccessTypeNode(grandParent)
70455                             ? getTypeFromTypeNode(grandParent.objectType)
70456                             : undefined;
70457                     return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
70458                 case 88:
70459                 case 98:
70460                 case 38:
70461                 case 84:
70462                     return getSymbolOfNode(node.parent);
70463                 case 199:
70464                     return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined;
70465                 case 93:
70466                     return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined;
70467                 case 100:
70468                 case 103:
70469                     return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined;
70470                 case 230:
70471                     return checkExpression(node).symbol;
70472                 default:
70473                     return undefined;
70474             }
70475         }
70476         function getIndexInfosAtLocation(node) {
70477             if (ts.isIdentifier(node) && ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
70478                 var keyType_1 = getLiteralTypeFromPropertyName(node);
70479                 var objectType = getTypeOfExpression(node.parent.expression);
70480                 var objectTypes = objectType.flags & 1048576 ? objectType.types : [objectType];
70481                 return ts.flatMap(objectTypes, function (t) { return ts.filter(getIndexInfosOfType(t), function (info) { return isApplicableIndexType(keyType_1, info.keyType); }); });
70482             }
70483             return undefined;
70484         }
70485         function getShorthandAssignmentValueSymbol(location) {
70486             if (location && location.kind === 295) {
70487                 return resolveEntityName(location.name, 111551 | 2097152);
70488             }
70489             return undefined;
70490         }
70491         function getExportSpecifierLocalTargetSymbol(node) {
70492             if (ts.isExportSpecifier(node)) {
70493                 return node.parent.parent.moduleSpecifier ?
70494                     getExternalModuleMember(node.parent.parent, node) :
70495                     resolveEntityName(node.propertyName || node.name, 111551 | 788968 | 1920 | 2097152);
70496             }
70497             else {
70498                 return resolveEntityName(node, 111551 | 788968 | 1920 | 2097152);
70499             }
70500         }
70501         function getTypeOfNode(node) {
70502             if (ts.isSourceFile(node) && !ts.isExternalModule(node)) {
70503                 return errorType;
70504             }
70505             if (node.flags & 16777216) {
70506                 return errorType;
70507             }
70508             var classDecl = ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node);
70509             var classType = classDecl && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(classDecl.class));
70510             if (ts.isPartOfTypeNode(node)) {
70511                 var typeFromTypeNode = getTypeFromTypeNode(node);
70512                 return classType ? getTypeWithThisArgument(typeFromTypeNode, classType.thisType) : typeFromTypeNode;
70513             }
70514             if (ts.isExpressionNode(node)) {
70515                 return getRegularTypeOfExpression(node);
70516             }
70517             if (classType && !classDecl.isImplements) {
70518                 var baseType = ts.firstOrUndefined(getBaseTypes(classType));
70519                 return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
70520             }
70521             if (isTypeDeclaration(node)) {
70522                 var symbol = getSymbolOfNode(node);
70523                 return getDeclaredTypeOfSymbol(symbol);
70524             }
70525             if (isTypeDeclarationName(node)) {
70526                 var symbol = getSymbolAtLocation(node);
70527                 return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
70528             }
70529             if (ts.isDeclaration(node)) {
70530                 var symbol = getSymbolOfNode(node);
70531                 return getTypeOfSymbol(symbol);
70532             }
70533             if (isDeclarationNameOrImportPropertyName(node)) {
70534                 var symbol = getSymbolAtLocation(node);
70535                 if (symbol) {
70536                     return getTypeOfSymbol(symbol);
70537                 }
70538                 return errorType;
70539             }
70540             if (ts.isBindingPattern(node)) {
70541                 return getTypeForVariableLikeDeclaration(node.parent, true) || errorType;
70542             }
70543             if (isInRightSideOfImportOrExportAssignment(node)) {
70544                 var symbol = getSymbolAtLocation(node);
70545                 if (symbol) {
70546                     var declaredType = getDeclaredTypeOfSymbol(symbol);
70547                     return !isErrorType(declaredType) ? declaredType : getTypeOfSymbol(symbol);
70548                 }
70549             }
70550             if (ts.isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
70551                 return checkMetaPropertyKeyword(node.parent);
70552             }
70553             return errorType;
70554         }
70555         function getTypeOfAssignmentPattern(expr) {
70556             ts.Debug.assert(expr.kind === 204 || expr.kind === 203);
70557             if (expr.parent.kind === 243) {
70558                 var iteratedType = checkRightHandSideOfForOf(expr.parent);
70559                 return checkDestructuringAssignment(expr, iteratedType || errorType);
70560             }
70561             if (expr.parent.kind === 220) {
70562                 var iteratedType = getTypeOfExpression(expr.parent.right);
70563                 return checkDestructuringAssignment(expr, iteratedType || errorType);
70564             }
70565             if (expr.parent.kind === 294) {
70566                 var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
70567                 var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
70568                 var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
70569                 return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
70570             }
70571             var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
70572             var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
70573             var elementType = checkIteratedTypeOrElementType(65, typeOfArrayLiteral, undefinedType, expr.parent) || errorType;
70574             return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
70575         }
70576         function getPropertySymbolOfDestructuringAssignment(location) {
70577             var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
70578             return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
70579         }
70580         function getRegularTypeOfExpression(expr) {
70581             if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
70582                 expr = expr.parent;
70583             }
70584             return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
70585         }
70586         function getParentTypeOfClassElement(node) {
70587             var classSymbol = getSymbolOfNode(node.parent);
70588             return ts.isStatic(node)
70589                 ? getTypeOfSymbol(classSymbol)
70590                 : getDeclaredTypeOfSymbol(classSymbol);
70591         }
70592         function getClassElementPropertyKeyType(element) {
70593             var name = element.name;
70594             switch (name.kind) {
70595                 case 79:
70596                     return getStringLiteralType(ts.idText(name));
70597                 case 8:
70598                 case 10:
70599                     return getStringLiteralType(name.text);
70600                 case 161:
70601                     var nameType = checkComputedPropertyName(name);
70602                     return isTypeAssignableToKind(nameType, 12288) ? nameType : stringType;
70603                 default:
70604                     return ts.Debug.fail("Unsupported property name.");
70605             }
70606         }
70607         function getAugmentedPropertiesOfType(type) {
70608             type = getApparentType(type);
70609             var propsByName = ts.createSymbolTable(getPropertiesOfType(type));
70610             var functionType = getSignaturesOfType(type, 0).length ? globalCallableFunctionType :
70611                 getSignaturesOfType(type, 1).length ? globalNewableFunctionType :
70612                     undefined;
70613             if (functionType) {
70614                 ts.forEach(getPropertiesOfType(functionType), function (p) {
70615                     if (!propsByName.has(p.escapedName)) {
70616                         propsByName.set(p.escapedName, p);
70617                     }
70618                 });
70619             }
70620             return getNamedMembers(propsByName);
70621         }
70622         function typeHasCallOrConstructSignatures(type) {
70623             return ts.typeHasCallOrConstructSignatures(type, checker);
70624         }
70625         function getRootSymbols(symbol) {
70626             var roots = getImmediateRootSymbols(symbol);
70627             return roots ? ts.flatMap(roots, getRootSymbols) : [symbol];
70628         }
70629         function getImmediateRootSymbols(symbol) {
70630             if (ts.getCheckFlags(symbol) & 6) {
70631                 return ts.mapDefined(getSymbolLinks(symbol).containingType.types, function (type) { return getPropertyOfType(type, symbol.escapedName); });
70632             }
70633             else if (symbol.flags & 33554432) {
70634                 var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
70635                 return leftSpread ? [leftSpread, rightSpread]
70636                     : syntheticOrigin ? [syntheticOrigin]
70637                         : ts.singleElementArray(tryGetAliasTarget(symbol));
70638             }
70639             return undefined;
70640         }
70641         function tryGetAliasTarget(symbol) {
70642             var target;
70643             var next = symbol;
70644             while (next = getSymbolLinks(next).target) {
70645                 target = next;
70646             }
70647             return target;
70648         }
70649         function isArgumentsLocalBinding(nodeIn) {
70650             if (ts.isGeneratedIdentifier(nodeIn))
70651                 return false;
70652             var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
70653             if (!node)
70654                 return false;
70655             var parent = node.parent;
70656             if (!parent)
70657                 return false;
70658             var isPropertyName = ((ts.isPropertyAccessExpression(parent)
70659                 || ts.isPropertyAssignment(parent))
70660                 && parent.name === node);
70661             return !isPropertyName && getReferencedValueSymbol(node) === argumentsSymbol;
70662         }
70663         function moduleExportsSomeValue(moduleReferenceExpression) {
70664             var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
70665             if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
70666                 return true;
70667             }
70668             var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
70669             moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
70670             var symbolLinks = getSymbolLinks(moduleSymbol);
70671             if (symbolLinks.exportsSomeValue === undefined) {
70672                 symbolLinks.exportsSomeValue = hasExportAssignment
70673                     ? !!(moduleSymbol.flags & 111551)
70674                     : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue);
70675             }
70676             return symbolLinks.exportsSomeValue;
70677             function isValue(s) {
70678                 s = resolveSymbol(s);
70679                 return s && !!(s.flags & 111551);
70680             }
70681         }
70682         function isNameOfModuleOrEnumDeclaration(node) {
70683             return ts.isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
70684         }
70685         function getReferencedExportContainer(nodeIn, prefixLocals) {
70686             var _a;
70687             var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
70688             if (node) {
70689                 var symbol = getReferencedValueSymbol(node, isNameOfModuleOrEnumDeclaration(node));
70690                 if (symbol) {
70691                     if (symbol.flags & 1048576) {
70692                         var exportSymbol = getMergedSymbol(symbol.exportSymbol);
70693                         if (!prefixLocals && exportSymbol.flags & 944 && !(exportSymbol.flags & 3)) {
70694                             return undefined;
70695                         }
70696                         symbol = exportSymbol;
70697                     }
70698                     var parentSymbol_1 = getParentOfSymbol(symbol);
70699                     if (parentSymbol_1) {
70700                         if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 303) {
70701                             var symbolFile = parentSymbol_1.valueDeclaration;
70702                             var referenceFile = ts.getSourceFileOfNode(node);
70703                             var symbolIsUmdExport = symbolFile !== referenceFile;
70704                             return symbolIsUmdExport ? undefined : symbolFile;
70705                         }
70706                         return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; });
70707                     }
70708                 }
70709             }
70710         }
70711         function getReferencedImportDeclaration(nodeIn) {
70712             if (nodeIn.generatedImportReference) {
70713                 return nodeIn.generatedImportReference;
70714             }
70715             var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
70716             if (node) {
70717                 var symbol = getReferencedValueSymbol(node);
70718                 if (isNonLocalAlias(symbol, 111551) && !getTypeOnlyAliasDeclaration(symbol)) {
70719                     return getDeclarationOfAliasSymbol(symbol);
70720                 }
70721             }
70722             return undefined;
70723         }
70724         function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
70725             return symbol.valueDeclaration
70726                 && ts.isBindingElement(symbol.valueDeclaration)
70727                 && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 291;
70728         }
70729         function isSymbolOfDeclarationWithCollidingName(symbol) {
70730             if (symbol.flags & 418 && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) {
70731                 var links = getSymbolLinks(symbol);
70732                 if (links.isDeclarationWithCollidingName === undefined) {
70733                     var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
70734                     if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
70735                         var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
70736                         if (resolveName(container.parent, symbol.escapedName, 111551, undefined, undefined, false)) {
70737                             links.isDeclarationWithCollidingName = true;
70738                         }
70739                         else if (nodeLinks_1.flags & 262144) {
70740                             var isDeclaredInLoop = nodeLinks_1.flags & 524288;
70741                             var inLoopInitializer = ts.isIterationStatement(container, false);
70742                             var inLoopBodyBlock = container.kind === 234 && ts.isIterationStatement(container.parent, false);
70743                             links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
70744                         }
70745                         else {
70746                             links.isDeclarationWithCollidingName = false;
70747                         }
70748                     }
70749                 }
70750                 return links.isDeclarationWithCollidingName;
70751             }
70752             return false;
70753         }
70754         function getReferencedDeclarationWithCollidingName(nodeIn) {
70755             if (!ts.isGeneratedIdentifier(nodeIn)) {
70756                 var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
70757                 if (node) {
70758                     var symbol = getReferencedValueSymbol(node);
70759                     if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) {
70760                         return symbol.valueDeclaration;
70761                     }
70762                 }
70763             }
70764             return undefined;
70765         }
70766         function isDeclarationWithCollidingName(nodeIn) {
70767             var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
70768             if (node) {
70769                 var symbol = getSymbolOfNode(node);
70770                 if (symbol) {
70771                     return isSymbolOfDeclarationWithCollidingName(symbol);
70772                 }
70773             }
70774             return false;
70775         }
70776         function isValueAliasDeclaration(node) {
70777             switch (node.kind) {
70778                 case 264:
70779                     return isAliasResolvedToValue(getSymbolOfNode(node));
70780                 case 266:
70781                 case 267:
70782                 case 269:
70783                 case 274:
70784                     var symbol = getSymbolOfNode(node);
70785                     return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
70786                 case 271:
70787                     var exportClause = node.exportClause;
70788                     return !!exportClause && (ts.isNamespaceExport(exportClause) ||
70789                         ts.some(exportClause.elements, isValueAliasDeclaration));
70790                 case 270:
70791                     return node.expression && node.expression.kind === 79 ?
70792                         isAliasResolvedToValue(getSymbolOfNode(node)) :
70793                         true;
70794             }
70795             return false;
70796         }
70797         function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
70798             var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
70799             if (node === undefined || node.parent.kind !== 303 || !ts.isInternalModuleImportEqualsDeclaration(node)) {
70800                 return false;
70801             }
70802             var isValue = isAliasResolvedToValue(getSymbolOfNode(node));
70803             return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
70804         }
70805         function isAliasResolvedToValue(symbol) {
70806             if (!symbol) {
70807                 return false;
70808             }
70809             var target = resolveAlias(symbol);
70810             if (target === unknownSymbol) {
70811                 return true;
70812             }
70813             return !!(target.flags & 111551) &&
70814                 (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
70815         }
70816         function isConstEnumOrConstEnumOnlyModule(s) {
70817             return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
70818         }
70819         function isReferencedAliasDeclaration(node, checkChildren) {
70820             if (isAliasSymbolDeclaration(node)) {
70821                 var symbol = getSymbolOfNode(node);
70822                 var links = symbol && getSymbolLinks(symbol);
70823                 if (links === null || links === void 0 ? void 0 : links.referenced) {
70824                     return true;
70825                 }
70826                 var target = getSymbolLinks(symbol).target;
70827                 if (target && ts.getEffectiveModifierFlags(node) & 1 &&
70828                     target.flags & 111551 &&
70829                     (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
70830                     return true;
70831                 }
70832             }
70833             if (checkChildren) {
70834                 return !!ts.forEachChild(node, function (node) { return isReferencedAliasDeclaration(node, checkChildren); });
70835             }
70836             return false;
70837         }
70838         function isImplementationOfOverload(node) {
70839             if (ts.nodeIsPresent(node.body)) {
70840                 if (ts.isGetAccessor(node) || ts.isSetAccessor(node))
70841                     return false;
70842                 var symbol = getSymbolOfNode(node);
70843                 var signaturesOfSymbol = getSignaturesOfSymbol(symbol);
70844                 return signaturesOfSymbol.length > 1 ||
70845                     (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node);
70846             }
70847             return false;
70848         }
70849         function isRequiredInitializedParameter(parameter) {
70850             return !!strictNullChecks &&
70851                 !isOptionalParameter(parameter) &&
70852                 !ts.isJSDocParameterTag(parameter) &&
70853                 !!parameter.initializer &&
70854                 !ts.hasSyntacticModifier(parameter, 16476);
70855         }
70856         function isOptionalUninitializedParameterProperty(parameter) {
70857             return strictNullChecks &&
70858                 isOptionalParameter(parameter) &&
70859                 !parameter.initializer &&
70860                 ts.hasSyntacticModifier(parameter, 16476);
70861         }
70862         function isOptionalUninitializedParameter(parameter) {
70863             return !!strictNullChecks &&
70864                 isOptionalParameter(parameter) &&
70865                 !parameter.initializer;
70866         }
70867         function isExpandoFunctionDeclaration(node) {
70868             var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
70869             if (!declaration) {
70870                 return false;
70871             }
70872             var symbol = getSymbolOfNode(declaration);
70873             if (!symbol || !(symbol.flags & 16)) {
70874                 return false;
70875             }
70876             return !!ts.forEachEntry(getExportsOfSymbol(symbol), function (p) { return p.flags & 111551 && p.valueDeclaration && ts.isPropertyAccessExpression(p.valueDeclaration); });
70877         }
70878         function getPropertiesOfContainerFunction(node) {
70879             var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
70880             if (!declaration) {
70881                 return ts.emptyArray;
70882             }
70883             var symbol = getSymbolOfNode(declaration);
70884             return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || ts.emptyArray;
70885         }
70886         function getNodeCheckFlags(node) {
70887             var _a;
70888             var nodeId = node.id || 0;
70889             if (nodeId < 0 || nodeId >= nodeLinks.length)
70890                 return 0;
70891             return ((_a = nodeLinks[nodeId]) === null || _a === void 0 ? void 0 : _a.flags) || 0;
70892         }
70893         function getEnumMemberValue(node) {
70894             computeEnumMemberValues(node.parent);
70895             return getNodeLinks(node).enumMemberValue;
70896         }
70897         function canHaveConstantValue(node) {
70898             switch (node.kind) {
70899                 case 297:
70900                 case 205:
70901                 case 206:
70902                     return true;
70903             }
70904             return false;
70905         }
70906         function getConstantValue(node) {
70907             if (node.kind === 297) {
70908                 return getEnumMemberValue(node);
70909             }
70910             var symbol = getNodeLinks(node).resolvedSymbol;
70911             if (symbol && (symbol.flags & 8)) {
70912                 var member = symbol.valueDeclaration;
70913                 if (ts.isEnumConst(member.parent)) {
70914                     return getEnumMemberValue(member);
70915                 }
70916             }
70917             return undefined;
70918         }
70919         function isFunctionType(type) {
70920             return !!(type.flags & 524288) && getSignaturesOfType(type, 0).length > 0;
70921         }
70922         function getTypeReferenceSerializationKind(typeNameIn, location) {
70923             var _a, _b;
70924             var typeName = ts.getParseTreeNode(typeNameIn, ts.isEntityName);
70925             if (!typeName)
70926                 return ts.TypeReferenceSerializationKind.Unknown;
70927             if (location) {
70928                 location = ts.getParseTreeNode(location);
70929                 if (!location)
70930                     return ts.TypeReferenceSerializationKind.Unknown;
70931             }
70932             var isTypeOnly = false;
70933             if (ts.isQualifiedName(typeName)) {
70934                 var rootValueSymbol = resolveEntityName(ts.getFirstIdentifier(typeName), 111551, true, true, location);
70935                 isTypeOnly = !!((_a = rootValueSymbol === null || rootValueSymbol === void 0 ? void 0 : rootValueSymbol.declarations) === null || _a === void 0 ? void 0 : _a.every(ts.isTypeOnlyImportOrExportDeclaration));
70936             }
70937             var valueSymbol = resolveEntityName(typeName, 111551, true, true, location);
70938             var resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 ? resolveAlias(valueSymbol) : valueSymbol;
70939             isTypeOnly || (isTypeOnly = !!((_b = valueSymbol === null || valueSymbol === void 0 ? void 0 : valueSymbol.declarations) === null || _b === void 0 ? void 0 : _b.every(ts.isTypeOnlyImportOrExportDeclaration)));
70940             var typeSymbol = resolveEntityName(typeName, 788968, true, false, location);
70941             if (resolvedSymbol && resolvedSymbol === typeSymbol) {
70942                 var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false);
70943                 if (globalPromiseSymbol && resolvedSymbol === globalPromiseSymbol) {
70944                     return ts.TypeReferenceSerializationKind.Promise;
70945                 }
70946                 var constructorType = getTypeOfSymbol(resolvedSymbol);
70947                 if (constructorType && isConstructorType(constructorType)) {
70948                     return isTypeOnly ? ts.TypeReferenceSerializationKind.TypeWithCallSignature : ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;
70949                 }
70950             }
70951             if (!typeSymbol) {
70952                 return isTypeOnly ? ts.TypeReferenceSerializationKind.ObjectType : ts.TypeReferenceSerializationKind.Unknown;
70953             }
70954             var type = getDeclaredTypeOfSymbol(typeSymbol);
70955             if (isErrorType(type)) {
70956                 return isTypeOnly ? ts.TypeReferenceSerializationKind.ObjectType : ts.TypeReferenceSerializationKind.Unknown;
70957             }
70958             else if (type.flags & 3) {
70959                 return ts.TypeReferenceSerializationKind.ObjectType;
70960             }
70961             else if (isTypeAssignableToKind(type, 16384 | 98304 | 131072)) {
70962                 return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType;
70963             }
70964             else if (isTypeAssignableToKind(type, 528)) {
70965                 return ts.TypeReferenceSerializationKind.BooleanType;
70966             }
70967             else if (isTypeAssignableToKind(type, 296)) {
70968                 return ts.TypeReferenceSerializationKind.NumberLikeType;
70969             }
70970             else if (isTypeAssignableToKind(type, 2112)) {
70971                 return ts.TypeReferenceSerializationKind.BigIntLikeType;
70972             }
70973             else if (isTypeAssignableToKind(type, 402653316)) {
70974                 return ts.TypeReferenceSerializationKind.StringLikeType;
70975             }
70976             else if (isTupleType(type)) {
70977                 return ts.TypeReferenceSerializationKind.ArrayLikeType;
70978             }
70979             else if (isTypeAssignableToKind(type, 12288)) {
70980                 return ts.TypeReferenceSerializationKind.ESSymbolType;
70981             }
70982             else if (isFunctionType(type)) {
70983                 return ts.TypeReferenceSerializationKind.TypeWithCallSignature;
70984             }
70985             else if (isArrayType(type)) {
70986                 return ts.TypeReferenceSerializationKind.ArrayLikeType;
70987             }
70988             else {
70989                 return ts.TypeReferenceSerializationKind.ObjectType;
70990             }
70991         }
70992         function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
70993             var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
70994             if (!declaration) {
70995                 return ts.factory.createToken(130);
70996             }
70997             var symbol = getSymbolOfNode(declaration);
70998             var type = symbol && !(symbol.flags & (2048 | 131072))
70999                 ? getWidenedLiteralType(getTypeOfSymbol(symbol))
71000                 : errorType;
71001             if (type.flags & 8192 &&
71002                 type.symbol === symbol) {
71003                 flags |= 1048576;
71004             }
71005             if (addUndefined) {
71006                 type = getOptionalType(type);
71007             }
71008             return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker);
71009         }
71010         function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
71011             var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
71012             if (!signatureDeclaration) {
71013                 return ts.factory.createToken(130);
71014             }
71015             var signature = getSignatureFromDeclaration(signatureDeclaration);
71016             return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024, tracker);
71017         }
71018         function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
71019             var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
71020             if (!expr) {
71021                 return ts.factory.createToken(130);
71022             }
71023             var type = getWidenedType(getRegularTypeOfExpression(expr));
71024             return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker);
71025         }
71026         function hasGlobalName(name) {
71027             return globals.has(ts.escapeLeadingUnderscores(name));
71028         }
71029         function getReferencedValueSymbol(reference, startInDeclarationContainer) {
71030             var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
71031             if (resolvedSymbol) {
71032                 return resolvedSymbol;
71033             }
71034             var location = reference;
71035             if (startInDeclarationContainer) {
71036                 var parent = reference.parent;
71037                 if (ts.isDeclaration(parent) && reference === parent.name) {
71038                     location = getDeclarationContainer(parent);
71039                 }
71040             }
71041             return resolveName(location, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true);
71042         }
71043         function getReferencedValueDeclaration(referenceIn) {
71044             if (!ts.isGeneratedIdentifier(referenceIn)) {
71045                 var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
71046                 if (reference) {
71047                     var symbol = getReferencedValueSymbol(reference);
71048                     if (symbol) {
71049                         return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;
71050                     }
71051                 }
71052             }
71053             return undefined;
71054         }
71055         function isLiteralConstDeclaration(node) {
71056             if (ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) {
71057                 return isFreshLiteralType(getTypeOfSymbol(getSymbolOfNode(node)));
71058             }
71059             return false;
71060         }
71061         function literalTypeToNode(type, enclosing, tracker) {
71062             var enumResult = type.flags & 1024 ? nodeBuilder.symbolToExpression(type.symbol, 111551, enclosing, undefined, tracker)
71063                 : type === trueType ? ts.factory.createTrue() : type === falseType && ts.factory.createFalse();
71064             if (enumResult)
71065                 return enumResult;
71066             var literalValue = type.value;
71067             return typeof literalValue === "object" ? ts.factory.createBigIntLiteral(literalValue) :
71068                 typeof literalValue === "number" ? ts.factory.createNumericLiteral(literalValue) :
71069                     ts.factory.createStringLiteral(literalValue);
71070         }
71071         function createLiteralConstValue(node, tracker) {
71072             var type = getTypeOfSymbol(getSymbolOfNode(node));
71073             return literalTypeToNode(type, node, tracker);
71074         }
71075         function getJsxFactoryEntity(location) {
71076             return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity;
71077         }
71078         function getJsxFragmentFactoryEntity(location) {
71079             if (location) {
71080                 var file = ts.getSourceFileOfNode(location);
71081                 if (file) {
71082                     if (file.localJsxFragmentFactory) {
71083                         return file.localJsxFragmentFactory;
71084                     }
71085                     var jsxFragPragmas = file.pragmas.get("jsxfrag");
71086                     var jsxFragPragma = ts.isArray(jsxFragPragmas) ? jsxFragPragmas[0] : jsxFragPragmas;
71087                     if (jsxFragPragma) {
71088                         file.localJsxFragmentFactory = ts.parseIsolatedEntityName(jsxFragPragma.arguments.factory, languageVersion);
71089                         return file.localJsxFragmentFactory;
71090                     }
71091                 }
71092             }
71093             if (compilerOptions.jsxFragmentFactory) {
71094                 return ts.parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
71095             }
71096         }
71097         function createResolver() {
71098             var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
71099             var fileToDirective;
71100             if (resolvedTypeReferenceDirectives) {
71101                 fileToDirective = new ts.Map();
71102                 resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) {
71103                     if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
71104                         return;
71105                     }
71106                     var file = host.getSourceFile(resolvedDirective.resolvedFileName);
71107                     if (file) {
71108                         addReferencedFilesToTypeDirective(file, key);
71109                     }
71110                 });
71111             }
71112             return {
71113                 getReferencedExportContainer: getReferencedExportContainer,
71114                 getReferencedImportDeclaration: getReferencedImportDeclaration,
71115                 getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName,
71116                 isDeclarationWithCollidingName: isDeclarationWithCollidingName,
71117                 isValueAliasDeclaration: function (nodeIn) {
71118                     var node = ts.getParseTreeNode(nodeIn);
71119                     return node ? isValueAliasDeclaration(node) : true;
71120                 },
71121                 hasGlobalName: hasGlobalName,
71122                 isReferencedAliasDeclaration: function (nodeIn, checkChildren) {
71123                     var node = ts.getParseTreeNode(nodeIn);
71124                     return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
71125                 },
71126                 getNodeCheckFlags: function (nodeIn) {
71127                     var node = ts.getParseTreeNode(nodeIn);
71128                     return node ? getNodeCheckFlags(node) : 0;
71129                 },
71130                 isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName,
71131                 isDeclarationVisible: isDeclarationVisible,
71132                 isImplementationOfOverload: isImplementationOfOverload,
71133                 isRequiredInitializedParameter: isRequiredInitializedParameter,
71134                 isOptionalUninitializedParameterProperty: isOptionalUninitializedParameterProperty,
71135                 isExpandoFunctionDeclaration: isExpandoFunctionDeclaration,
71136                 getPropertiesOfContainerFunction: getPropertiesOfContainerFunction,
71137                 createTypeOfDeclaration: createTypeOfDeclaration,
71138                 createReturnTypeOfSignatureDeclaration: createReturnTypeOfSignatureDeclaration,
71139                 createTypeOfExpression: createTypeOfExpression,
71140                 createLiteralConstValue: createLiteralConstValue,
71141                 isSymbolAccessible: isSymbolAccessible,
71142                 isEntityNameVisible: isEntityNameVisible,
71143                 getConstantValue: function (nodeIn) {
71144                     var node = ts.getParseTreeNode(nodeIn, canHaveConstantValue);
71145                     return node ? getConstantValue(node) : undefined;
71146                 },
71147                 collectLinkedAliases: collectLinkedAliases,
71148                 getReferencedValueDeclaration: getReferencedValueDeclaration,
71149                 getTypeReferenceSerializationKind: getTypeReferenceSerializationKind,
71150                 isOptionalParameter: isOptionalParameter,
71151                 moduleExportsSomeValue: moduleExportsSomeValue,
71152                 isArgumentsLocalBinding: isArgumentsLocalBinding,
71153                 getExternalModuleFileFromDeclaration: function (nodeIn) {
71154                     var node = ts.getParseTreeNode(nodeIn, ts.hasPossibleExternalModuleReference);
71155                     return node && getExternalModuleFileFromDeclaration(node);
71156                 },
71157                 getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName,
71158                 getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol,
71159                 isLiteralConstDeclaration: isLiteralConstDeclaration,
71160                 isLateBound: function (nodeIn) {
71161                     var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
71162                     var symbol = node && getSymbolOfNode(node);
71163                     return !!(symbol && ts.getCheckFlags(symbol) & 4096);
71164                 },
71165                 getJsxFactoryEntity: getJsxFactoryEntity,
71166                 getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity,
71167                 getAllAccessorDeclarations: function (accessor) {
71168                     accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration);
71169                     var otherKind = accessor.kind === 172 ? 171 : 172;
71170                     var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
71171                     var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
71172                     var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
71173                     var setAccessor = accessor.kind === 172 ? accessor : otherAccessor;
71174                     var getAccessor = accessor.kind === 171 ? accessor : otherAccessor;
71175                     return {
71176                         firstAccessor: firstAccessor,
71177                         secondAccessor: secondAccessor,
71178                         setAccessor: setAccessor,
71179                         getAccessor: getAccessor
71180                     };
71181                 },
71182                 getSymbolOfExternalModuleSpecifier: function (moduleName) { return resolveExternalModuleNameWorker(moduleName, moduleName, undefined); },
71183                 isBindingCapturedByNode: function (node, decl) {
71184                     var parseNode = ts.getParseTreeNode(node);
71185                     var parseDecl = ts.getParseTreeNode(decl);
71186                     return !!parseNode && !!parseDecl && (ts.isVariableDeclaration(parseDecl) || ts.isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
71187                 },
71188                 getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) {
71189                     var n = ts.getParseTreeNode(node);
71190                     ts.Debug.assert(n && n.kind === 303, "Non-sourcefile node passed into getDeclarationsForSourceFile");
71191                     var sym = getSymbolOfNode(node);
71192                     if (!sym) {
71193                         return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled);
71194                     }
71195                     return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
71196                 },
71197                 isImportRequiredByAugmentation: isImportRequiredByAugmentation,
71198             };
71199             function isImportRequiredByAugmentation(node) {
71200                 var file = ts.getSourceFileOfNode(node);
71201                 if (!file.symbol)
71202                     return false;
71203                 var importTarget = getExternalModuleFileFromDeclaration(node);
71204                 if (!importTarget)
71205                     return false;
71206                 if (importTarget === file)
71207                     return false;
71208                 var exports = getExportsOfModule(file.symbol);
71209                 for (var _i = 0, _a = ts.arrayFrom(exports.values()); _i < _a.length; _i++) {
71210                     var s = _a[_i];
71211                     if (s.mergeId) {
71212                         var merged = getMergedSymbol(s);
71213                         if (merged.declarations) {
71214                             for (var _b = 0, _c = merged.declarations; _b < _c.length; _b++) {
71215                                 var d = _c[_b];
71216                                 var declFile = ts.getSourceFileOfNode(d);
71217                                 if (declFile === importTarget) {
71218                                     return true;
71219                                 }
71220                             }
71221                         }
71222                     }
71223                 }
71224                 return false;
71225             }
71226             function isInHeritageClause(node) {
71227                 return node.parent && node.parent.kind === 227 && node.parent.parent && node.parent.parent.kind === 290;
71228             }
71229             function getTypeReferenceDirectivesForEntityName(node) {
71230                 if (!fileToDirective) {
71231                     return undefined;
71232                 }
71233                 var meaning = 788968 | 1920;
71234                 if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 205 && !isInHeritageClause(node))) {
71235                     meaning = 111551 | 1048576;
71236                 }
71237                 var symbol = resolveEntityName(node, meaning, true);
71238                 return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
71239             }
71240             function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
71241                 if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
71242                     return undefined;
71243                 }
71244                 var typeReferenceDirectives;
71245                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
71246                     var decl = _a[_i];
71247                     if (decl.symbol && decl.symbol.flags & meaning) {
71248                         var file = ts.getSourceFileOfNode(decl);
71249                         var typeReferenceDirective = fileToDirective.get(file.path);
71250                         if (typeReferenceDirective) {
71251                             (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
71252                         }
71253                         else {
71254                             return undefined;
71255                         }
71256                     }
71257                 }
71258                 return typeReferenceDirectives;
71259             }
71260             function isSymbolFromTypeDeclarationFile(symbol) {
71261                 if (!symbol.declarations) {
71262                     return false;
71263                 }
71264                 var current = symbol;
71265                 while (true) {
71266                     var parent = getParentOfSymbol(current);
71267                     if (parent) {
71268                         current = parent;
71269                     }
71270                     else {
71271                         break;
71272                     }
71273                 }
71274                 if (current.valueDeclaration && current.valueDeclaration.kind === 303 && current.flags & 512) {
71275                     return false;
71276                 }
71277                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
71278                     var decl = _a[_i];
71279                     var file = ts.getSourceFileOfNode(decl);
71280                     if (fileToDirective.has(file.path)) {
71281                         return true;
71282                     }
71283                 }
71284                 return false;
71285             }
71286             function addReferencedFilesToTypeDirective(file, key) {
71287                 if (fileToDirective.has(file.path))
71288                     return;
71289                 fileToDirective.set(file.path, key);
71290                 for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
71291                     var fileName = _a[_i].fileName;
71292                     var resolvedFile = ts.resolveTripleslashReference(fileName, file.fileName);
71293                     var referencedFile = host.getSourceFile(resolvedFile);
71294                     if (referencedFile) {
71295                         addReferencedFilesToTypeDirective(referencedFile, key);
71296                     }
71297                 }
71298             }
71299         }
71300         function getExternalModuleFileFromDeclaration(declaration) {
71301             var specifier = declaration.kind === 260 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
71302             var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined);
71303             if (!moduleSymbol) {
71304                 return undefined;
71305             }
71306             return ts.getDeclarationOfKind(moduleSymbol, 303);
71307         }
71308         function initializeTypeChecker() {
71309             for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) {
71310                 var file = _a[_i];
71311                 ts.bindSourceFile(file, compilerOptions);
71312             }
71313             amalgamatedDuplicates = new ts.Map();
71314             var augmentations;
71315             for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) {
71316                 var file = _c[_b];
71317                 if (file.redirectInfo) {
71318                     continue;
71319                 }
71320                 if (!ts.isExternalOrCommonJsModule(file)) {
71321                     var fileGlobalThisSymbol = file.locals.get("globalThis");
71322                     if (fileGlobalThisSymbol === null || fileGlobalThisSymbol === void 0 ? void 0 : fileGlobalThisSymbol.declarations) {
71323                         for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
71324                             var declaration = _e[_d];
71325                             diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
71326                         }
71327                     }
71328                     mergeSymbolTable(globals, file.locals);
71329                 }
71330                 if (file.jsGlobalAugmentations) {
71331                     mergeSymbolTable(globals, file.jsGlobalAugmentations);
71332                 }
71333                 if (file.patternAmbientModules && file.patternAmbientModules.length) {
71334                     patternAmbientModules = ts.concatenate(patternAmbientModules, file.patternAmbientModules);
71335                 }
71336                 if (file.moduleAugmentations.length) {
71337                     (augmentations || (augmentations = [])).push(file.moduleAugmentations);
71338                 }
71339                 if (file.symbol && file.symbol.globalExports) {
71340                     var source = file.symbol.globalExports;
71341                     source.forEach(function (sourceSymbol, id) {
71342                         if (!globals.has(id)) {
71343                             globals.set(id, sourceSymbol);
71344                         }
71345                     });
71346                 }
71347             }
71348             if (augmentations) {
71349                 for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
71350                     var list = augmentations_1[_f];
71351                     for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
71352                         var augmentation = list_1[_g];
71353                         if (!ts.isGlobalScopeAugmentation(augmentation.parent))
71354                             continue;
71355                         mergeModuleAugmentation(augmentation);
71356                     }
71357                 }
71358             }
71359             addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);
71360             getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
71361             getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, true);
71362             getSymbolLinks(unknownSymbol).type = errorType;
71363             getSymbolLinks(globalThisSymbol).type = createObjectType(16, globalThisSymbol);
71364             globalArrayType = getGlobalType("Array", 1, true);
71365             globalObjectType = getGlobalType("Object", 0, true);
71366             globalFunctionType = getGlobalType("Function", 0, true);
71367             globalCallableFunctionType = strictBindCallApply && getGlobalType("CallableFunction", 0, true) || globalFunctionType;
71368             globalNewableFunctionType = strictBindCallApply && getGlobalType("NewableFunction", 0, true) || globalFunctionType;
71369             globalStringType = getGlobalType("String", 0, true);
71370             globalNumberType = getGlobalType("Number", 0, true);
71371             globalBooleanType = getGlobalType("Boolean", 0, true);
71372             globalRegExpType = getGlobalType("RegExp", 0, true);
71373             anyArrayType = createArrayType(anyType);
71374             autoArrayType = createArrayType(autoType);
71375             if (autoArrayType === emptyObjectType) {
71376                 autoArrayType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
71377             }
71378             globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1) || globalArrayType;
71379             anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
71380             globalThisType = getGlobalTypeOrUndefined("ThisType", 1);
71381             if (augmentations) {
71382                 for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
71383                     var list = augmentations_2[_h];
71384                     for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
71385                         var augmentation = list_2[_j];
71386                         if (ts.isGlobalScopeAugmentation(augmentation.parent))
71387                             continue;
71388                         mergeModuleAugmentation(augmentation);
71389                     }
71390                 }
71391             }
71392             amalgamatedDuplicates.forEach(function (_a) {
71393                 var firstFile = _a.firstFile, secondFile = _a.secondFile, conflictingSymbols = _a.conflictingSymbols;
71394                 if (conflictingSymbols.size < 8) {
71395                     conflictingSymbols.forEach(function (_a, symbolName) {
71396                         var isBlockScoped = _a.isBlockScoped, firstFileLocations = _a.firstFileLocations, secondFileLocations = _a.secondFileLocations;
71397                         var message = isBlockScoped ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0;
71398                         for (var _i = 0, firstFileLocations_1 = firstFileLocations; _i < firstFileLocations_1.length; _i++) {
71399                             var node = firstFileLocations_1[_i];
71400                             addDuplicateDeclarationError(node, message, symbolName, secondFileLocations);
71401                         }
71402                         for (var _b = 0, secondFileLocations_1 = secondFileLocations; _b < secondFileLocations_1.length; _b++) {
71403                             var node = secondFileLocations_1[_b];
71404                             addDuplicateDeclarationError(node, message, symbolName, firstFileLocations);
71405                         }
71406                     });
71407                 }
71408                 else {
71409                     var list = ts.arrayFrom(conflictingSymbols.keys()).join(", ");
71410                     diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Conflicts_are_in_this_file)));
71411                     diagnostics.add(ts.addRelatedInfo(ts.createDiagnosticForNode(secondFile, ts.Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), ts.createDiagnosticForNode(firstFile, ts.Diagnostics.Conflicts_are_in_this_file)));
71412                 }
71413             });
71414             amalgamatedDuplicates = undefined;
71415         }
71416         function checkExternalEmitHelpers(location, helpers) {
71417             if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) {
71418                 var sourceFile = ts.getSourceFileOfNode(location);
71419                 if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 8388608)) {
71420                     var helpersModule = resolveHelpersModule(sourceFile, location);
71421                     if (helpersModule !== unknownSymbol) {
71422                         var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
71423                         for (var helper = 1; helper <= 4194304; helper <<= 1) {
71424                             if (uncheckedHelpers & helper) {
71425                                 var name = getHelperName(helper);
71426                                 var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551);
71427                                 if (!symbol) {
71428                                     error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, ts.externalHelpersModuleNameText, name);
71429                                 }
71430                                 else if (helper & 524288) {
71431                                     if (!ts.some(getSignaturesOfSymbol(symbol), function (signature) { return getParameterCount(signature) > 3; })) {
71432                                         error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts.externalHelpersModuleNameText, name, 4);
71433                                     }
71434                                 }
71435                                 else if (helper & 1048576) {
71436                                     if (!ts.some(getSignaturesOfSymbol(symbol), function (signature) { return getParameterCount(signature) > 4; })) {
71437                                         error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts.externalHelpersModuleNameText, name, 5);
71438                                     }
71439                                 }
71440                                 else if (helper & 1024) {
71441                                     if (!ts.some(getSignaturesOfSymbol(symbol), function (signature) { return getParameterCount(signature) > 2; })) {
71442                                         error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, ts.externalHelpersModuleNameText, name, 3);
71443                                     }
71444                                 }
71445                             }
71446                         }
71447                     }
71448                     requestedExternalEmitHelpers |= helpers;
71449                 }
71450             }
71451         }
71452         function getHelperName(helper) {
71453             switch (helper) {
71454                 case 1: return "__extends";
71455                 case 2: return "__assign";
71456                 case 4: return "__rest";
71457                 case 8: return "__decorate";
71458                 case 16: return "__metadata";
71459                 case 32: return "__param";
71460                 case 64: return "__awaiter";
71461                 case 128: return "__generator";
71462                 case 256: return "__values";
71463                 case 512: return "__read";
71464                 case 1024: return "__spreadArray";
71465                 case 2048: return "__await";
71466                 case 4096: return "__asyncGenerator";
71467                 case 8192: return "__asyncDelegator";
71468                 case 16384: return "__asyncValues";
71469                 case 32768: return "__exportStar";
71470                 case 65536: return "__importStar";
71471                 case 131072: return "__importDefault";
71472                 case 262144: return "__makeTemplateObject";
71473                 case 524288: return "__classPrivateFieldGet";
71474                 case 1048576: return "__classPrivateFieldSet";
71475                 case 2097152: return "__classPrivateFieldIn";
71476                 case 4194304: return "__createBinding";
71477                 default: return ts.Debug.fail("Unrecognized helper");
71478             }
71479         }
71480         function resolveHelpersModule(node, errorNode) {
71481             if (!externalHelpersModule) {
71482                 externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol;
71483             }
71484             return externalHelpersModule;
71485         }
71486         function checkGrammarDecoratorsAndModifiers(node) {
71487             return checkGrammarDecorators(node) || checkGrammarModifiers(node);
71488         }
71489         function checkGrammarDecorators(node) {
71490             if (!node.decorators) {
71491                 return false;
71492             }
71493             if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
71494                 if (node.kind === 168 && !ts.nodeIsPresent(node.body)) {
71495                     return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
71496                 }
71497                 else {
71498                     return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
71499                 }
71500             }
71501             else if (node.kind === 171 || node.kind === 172) {
71502                 var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
71503                 if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
71504                     return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
71505                 }
71506             }
71507             return false;
71508         }
71509         function checkGrammarModifiers(node) {
71510             var quickResult = reportObviousModifierErrors(node);
71511             if (quickResult !== undefined) {
71512                 return quickResult;
71513             }
71514             var lastStatic, lastDeclare, lastAsync, lastReadonly, lastOverride;
71515             var flags = 0;
71516             for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
71517                 var modifier = _a[_i];
71518                 if (modifier.kind !== 144) {
71519                     if (node.kind === 165 || node.kind === 167) {
71520                         return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
71521                     }
71522                     if (node.kind === 175 && (modifier.kind !== 124 || !ts.isClassLike(node.parent))) {
71523                         return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
71524                     }
71525                 }
71526                 switch (modifier.kind) {
71527                     case 85:
71528                         if (node.kind !== 259) {
71529                             return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85));
71530                         }
71531                         break;
71532                     case 158:
71533                         if (flags & 16384) {
71534                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override");
71535                         }
71536                         else if (flags & 2) {
71537                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare");
71538                         }
71539                         else if (flags & 64) {
71540                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly");
71541                         }
71542                         else if (flags & 256) {
71543                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async");
71544                         }
71545                         flags |= 16384;
71546                         lastOverride = modifier;
71547                         break;
71548                     case 123:
71549                     case 122:
71550                     case 121:
71551                         var text = visibilityToString(ts.modifierToFlag(modifier.kind));
71552                         if (flags & 28) {
71553                             return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
71554                         }
71555                         else if (flags & 16384) {
71556                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "override");
71557                         }
71558                         else if (flags & 32) {
71559                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static");
71560                         }
71561                         else if (flags & 64) {
71562                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly");
71563                         }
71564                         else if (flags & 256) {
71565                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
71566                         }
71567                         else if (node.parent.kind === 261 || node.parent.kind === 303) {
71568                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
71569                         }
71570                         else if (flags & 128) {
71571                             if (modifier.kind === 121) {
71572                                 return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
71573                             }
71574                             else {
71575                                 return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract");
71576                             }
71577                         }
71578                         else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
71579                             return grammarErrorOnNode(modifier, ts.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
71580                         }
71581                         flags |= ts.modifierToFlag(modifier.kind);
71582                         break;
71583                     case 124:
71584                         if (flags & 32) {
71585                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
71586                         }
71587                         else if (flags & 64) {
71588                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly");
71589                         }
71590                         else if (flags & 256) {
71591                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
71592                         }
71593                         else if (node.parent.kind === 261 || node.parent.kind === 303) {
71594                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
71595                         }
71596                         else if (node.kind === 163) {
71597                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
71598                         }
71599                         else if (flags & 128) {
71600                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
71601                         }
71602                         else if (flags & 16384) {
71603                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "override");
71604                         }
71605                         flags |= 32;
71606                         lastStatic = modifier;
71607                         break;
71608                     case 144:
71609                         if (flags & 64) {
71610                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
71611                         }
71612                         else if (node.kind !== 166 && node.kind !== 165 && node.kind !== 175 && node.kind !== 163) {
71613                             return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
71614                         }
71615                         flags |= 64;
71616                         lastReadonly = modifier;
71617                         break;
71618                     case 93:
71619                         if (flags & 1) {
71620                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
71621                         }
71622                         else if (flags & 2) {
71623                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare");
71624                         }
71625                         else if (flags & 128) {
71626                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract");
71627                         }
71628                         else if (flags & 256) {
71629                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
71630                         }
71631                         else if (ts.isClassLike(node.parent)) {
71632                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export");
71633                         }
71634                         else if (node.kind === 163) {
71635                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
71636                         }
71637                         flags |= 1;
71638                         break;
71639                     case 88:
71640                         var container = node.parent.kind === 303 ? node.parent : node.parent.parent;
71641                         if (container.kind === 260 && !ts.isAmbientModule(container)) {
71642                             return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
71643                         }
71644                         else if (!(flags & 1)) {
71645                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default");
71646                         }
71647                         flags |= 512;
71648                         break;
71649                     case 135:
71650                         if (flags & 2) {
71651                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
71652                         }
71653                         else if (flags & 256) {
71654                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
71655                         }
71656                         else if (flags & 16384) {
71657                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override");
71658                         }
71659                         else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) {
71660                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare");
71661                         }
71662                         else if (node.kind === 163) {
71663                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
71664                         }
71665                         else if ((node.parent.flags & 8388608) && node.parent.kind === 261) {
71666                             return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
71667                         }
71668                         else if (ts.isPrivateIdentifierClassElementDeclaration(node)) {
71669                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare");
71670                         }
71671                         flags |= 2;
71672                         lastDeclare = modifier;
71673                         break;
71674                     case 126:
71675                         if (flags & 128) {
71676                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
71677                         }
71678                         if (node.kind !== 256 &&
71679                             node.kind !== 179) {
71680                             if (node.kind !== 168 &&
71681                                 node.kind !== 166 &&
71682                                 node.kind !== 171 &&
71683                                 node.kind !== 172) {
71684                                 return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
71685                             }
71686                             if (!(node.parent.kind === 256 && ts.hasSyntacticModifier(node.parent, 128))) {
71687                                 return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
71688                             }
71689                             if (flags & 32) {
71690                                 return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
71691                             }
71692                             if (flags & 8) {
71693                                 return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract");
71694                             }
71695                             if (flags & 256 && lastAsync) {
71696                                 return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
71697                             }
71698                             if (flags & 16384) {
71699                                 return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override");
71700                             }
71701                         }
71702                         if (ts.isNamedDeclaration(node) && node.name.kind === 80) {
71703                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract");
71704                         }
71705                         flags |= 128;
71706                         break;
71707                     case 131:
71708                         if (flags & 256) {
71709                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
71710                         }
71711                         else if (flags & 2 || node.parent.flags & 8388608) {
71712                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
71713                         }
71714                         else if (node.kind === 163) {
71715                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
71716                         }
71717                         if (flags & 128) {
71718                             return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract");
71719                         }
71720                         flags |= 256;
71721                         lastAsync = modifier;
71722                         break;
71723                 }
71724             }
71725             if (node.kind === 170) {
71726                 if (flags & 32) {
71727                     return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
71728                 }
71729                 if (flags & 128) {
71730                     return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract");
71731                 }
71732                 if (flags & 16384) {
71733                     return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override");
71734                 }
71735                 else if (flags & 256) {
71736                     return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async");
71737                 }
71738                 else if (flags & 64) {
71739                     return grammarErrorOnNode(lastReadonly, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly");
71740                 }
71741                 return false;
71742             }
71743             else if ((node.kind === 265 || node.kind === 264) && flags & 2) {
71744                 return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
71745             }
71746             else if (node.kind === 163 && (flags & 16476) && ts.isBindingPattern(node.name)) {
71747                 return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
71748             }
71749             else if (node.kind === 163 && (flags & 16476) && node.dotDotDotToken) {
71750                 return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
71751             }
71752             if (flags & 256) {
71753                 return checkGrammarAsyncModifier(node, lastAsync);
71754             }
71755             return false;
71756         }
71757         function reportObviousModifierErrors(node) {
71758             return !node.modifiers
71759                 ? false
71760                 : shouldReportBadModifier(node)
71761                     ? grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here)
71762                     : undefined;
71763         }
71764         function shouldReportBadModifier(node) {
71765             switch (node.kind) {
71766                 case 171:
71767                 case 172:
71768                 case 170:
71769                 case 166:
71770                 case 165:
71771                 case 168:
71772                 case 167:
71773                 case 175:
71774                 case 260:
71775                 case 265:
71776                 case 264:
71777                 case 271:
71778                 case 270:
71779                 case 212:
71780                 case 213:
71781                 case 163:
71782                     return false;
71783                 default:
71784                     if (node.parent.kind === 261 || node.parent.kind === 303) {
71785                         return false;
71786                     }
71787                     switch (node.kind) {
71788                         case 255:
71789                             return nodeHasAnyModifiersExcept(node, 131);
71790                         case 256:
71791                         case 179:
71792                             return nodeHasAnyModifiersExcept(node, 126);
71793                         case 257:
71794                         case 236:
71795                         case 258:
71796                         case 169:
71797                             return true;
71798                         case 259:
71799                             return nodeHasAnyModifiersExcept(node, 85);
71800                         default:
71801                             ts.Debug.fail();
71802                     }
71803             }
71804         }
71805         function nodeHasAnyModifiersExcept(node, allowedModifier) {
71806             return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier;
71807         }
71808         function checkGrammarAsyncModifier(node, asyncModifier) {
71809             switch (node.kind) {
71810                 case 168:
71811                 case 255:
71812                 case 212:
71813                 case 213:
71814                     return false;
71815             }
71816             return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
71817         }
71818         function checkGrammarForDisallowedTrailingComma(list, diag) {
71819             if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; }
71820             if (list && list.hasTrailingComma) {
71821                 return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag);
71822             }
71823             return false;
71824         }
71825         function checkGrammarTypeParameterList(typeParameters, file) {
71826             if (typeParameters && typeParameters.length === 0) {
71827                 var start = typeParameters.pos - "<".length;
71828                 var end = ts.skipTrivia(file.text, typeParameters.end) + ">".length;
71829                 return grammarErrorAtPos(file, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty);
71830             }
71831             return false;
71832         }
71833         function checkGrammarParameterList(parameters) {
71834             var seenOptionalParameter = false;
71835             var parameterCount = parameters.length;
71836             for (var i = 0; i < parameterCount; i++) {
71837                 var parameter = parameters[i];
71838                 if (parameter.dotDotDotToken) {
71839                     if (i !== (parameterCount - 1)) {
71840                         return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
71841                     }
71842                     if (!(parameter.flags & 8388608)) {
71843                         checkGrammarForDisallowedTrailingComma(parameters, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
71844                     }
71845                     if (parameter.questionToken) {
71846                         return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional);
71847                     }
71848                     if (parameter.initializer) {
71849                         return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer);
71850                     }
71851                 }
71852                 else if (isOptionalParameter(parameter)) {
71853                     seenOptionalParameter = true;
71854                     if (parameter.questionToken && parameter.initializer) {
71855                         return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
71856                     }
71857                 }
71858                 else if (seenOptionalParameter && !parameter.initializer) {
71859                     return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter);
71860                 }
71861             }
71862         }
71863         function getNonSimpleParameters(parameters) {
71864             return ts.filter(parameters, function (parameter) { return !!parameter.initializer || ts.isBindingPattern(parameter.name) || ts.isRestParameter(parameter); });
71865         }
71866         function checkGrammarForUseStrictSimpleParameterList(node) {
71867             if (languageVersion >= 3) {
71868                 var useStrictDirective_1 = node.body && ts.isBlock(node.body) && ts.findUseStrictPrologue(node.body.statements);
71869                 if (useStrictDirective_1) {
71870                     var nonSimpleParameters = getNonSimpleParameters(node.parameters);
71871                     if (ts.length(nonSimpleParameters)) {
71872                         ts.forEach(nonSimpleParameters, function (parameter) {
71873                             ts.addRelatedInfo(error(parameter, ts.Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), ts.createDiagnosticForNode(useStrictDirective_1, ts.Diagnostics.use_strict_directive_used_here));
71874                         });
71875                         var diagnostics_2 = nonSimpleParameters.map(function (parameter, index) { return (index === 0 ? ts.createDiagnosticForNode(parameter, ts.Diagnostics.Non_simple_parameter_declared_here) : ts.createDiagnosticForNode(parameter, ts.Diagnostics.and_here)); });
71876                         ts.addRelatedInfo.apply(void 0, __spreadArray([error(useStrictDirective_1, ts.Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list)], diagnostics_2, false));
71877                         return true;
71878                     }
71879                 }
71880             }
71881             return false;
71882         }
71883         function checkGrammarFunctionLikeDeclaration(node) {
71884             var file = ts.getSourceFileOfNode(node);
71885             return checkGrammarDecoratorsAndModifiers(node) ||
71886                 checkGrammarTypeParameterList(node.typeParameters, file) ||
71887                 checkGrammarParameterList(node.parameters) ||
71888                 checkGrammarArrowFunction(node, file) ||
71889                 (ts.isFunctionLikeDeclaration(node) && checkGrammarForUseStrictSimpleParameterList(node));
71890         }
71891         function checkGrammarClassLikeDeclaration(node) {
71892             var file = ts.getSourceFileOfNode(node);
71893             return checkGrammarClassDeclarationHeritageClauses(node) ||
71894                 checkGrammarTypeParameterList(node.typeParameters, file);
71895         }
71896         function checkGrammarArrowFunction(node, file) {
71897             if (!ts.isArrowFunction(node)) {
71898                 return false;
71899             }
71900             if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
71901                 if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts", ".cts"])) {
71902                     grammarErrorOnNode(node.typeParameters[0], ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
71903                 }
71904             }
71905             var equalsGreaterThanToken = node.equalsGreaterThanToken;
71906             var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
71907             var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
71908             return startLine !== endLine && grammarErrorOnNode(equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow);
71909         }
71910         function checkGrammarIndexSignatureParameters(node) {
71911             var parameter = node.parameters[0];
71912             if (node.parameters.length !== 1) {
71913                 if (parameter) {
71914                     return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);
71915                 }
71916                 else {
71917                     return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter);
71918                 }
71919             }
71920             checkGrammarForDisallowedTrailingComma(node.parameters, ts.Diagnostics.An_index_signature_cannot_have_a_trailing_comma);
71921             if (parameter.dotDotDotToken) {
71922                 return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
71923             }
71924             if (ts.hasEffectiveModifiers(parameter)) {
71925                 return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);
71926             }
71927             if (parameter.questionToken) {
71928                 return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
71929             }
71930             if (parameter.initializer) {
71931                 return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
71932             }
71933             if (!parameter.type) {
71934                 return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
71935             }
71936             var type = getTypeFromTypeNode(parameter.type);
71937             if (someType(type, function (t) { return !!(t.flags & 8576); }) || isGenericType(type)) {
71938                 return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead);
71939             }
71940             if (!everyType(type, isValidIndexKeyType)) {
71941                 return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type);
71942             }
71943             if (!node.type) {
71944                 return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation);
71945             }
71946             return false;
71947         }
71948         function checkGrammarIndexSignature(node) {
71949             return checkGrammarDecoratorsAndModifiers(node) || checkGrammarIndexSignatureParameters(node);
71950         }
71951         function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) {
71952             if (typeArguments && typeArguments.length === 0) {
71953                 var sourceFile = ts.getSourceFileOfNode(node);
71954                 var start = typeArguments.pos - "<".length;
71955                 var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + ">".length;
71956                 return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty);
71957             }
71958             return false;
71959         }
71960         function checkGrammarTypeArguments(node, typeArguments) {
71961             return checkGrammarForDisallowedTrailingComma(typeArguments) ||
71962                 checkGrammarForAtLeastOneTypeArgument(node, typeArguments);
71963         }
71964         function checkGrammarTaggedTemplateChain(node) {
71965             if (node.questionDotToken || node.flags & 32) {
71966                 return grammarErrorOnNode(node.template, ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain);
71967             }
71968             return false;
71969         }
71970         function checkGrammarForOmittedArgument(args) {
71971             if (args) {
71972                 for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
71973                     var arg = args_4[_i];
71974                     if (arg.kind === 226) {
71975                         return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
71976                     }
71977                 }
71978             }
71979             return false;
71980         }
71981         function checkGrammarArguments(args) {
71982             return checkGrammarForOmittedArgument(args);
71983         }
71984         function checkGrammarHeritageClause(node) {
71985             var types = node.types;
71986             if (checkGrammarForDisallowedTrailingComma(types)) {
71987                 return true;
71988             }
71989             if (types && types.length === 0) {
71990                 var listType = ts.tokenToString(node.token);
71991                 return grammarErrorAtPos(node, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType);
71992             }
71993             return ts.some(types, checkGrammarExpressionWithTypeArguments);
71994         }
71995         function checkGrammarExpressionWithTypeArguments(node) {
71996             return checkGrammarTypeArguments(node, node.typeArguments);
71997         }
71998         function checkGrammarClassDeclarationHeritageClauses(node) {
71999             var seenExtendsClause = false;
72000             var seenImplementsClause = false;
72001             if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
72002                 for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
72003                     var heritageClause = _a[_i];
72004                     if (heritageClause.token === 94) {
72005                         if (seenExtendsClause) {
72006                             return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
72007                         }
72008                         if (seenImplementsClause) {
72009                             return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause);
72010                         }
72011                         if (heritageClause.types.length > 1) {
72012                             return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class);
72013                         }
72014                         seenExtendsClause = true;
72015                     }
72016                     else {
72017                         ts.Debug.assert(heritageClause.token === 117);
72018                         if (seenImplementsClause) {
72019                             return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
72020                         }
72021                         seenImplementsClause = true;
72022                     }
72023                     checkGrammarHeritageClause(heritageClause);
72024                 }
72025             }
72026         }
72027         function checkGrammarInterfaceDeclaration(node) {
72028             var seenExtendsClause = false;
72029             if (node.heritageClauses) {
72030                 for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
72031                     var heritageClause = _a[_i];
72032                     if (heritageClause.token === 94) {
72033                         if (seenExtendsClause) {
72034                             return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
72035                         }
72036                         seenExtendsClause = true;
72037                     }
72038                     else {
72039                         ts.Debug.assert(heritageClause.token === 117);
72040                         return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
72041                     }
72042                     checkGrammarHeritageClause(heritageClause);
72043                 }
72044             }
72045             return false;
72046         }
72047         function checkGrammarComputedPropertyName(node) {
72048             if (node.kind !== 161) {
72049                 return false;
72050             }
72051             var computedPropertyName = node;
72052             if (computedPropertyName.expression.kind === 220 && computedPropertyName.expression.operatorToken.kind === 27) {
72053                 return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
72054             }
72055             return false;
72056         }
72057         function checkGrammarForGenerator(node) {
72058             if (node.asteriskToken) {
72059                 ts.Debug.assert(node.kind === 255 ||
72060                     node.kind === 212 ||
72061                     node.kind === 168);
72062                 if (node.flags & 8388608) {
72063                     return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
72064                 }
72065                 if (!node.body) {
72066                     return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);
72067                 }
72068             }
72069         }
72070         function checkGrammarForInvalidQuestionMark(questionToken, message) {
72071             return !!questionToken && grammarErrorOnNode(questionToken, message);
72072         }
72073         function checkGrammarForInvalidExclamationToken(exclamationToken, message) {
72074             return !!exclamationToken && grammarErrorOnNode(exclamationToken, message);
72075         }
72076         function checkGrammarObjectLiteralExpression(node, inDestructuring) {
72077             var seen = new ts.Map();
72078             for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
72079                 var prop = _a[_i];
72080                 if (prop.kind === 296) {
72081                     if (inDestructuring) {
72082                         var expression = ts.skipParentheses(prop.expression);
72083                         if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
72084                             return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
72085                         }
72086                     }
72087                     continue;
72088                 }
72089                 var name = prop.name;
72090                 if (name.kind === 161) {
72091                     checkGrammarComputedPropertyName(name);
72092                 }
72093                 if (prop.kind === 295 && !inDestructuring && prop.objectAssignmentInitializer) {
72094                     return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern);
72095                 }
72096                 if (name.kind === 80) {
72097                     grammarErrorOnNode(name, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
72098                 }
72099                 if (prop.modifiers) {
72100                     for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {
72101                         var mod = _c[_b];
72102                         if (mod.kind !== 131 || prop.kind !== 168) {
72103                             grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
72104                         }
72105                     }
72106                 }
72107                 var currentKind = void 0;
72108                 switch (prop.kind) {
72109                     case 295:
72110                         checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
72111                     case 294:
72112                         checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
72113                         if (name.kind === 8) {
72114                             checkGrammarNumericLiteral(name);
72115                         }
72116                         currentKind = 4;
72117                         break;
72118                     case 168:
72119                         currentKind = 8;
72120                         break;
72121                     case 171:
72122                         currentKind = 1;
72123                         break;
72124                     case 172:
72125                         currentKind = 2;
72126                         break;
72127                     default:
72128                         throw ts.Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
72129                 }
72130                 if (!inDestructuring) {
72131                     var effectiveName = ts.getPropertyNameForPropertyNameNode(name);
72132                     if (effectiveName === undefined) {
72133                         continue;
72134                     }
72135                     var existingKind = seen.get(effectiveName);
72136                     if (!existingKind) {
72137                         seen.set(effectiveName, currentKind);
72138                     }
72139                     else {
72140                         if ((currentKind & 12) && (existingKind & 12)) {
72141                             grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name));
72142                         }
72143                         else if ((currentKind & 3) && (existingKind & 3)) {
72144                             if (existingKind !== 3 && currentKind !== existingKind) {
72145                                 seen.set(effectiveName, currentKind | existingKind);
72146                             }
72147                             else {
72148                                 return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name);
72149                             }
72150                         }
72151                         else {
72152                             return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name);
72153                         }
72154                     }
72155                 }
72156             }
72157         }
72158         function checkGrammarJsxElement(node) {
72159             checkGrammarJsxName(node.tagName);
72160             checkGrammarTypeArguments(node, node.typeArguments);
72161             var seen = new ts.Map();
72162             for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
72163                 var attr = _a[_i];
72164                 if (attr.kind === 286) {
72165                     continue;
72166                 }
72167                 var name = attr.name, initializer = attr.initializer;
72168                 if (!seen.get(name.escapedText)) {
72169                     seen.set(name.escapedText, true);
72170                 }
72171                 else {
72172                     return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
72173                 }
72174                 if (initializer && initializer.kind === 287 && !initializer.expression) {
72175                     return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
72176                 }
72177             }
72178         }
72179         function checkGrammarJsxName(node) {
72180             if (ts.isPropertyAccessExpression(node)) {
72181                 var propName = node;
72182                 do {
72183                     var check_1 = checkGrammarJsxNestedIdentifier(propName.name);
72184                     if (check_1) {
72185                         return check_1;
72186                     }
72187                     propName = propName.expression;
72188                 } while (ts.isPropertyAccessExpression(propName));
72189                 var check = checkGrammarJsxNestedIdentifier(propName);
72190                 if (check) {
72191                     return check;
72192                 }
72193             }
72194             function checkGrammarJsxNestedIdentifier(name) {
72195                 if (ts.isIdentifier(name) && ts.idText(name).indexOf(":") !== -1) {
72196                     return grammarErrorOnNode(name, ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names);
72197                 }
72198             }
72199         }
72200         function checkGrammarJsxExpression(node) {
72201             if (node.expression && ts.isCommaSequence(node.expression)) {
72202                 return grammarErrorOnNode(node.expression, ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array);
72203             }
72204         }
72205         function checkGrammarForInOrForOfStatement(forInOrOfStatement) {
72206             if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
72207                 return true;
72208             }
72209             if (forInOrOfStatement.kind === 243 && forInOrOfStatement.awaitModifier) {
72210                 if (!(forInOrOfStatement.flags & 32768)) {
72211                     var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
72212                     if (ts.isInTopLevelContext(forInOrOfStatement)) {
72213                         if (!hasParseDiagnostics(sourceFile)) {
72214                             if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
72215                                 diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
72216                             }
72217                             if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
72218                                 diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
72219                             }
72220                         }
72221                     }
72222                     else {
72223                         if (!hasParseDiagnostics(sourceFile)) {
72224                             var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
72225                             var func = ts.getContainingFunction(forInOrOfStatement);
72226                             if (func && func.kind !== 170) {
72227                                 ts.Debug.assert((ts.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function.");
72228                                 var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
72229                                 ts.addRelatedInfo(diagnostic, relatedInfo);
72230                             }
72231                             diagnostics.add(diagnostic);
72232                             return true;
72233                         }
72234                     }
72235                     return false;
72236                 }
72237             }
72238             if (ts.isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 32768) &&
72239                 ts.isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
72240                 grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async);
72241                 return false;
72242             }
72243             if (forInOrOfStatement.initializer.kind === 254) {
72244                 var variableList = forInOrOfStatement.initializer;
72245                 if (!checkGrammarVariableDeclarationList(variableList)) {
72246                     var declarations = variableList.declarations;
72247                     if (!declarations.length) {
72248                         return false;
72249                     }
72250                     if (declarations.length > 1) {
72251                         var diagnostic = forInOrOfStatement.kind === 242
72252                             ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
72253                             : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
72254                         return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
72255                     }
72256                     var firstDeclaration = declarations[0];
72257                     if (firstDeclaration.initializer) {
72258                         var diagnostic = forInOrOfStatement.kind === 242
72259                             ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
72260                             : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
72261                         return grammarErrorOnNode(firstDeclaration.name, diagnostic);
72262                     }
72263                     if (firstDeclaration.type) {
72264                         var diagnostic = forInOrOfStatement.kind === 242
72265                             ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
72266                             : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
72267                         return grammarErrorOnNode(firstDeclaration, diagnostic);
72268                     }
72269                 }
72270             }
72271             return false;
72272         }
72273         function checkGrammarAccessor(accessor) {
72274             if (!(accessor.flags & 8388608) && (accessor.parent.kind !== 181) && (accessor.parent.kind !== 257)) {
72275                 if (languageVersion < 1) {
72276                     return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
72277                 }
72278                 if (languageVersion < 2 && ts.isPrivateIdentifier(accessor.name)) {
72279                     return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
72280                 }
72281                 if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128)) {
72282                     return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
72283                 }
72284             }
72285             if (accessor.body) {
72286                 if (ts.hasSyntacticModifier(accessor, 128)) {
72287                     return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
72288                 }
72289                 if (accessor.parent.kind === 181 || accessor.parent.kind === 257) {
72290                     return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
72291                 }
72292             }
72293             if (accessor.typeParameters) {
72294                 return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
72295             }
72296             if (!doesAccessorHaveCorrectParameterCount(accessor)) {
72297                 return grammarErrorOnNode(accessor.name, accessor.kind === 171 ?
72298                     ts.Diagnostics.A_get_accessor_cannot_have_parameters :
72299                     ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
72300             }
72301             if (accessor.kind === 172) {
72302                 if (accessor.type) {
72303                     return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
72304                 }
72305                 var parameter = ts.Debug.checkDefined(ts.getSetAccessorValueParameter(accessor), "Return value does not match parameter count assertion.");
72306                 if (parameter.dotDotDotToken) {
72307                     return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter);
72308                 }
72309                 if (parameter.questionToken) {
72310                     return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
72311                 }
72312                 if (parameter.initializer) {
72313                     return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
72314                 }
72315             }
72316             return false;
72317         }
72318         function doesAccessorHaveCorrectParameterCount(accessor) {
72319             return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 171 ? 0 : 1);
72320         }
72321         function getAccessorThisParameter(accessor) {
72322             if (accessor.parameters.length === (accessor.kind === 171 ? 1 : 2)) {
72323                 return ts.getThisParameter(accessor);
72324             }
72325         }
72326         function checkGrammarTypeOperatorNode(node) {
72327             if (node.operator === 153) {
72328                 if (node.type.kind !== 150) {
72329                     return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(150));
72330                 }
72331                 var parent = ts.walkUpParenthesizedTypes(node.parent);
72332                 if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
72333                     parent = parent.parent;
72334                     if (ts.isJSDocTypeTag(parent)) {
72335                         parent = parent.parent.parent;
72336                     }
72337                 }
72338                 switch (parent.kind) {
72339                     case 253:
72340                         var decl = parent;
72341                         if (decl.name.kind !== 79) {
72342                             return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
72343                         }
72344                         if (!ts.isVariableDeclarationInVariableStatement(decl)) {
72345                             return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement);
72346                         }
72347                         if (!(decl.parent.flags & 2)) {
72348                             return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
72349                         }
72350                         break;
72351                     case 166:
72352                         if (!ts.isStatic(parent) ||
72353                             !ts.hasEffectiveReadonlyModifier(parent)) {
72354                             return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
72355                         }
72356                         break;
72357                     case 165:
72358                         if (!ts.hasSyntacticModifier(parent, 64)) {
72359                             return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
72360                         }
72361                         break;
72362                     default:
72363                         return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
72364                 }
72365             }
72366             else if (node.operator === 144) {
72367                 if (node.type.kind !== 182 && node.type.kind !== 183) {
72368                     return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(150));
72369                 }
72370             }
72371         }
72372         function checkGrammarForInvalidDynamicName(node, message) {
72373             if (isNonBindableDynamicName(node)) {
72374                 return grammarErrorOnNode(node, message);
72375             }
72376         }
72377         function checkGrammarMethod(node) {
72378             if (checkGrammarFunctionLikeDeclaration(node)) {
72379                 return true;
72380             }
72381             if (node.kind === 168) {
72382                 if (node.parent.kind === 204) {
72383                     if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131)) {
72384                         return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
72385                     }
72386                     else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
72387                         return true;
72388                     }
72389                     else if (checkGrammarForInvalidExclamationToken(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context)) {
72390                         return true;
72391                     }
72392                     else if (node.body === undefined) {
72393                         return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
72394                     }
72395                 }
72396                 if (checkGrammarForGenerator(node)) {
72397                     return true;
72398                 }
72399             }
72400             if (ts.isClassLike(node.parent)) {
72401                 if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) {
72402                     return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
72403                 }
72404                 if (node.flags & 8388608) {
72405                     return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
72406                 }
72407                 else if (node.kind === 168 && !node.body) {
72408                     return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
72409                 }
72410             }
72411             else if (node.parent.kind === 257) {
72412                 return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
72413             }
72414             else if (node.parent.kind === 181) {
72415                 return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
72416             }
72417         }
72418         function checkGrammarBreakOrContinueStatement(node) {
72419             var current = node;
72420             while (current) {
72421                 if (ts.isFunctionLikeOrClassStaticBlockDeclaration(current)) {
72422                     return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
72423                 }
72424                 switch (current.kind) {
72425                     case 249:
72426                         if (node.label && current.label.escapedText === node.label.escapedText) {
72427                             var isMisplacedContinueLabel = node.kind === 244
72428                                 && !ts.isIterationStatement(current.statement, true);
72429                             if (isMisplacedContinueLabel) {
72430                                 return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
72431                             }
72432                             return false;
72433                         }
72434                         break;
72435                     case 248:
72436                         if (node.kind === 245 && !node.label) {
72437                             return false;
72438                         }
72439                         break;
72440                     default:
72441                         if (ts.isIterationStatement(current, false) && !node.label) {
72442                             return false;
72443                         }
72444                         break;
72445                 }
72446                 current = current.parent;
72447             }
72448             if (node.label) {
72449                 var message = node.kind === 245
72450                     ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
72451                     : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
72452                 return grammarErrorOnNode(node, message);
72453             }
72454             else {
72455                 var message = node.kind === 245
72456                     ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
72457                     : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
72458                 return grammarErrorOnNode(node, message);
72459             }
72460         }
72461         function checkGrammarBindingElement(node) {
72462             if (node.dotDotDotToken) {
72463                 var elements = node.parent.elements;
72464                 if (node !== ts.last(elements)) {
72465                     return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
72466                 }
72467                 checkGrammarForDisallowedTrailingComma(elements, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
72468                 if (node.propertyName) {
72469                     return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_have_a_property_name);
72470                 }
72471             }
72472             if (node.dotDotDotToken && node.initializer) {
72473                 return grammarErrorAtPos(node, node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
72474             }
72475         }
72476         function isStringOrNumberLiteralExpression(expr) {
72477             return ts.isStringOrNumericLiteralLike(expr) ||
72478                 expr.kind === 218 && expr.operator === 40 &&
72479                     expr.operand.kind === 8;
72480         }
72481         function isBigIntLiteralExpression(expr) {
72482             return expr.kind === 9 ||
72483                 expr.kind === 218 && expr.operator === 40 &&
72484                     expr.operand.kind === 9;
72485         }
72486         function isSimpleLiteralEnumReference(expr) {
72487             if ((ts.isPropertyAccessExpression(expr) || (ts.isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression))) &&
72488                 ts.isEntityNameExpression(expr.expression)) {
72489                 return !!(checkExpressionCached(expr).flags & 1024);
72490             }
72491         }
72492         function checkAmbientInitializer(node) {
72493             var initializer = node.initializer;
72494             if (initializer) {
72495                 var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
72496                     isSimpleLiteralEnumReference(initializer) ||
72497                     initializer.kind === 110 || initializer.kind === 95 ||
72498                     isBigIntLiteralExpression(initializer));
72499                 var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
72500                 if (isConstOrReadonly && !node.type) {
72501                     if (isInvalidInitializer) {
72502                         return grammarErrorOnNode(initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference);
72503                     }
72504                 }
72505                 else {
72506                     return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
72507                 }
72508                 if (!isConstOrReadonly || isInvalidInitializer) {
72509                     return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
72510                 }
72511             }
72512         }
72513         function checkGrammarVariableDeclaration(node) {
72514             if (node.parent.parent.kind !== 242 && node.parent.parent.kind !== 243) {
72515                 if (node.flags & 8388608) {
72516                     checkAmbientInitializer(node);
72517                 }
72518                 else if (!node.initializer) {
72519                     if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) {
72520                         return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer);
72521                     }
72522                     if (ts.isVarConst(node)) {
72523                         return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized);
72524                     }
72525                 }
72526             }
72527             if (node.exclamationToken && (node.parent.parent.kind !== 236 || !node.type || node.initializer || node.flags & 8388608)) {
72528                 var message = node.initializer
72529                     ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
72530                     : !node.type
72531                         ? ts.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations
72532                         : ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
72533                 return grammarErrorOnNode(node.exclamationToken, message);
72534             }
72535             if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
72536                 !(node.parent.parent.flags & 8388608) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
72537                 checkESModuleMarker(node.name);
72538             }
72539             var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node));
72540             return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
72541         }
72542         function checkESModuleMarker(name) {
72543             if (name.kind === 79) {
72544                 if (ts.idText(name) === "__esModule") {
72545                     return grammarErrorOnNodeSkippedOn("noEmit", name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
72546                 }
72547             }
72548             else {
72549                 var elements = name.elements;
72550                 for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
72551                     var element = elements_1[_i];
72552                     if (!ts.isOmittedExpression(element)) {
72553                         return checkESModuleMarker(element.name);
72554                     }
72555                 }
72556             }
72557             return false;
72558         }
72559         function checkGrammarNameInLetOrConstDeclarations(name) {
72560             if (name.kind === 79) {
72561                 if (name.originalKeywordKind === 119) {
72562                     return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
72563                 }
72564             }
72565             else {
72566                 var elements = name.elements;
72567                 for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
72568                     var element = elements_2[_i];
72569                     if (!ts.isOmittedExpression(element)) {
72570                         checkGrammarNameInLetOrConstDeclarations(element.name);
72571                     }
72572                 }
72573             }
72574             return false;
72575         }
72576         function checkGrammarVariableDeclarationList(declarationList) {
72577             var declarations = declarationList.declarations;
72578             if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) {
72579                 return true;
72580             }
72581             if (!declarationList.declarations.length) {
72582                 return grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty);
72583             }
72584             return false;
72585         }
72586         function allowLetAndConstDeclarations(parent) {
72587             switch (parent.kind) {
72588                 case 238:
72589                 case 239:
72590                 case 240:
72591                 case 247:
72592                 case 241:
72593                 case 242:
72594                 case 243:
72595                     return false;
72596                 case 249:
72597                     return allowLetAndConstDeclarations(parent.parent);
72598             }
72599             return true;
72600         }
72601         function checkGrammarForDisallowedLetOrConstStatement(node) {
72602             if (!allowLetAndConstDeclarations(node.parent)) {
72603                 if (ts.isLet(node.declarationList)) {
72604                     return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);
72605                 }
72606                 else if (ts.isVarConst(node.declarationList)) {
72607                     return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block);
72608                 }
72609             }
72610         }
72611         function checkGrammarMetaProperty(node) {
72612             var escapedText = node.name.escapedText;
72613             switch (node.keywordToken) {
72614                 case 103:
72615                     if (escapedText !== "target") {
72616                         return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
72617                     }
72618                     break;
72619                 case 100:
72620                     if (escapedText !== "meta") {
72621                         return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
72622                     }
72623                     break;
72624             }
72625         }
72626         function hasParseDiagnostics(sourceFile) {
72627             return sourceFile.parseDiagnostics.length > 0;
72628         }
72629         function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) {
72630             var sourceFile = ts.getSourceFileOfNode(node);
72631             if (!hasParseDiagnostics(sourceFile)) {
72632                 var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
72633                 diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2));
72634                 return true;
72635             }
72636             return false;
72637         }
72638         function grammarErrorAtPos(nodeForSourceFile, start, length, message, arg0, arg1, arg2) {
72639             var sourceFile = ts.getSourceFileOfNode(nodeForSourceFile);
72640             if (!hasParseDiagnostics(sourceFile)) {
72641                 diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2));
72642                 return true;
72643             }
72644             return false;
72645         }
72646         function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) {
72647             var sourceFile = ts.getSourceFileOfNode(node);
72648             if (!hasParseDiagnostics(sourceFile)) {
72649                 errorSkippedOn(key, node, message, arg0, arg1, arg2);
72650                 return true;
72651             }
72652             return false;
72653         }
72654         function grammarErrorOnNode(node, message, arg0, arg1, arg2) {
72655             var sourceFile = ts.getSourceFileOfNode(node);
72656             if (!hasParseDiagnostics(sourceFile)) {
72657                 diagnostics.add(ts.createDiagnosticForNode(node, message, arg0, arg1, arg2));
72658                 return true;
72659             }
72660             return false;
72661         }
72662         function checkGrammarConstructorTypeParameters(node) {
72663             var jsdocTypeParameters = ts.isInJSFile(node) ? ts.getJSDocTypeParameterDeclarations(node) : undefined;
72664             var range = node.typeParameters || jsdocTypeParameters && ts.firstOrUndefined(jsdocTypeParameters);
72665             if (range) {
72666                 var pos = range.pos === range.end ? range.pos : ts.skipTrivia(ts.getSourceFileOfNode(node).text, range.pos);
72667                 return grammarErrorAtPos(node, pos, range.end - pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration);
72668             }
72669         }
72670         function checkGrammarConstructorTypeAnnotation(node) {
72671             var type = ts.getEffectiveReturnTypeNode(node);
72672             if (type) {
72673                 return grammarErrorOnNode(type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration);
72674             }
72675         }
72676         function checkGrammarProperty(node) {
72677             if (ts.isComputedPropertyName(node.name) && ts.isBinaryExpression(node.name.expression) && node.name.expression.operatorToken.kind === 101) {
72678                 return grammarErrorOnNode(node.parent.members[0], ts.Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);
72679             }
72680             if (ts.isClassLike(node.parent)) {
72681                 if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
72682                     return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
72683                 }
72684                 if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type)) {
72685                     return true;
72686                 }
72687                 if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) {
72688                     return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
72689                 }
72690             }
72691             else if (node.parent.kind === 257) {
72692                 if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
72693                     return true;
72694                 }
72695                 if (node.initializer) {
72696                     return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
72697                 }
72698             }
72699             else if (ts.isTypeLiteralNode(node.parent)) {
72700                 if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
72701                     return true;
72702                 }
72703                 if (node.initializer) {
72704                     return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_type_literal_property_cannot_have_an_initializer);
72705                 }
72706             }
72707             if (node.flags & 8388608) {
72708                 checkAmbientInitializer(node);
72709             }
72710             if (ts.isPropertyDeclaration(node) && node.exclamationToken && (!ts.isClassLike(node.parent) || !node.type || node.initializer ||
72711                 node.flags & 8388608 || ts.isStatic(node) || ts.hasAbstractModifier(node))) {
72712                 var message = node.initializer
72713                     ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
72714                     : !node.type
72715                         ? ts.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations
72716                         : ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
72717                 return grammarErrorOnNode(node.exclamationToken, message);
72718             }
72719         }
72720         function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
72721             if (node.kind === 257 ||
72722                 node.kind === 258 ||
72723                 node.kind === 265 ||
72724                 node.kind === 264 ||
72725                 node.kind === 271 ||
72726                 node.kind === 270 ||
72727                 node.kind === 263 ||
72728                 ts.hasSyntacticModifier(node, 2 | 1 | 512)) {
72729                 return false;
72730             }
72731             return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
72732         }
72733         function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
72734             for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
72735                 var decl = _a[_i];
72736                 if (ts.isDeclaration(decl) || decl.kind === 236) {
72737                     if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
72738                         return true;
72739                     }
72740                 }
72741             }
72742             return false;
72743         }
72744         function checkGrammarSourceFile(node) {
72745             return !!(node.flags & 8388608) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node);
72746         }
72747         function checkGrammarStatementInAmbientContext(node) {
72748             if (node.flags & 8388608) {
72749                 var links = getNodeLinks(node);
72750                 if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) {
72751                     return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
72752                 }
72753                 if (node.parent.kind === 234 || node.parent.kind === 261 || node.parent.kind === 303) {
72754                     var links_2 = getNodeLinks(node.parent);
72755                     if (!links_2.hasReportedStatementInAmbientContext) {
72756                         return links_2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts);
72757                     }
72758                 }
72759                 else {
72760                 }
72761             }
72762             return false;
72763         }
72764         function checkGrammarNumericLiteral(node) {
72765             if (node.numericLiteralFlags & 32) {
72766                 var diagnosticMessage = void 0;
72767                 if (languageVersion >= 1) {
72768                     diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
72769                 }
72770                 else if (ts.isChildOfNodeWithKind(node, 195)) {
72771                     diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
72772                 }
72773                 else if (ts.isChildOfNodeWithKind(node, 297)) {
72774                     diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
72775                 }
72776                 if (diagnosticMessage) {
72777                     var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 40;
72778                     var literal = (withMinus ? "-" : "") + "0o" + node.text;
72779                     return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal);
72780                 }
72781             }
72782             checkNumericLiteralValueSize(node);
72783             return false;
72784         }
72785         function checkNumericLiteralValueSize(node) {
72786             if (node.numericLiteralFlags & 16 || node.text.length <= 15 || node.text.indexOf(".") !== -1) {
72787                 return;
72788             }
72789             var apparentValue = +ts.getTextOfNode(node);
72790             if (apparentValue <= Math.pow(2, 53) - 1 && apparentValue + 1 > apparentValue) {
72791                 return;
72792             }
72793             addErrorOrSuggestion(false, ts.createDiagnosticForNode(node, ts.Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers));
72794         }
72795         function checkGrammarBigIntLiteral(node) {
72796             var literalType = ts.isLiteralTypeNode(node.parent) ||
72797                 ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
72798             if (!literalType) {
72799                 if (languageVersion < 7) {
72800                     if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) {
72801                         return true;
72802                     }
72803                 }
72804             }
72805             return false;
72806         }
72807         function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) {
72808             var sourceFile = ts.getSourceFileOfNode(node);
72809             if (!hasParseDiagnostics(sourceFile)) {
72810                 var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
72811                 diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), 0, message, arg0, arg1, arg2));
72812                 return true;
72813             }
72814             return false;
72815         }
72816         function getAmbientModules() {
72817             if (!ambientModulesCache) {
72818                 ambientModulesCache = [];
72819                 globals.forEach(function (global, sym) {
72820                     if (ambientModuleSymbolRegex.test(sym)) {
72821                         ambientModulesCache.push(global);
72822                     }
72823                 });
72824             }
72825             return ambientModulesCache;
72826         }
72827         function checkGrammarImportClause(node) {
72828             var _a;
72829             if (node.isTypeOnly && node.name && node.namedBindings) {
72830                 return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both);
72831             }
72832             if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268) {
72833                 return checkGrammarNamedImportsOrExports(node.namedBindings);
72834             }
72835             return false;
72836         }
72837         function checkGrammarNamedImportsOrExports(namedBindings) {
72838             return !!ts.forEach(namedBindings.elements, function (specifier) {
72839                 if (specifier.isTypeOnly) {
72840                     return grammarErrorOnFirstToken(specifier, specifier.kind === 269
72841                         ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement
72842                         : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement);
72843                 }
72844             });
72845         }
72846         function checkGrammarImportCallExpression(node) {
72847             if (moduleKind === ts.ModuleKind.ES2015) {
72848                 return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
72849             }
72850             if (node.typeArguments) {
72851                 return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
72852             }
72853             var nodeArguments = node.arguments;
72854             if (moduleKind !== ts.ModuleKind.ESNext) {
72855                 checkGrammarForDisallowedTrailingComma(nodeArguments);
72856                 if (nodeArguments.length > 1) {
72857                     var assertionArgument = nodeArguments[1];
72858                     return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext);
72859                 }
72860             }
72861             if (nodeArguments.length === 0 || nodeArguments.length > 2) {
72862                 return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments);
72863             }
72864             var spreadElement = ts.find(nodeArguments, ts.isSpreadElement);
72865             if (spreadElement) {
72866                 return grammarErrorOnNode(spreadElement, ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element);
72867             }
72868             return false;
72869         }
72870         function findMatchingTypeReferenceOrTypeAliasReference(source, unionTarget) {
72871             var sourceObjectFlags = ts.getObjectFlags(source);
72872             if (sourceObjectFlags & (4 | 16) && unionTarget.flags & 1048576) {
72873                 return ts.find(unionTarget.types, function (target) {
72874                     if (target.flags & 524288) {
72875                         var overlapObjFlags = sourceObjectFlags & ts.getObjectFlags(target);
72876                         if (overlapObjFlags & 4) {
72877                             return source.target === target.target;
72878                         }
72879                         if (overlapObjFlags & 16) {
72880                             return !!source.aliasSymbol && source.aliasSymbol === target.aliasSymbol;
72881                         }
72882                     }
72883                     return false;
72884                 });
72885             }
72886         }
72887         function findBestTypeForObjectLiteral(source, unionTarget) {
72888             if (ts.getObjectFlags(source) & 128 && someType(unionTarget, isArrayLikeType)) {
72889                 return ts.find(unionTarget.types, function (t) { return !isArrayLikeType(t); });
72890             }
72891         }
72892         function findBestTypeForInvokable(source, unionTarget) {
72893             var signatureKind = 0;
72894             var hasSignatures = getSignaturesOfType(source, signatureKind).length > 0 ||
72895                 (signatureKind = 1, getSignaturesOfType(source, signatureKind).length > 0);
72896             if (hasSignatures) {
72897                 return ts.find(unionTarget.types, function (t) { return getSignaturesOfType(t, signatureKind).length > 0; });
72898             }
72899         }
72900         function findMostOverlappyType(source, unionTarget) {
72901             var bestMatch;
72902             var matchingCount = 0;
72903             for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
72904                 var target = _a[_i];
72905                 var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
72906                 if (overlap.flags & 4194304) {
72907                     bestMatch = target;
72908                     matchingCount = Infinity;
72909                 }
72910                 else if (overlap.flags & 1048576) {
72911                     var len = ts.length(ts.filter(overlap.types, isUnitType));
72912                     if (len >= matchingCount) {
72913                         bestMatch = target;
72914                         matchingCount = len;
72915                     }
72916                 }
72917                 else if (isUnitType(overlap) && 1 >= matchingCount) {
72918                     bestMatch = target;
72919                     matchingCount = 1;
72920                 }
72921             }
72922             return bestMatch;
72923         }
72924         function filterPrimitivesIfContainsNonPrimitive(type) {
72925             if (maybeTypeOfKind(type, 67108864)) {
72926                 var result = filterType(type, function (t) { return !(t.flags & 131068); });
72927                 if (!(result.flags & 131072)) {
72928                     return result;
72929                 }
72930             }
72931             return type;
72932         }
72933         function findMatchingDiscriminantType(source, target, isRelatedTo, skipPartial) {
72934             if (target.flags & 1048576 && source.flags & (2097152 | 524288)) {
72935                 var match = getMatchingUnionConstituentForType(target, source);
72936                 if (match) {
72937                     return match;
72938                 }
72939                 var sourceProperties = getPropertiesOfType(source);
72940                 if (sourceProperties) {
72941                     var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
72942                     if (sourcePropertiesFiltered) {
72943                         return discriminateTypeByDiscriminableItems(target, ts.map(sourcePropertiesFiltered, function (p) { return [function () { return getTypeOfSymbol(p); }, p.escapedName]; }), isRelatedTo, undefined, skipPartial);
72944                     }
72945                 }
72946             }
72947             return undefined;
72948         }
72949     }
72950     ts.createTypeChecker = createTypeChecker;
72951     function isNotAccessor(declaration) {
72952         return !ts.isAccessor(declaration);
72953     }
72954     function isNotOverload(declaration) {
72955         return (declaration.kind !== 255 && declaration.kind !== 168) ||
72956             !!declaration.body;
72957     }
72958     function isDeclarationNameOrImportPropertyName(name) {
72959         switch (name.parent.kind) {
72960             case 269:
72961             case 274:
72962                 return ts.isIdentifier(name);
72963             default:
72964                 return ts.isDeclarationName(name);
72965         }
72966     }
72967     var JsxNames;
72968     (function (JsxNames) {
72969         JsxNames.JSX = "JSX";
72970         JsxNames.IntrinsicElements = "IntrinsicElements";
72971         JsxNames.ElementClass = "ElementClass";
72972         JsxNames.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
72973         JsxNames.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
72974         JsxNames.Element = "Element";
72975         JsxNames.IntrinsicAttributes = "IntrinsicAttributes";
72976         JsxNames.IntrinsicClassAttributes = "IntrinsicClassAttributes";
72977         JsxNames.LibraryManagedAttributes = "LibraryManagedAttributes";
72978     })(JsxNames || (JsxNames = {}));
72979     function getIterationTypesKeyFromIterationTypeKind(typeKind) {
72980         switch (typeKind) {
72981             case 0: return "yieldType";
72982             case 1: return "returnType";
72983             case 2: return "nextType";
72984         }
72985     }
72986     function signatureHasRestParameter(s) {
72987         return !!(s.flags & 1);
72988     }
72989     ts.signatureHasRestParameter = signatureHasRestParameter;
72990     function signatureHasLiteralTypes(s) {
72991         return !!(s.flags & 2);
72992     }
72993     ts.signatureHasLiteralTypes = signatureHasLiteralTypes;
72994 })(ts || (ts = {}));
72995 var ts;
72996 (function (ts) {
72997     function visitNode(node, visitor, test, lift) {
72998         if (node === undefined || visitor === undefined) {
72999             return node;
73000         }
73001         var visited = visitor(node);
73002         if (visited === node) {
73003             return node;
73004         }
73005         var visitedNode;
73006         if (visited === undefined) {
73007             return undefined;
73008         }
73009         else if (ts.isArray(visited)) {
73010             visitedNode = (lift || extractSingleNode)(visited);
73011         }
73012         else {
73013             visitedNode = visited;
73014         }
73015         ts.Debug.assertNode(visitedNode, test);
73016         return visitedNode;
73017     }
73018     ts.visitNode = visitNode;
73019     function visitNodes(nodes, visitor, test, start, count) {
73020         if (nodes === undefined || visitor === undefined) {
73021             return nodes;
73022         }
73023         var updated;
73024         var length = nodes.length;
73025         if (start === undefined || start < 0) {
73026             start = 0;
73027         }
73028         if (count === undefined || count > length - start) {
73029             count = length - start;
73030         }
73031         var hasTrailingComma;
73032         var pos = -1;
73033         var end = -1;
73034         if (start > 0 || count < length) {
73035             updated = [];
73036             hasTrailingComma = nodes.hasTrailingComma && start + count === length;
73037         }
73038         for (var i = 0; i < count; i++) {
73039             var node = nodes[i + start];
73040             var visited = node !== undefined ? visitor(node) : undefined;
73041             if (updated !== undefined || visited === undefined || visited !== node) {
73042                 if (updated === undefined) {
73043                     updated = nodes.slice(0, i);
73044                     hasTrailingComma = nodes.hasTrailingComma;
73045                     pos = nodes.pos;
73046                     end = nodes.end;
73047                 }
73048                 if (visited) {
73049                     if (ts.isArray(visited)) {
73050                         for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) {
73051                             var visitedNode = visited_1[_i];
73052                             void ts.Debug.assertNode(visitedNode, test);
73053                             updated.push(visitedNode);
73054                         }
73055                     }
73056                     else {
73057                         void ts.Debug.assertNode(visited, test);
73058                         updated.push(visited);
73059                     }
73060                 }
73061             }
73062         }
73063         if (updated) {
73064             var updatedArray = ts.factory.createNodeArray(updated, hasTrailingComma);
73065             ts.setTextRangePosEnd(updatedArray, pos, end);
73066             return updatedArray;
73067         }
73068         return nodes;
73069     }
73070     ts.visitNodes = visitNodes;
73071     function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor) {
73072         if (nodesVisitor === void 0) { nodesVisitor = visitNodes; }
73073         context.startLexicalEnvironment();
73074         statements = nodesVisitor(statements, visitor, ts.isStatement, start);
73075         if (ensureUseStrict)
73076             statements = context.factory.ensureUseStrict(statements);
73077         return ts.factory.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
73078     }
73079     ts.visitLexicalEnvironment = visitLexicalEnvironment;
73080     function visitParameterList(nodes, visitor, context, nodesVisitor) {
73081         if (nodesVisitor === void 0) { nodesVisitor = visitNodes; }
73082         var updated;
73083         context.startLexicalEnvironment();
73084         if (nodes) {
73085             context.setLexicalEnvironmentFlags(1, true);
73086             updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration);
73087             if (context.getLexicalEnvironmentFlags() & 2 &&
73088                 ts.getEmitScriptTarget(context.getCompilerOptions()) >= 2) {
73089                 updated = addDefaultValueAssignmentsIfNeeded(updated, context);
73090             }
73091             context.setLexicalEnvironmentFlags(1, false);
73092         }
73093         context.suspendLexicalEnvironment();
73094         return updated;
73095     }
73096     ts.visitParameterList = visitParameterList;
73097     function addDefaultValueAssignmentsIfNeeded(parameters, context) {
73098         var result;
73099         for (var i = 0; i < parameters.length; i++) {
73100             var parameter = parameters[i];
73101             var updated = addDefaultValueAssignmentIfNeeded(parameter, context);
73102             if (result || updated !== parameter) {
73103                 if (!result)
73104                     result = parameters.slice(0, i);
73105                 result[i] = updated;
73106             }
73107         }
73108         if (result) {
73109             return ts.setTextRange(context.factory.createNodeArray(result, parameters.hasTrailingComma), parameters);
73110         }
73111         return parameters;
73112     }
73113     function addDefaultValueAssignmentIfNeeded(parameter, context) {
73114         return parameter.dotDotDotToken ? parameter :
73115             ts.isBindingPattern(parameter.name) ? addDefaultValueAssignmentForBindingPattern(parameter, context) :
73116                 parameter.initializer ? addDefaultValueAssignmentForInitializer(parameter, parameter.name, parameter.initializer, context) :
73117                     parameter;
73118     }
73119     function addDefaultValueAssignmentForBindingPattern(parameter, context) {
73120         var factory = context.factory;
73121         context.addInitializationStatement(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
73122             factory.createVariableDeclaration(parameter.name, undefined, parameter.type, parameter.initializer ?
73123                 factory.createConditionalExpression(factory.createStrictEquality(factory.getGeneratedNameForNode(parameter), factory.createVoidZero()), undefined, parameter.initializer, undefined, factory.getGeneratedNameForNode(parameter)) :
73124                 factory.getGeneratedNameForNode(parameter)),
73125         ])));
73126         return factory.updateParameterDeclaration(parameter, parameter.decorators, parameter.modifiers, parameter.dotDotDotToken, factory.getGeneratedNameForNode(parameter), parameter.questionToken, parameter.type, undefined);
73127     }
73128     function addDefaultValueAssignmentForInitializer(parameter, name, initializer, context) {
73129         var factory = context.factory;
73130         context.addInitializationStatement(factory.createIfStatement(factory.createTypeCheck(factory.cloneNode(name), "undefined"), ts.setEmitFlags(ts.setTextRange(factory.createBlock([
73131             factory.createExpressionStatement(ts.setEmitFlags(ts.setTextRange(factory.createAssignment(ts.setEmitFlags(factory.cloneNode(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer) | 1536)), parameter), 1536))
73132         ]), parameter), 1 | 32 | 384 | 1536)));
73133         return factory.updateParameterDeclaration(parameter, parameter.decorators, parameter.modifiers, parameter.dotDotDotToken, parameter.name, parameter.questionToken, parameter.type, undefined);
73134     }
73135     function visitFunctionBody(node, visitor, context, nodeVisitor) {
73136         if (nodeVisitor === void 0) { nodeVisitor = visitNode; }
73137         context.resumeLexicalEnvironment();
73138         var updated = nodeVisitor(node, visitor, ts.isConciseBody);
73139         var declarations = context.endLexicalEnvironment();
73140         if (ts.some(declarations)) {
73141             if (!updated) {
73142                 return context.factory.createBlock(declarations);
73143             }
73144             var block = context.factory.converters.convertToFunctionBlock(updated);
73145             var statements = ts.factory.mergeLexicalEnvironment(block.statements, declarations);
73146             return context.factory.updateBlock(block, statements);
73147         }
73148         return updated;
73149     }
73150     ts.visitFunctionBody = visitFunctionBody;
73151     function visitIterationBody(body, visitor, context) {
73152         context.startBlockScope();
73153         var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock);
73154         var declarations = context.endBlockScope();
73155         if (ts.some(declarations)) {
73156             if (ts.isBlock(updated)) {
73157                 declarations.push.apply(declarations, updated.statements);
73158                 return context.factory.updateBlock(updated, declarations);
73159             }
73160             declarations.push(updated);
73161             return context.factory.createBlock(declarations);
73162         }
73163         return updated;
73164     }
73165     ts.visitIterationBody = visitIterationBody;
73166     function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor, nodeVisitor) {
73167         if (nodesVisitor === void 0) { nodesVisitor = visitNodes; }
73168         if (nodeVisitor === void 0) { nodeVisitor = visitNode; }
73169         if (node === undefined) {
73170             return undefined;
73171         }
73172         var kind = node.kind;
73173         if ((kind > 0 && kind <= 159) || kind === 191) {
73174             return node;
73175         }
73176         var factory = context.factory;
73177         switch (kind) {
73178             case 79:
73179                 ts.Debug.type(node);
73180                 return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration));
73181             case 160:
73182                 ts.Debug.type(node);
73183                 return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier));
73184             case 161:
73185                 ts.Debug.type(node);
73186                 return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73187             case 162:
73188                 ts.Debug.type(node);
73189                 return factory.updateTypeParameterDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode));
73190             case 163:
73191                 ts.Debug.type(node);
73192                 return factory.updateParameterDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
73193             case 164:
73194                 ts.Debug.type(node);
73195                 return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73196             case 165:
73197                 ts.Debug.type(node);
73198                 return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
73199             case 166:
73200                 ts.Debug.type(node);
73201                 return factory.updatePropertyDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
73202             case 167:
73203                 ts.Debug.type(node);
73204                 return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73205             case 168:
73206                 ts.Debug.type(node);
73207                 return factory.updateMethodDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73208             case 170:
73209                 ts.Debug.type(node);
73210                 return factory.updateConstructorDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73211             case 171:
73212                 ts.Debug.type(node);
73213                 return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73214             case 172:
73215                 ts.Debug.type(node);
73216                 return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73217             case 169:
73218                 ts.Debug.type(node);
73219                 context.startLexicalEnvironment();
73220                 context.suspendLexicalEnvironment();
73221                 return factory.updateClassStaticBlockDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73222             case 173:
73223                 ts.Debug.type(node);
73224                 return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73225             case 174:
73226                 ts.Debug.type(node);
73227                 return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73228             case 175:
73229                 ts.Debug.type(node);
73230                 return factory.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73231             case 176:
73232                 ts.Debug.type(node);
73233                 return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode));
73234             case 177:
73235                 ts.Debug.type(node);
73236                 return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
73237             case 178:
73238                 ts.Debug.type(node);
73239                 return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73240             case 179:
73241                 ts.Debug.type(node);
73242                 return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73243             case 180:
73244                 ts.Debug.type(node);
73245                 return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName));
73246             case 181:
73247                 ts.Debug.type(node);
73248                 return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
73249             case 182:
73250                 ts.Debug.type(node);
73251                 return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode));
73252             case 183:
73253                 ts.Debug.type(node);
73254                 return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode));
73255             case 184:
73256                 ts.Debug.type(node);
73257                 return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
73258             case 185:
73259                 ts.Debug.type(node);
73260                 return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
73261             case 186:
73262                 ts.Debug.type(node);
73263                 return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
73264             case 187:
73265                 ts.Debug.type(node);
73266                 return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
73267             case 188:
73268                 ts.Debug.type(node);
73269                 return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode));
73270             case 189:
73271                 ts.Debug.type(node);
73272                 return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
73273             case 199:
73274                 ts.Debug.type(node);
73275                 return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
73276             case 196:
73277                 ts.Debug.type(node);
73278                 return factory.updateNamedTupleMember(node, visitNode(node.dotDotDotToken, visitor, ts.isDotDotDotToken), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.questionToken, visitor, ts.isQuestionToken), visitNode(node.type, visitor, ts.isTypeNode));
73279             case 190:
73280                 ts.Debug.type(node);
73281                 return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
73282             case 192:
73283                 ts.Debug.type(node);
73284                 return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
73285             case 193:
73286                 ts.Debug.type(node);
73287                 return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode));
73288             case 194:
73289                 ts.Debug.type(node);
73290                 return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement));
73291             case 195:
73292                 ts.Debug.type(node);
73293                 return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression));
73294             case 197:
73295                 ts.Debug.type(node);
73296                 return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan));
73297             case 198:
73298                 ts.Debug.type(node);
73299                 return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
73300             case 200:
73301                 ts.Debug.type(node);
73302                 return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
73303             case 201:
73304                 ts.Debug.type(node);
73305                 return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
73306             case 202:
73307                 ts.Debug.type(node);
73308                 return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression));
73309             case 203:
73310                 ts.Debug.type(node);
73311                 return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression));
73312             case 204:
73313                 ts.Debug.type(node);
73314                 return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
73315             case 205:
73316                 if (node.flags & 32) {
73317                     ts.Debug.type(node);
73318                     return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName));
73319                 }
73320                 ts.Debug.type(node);
73321                 return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName));
73322             case 206:
73323                 if (node.flags & 32) {
73324                     ts.Debug.type(node);
73325                     return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression));
73326                 }
73327                 ts.Debug.type(node);
73328                 return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression));
73329             case 207:
73330                 if (node.flags & 32) {
73331                     ts.Debug.type(node);
73332                     return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
73333                 }
73334                 ts.Debug.type(node);
73335                 return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
73336             case 208:
73337                 ts.Debug.type(node);
73338                 return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
73339             case 209:
73340                 ts.Debug.type(node);
73341                 return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral));
73342             case 210:
73343                 ts.Debug.type(node);
73344                 return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression));
73345             case 211:
73346                 ts.Debug.type(node);
73347                 return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73348             case 212:
73349                 ts.Debug.type(node);
73350                 return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73351             case 213:
73352                 ts.Debug.type(node);
73353                 return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73354             case 214:
73355                 ts.Debug.type(node);
73356                 return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73357             case 215:
73358                 ts.Debug.type(node);
73359                 return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73360             case 216:
73361                 ts.Debug.type(node);
73362                 return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73363             case 217:
73364                 ts.Debug.type(node);
73365                 return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73366             case 218:
73367                 ts.Debug.type(node);
73368                 return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression));
73369             case 219:
73370                 ts.Debug.type(node);
73371                 return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression));
73372             case 220:
73373                 ts.Debug.type(node);
73374                 return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression));
73375             case 221:
73376                 ts.Debug.type(node);
73377                 return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression));
73378             case 222:
73379                 ts.Debug.type(node);
73380                 return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
73381             case 223:
73382                 ts.Debug.type(node);
73383                 return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression));
73384             case 224:
73385                 ts.Debug.type(node);
73386                 return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73387             case 225:
73388                 ts.Debug.type(node);
73389                 return factory.updateClassExpression(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
73390             case 227:
73391                 ts.Debug.type(node);
73392                 return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
73393             case 228:
73394                 ts.Debug.type(node);
73395                 return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode));
73396             case 229:
73397                 if (node.flags & 32) {
73398                     ts.Debug.type(node);
73399                     return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73400                 }
73401                 ts.Debug.type(node);
73402                 return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73403             case 230:
73404                 ts.Debug.type(node);
73405                 return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier));
73406             case 232:
73407                 ts.Debug.type(node);
73408                 return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
73409             case 234:
73410                 ts.Debug.type(node);
73411                 return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
73412             case 236:
73413                 ts.Debug.type(node);
73414                 return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList));
73415             case 237:
73416                 ts.Debug.type(node);
73417                 return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73418             case 238:
73419                 ts.Debug.type(node);
73420                 return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock));
73421             case 239:
73422                 ts.Debug.type(node);
73423                 return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression));
73424             case 240:
73425                 ts.Debug.type(node);
73426                 return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context));
73427             case 241:
73428                 ts.Debug.type(node);
73429                 return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context));
73430             case 242:
73431                 ts.Debug.type(node);
73432                 return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context));
73433             case 243:
73434                 ts.Debug.type(node);
73435                 return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context));
73436             case 244:
73437                 ts.Debug.type(node);
73438                 return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier));
73439             case 245:
73440                 ts.Debug.type(node);
73441                 return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier));
73442             case 246:
73443                 ts.Debug.type(node);
73444                 return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73445             case 247:
73446                 ts.Debug.type(node);
73447                 return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock));
73448             case 248:
73449                 ts.Debug.type(node);
73450                 return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock));
73451             case 249:
73452                 ts.Debug.type(node);
73453                 return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock));
73454             case 250:
73455                 ts.Debug.type(node);
73456                 return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73457             case 251:
73458                 ts.Debug.type(node);
73459                 return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock));
73460             case 253:
73461                 ts.Debug.type(node);
73462                 return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression));
73463             case 254:
73464                 ts.Debug.type(node);
73465                 return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
73466             case 255:
73467                 ts.Debug.type(node);
73468                 return factory.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor));
73469             case 256:
73470                 ts.Debug.type(node);
73471                 return factory.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
73472             case 257:
73473                 ts.Debug.type(node);
73474                 return factory.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
73475             case 258:
73476                 ts.Debug.type(node);
73477                 return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode));
73478             case 259:
73479                 ts.Debug.type(node);
73480                 return factory.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
73481             case 260:
73482                 ts.Debug.type(node);
73483                 return factory.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody));
73484             case 261:
73485                 ts.Debug.type(node);
73486                 return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
73487             case 262:
73488                 ts.Debug.type(node);
73489                 return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
73490             case 263:
73491                 ts.Debug.type(node);
73492                 return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier));
73493             case 264:
73494                 ts.Debug.type(node);
73495                 return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference));
73496             case 265:
73497                 ts.Debug.type(node);
73498                 return factory.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause));
73499             case 292:
73500                 ts.Debug.type(node);
73501                 return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
73502             case 293:
73503                 ts.Debug.type(node);
73504                 return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isStringLiteral));
73505             case 266:
73506                 ts.Debug.type(node);
73507                 return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
73508             case 267:
73509                 ts.Debug.type(node);
73510                 return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier));
73511             case 273:
73512                 ts.Debug.type(node);
73513                 return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier));
73514             case 268:
73515                 ts.Debug.type(node);
73516                 return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
73517             case 269:
73518                 ts.Debug.type(node);
73519                 return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
73520             case 270:
73521                 ts.Debug.type(node);
73522                 return factory.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression));
73523             case 271:
73524                 ts.Debug.type(node);
73525                 return factory.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause));
73526             case 272:
73527                 ts.Debug.type(node);
73528                 return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
73529             case 274:
73530                 ts.Debug.type(node);
73531                 return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
73532             case 276:
73533                 ts.Debug.type(node);
73534                 return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73535             case 277:
73536                 ts.Debug.type(node);
73537                 return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement));
73538             case 278:
73539                 ts.Debug.type(node);
73540                 return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes));
73541             case 279:
73542                 ts.Debug.type(node);
73543                 return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes));
73544             case 280:
73545                 ts.Debug.type(node);
73546                 return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression));
73547             case 281:
73548                 ts.Debug.type(node);
73549                 return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment));
73550             case 284:
73551                 ts.Debug.type(node);
73552                 return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
73553             case 285:
73554                 ts.Debug.type(node);
73555                 return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
73556             case 286:
73557                 ts.Debug.type(node);
73558                 return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73559             case 287:
73560                 ts.Debug.type(node);
73561                 return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73562             case 288:
73563                 ts.Debug.type(node);
73564                 return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
73565             case 289:
73566                 ts.Debug.type(node);
73567                 return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
73568             case 290:
73569                 ts.Debug.type(node);
73570                 return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
73571             case 291:
73572                 ts.Debug.type(node);
73573                 return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock));
73574             case 294:
73575                 ts.Debug.type(node);
73576                 return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression));
73577             case 295:
73578                 ts.Debug.type(node);
73579                 return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression));
73580             case 296:
73581                 ts.Debug.type(node);
73582                 return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73583             case 297:
73584                 ts.Debug.type(node);
73585                 return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression));
73586             case 303:
73587                 ts.Debug.type(node);
73588                 return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context));
73589             case 348:
73590                 ts.Debug.type(node);
73591                 return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression));
73592             case 349:
73593                 ts.Debug.type(node);
73594                 return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression));
73595             default:
73596                 return node;
73597         }
73598     }
73599     ts.visitEachChild = visitEachChild;
73600     function extractSingleNode(nodes) {
73601         ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output.");
73602         return ts.singleOrUndefined(nodes);
73603     }
73604 })(ts || (ts = {}));
73605 var ts;
73606 (function (ts) {
73607     function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
73608         var _a = generatorOptions.extendedDiagnostics
73609             ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
73610             : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
73611         var rawSources = [];
73612         var sources = [];
73613         var sourceToSourceIndexMap = new ts.Map();
73614         var sourcesContent;
73615         var names = [];
73616         var nameToNameIndexMap;
73617         var mappingCharCodes = [];
73618         var mappings = "";
73619         var lastGeneratedLine = 0;
73620         var lastGeneratedCharacter = 0;
73621         var lastSourceIndex = 0;
73622         var lastSourceLine = 0;
73623         var lastSourceCharacter = 0;
73624         var lastNameIndex = 0;
73625         var hasLast = false;
73626         var pendingGeneratedLine = 0;
73627         var pendingGeneratedCharacter = 0;
73628         var pendingSourceIndex = 0;
73629         var pendingSourceLine = 0;
73630         var pendingSourceCharacter = 0;
73631         var pendingNameIndex = 0;
73632         var hasPending = false;
73633         var hasPendingSource = false;
73634         var hasPendingName = false;
73635         return {
73636             getSources: function () { return rawSources; },
73637             addSource: addSource,
73638             setSourceContent: setSourceContent,
73639             addName: addName,
73640             addMapping: addMapping,
73641             appendSourceMap: appendSourceMap,
73642             toJSON: toJSON,
73643             toString: function () { return JSON.stringify(toJSON()); }
73644         };
73645         function addSource(fileName) {
73646             enter();
73647             var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true);
73648             var sourceIndex = sourceToSourceIndexMap.get(source);
73649             if (sourceIndex === undefined) {
73650                 sourceIndex = sources.length;
73651                 sources.push(source);
73652                 rawSources.push(fileName);
73653                 sourceToSourceIndexMap.set(source, sourceIndex);
73654             }
73655             exit();
73656             return sourceIndex;
73657         }
73658         function setSourceContent(sourceIndex, content) {
73659             enter();
73660             if (content !== null) {
73661                 if (!sourcesContent)
73662                     sourcesContent = [];
73663                 while (sourcesContent.length < sourceIndex) {
73664                     sourcesContent.push(null);
73665                 }
73666                 sourcesContent[sourceIndex] = content;
73667             }
73668             exit();
73669         }
73670         function addName(name) {
73671             enter();
73672             if (!nameToNameIndexMap)
73673                 nameToNameIndexMap = new ts.Map();
73674             var nameIndex = nameToNameIndexMap.get(name);
73675             if (nameIndex === undefined) {
73676                 nameIndex = names.length;
73677                 names.push(name);
73678                 nameToNameIndexMap.set(name, nameIndex);
73679             }
73680             exit();
73681             return nameIndex;
73682         }
73683         function isNewGeneratedPosition(generatedLine, generatedCharacter) {
73684             return !hasPending
73685                 || pendingGeneratedLine !== generatedLine
73686                 || pendingGeneratedCharacter !== generatedCharacter;
73687         }
73688         function isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter) {
73689             return sourceIndex !== undefined
73690                 && sourceLine !== undefined
73691                 && sourceCharacter !== undefined
73692                 && pendingSourceIndex === sourceIndex
73693                 && (pendingSourceLine > sourceLine
73694                     || pendingSourceLine === sourceLine && pendingSourceCharacter > sourceCharacter);
73695         }
73696         function addMapping(generatedLine, generatedCharacter, sourceIndex, sourceLine, sourceCharacter, nameIndex) {
73697             ts.Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack");
73698             ts.Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative");
73699             ts.Debug.assert(sourceIndex === undefined || sourceIndex >= 0, "sourceIndex cannot be negative");
73700             ts.Debug.assert(sourceLine === undefined || sourceLine >= 0, "sourceLine cannot be negative");
73701             ts.Debug.assert(sourceCharacter === undefined || sourceCharacter >= 0, "sourceCharacter cannot be negative");
73702             enter();
73703             if (isNewGeneratedPosition(generatedLine, generatedCharacter) ||
73704                 isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter)) {
73705                 commitPendingMapping();
73706                 pendingGeneratedLine = generatedLine;
73707                 pendingGeneratedCharacter = generatedCharacter;
73708                 hasPendingSource = false;
73709                 hasPendingName = false;
73710                 hasPending = true;
73711             }
73712             if (sourceIndex !== undefined && sourceLine !== undefined && sourceCharacter !== undefined) {
73713                 pendingSourceIndex = sourceIndex;
73714                 pendingSourceLine = sourceLine;
73715                 pendingSourceCharacter = sourceCharacter;
73716                 hasPendingSource = true;
73717                 if (nameIndex !== undefined) {
73718                     pendingNameIndex = nameIndex;
73719                     hasPendingName = true;
73720                 }
73721             }
73722             exit();
73723         }
73724         function appendSourceMap(generatedLine, generatedCharacter, map, sourceMapPath, start, end) {
73725             ts.Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack");
73726             ts.Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative");
73727             enter();
73728             var sourceIndexToNewSourceIndexMap = [];
73729             var nameIndexToNewNameIndexMap;
73730             var mappingIterator = decodeMappings(map.mappings);
73731             for (var iterResult = mappingIterator.next(); !iterResult.done; iterResult = mappingIterator.next()) {
73732                 var raw = iterResult.value;
73733                 if (end && (raw.generatedLine > end.line ||
73734                     (raw.generatedLine === end.line && raw.generatedCharacter > end.character))) {
73735                     break;
73736                 }
73737                 if (start && (raw.generatedLine < start.line ||
73738                     (start.line === raw.generatedLine && raw.generatedCharacter < start.character))) {
73739                     continue;
73740                 }
73741                 var newSourceIndex = void 0;
73742                 var newSourceLine = void 0;
73743                 var newSourceCharacter = void 0;
73744                 var newNameIndex = void 0;
73745                 if (raw.sourceIndex !== undefined) {
73746                     newSourceIndex = sourceIndexToNewSourceIndexMap[raw.sourceIndex];
73747                     if (newSourceIndex === undefined) {
73748                         var rawPath = map.sources[raw.sourceIndex];
73749                         var relativePath = map.sourceRoot ? ts.combinePaths(map.sourceRoot, rawPath) : rawPath;
73750                         var combinedPath = ts.combinePaths(ts.getDirectoryPath(sourceMapPath), relativePath);
73751                         sourceIndexToNewSourceIndexMap[raw.sourceIndex] = newSourceIndex = addSource(combinedPath);
73752                         if (map.sourcesContent && typeof map.sourcesContent[raw.sourceIndex] === "string") {
73753                             setSourceContent(newSourceIndex, map.sourcesContent[raw.sourceIndex]);
73754                         }
73755                     }
73756                     newSourceLine = raw.sourceLine;
73757                     newSourceCharacter = raw.sourceCharacter;
73758                     if (map.names && raw.nameIndex !== undefined) {
73759                         if (!nameIndexToNewNameIndexMap)
73760                             nameIndexToNewNameIndexMap = [];
73761                         newNameIndex = nameIndexToNewNameIndexMap[raw.nameIndex];
73762                         if (newNameIndex === undefined) {
73763                             nameIndexToNewNameIndexMap[raw.nameIndex] = newNameIndex = addName(map.names[raw.nameIndex]);
73764                         }
73765                     }
73766                 }
73767                 var rawGeneratedLine = raw.generatedLine - (start ? start.line : 0);
73768                 var newGeneratedLine = rawGeneratedLine + generatedLine;
73769                 var rawGeneratedCharacter = start && start.line === raw.generatedLine ? raw.generatedCharacter - start.character : raw.generatedCharacter;
73770                 var newGeneratedCharacter = rawGeneratedLine === 0 ? rawGeneratedCharacter + generatedCharacter : rawGeneratedCharacter;
73771                 addMapping(newGeneratedLine, newGeneratedCharacter, newSourceIndex, newSourceLine, newSourceCharacter, newNameIndex);
73772             }
73773             exit();
73774         }
73775         function shouldCommitMapping() {
73776             return !hasLast
73777                 || lastGeneratedLine !== pendingGeneratedLine
73778                 || lastGeneratedCharacter !== pendingGeneratedCharacter
73779                 || lastSourceIndex !== pendingSourceIndex
73780                 || lastSourceLine !== pendingSourceLine
73781                 || lastSourceCharacter !== pendingSourceCharacter
73782                 || lastNameIndex !== pendingNameIndex;
73783         }
73784         function appendMappingCharCode(charCode) {
73785             mappingCharCodes.push(charCode);
73786             if (mappingCharCodes.length >= 1024) {
73787                 flushMappingBuffer();
73788             }
73789         }
73790         function commitPendingMapping() {
73791             if (!hasPending || !shouldCommitMapping()) {
73792                 return;
73793             }
73794             enter();
73795             if (lastGeneratedLine < pendingGeneratedLine) {
73796                 do {
73797                     appendMappingCharCode(59);
73798                     lastGeneratedLine++;
73799                 } while (lastGeneratedLine < pendingGeneratedLine);
73800                 lastGeneratedCharacter = 0;
73801             }
73802             else {
73803                 ts.Debug.assertEqual(lastGeneratedLine, pendingGeneratedLine, "generatedLine cannot backtrack");
73804                 if (hasLast) {
73805                     appendMappingCharCode(44);
73806                 }
73807             }
73808             appendBase64VLQ(pendingGeneratedCharacter - lastGeneratedCharacter);
73809             lastGeneratedCharacter = pendingGeneratedCharacter;
73810             if (hasPendingSource) {
73811                 appendBase64VLQ(pendingSourceIndex - lastSourceIndex);
73812                 lastSourceIndex = pendingSourceIndex;
73813                 appendBase64VLQ(pendingSourceLine - lastSourceLine);
73814                 lastSourceLine = pendingSourceLine;
73815                 appendBase64VLQ(pendingSourceCharacter - lastSourceCharacter);
73816                 lastSourceCharacter = pendingSourceCharacter;
73817                 if (hasPendingName) {
73818                     appendBase64VLQ(pendingNameIndex - lastNameIndex);
73819                     lastNameIndex = pendingNameIndex;
73820                 }
73821             }
73822             hasLast = true;
73823             exit();
73824         }
73825         function flushMappingBuffer() {
73826             if (mappingCharCodes.length > 0) {
73827                 mappings += String.fromCharCode.apply(undefined, mappingCharCodes);
73828                 mappingCharCodes.length = 0;
73829             }
73830         }
73831         function toJSON() {
73832             commitPendingMapping();
73833             flushMappingBuffer();
73834             return {
73835                 version: 3,
73836                 file: file,
73837                 sourceRoot: sourceRoot,
73838                 sources: sources,
73839                 names: names,
73840                 mappings: mappings,
73841                 sourcesContent: sourcesContent,
73842             };
73843         }
73844         function appendBase64VLQ(inValue) {
73845             if (inValue < 0) {
73846                 inValue = ((-inValue) << 1) + 1;
73847             }
73848             else {
73849                 inValue = inValue << 1;
73850             }
73851             do {
73852                 var currentDigit = inValue & 31;
73853                 inValue = inValue >> 5;
73854                 if (inValue > 0) {
73855                     currentDigit = currentDigit | 32;
73856                 }
73857                 appendMappingCharCode(base64FormatEncode(currentDigit));
73858             } while (inValue > 0);
73859         }
73860     }
73861     ts.createSourceMapGenerator = createSourceMapGenerator;
73862     var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/;
73863     var whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/;
73864     function getLineInfo(text, lineStarts) {
73865         return {
73866             getLineCount: function () { return lineStarts.length; },
73867             getLineText: function (line) { return text.substring(lineStarts[line], lineStarts[line + 1]); }
73868         };
73869     }
73870     ts.getLineInfo = getLineInfo;
73871     function tryGetSourceMappingURL(lineInfo) {
73872         for (var index = lineInfo.getLineCount() - 1; index >= 0; index--) {
73873             var line = lineInfo.getLineText(index);
73874             var comment = sourceMapCommentRegExp.exec(line);
73875             if (comment) {
73876                 return ts.trimStringEnd(comment[1]);
73877             }
73878             else if (!line.match(whitespaceOrMapCommentRegExp)) {
73879                 break;
73880             }
73881         }
73882     }
73883     ts.tryGetSourceMappingURL = tryGetSourceMappingURL;
73884     function isStringOrNull(x) {
73885         return typeof x === "string" || x === null;
73886     }
73887     function isRawSourceMap(x) {
73888         return x !== null
73889             && typeof x === "object"
73890             && x.version === 3
73891             && typeof x.file === "string"
73892             && typeof x.mappings === "string"
73893             && ts.isArray(x.sources) && ts.every(x.sources, ts.isString)
73894             && (x.sourceRoot === undefined || x.sourceRoot === null || typeof x.sourceRoot === "string")
73895             && (x.sourcesContent === undefined || x.sourcesContent === null || ts.isArray(x.sourcesContent) && ts.every(x.sourcesContent, isStringOrNull))
73896             && (x.names === undefined || x.names === null || ts.isArray(x.names) && ts.every(x.names, ts.isString));
73897     }
73898     ts.isRawSourceMap = isRawSourceMap;
73899     function tryParseRawSourceMap(text) {
73900         try {
73901             var parsed = JSON.parse(text);
73902             if (isRawSourceMap(parsed)) {
73903                 return parsed;
73904             }
73905         }
73906         catch (_a) {
73907         }
73908         return undefined;
73909     }
73910     ts.tryParseRawSourceMap = tryParseRawSourceMap;
73911     function decodeMappings(mappings) {
73912         var done = false;
73913         var pos = 0;
73914         var generatedLine = 0;
73915         var generatedCharacter = 0;
73916         var sourceIndex = 0;
73917         var sourceLine = 0;
73918         var sourceCharacter = 0;
73919         var nameIndex = 0;
73920         var error;
73921         return {
73922             get pos() { return pos; },
73923             get error() { return error; },
73924             get state() { return captureMapping(true, true); },
73925             next: function () {
73926                 while (!done && pos < mappings.length) {
73927                     var ch = mappings.charCodeAt(pos);
73928                     if (ch === 59) {
73929                         generatedLine++;
73930                         generatedCharacter = 0;
73931                         pos++;
73932                         continue;
73933                     }
73934                     if (ch === 44) {
73935                         pos++;
73936                         continue;
73937                     }
73938                     var hasSource = false;
73939                     var hasName = false;
73940                     generatedCharacter += base64VLQFormatDecode();
73941                     if (hasReportedError())
73942                         return stopIterating();
73943                     if (generatedCharacter < 0)
73944                         return setErrorAndStopIterating("Invalid generatedCharacter found");
73945                     if (!isSourceMappingSegmentEnd()) {
73946                         hasSource = true;
73947                         sourceIndex += base64VLQFormatDecode();
73948                         if (hasReportedError())
73949                             return stopIterating();
73950                         if (sourceIndex < 0)
73951                             return setErrorAndStopIterating("Invalid sourceIndex found");
73952                         if (isSourceMappingSegmentEnd())
73953                             return setErrorAndStopIterating("Unsupported Format: No entries after sourceIndex");
73954                         sourceLine += base64VLQFormatDecode();
73955                         if (hasReportedError())
73956                             return stopIterating();
73957                         if (sourceLine < 0)
73958                             return setErrorAndStopIterating("Invalid sourceLine found");
73959                         if (isSourceMappingSegmentEnd())
73960                             return setErrorAndStopIterating("Unsupported Format: No entries after sourceLine");
73961                         sourceCharacter += base64VLQFormatDecode();
73962                         if (hasReportedError())
73963                             return stopIterating();
73964                         if (sourceCharacter < 0)
73965                             return setErrorAndStopIterating("Invalid sourceCharacter found");
73966                         if (!isSourceMappingSegmentEnd()) {
73967                             hasName = true;
73968                             nameIndex += base64VLQFormatDecode();
73969                             if (hasReportedError())
73970                                 return stopIterating();
73971                             if (nameIndex < 0)
73972                                 return setErrorAndStopIterating("Invalid nameIndex found");
73973                             if (!isSourceMappingSegmentEnd())
73974                                 return setErrorAndStopIterating("Unsupported Error Format: Entries after nameIndex");
73975                         }
73976                     }
73977                     return { value: captureMapping(hasSource, hasName), done: done };
73978                 }
73979                 return stopIterating();
73980             }
73981         };
73982         function captureMapping(hasSource, hasName) {
73983             return {
73984                 generatedLine: generatedLine,
73985                 generatedCharacter: generatedCharacter,
73986                 sourceIndex: hasSource ? sourceIndex : undefined,
73987                 sourceLine: hasSource ? sourceLine : undefined,
73988                 sourceCharacter: hasSource ? sourceCharacter : undefined,
73989                 nameIndex: hasName ? nameIndex : undefined
73990             };
73991         }
73992         function stopIterating() {
73993             done = true;
73994             return { value: undefined, done: true };
73995         }
73996         function setError(message) {
73997             if (error === undefined) {
73998                 error = message;
73999             }
74000         }
74001         function setErrorAndStopIterating(message) {
74002             setError(message);
74003             return stopIterating();
74004         }
74005         function hasReportedError() {
74006             return error !== undefined;
74007         }
74008         function isSourceMappingSegmentEnd() {
74009             return (pos === mappings.length ||
74010                 mappings.charCodeAt(pos) === 44 ||
74011                 mappings.charCodeAt(pos) === 59);
74012         }
74013         function base64VLQFormatDecode() {
74014             var moreDigits = true;
74015             var shiftCount = 0;
74016             var value = 0;
74017             for (; moreDigits; pos++) {
74018                 if (pos >= mappings.length)
74019                     return setError("Error in decoding base64VLQFormatDecode, past the mapping string"), -1;
74020                 var currentByte = base64FormatDecode(mappings.charCodeAt(pos));
74021                 if (currentByte === -1)
74022                     return setError("Invalid character in VLQ"), -1;
74023                 moreDigits = (currentByte & 32) !== 0;
74024                 value = value | ((currentByte & 31) << shiftCount);
74025                 shiftCount += 5;
74026             }
74027             if ((value & 1) === 0) {
74028                 value = value >> 1;
74029             }
74030             else {
74031                 value = value >> 1;
74032                 value = -value;
74033             }
74034             return value;
74035         }
74036     }
74037     ts.decodeMappings = decodeMappings;
74038     function sameMapping(left, right) {
74039         return left === right
74040             || left.generatedLine === right.generatedLine
74041                 && left.generatedCharacter === right.generatedCharacter
74042                 && left.sourceIndex === right.sourceIndex
74043                 && left.sourceLine === right.sourceLine
74044                 && left.sourceCharacter === right.sourceCharacter
74045                 && left.nameIndex === right.nameIndex;
74046     }
74047     ts.sameMapping = sameMapping;
74048     function isSourceMapping(mapping) {
74049         return mapping.sourceIndex !== undefined
74050             && mapping.sourceLine !== undefined
74051             && mapping.sourceCharacter !== undefined;
74052     }
74053     ts.isSourceMapping = isSourceMapping;
74054     function base64FormatEncode(value) {
74055         return value >= 0 && value < 26 ? 65 + value :
74056             value >= 26 && value < 52 ? 97 + value - 26 :
74057                 value >= 52 && value < 62 ? 48 + value - 52 :
74058                     value === 62 ? 43 :
74059                         value === 63 ? 47 :
74060                             ts.Debug.fail("".concat(value, ": not a base64 value"));
74061     }
74062     function base64FormatDecode(ch) {
74063         return ch >= 65 && ch <= 90 ? ch - 65 :
74064             ch >= 97 && ch <= 122 ? ch - 97 + 26 :
74065                 ch >= 48 && ch <= 57 ? ch - 48 + 52 :
74066                     ch === 43 ? 62 :
74067                         ch === 47 ? 63 :
74068                             -1;
74069     }
74070     function isSourceMappedPosition(value) {
74071         return value.sourceIndex !== undefined
74072             && value.sourcePosition !== undefined;
74073     }
74074     function sameMappedPosition(left, right) {
74075         return left.generatedPosition === right.generatedPosition
74076             && left.sourceIndex === right.sourceIndex
74077             && left.sourcePosition === right.sourcePosition;
74078     }
74079     function compareSourcePositions(left, right) {
74080         ts.Debug.assert(left.sourceIndex === right.sourceIndex);
74081         return ts.compareValues(left.sourcePosition, right.sourcePosition);
74082     }
74083     function compareGeneratedPositions(left, right) {
74084         return ts.compareValues(left.generatedPosition, right.generatedPosition);
74085     }
74086     function getSourcePositionOfMapping(value) {
74087         return value.sourcePosition;
74088     }
74089     function getGeneratedPositionOfMapping(value) {
74090         return value.generatedPosition;
74091     }
74092     function createDocumentPositionMapper(host, map, mapPath) {
74093         var mapDirectory = ts.getDirectoryPath(mapPath);
74094         var sourceRoot = map.sourceRoot ? ts.getNormalizedAbsolutePath(map.sourceRoot, mapDirectory) : mapDirectory;
74095         var generatedAbsoluteFilePath = ts.getNormalizedAbsolutePath(map.file, mapDirectory);
74096         var generatedFile = host.getSourceFileLike(generatedAbsoluteFilePath);
74097         var sourceFileAbsolutePaths = map.sources.map(function (source) { return ts.getNormalizedAbsolutePath(source, sourceRoot); });
74098         var sourceToSourceIndexMap = new ts.Map(sourceFileAbsolutePaths.map(function (source, i) { return [host.getCanonicalFileName(source), i]; }));
74099         var decodedMappings;
74100         var generatedMappings;
74101         var sourceMappings;
74102         return {
74103             getSourcePosition: getSourcePosition,
74104             getGeneratedPosition: getGeneratedPosition
74105         };
74106         function processMapping(mapping) {
74107             var generatedPosition = generatedFile !== undefined
74108                 ? ts.getPositionOfLineAndCharacter(generatedFile, mapping.generatedLine, mapping.generatedCharacter, true)
74109                 : -1;
74110             var source;
74111             var sourcePosition;
74112             if (isSourceMapping(mapping)) {
74113                 var sourceFile = host.getSourceFileLike(sourceFileAbsolutePaths[mapping.sourceIndex]);
74114                 source = map.sources[mapping.sourceIndex];
74115                 sourcePosition = sourceFile !== undefined
74116                     ? ts.getPositionOfLineAndCharacter(sourceFile, mapping.sourceLine, mapping.sourceCharacter, true)
74117                     : -1;
74118             }
74119             return {
74120                 generatedPosition: generatedPosition,
74121                 source: source,
74122                 sourceIndex: mapping.sourceIndex,
74123                 sourcePosition: sourcePosition,
74124                 nameIndex: mapping.nameIndex
74125             };
74126         }
74127         function getDecodedMappings() {
74128             if (decodedMappings === undefined) {
74129                 var decoder = decodeMappings(map.mappings);
74130                 var mappings = ts.arrayFrom(decoder, processMapping);
74131                 if (decoder.error !== undefined) {
74132                     if (host.log) {
74133                         host.log("Encountered error while decoding sourcemap: ".concat(decoder.error));
74134                     }
74135                     decodedMappings = ts.emptyArray;
74136                 }
74137                 else {
74138                     decodedMappings = mappings;
74139                 }
74140             }
74141             return decodedMappings;
74142         }
74143         function getSourceMappings(sourceIndex) {
74144             if (sourceMappings === undefined) {
74145                 var lists = [];
74146                 for (var _i = 0, _a = getDecodedMappings(); _i < _a.length; _i++) {
74147                     var mapping = _a[_i];
74148                     if (!isSourceMappedPosition(mapping))
74149                         continue;
74150                     var list = lists[mapping.sourceIndex];
74151                     if (!list)
74152                         lists[mapping.sourceIndex] = list = [];
74153                     list.push(mapping);
74154                 }
74155                 sourceMappings = lists.map(function (list) { return ts.sortAndDeduplicate(list, compareSourcePositions, sameMappedPosition); });
74156             }
74157             return sourceMappings[sourceIndex];
74158         }
74159         function getGeneratedMappings() {
74160             if (generatedMappings === undefined) {
74161                 var list = [];
74162                 for (var _i = 0, _a = getDecodedMappings(); _i < _a.length; _i++) {
74163                     var mapping = _a[_i];
74164                     list.push(mapping);
74165                 }
74166                 generatedMappings = ts.sortAndDeduplicate(list, compareGeneratedPositions, sameMappedPosition);
74167             }
74168             return generatedMappings;
74169         }
74170         function getGeneratedPosition(loc) {
74171             var sourceIndex = sourceToSourceIndexMap.get(host.getCanonicalFileName(loc.fileName));
74172             if (sourceIndex === undefined)
74173                 return loc;
74174             var sourceMappings = getSourceMappings(sourceIndex);
74175             if (!ts.some(sourceMappings))
74176                 return loc;
74177             var targetIndex = ts.binarySearchKey(sourceMappings, loc.pos, getSourcePositionOfMapping, ts.compareValues);
74178             if (targetIndex < 0) {
74179                 targetIndex = ~targetIndex;
74180             }
74181             var mapping = sourceMappings[targetIndex];
74182             if (mapping === undefined || mapping.sourceIndex !== sourceIndex) {
74183                 return loc;
74184             }
74185             return { fileName: generatedAbsoluteFilePath, pos: mapping.generatedPosition };
74186         }
74187         function getSourcePosition(loc) {
74188             var generatedMappings = getGeneratedMappings();
74189             if (!ts.some(generatedMappings))
74190                 return loc;
74191             var targetIndex = ts.binarySearchKey(generatedMappings, loc.pos, getGeneratedPositionOfMapping, ts.compareValues);
74192             if (targetIndex < 0) {
74193                 targetIndex = ~targetIndex;
74194             }
74195             var mapping = generatedMappings[targetIndex];
74196             if (mapping === undefined || !isSourceMappedPosition(mapping)) {
74197                 return loc;
74198             }
74199             return { fileName: sourceFileAbsolutePaths[mapping.sourceIndex], pos: mapping.sourcePosition };
74200         }
74201     }
74202     ts.createDocumentPositionMapper = createDocumentPositionMapper;
74203     ts.identitySourceMapConsumer = {
74204         getSourcePosition: ts.identity,
74205         getGeneratedPosition: ts.identity
74206     };
74207 })(ts || (ts = {}));
74208 var ts;
74209 (function (ts) {
74210     function getOriginalNodeId(node) {
74211         node = ts.getOriginalNode(node);
74212         return node ? ts.getNodeId(node) : 0;
74213     }
74214     ts.getOriginalNodeId = getOriginalNodeId;
74215     function containsDefaultReference(node) {
74216         if (!node)
74217             return false;
74218         if (!ts.isNamedImports(node))
74219             return false;
74220         return ts.some(node.elements, isNamedDefaultReference);
74221     }
74222     function isNamedDefaultReference(e) {
74223         return e.propertyName !== undefined && e.propertyName.escapedText === "default";
74224     }
74225     function chainBundle(context, transformSourceFile) {
74226         return transformSourceFileOrBundle;
74227         function transformSourceFileOrBundle(node) {
74228             return node.kind === 303 ? transformSourceFile(node) : transformBundle(node);
74229         }
74230         function transformBundle(node) {
74231             return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
74232         }
74233     }
74234     ts.chainBundle = chainBundle;
74235     function getExportNeedsImportStarHelper(node) {
74236         return !!ts.getNamespaceDeclarationNode(node);
74237     }
74238     ts.getExportNeedsImportStarHelper = getExportNeedsImportStarHelper;
74239     function getImportNeedsImportStarHelper(node) {
74240         if (!!ts.getNamespaceDeclarationNode(node)) {
74241             return true;
74242         }
74243         var bindings = node.importClause && node.importClause.namedBindings;
74244         if (!bindings) {
74245             return false;
74246         }
74247         if (!ts.isNamedImports(bindings))
74248             return false;
74249         var defaultRefCount = 0;
74250         for (var _i = 0, _a = bindings.elements; _i < _a.length; _i++) {
74251             var binding = _a[_i];
74252             if (isNamedDefaultReference(binding)) {
74253                 defaultRefCount++;
74254             }
74255         }
74256         return (defaultRefCount > 0 && defaultRefCount !== bindings.elements.length) || (!!(bindings.elements.length - defaultRefCount) && ts.isDefaultImport(node));
74257     }
74258     ts.getImportNeedsImportStarHelper = getImportNeedsImportStarHelper;
74259     function getImportNeedsImportDefaultHelper(node) {
74260         return !getImportNeedsImportStarHelper(node) && (ts.isDefaultImport(node) || (!!node.importClause && ts.isNamedImports(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)));
74261     }
74262     ts.getImportNeedsImportDefaultHelper = getImportNeedsImportDefaultHelper;
74263     function collectExternalModuleInfo(context, sourceFile, resolver, compilerOptions) {
74264         var externalImports = [];
74265         var exportSpecifiers = ts.createMultiMap();
74266         var exportedBindings = [];
74267         var uniqueExports = new ts.Map();
74268         var exportedNames;
74269         var hasExportDefault = false;
74270         var exportEquals;
74271         var hasExportStarsToExportValues = false;
74272         var hasImportStar = false;
74273         var hasImportDefault = false;
74274         for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
74275             var node = _a[_i];
74276             switch (node.kind) {
74277                 case 265:
74278                     externalImports.push(node);
74279                     if (!hasImportStar && getImportNeedsImportStarHelper(node)) {
74280                         hasImportStar = true;
74281                     }
74282                     if (!hasImportDefault && getImportNeedsImportDefaultHelper(node)) {
74283                         hasImportDefault = true;
74284                     }
74285                     break;
74286                 case 264:
74287                     if (node.moduleReference.kind === 276) {
74288                         externalImports.push(node);
74289                     }
74290                     break;
74291                 case 271:
74292                     if (node.moduleSpecifier) {
74293                         if (!node.exportClause) {
74294                             externalImports.push(node);
74295                             hasExportStarsToExportValues = true;
74296                         }
74297                         else {
74298                             externalImports.push(node);
74299                             if (ts.isNamedExports(node.exportClause)) {
74300                                 addExportedNamesForExportDeclaration(node);
74301                             }
74302                             else {
74303                                 var name = node.exportClause.name;
74304                                 if (!uniqueExports.get(ts.idText(name))) {
74305                                     multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
74306                                     uniqueExports.set(ts.idText(name), true);
74307                                     exportedNames = ts.append(exportedNames, name);
74308                                 }
74309                                 hasImportStar = true;
74310                             }
74311                         }
74312                     }
74313                     else {
74314                         addExportedNamesForExportDeclaration(node);
74315                     }
74316                     break;
74317                 case 270:
74318                     if (node.isExportEquals && !exportEquals) {
74319                         exportEquals = node;
74320                     }
74321                     break;
74322                 case 236:
74323                     if (ts.hasSyntacticModifier(node, 1)) {
74324                         for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) {
74325                             var decl = _c[_b];
74326                             exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
74327                         }
74328                     }
74329                     break;
74330                 case 255:
74331                     if (ts.hasSyntacticModifier(node, 1)) {
74332                         if (ts.hasSyntacticModifier(node, 512)) {
74333                             if (!hasExportDefault) {
74334                                 multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
74335                                 hasExportDefault = true;
74336                             }
74337                         }
74338                         else {
74339                             var name = node.name;
74340                             if (!uniqueExports.get(ts.idText(name))) {
74341                                 multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
74342                                 uniqueExports.set(ts.idText(name), true);
74343                                 exportedNames = ts.append(exportedNames, name);
74344                             }
74345                         }
74346                     }
74347                     break;
74348                 case 256:
74349                     if (ts.hasSyntacticModifier(node, 1)) {
74350                         if (ts.hasSyntacticModifier(node, 512)) {
74351                             if (!hasExportDefault) {
74352                                 multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
74353                                 hasExportDefault = true;
74354                             }
74355                         }
74356                         else {
74357                             var name = node.name;
74358                             if (name && !uniqueExports.get(ts.idText(name))) {
74359                                 multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
74360                                 uniqueExports.set(ts.idText(name), true);
74361                                 exportedNames = ts.append(exportedNames, name);
74362                             }
74363                         }
74364                     }
74365                     break;
74366             }
74367         }
74368         var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(context.factory, context.getEmitHelperFactory(), sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault);
74369         if (externalHelpersImportDeclaration) {
74370             externalImports.unshift(externalHelpersImportDeclaration);
74371         }
74372         return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration };
74373         function addExportedNamesForExportDeclaration(node) {
74374             for (var _i = 0, _a = ts.cast(node.exportClause, ts.isNamedExports).elements; _i < _a.length; _i++) {
74375                 var specifier = _a[_i];
74376                 if (!uniqueExports.get(ts.idText(specifier.name))) {
74377                     var name = specifier.propertyName || specifier.name;
74378                     if (!node.moduleSpecifier) {
74379                         exportSpecifiers.add(ts.idText(name), specifier);
74380                     }
74381                     var decl = resolver.getReferencedImportDeclaration(name)
74382                         || resolver.getReferencedValueDeclaration(name);
74383                     if (decl) {
74384                         multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
74385                     }
74386                     uniqueExports.set(ts.idText(specifier.name), true);
74387                     exportedNames = ts.append(exportedNames, specifier.name);
74388                 }
74389             }
74390         }
74391     }
74392     ts.collectExternalModuleInfo = collectExternalModuleInfo;
74393     function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
74394         if (ts.isBindingPattern(decl.name)) {
74395             for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
74396                 var element = _a[_i];
74397                 if (!ts.isOmittedExpression(element)) {
74398                     exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
74399                 }
74400             }
74401         }
74402         else if (!ts.isGeneratedIdentifier(decl.name)) {
74403             var text = ts.idText(decl.name);
74404             if (!uniqueExports.get(text)) {
74405                 uniqueExports.set(text, true);
74406                 exportedNames = ts.append(exportedNames, decl.name);
74407             }
74408         }
74409         return exportedNames;
74410     }
74411     function multiMapSparseArrayAdd(map, key, value) {
74412         var values = map[key];
74413         if (values) {
74414             values.push(value);
74415         }
74416         else {
74417             map[key] = values = [value];
74418         }
74419         return values;
74420     }
74421     function isSimpleCopiableExpression(expression) {
74422         return ts.isStringLiteralLike(expression) ||
74423             expression.kind === 8 ||
74424             ts.isKeyword(expression.kind) ||
74425             ts.isIdentifier(expression);
74426     }
74427     ts.isSimpleCopiableExpression = isSimpleCopiableExpression;
74428     function isSimpleInlineableExpression(expression) {
74429         return !ts.isIdentifier(expression) && isSimpleCopiableExpression(expression);
74430     }
74431     ts.isSimpleInlineableExpression = isSimpleInlineableExpression;
74432     function isCompoundAssignment(kind) {
74433         return kind >= 64
74434             && kind <= 78;
74435     }
74436     ts.isCompoundAssignment = isCompoundAssignment;
74437     function getNonAssignmentOperatorForCompoundAssignment(kind) {
74438         switch (kind) {
74439             case 64: return 39;
74440             case 65: return 40;
74441             case 66: return 41;
74442             case 67: return 42;
74443             case 68: return 43;
74444             case 69: return 44;
74445             case 70: return 47;
74446             case 71: return 48;
74447             case 72: return 49;
74448             case 73: return 50;
74449             case 74: return 51;
74450             case 78: return 52;
74451             case 75: return 56;
74452             case 76: return 55;
74453             case 77: return 60;
74454         }
74455     }
74456     ts.getNonAssignmentOperatorForCompoundAssignment = getNonAssignmentOperatorForCompoundAssignment;
74457     function addPrologueDirectivesAndInitialSuperCall(factory, ctor, result, visitor) {
74458         if (ctor.body) {
74459             var statements = ctor.body.statements;
74460             var index = factory.copyPrologue(statements, result, false, visitor);
74461             if (index === statements.length) {
74462                 return index;
74463             }
74464             var superIndex = ts.findIndex(statements, function (s) { return ts.isExpressionStatement(s) && ts.isSuperCall(s.expression); }, index);
74465             if (superIndex > -1) {
74466                 for (var i = index; i <= superIndex; i++) {
74467                     result.push(ts.visitNode(statements[i], visitor, ts.isStatement));
74468                 }
74469                 return superIndex + 1;
74470             }
74471             return index;
74472         }
74473         return 0;
74474     }
74475     ts.addPrologueDirectivesAndInitialSuperCall = addPrologueDirectivesAndInitialSuperCall;
74476     function getProperties(node, requireInitializer, isStatic) {
74477         return ts.filter(node.members, function (m) { return isInitializedOrStaticProperty(m, requireInitializer, isStatic); });
74478     }
74479     ts.getProperties = getProperties;
74480     function isStaticPropertyDeclarationOrClassStaticBlockDeclaration(element) {
74481         return isStaticPropertyDeclaration(element) || ts.isClassStaticBlockDeclaration(element);
74482     }
74483     function getStaticPropertiesAndClassStaticBlock(node) {
74484         return ts.filter(node.members, isStaticPropertyDeclarationOrClassStaticBlockDeclaration);
74485     }
74486     ts.getStaticPropertiesAndClassStaticBlock = getStaticPropertiesAndClassStaticBlock;
74487     function isInitializedOrStaticProperty(member, requireInitializer, isStatic) {
74488         return ts.isPropertyDeclaration(member)
74489             && (!!member.initializer || !requireInitializer)
74490             && ts.hasStaticModifier(member) === isStatic;
74491     }
74492     function isStaticPropertyDeclaration(member) {
74493         return ts.isPropertyDeclaration(member) && ts.hasStaticModifier(member);
74494     }
74495     function isInitializedProperty(member) {
74496         return member.kind === 166
74497             && member.initializer !== undefined;
74498     }
74499     ts.isInitializedProperty = isInitializedProperty;
74500     function isNonStaticMethodOrAccessorWithPrivateName(member) {
74501         return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name);
74502     }
74503     ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName;
74504 })(ts || (ts = {}));
74505 var ts;
74506 (function (ts) {
74507     function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
74508         var location = node;
74509         var value;
74510         if (ts.isDestructuringAssignment(node)) {
74511             value = node.right;
74512             while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) {
74513                 if (ts.isDestructuringAssignment(value)) {
74514                     location = node = value;
74515                     value = node.right;
74516                 }
74517                 else {
74518                     return ts.visitNode(value, visitor, ts.isExpression);
74519                 }
74520             }
74521         }
74522         var expressions;
74523         var flattenContext = {
74524             context: context,
74525             level: level,
74526             downlevelIteration: !!context.getCompilerOptions().downlevelIteration,
74527             hoistTempVariables: true,
74528             emitExpression: emitExpression,
74529             emitBindingOrAssignment: emitBindingOrAssignment,
74530             createArrayBindingOrAssignmentPattern: function (elements) { return makeArrayAssignmentPattern(context.factory, elements); },
74531             createObjectBindingOrAssignmentPattern: function (elements) { return makeObjectAssignmentPattern(context.factory, elements); },
74532             createArrayBindingOrAssignmentElement: makeAssignmentElement,
74533             visitor: visitor
74534         };
74535         if (value) {
74536             value = ts.visitNode(value, visitor, ts.isExpression);
74537             if (ts.isIdentifier(value) && bindingOrAssignmentElementAssignsToName(node, value.escapedText) ||
74538                 bindingOrAssignmentElementContainsNonLiteralComputedName(node)) {
74539                 value = ensureIdentifier(flattenContext, value, false, location);
74540             }
74541             else if (needsValue) {
74542                 value = ensureIdentifier(flattenContext, value, true, location);
74543             }
74544             else if (ts.nodeIsSynthesized(node)) {
74545                 location = value;
74546             }
74547         }
74548         flattenBindingOrAssignmentElement(flattenContext, node, value, location, ts.isDestructuringAssignment(node));
74549         if (value && needsValue) {
74550             if (!ts.some(expressions)) {
74551                 return value;
74552             }
74553             expressions.push(value);
74554         }
74555         return context.factory.inlineExpressions(expressions) || context.factory.createOmittedExpression();
74556         function emitExpression(expression) {
74557             expressions = ts.append(expressions, expression);
74558         }
74559         function emitBindingOrAssignment(target, value, location, original) {
74560             ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression);
74561             var expression = createAssignmentCallback
74562                 ? createAssignmentCallback(target, value, location)
74563                 : ts.setTextRange(context.factory.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location);
74564             expression.original = original;
74565             emitExpression(expression);
74566         }
74567     }
74568     ts.flattenDestructuringAssignment = flattenDestructuringAssignment;
74569     function bindingOrAssignmentElementAssignsToName(element, escapedName) {
74570         var target = ts.getTargetOfBindingOrAssignmentElement(element);
74571         if (ts.isBindingOrAssignmentPattern(target)) {
74572             return bindingOrAssignmentPatternAssignsToName(target, escapedName);
74573         }
74574         else if (ts.isIdentifier(target)) {
74575             return target.escapedText === escapedName;
74576         }
74577         return false;
74578     }
74579     function bindingOrAssignmentPatternAssignsToName(pattern, escapedName) {
74580         var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
74581         for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
74582             var element = elements_3[_i];
74583             if (bindingOrAssignmentElementAssignsToName(element, escapedName)) {
74584                 return true;
74585             }
74586         }
74587         return false;
74588     }
74589     function bindingOrAssignmentElementContainsNonLiteralComputedName(element) {
74590         var propertyName = ts.tryGetPropertyNameOfBindingOrAssignmentElement(element);
74591         if (propertyName && ts.isComputedPropertyName(propertyName) && !ts.isLiteralExpression(propertyName.expression)) {
74592             return true;
74593         }
74594         var target = ts.getTargetOfBindingOrAssignmentElement(element);
74595         return !!target && ts.isBindingOrAssignmentPattern(target) && bindingOrAssignmentPatternContainsNonLiteralComputedName(target);
74596     }
74597     function bindingOrAssignmentPatternContainsNonLiteralComputedName(pattern) {
74598         return !!ts.forEach(ts.getElementsOfBindingOrAssignmentPattern(pattern), bindingOrAssignmentElementContainsNonLiteralComputedName);
74599     }
74600     function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) {
74601         if (hoistTempVariables === void 0) { hoistTempVariables = false; }
74602         var pendingExpressions;
74603         var pendingDeclarations = [];
74604         var declarations = [];
74605         var flattenContext = {
74606             context: context,
74607             level: level,
74608             downlevelIteration: !!context.getCompilerOptions().downlevelIteration,
74609             hoistTempVariables: hoistTempVariables,
74610             emitExpression: emitExpression,
74611             emitBindingOrAssignment: emitBindingOrAssignment,
74612             createArrayBindingOrAssignmentPattern: function (elements) { return makeArrayBindingPattern(context.factory, elements); },
74613             createObjectBindingOrAssignmentPattern: function (elements) { return makeObjectBindingPattern(context.factory, elements); },
74614             createArrayBindingOrAssignmentElement: function (name) { return makeBindingElement(context.factory, name); },
74615             visitor: visitor
74616         };
74617         if (ts.isVariableDeclaration(node)) {
74618             var initializer = ts.getInitializerOfBindingOrAssignmentElement(node);
74619             if (initializer && (ts.isIdentifier(initializer) && bindingOrAssignmentElementAssignsToName(node, initializer.escapedText) ||
74620                 bindingOrAssignmentElementContainsNonLiteralComputedName(node))) {
74621                 initializer = ensureIdentifier(flattenContext, ts.visitNode(initializer, flattenContext.visitor), false, initializer);
74622                 node = context.factory.updateVariableDeclaration(node, node.name, undefined, undefined, initializer);
74623             }
74624         }
74625         flattenBindingOrAssignmentElement(flattenContext, node, rval, node, skipInitializer);
74626         if (pendingExpressions) {
74627             var temp = context.factory.createTempVariable(undefined);
74628             if (hoistTempVariables) {
74629                 var value = context.factory.inlineExpressions(pendingExpressions);
74630                 pendingExpressions = undefined;
74631                 emitBindingOrAssignment(temp, value, undefined, undefined);
74632             }
74633             else {
74634                 context.hoistVariableDeclaration(temp);
74635                 var pendingDeclaration = ts.last(pendingDeclarations);
74636                 pendingDeclaration.pendingExpressions = ts.append(pendingDeclaration.pendingExpressions, context.factory.createAssignment(temp, pendingDeclaration.value));
74637                 ts.addRange(pendingDeclaration.pendingExpressions, pendingExpressions);
74638                 pendingDeclaration.value = temp;
74639             }
74640         }
74641         for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) {
74642             var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original;
74643             var variable = context.factory.createVariableDeclaration(name, undefined, undefined, pendingExpressions_1 ? context.factory.inlineExpressions(ts.append(pendingExpressions_1, value)) : value);
74644             variable.original = original;
74645             ts.setTextRange(variable, location);
74646             declarations.push(variable);
74647         }
74648         return declarations;
74649         function emitExpression(value) {
74650             pendingExpressions = ts.append(pendingExpressions, value);
74651         }
74652         function emitBindingOrAssignment(target, value, location, original) {
74653             ts.Debug.assertNode(target, ts.isBindingName);
74654             if (pendingExpressions) {
74655                 value = context.factory.inlineExpressions(ts.append(pendingExpressions, value));
74656                 pendingExpressions = undefined;
74657             }
74658             pendingDeclarations.push({ pendingExpressions: pendingExpressions, name: target, value: value, location: location, original: original });
74659         }
74660     }
74661     ts.flattenDestructuringBinding = flattenDestructuringBinding;
74662     function flattenBindingOrAssignmentElement(flattenContext, element, value, location, skipInitializer) {
74663         var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element);
74664         if (!skipInitializer) {
74665             var initializer = ts.visitNode(ts.getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, ts.isExpression);
74666             if (initializer) {
74667                 if (value) {
74668                     value = createDefaultValueCheck(flattenContext, value, initializer, location);
74669                     if (!ts.isSimpleInlineableExpression(initializer) && ts.isBindingOrAssignmentPattern(bindingTarget)) {
74670                         value = ensureIdentifier(flattenContext, value, true, location);
74671                     }
74672                 }
74673                 else {
74674                     value = initializer;
74675                 }
74676             }
74677             else if (!value) {
74678                 value = flattenContext.context.factory.createVoidZero();
74679             }
74680         }
74681         if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) {
74682             flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
74683         }
74684         else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) {
74685             flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location);
74686         }
74687         else {
74688             flattenContext.emitBindingOrAssignment(bindingTarget, value, location, element);
74689         }
74690     }
74691     function flattenObjectBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
74692         var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
74693         var numElements = elements.length;
74694         if (numElements !== 1) {
74695             var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
74696             value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
74697         }
74698         var bindingElements;
74699         var computedTempVariables;
74700         for (var i = 0; i < numElements; i++) {
74701             var element = elements[i];
74702             if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
74703                 var propertyName = ts.getPropertyNameOfBindingOrAssignmentElement(element);
74704                 if (flattenContext.level >= 1
74705                     && !(element.transformFlags & (16384 | 32768))
74706                     && !(ts.getTargetOfBindingOrAssignmentElement(element).transformFlags & (16384 | 32768))
74707                     && !ts.isComputedPropertyName(propertyName)) {
74708                     bindingElements = ts.append(bindingElements, ts.visitNode(element, flattenContext.visitor));
74709                 }
74710                 else {
74711                     if (bindingElements) {
74712                         flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
74713                         bindingElements = undefined;
74714                     }
74715                     var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName);
74716                     if (ts.isComputedPropertyName(propertyName)) {
74717                         computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression);
74718                     }
74719                     flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
74720                 }
74721             }
74722             else if (i === numElements - 1) {
74723                 if (bindingElements) {
74724                     flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
74725                     bindingElements = undefined;
74726                 }
74727                 var rhsValue = flattenContext.context.getEmitHelperFactory().createRestHelper(value, elements, computedTempVariables, pattern);
74728                 flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
74729             }
74730         }
74731         if (bindingElements) {
74732             flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern);
74733         }
74734     }
74735     function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) {
74736         var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern);
74737         var numElements = elements.length;
74738         if (flattenContext.level < 1 && flattenContext.downlevelIteration) {
74739             value = ensureIdentifier(flattenContext, ts.setTextRange(flattenContext.context.getEmitHelperFactory().createReadHelper(value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1])
74740                 ? undefined
74741                 : numElements), location), false, location);
74742         }
74743         else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)
74744             || ts.every(elements, ts.isOmittedExpression)) {
74745             var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0;
74746             value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location);
74747         }
74748         var bindingElements;
74749         var restContainingElements;
74750         for (var i = 0; i < numElements; i++) {
74751             var element = elements[i];
74752             if (flattenContext.level >= 1) {
74753                 if (element.transformFlags & 32768 || flattenContext.hasTransformedPriorElement && !isSimpleBindingOrAssignmentElement(element)) {
74754                     flattenContext.hasTransformedPriorElement = true;
74755                     var temp = flattenContext.context.factory.createTempVariable(undefined);
74756                     if (flattenContext.hoistTempVariables) {
74757                         flattenContext.context.hoistVariableDeclaration(temp);
74758                     }
74759                     restContainingElements = ts.append(restContainingElements, [temp, element]);
74760                     bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp));
74761                 }
74762                 else {
74763                     bindingElements = ts.append(bindingElements, element);
74764                 }
74765             }
74766             else if (ts.isOmittedExpression(element)) {
74767                 continue;
74768             }
74769             else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) {
74770                 var rhsValue = flattenContext.context.factory.createElementAccessExpression(value, i);
74771                 flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
74772             }
74773             else if (i === numElements - 1) {
74774                 var rhsValue = flattenContext.context.factory.createArraySliceCall(value, i);
74775                 flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, element);
74776             }
74777         }
74778         if (bindingElements) {
74779             flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern);
74780         }
74781         if (restContainingElements) {
74782             for (var _i = 0, restContainingElements_1 = restContainingElements; _i < restContainingElements_1.length; _i++) {
74783                 var _a = restContainingElements_1[_i], id = _a[0], element = _a[1];
74784                 flattenBindingOrAssignmentElement(flattenContext, element, id, element);
74785             }
74786         }
74787     }
74788     function isSimpleBindingOrAssignmentElement(element) {
74789         var target = ts.getTargetOfBindingOrAssignmentElement(element);
74790         if (!target || ts.isOmittedExpression(target))
74791             return true;
74792         var propertyName = ts.tryGetPropertyNameOfBindingOrAssignmentElement(element);
74793         if (propertyName && !ts.isPropertyNameLiteral(propertyName))
74794             return false;
74795         var initializer = ts.getInitializerOfBindingOrAssignmentElement(element);
74796         if (initializer && !ts.isSimpleInlineableExpression(initializer))
74797             return false;
74798         if (ts.isBindingOrAssignmentPattern(target))
74799             return ts.every(ts.getElementsOfBindingOrAssignmentPattern(target), isSimpleBindingOrAssignmentElement);
74800         return ts.isIdentifier(target);
74801     }
74802     function createDefaultValueCheck(flattenContext, value, defaultValue, location) {
74803         value = ensureIdentifier(flattenContext, value, true, location);
74804         return flattenContext.context.factory.createConditionalExpression(flattenContext.context.factory.createTypeCheck(value, "undefined"), undefined, defaultValue, undefined, value);
74805     }
74806     function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
74807         if (ts.isComputedPropertyName(propertyName)) {
74808             var argumentExpression = ensureIdentifier(flattenContext, ts.visitNode(propertyName.expression, flattenContext.visitor), false, propertyName);
74809             return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
74810         }
74811         else if (ts.isStringOrNumericLiteralLike(propertyName)) {
74812             var argumentExpression = ts.factory.cloneNode(propertyName);
74813             return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
74814         }
74815         else {
74816             var name = flattenContext.context.factory.createIdentifier(ts.idText(propertyName));
74817             return flattenContext.context.factory.createPropertyAccessExpression(value, name);
74818         }
74819     }
74820     function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) {
74821         if (ts.isIdentifier(value) && reuseIdentifierExpressions) {
74822             return value;
74823         }
74824         else {
74825             var temp = flattenContext.context.factory.createTempVariable(undefined);
74826             if (flattenContext.hoistTempVariables) {
74827                 flattenContext.context.hoistVariableDeclaration(temp);
74828                 flattenContext.emitExpression(ts.setTextRange(flattenContext.context.factory.createAssignment(temp, value), location));
74829             }
74830             else {
74831                 flattenContext.emitBindingOrAssignment(temp, value, location, undefined);
74832             }
74833             return temp;
74834         }
74835     }
74836     function makeArrayBindingPattern(factory, elements) {
74837         ts.Debug.assertEachNode(elements, ts.isArrayBindingElement);
74838         return factory.createArrayBindingPattern(elements);
74839     }
74840     function makeArrayAssignmentPattern(factory, elements) {
74841         return factory.createArrayLiteralExpression(ts.map(elements, factory.converters.convertToArrayAssignmentElement));
74842     }
74843     function makeObjectBindingPattern(factory, elements) {
74844         ts.Debug.assertEachNode(elements, ts.isBindingElement);
74845         return factory.createObjectBindingPattern(elements);
74846     }
74847     function makeObjectAssignmentPattern(factory, elements) {
74848         return factory.createObjectLiteralExpression(ts.map(elements, factory.converters.convertToObjectAssignmentElement));
74849     }
74850     function makeBindingElement(factory, name) {
74851         return factory.createBindingElement(undefined, undefined, name);
74852     }
74853     function makeAssignmentElement(name) {
74854         return name;
74855     }
74856 })(ts || (ts = {}));
74857 var ts;
74858 (function (ts) {
74859     var ProcessLevel;
74860     (function (ProcessLevel) {
74861         ProcessLevel[ProcessLevel["LiftRestriction"] = 0] = "LiftRestriction";
74862         ProcessLevel[ProcessLevel["All"] = 1] = "All";
74863     })(ProcessLevel = ts.ProcessLevel || (ts.ProcessLevel = {}));
74864     function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) {
74865         var tag = ts.visitNode(node.tag, visitor, ts.isExpression);
74866         var templateArguments = [undefined];
74867         var cookedStrings = [];
74868         var rawStrings = [];
74869         var template = node.template;
74870         if (level === ProcessLevel.LiftRestriction && !ts.hasInvalidEscape(template)) {
74871             return ts.visitEachChild(node, visitor, context);
74872         }
74873         if (ts.isNoSubstitutionTemplateLiteral(template)) {
74874             cookedStrings.push(createTemplateCooked(template));
74875             rawStrings.push(getRawLiteral(template, currentSourceFile));
74876         }
74877         else {
74878             cookedStrings.push(createTemplateCooked(template.head));
74879             rawStrings.push(getRawLiteral(template.head, currentSourceFile));
74880             for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) {
74881                 var templateSpan = _a[_i];
74882                 cookedStrings.push(createTemplateCooked(templateSpan.literal));
74883                 rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile));
74884                 templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression));
74885             }
74886         }
74887         var helperCall = context.getEmitHelperFactory().createTemplateObjectHelper(ts.factory.createArrayLiteralExpression(cookedStrings), ts.factory.createArrayLiteralExpression(rawStrings));
74888         if (ts.isExternalModule(currentSourceFile)) {
74889             var tempVar = ts.factory.createUniqueName("templateObject");
74890             recordTaggedTemplateString(tempVar);
74891             templateArguments[0] = ts.factory.createLogicalOr(tempVar, ts.factory.createAssignment(tempVar, helperCall));
74892         }
74893         else {
74894             templateArguments[0] = helperCall;
74895         }
74896         return ts.factory.createCallExpression(tag, undefined, templateArguments);
74897     }
74898     ts.processTaggedTemplateExpression = processTaggedTemplateExpression;
74899     function createTemplateCooked(template) {
74900         return template.templateFlags ? ts.factory.createVoidZero() : ts.factory.createStringLiteral(template.text);
74901     }
74902     function getRawLiteral(node, currentSourceFile) {
74903         var text = node.rawText;
74904         if (text === undefined) {
74905             ts.Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
74906             text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
74907             var isLast = node.kind === 14 || node.kind === 17;
74908             text = text.substring(1, text.length - (isLast ? 1 : 2));
74909         }
74910         text = text.replace(/\r\n?/g, "\n");
74911         return ts.setTextRange(ts.factory.createStringLiteral(text), node);
74912     }
74913 })(ts || (ts = {}));
74914 var ts;
74915 (function (ts) {
74916     var USE_NEW_TYPE_METADATA_FORMAT = false;
74917     function transformTypeScript(context) {
74918         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
74919         var resolver = context.getEmitResolver();
74920         var compilerOptions = context.getCompilerOptions();
74921         var strictNullChecks = ts.getStrictOptionValue(compilerOptions, "strictNullChecks");
74922         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
74923         var moduleKind = ts.getEmitModuleKind(compilerOptions);
74924         var previousOnEmitNode = context.onEmitNode;
74925         var previousOnSubstituteNode = context.onSubstituteNode;
74926         context.onEmitNode = onEmitNode;
74927         context.onSubstituteNode = onSubstituteNode;
74928         context.enableSubstitution(205);
74929         context.enableSubstitution(206);
74930         var currentSourceFile;
74931         var currentNamespace;
74932         var currentNamespaceContainerName;
74933         var currentLexicalScope;
74934         var currentNameScope;
74935         var currentScopeFirstDeclarationsOfName;
74936         var currentClassHasParameterProperties;
74937         var enabledSubstitutions;
74938         var classAliases;
74939         var applicableSubstitutions;
74940         return transformSourceFileOrBundle;
74941         function transformSourceFileOrBundle(node) {
74942             if (node.kind === 304) {
74943                 return transformBundle(node);
74944             }
74945             return transformSourceFile(node);
74946         }
74947         function transformBundle(node) {
74948             return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
74949                 if (prepend.kind === 306) {
74950                     return ts.createUnparsedSourceFile(prepend, "js");
74951                 }
74952                 return prepend;
74953             }));
74954         }
74955         function transformSourceFile(node) {
74956             if (node.isDeclarationFile) {
74957                 return node;
74958             }
74959             currentSourceFile = node;
74960             var visited = saveStateAndInvoke(node, visitSourceFile);
74961             ts.addEmitHelpers(visited, context.readEmitHelpers());
74962             currentSourceFile = undefined;
74963             return visited;
74964         }
74965         function saveStateAndInvoke(node, f) {
74966             var savedCurrentScope = currentLexicalScope;
74967             var savedCurrentNameScope = currentNameScope;
74968             var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
74969             var savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
74970             onBeforeVisitNode(node);
74971             var visited = f(node);
74972             if (currentLexicalScope !== savedCurrentScope) {
74973                 currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
74974             }
74975             currentLexicalScope = savedCurrentScope;
74976             currentNameScope = savedCurrentNameScope;
74977             currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
74978             return visited;
74979         }
74980         function onBeforeVisitNode(node) {
74981             switch (node.kind) {
74982                 case 303:
74983                 case 262:
74984                 case 261:
74985                 case 234:
74986                     currentLexicalScope = node;
74987                     currentNameScope = undefined;
74988                     currentScopeFirstDeclarationsOfName = undefined;
74989                     break;
74990                 case 256:
74991                 case 255:
74992                     if (ts.hasSyntacticModifier(node, 2)) {
74993                         break;
74994                     }
74995                     if (node.name) {
74996                         recordEmittedDeclarationInScope(node);
74997                     }
74998                     else {
74999                         ts.Debug.assert(node.kind === 256 || ts.hasSyntacticModifier(node, 512));
75000                     }
75001                     if (ts.isClassDeclaration(node)) {
75002                         currentNameScope = node;
75003                     }
75004                     break;
75005             }
75006         }
75007         function visitor(node) {
75008             return saveStateAndInvoke(node, visitorWorker);
75009         }
75010         function visitorWorker(node) {
75011             if (node.transformFlags & 1) {
75012                 return visitTypeScript(node);
75013             }
75014             return node;
75015         }
75016         function sourceElementVisitor(node) {
75017             return saveStateAndInvoke(node, sourceElementVisitorWorker);
75018         }
75019         function sourceElementVisitorWorker(node) {
75020             switch (node.kind) {
75021                 case 265:
75022                 case 264:
75023                 case 270:
75024                 case 271:
75025                     return visitElidableStatement(node);
75026                 default:
75027                     return visitorWorker(node);
75028             }
75029         }
75030         function visitElidableStatement(node) {
75031             var parsed = ts.getParseTreeNode(node);
75032             if (parsed !== node) {
75033                 if (node.transformFlags & 1) {
75034                     return ts.visitEachChild(node, visitor, context);
75035                 }
75036                 return node;
75037             }
75038             switch (node.kind) {
75039                 case 265:
75040                     return visitImportDeclaration(node);
75041                 case 264:
75042                     return visitImportEqualsDeclaration(node);
75043                 case 270:
75044                     return visitExportAssignment(node);
75045                 case 271:
75046                     return visitExportDeclaration(node);
75047                 default:
75048                     ts.Debug.fail("Unhandled ellided statement");
75049             }
75050         }
75051         function namespaceElementVisitor(node) {
75052             return saveStateAndInvoke(node, namespaceElementVisitorWorker);
75053         }
75054         function namespaceElementVisitorWorker(node) {
75055             if (node.kind === 271 ||
75056                 node.kind === 265 ||
75057                 node.kind === 266 ||
75058                 (node.kind === 264 &&
75059                     node.moduleReference.kind === 276)) {
75060                 return undefined;
75061             }
75062             else if (node.transformFlags & 1 || ts.hasSyntacticModifier(node, 1)) {
75063                 return visitTypeScript(node);
75064             }
75065             return node;
75066         }
75067         function classElementVisitor(node) {
75068             return saveStateAndInvoke(node, classElementVisitorWorker);
75069         }
75070         function classElementVisitorWorker(node) {
75071             switch (node.kind) {
75072                 case 170:
75073                     return visitConstructor(node);
75074                 case 166:
75075                     return visitPropertyDeclaration(node);
75076                 case 175:
75077                 case 171:
75078                 case 172:
75079                 case 168:
75080                 case 169:
75081                     return visitorWorker(node);
75082                 case 233:
75083                     return node;
75084                 default:
75085                     return ts.Debug.failBadSyntaxKind(node);
75086             }
75087         }
75088         function modifierVisitor(node) {
75089             if (ts.modifierToFlag(node.kind) & 18654) {
75090                 return undefined;
75091             }
75092             else if (currentNamespace && node.kind === 93) {
75093                 return undefined;
75094             }
75095             return node;
75096         }
75097         function visitTypeScript(node) {
75098             if (ts.isStatement(node) && ts.hasSyntacticModifier(node, 2)) {
75099                 return factory.createNotEmittedStatement(node);
75100             }
75101             switch (node.kind) {
75102                 case 93:
75103                 case 88:
75104                     return currentNamespace ? undefined : node;
75105                 case 123:
75106                 case 121:
75107                 case 122:
75108                 case 126:
75109                 case 158:
75110                 case 85:
75111                 case 135:
75112                 case 144:
75113                 case 182:
75114                 case 183:
75115                 case 184:
75116                 case 185:
75117                 case 181:
75118                 case 176:
75119                 case 162:
75120                 case 130:
75121                 case 154:
75122                 case 133:
75123                 case 149:
75124                 case 146:
75125                 case 143:
75126                 case 114:
75127                 case 150:
75128                 case 179:
75129                 case 178:
75130                 case 180:
75131                 case 177:
75132                 case 186:
75133                 case 187:
75134                 case 188:
75135                 case 190:
75136                 case 191:
75137                 case 192:
75138                 case 193:
75139                 case 194:
75140                 case 195:
75141                 case 175:
75142                 case 164:
75143                     return undefined;
75144                 case 258:
75145                     return factory.createNotEmittedStatement(node);
75146                 case 166:
75147                     return visitPropertyDeclaration(node);
75148                 case 263:
75149                     return undefined;
75150                 case 170:
75151                     return visitConstructor(node);
75152                 case 257:
75153                     return factory.createNotEmittedStatement(node);
75154                 case 256:
75155                     return visitClassDeclaration(node);
75156                 case 225:
75157                     return visitClassExpression(node);
75158                 case 290:
75159                     return visitHeritageClause(node);
75160                 case 227:
75161                     return visitExpressionWithTypeArguments(node);
75162                 case 168:
75163                     return visitMethodDeclaration(node);
75164                 case 171:
75165                     return visitGetAccessor(node);
75166                 case 172:
75167                     return visitSetAccessor(node);
75168                 case 255:
75169                     return visitFunctionDeclaration(node);
75170                 case 212:
75171                     return visitFunctionExpression(node);
75172                 case 213:
75173                     return visitArrowFunction(node);
75174                 case 163:
75175                     return visitParameter(node);
75176                 case 211:
75177                     return visitParenthesizedExpression(node);
75178                 case 210:
75179                 case 228:
75180                     return visitAssertionExpression(node);
75181                 case 207:
75182                     return visitCallExpression(node);
75183                 case 208:
75184                     return visitNewExpression(node);
75185                 case 209:
75186                     return visitTaggedTemplateExpression(node);
75187                 case 229:
75188                     return visitNonNullExpression(node);
75189                 case 259:
75190                     return visitEnumDeclaration(node);
75191                 case 236:
75192                     return visitVariableStatement(node);
75193                 case 253:
75194                     return visitVariableDeclaration(node);
75195                 case 260:
75196                     return visitModuleDeclaration(node);
75197                 case 264:
75198                     return visitImportEqualsDeclaration(node);
75199                 case 278:
75200                     return visitJsxSelfClosingElement(node);
75201                 case 279:
75202                     return visitJsxJsxOpeningElement(node);
75203                 default:
75204                     return ts.visitEachChild(node, visitor, context);
75205             }
75206         }
75207         function visitSourceFile(node) {
75208             var alwaysStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") &&
75209                 !(ts.isExternalModule(node) && moduleKind >= ts.ModuleKind.ES2015) &&
75210                 !ts.isJsonSourceFile(node);
75211             return factory.updateSourceFile(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict));
75212         }
75213         function getClassFacts(node, staticProperties) {
75214             var facts = 0;
75215             if (ts.some(staticProperties))
75216                 facts |= 1;
75217             var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
75218             if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104)
75219                 facts |= 64;
75220             if (ts.classOrConstructorParameterIsDecorated(node))
75221                 facts |= 2;
75222             if (ts.childIsDecorated(node))
75223                 facts |= 4;
75224             if (isExportOfNamespace(node))
75225                 facts |= 8;
75226             else if (isDefaultExternalModuleExport(node))
75227                 facts |= 32;
75228             else if (isNamedExternalModuleExport(node))
75229                 facts |= 16;
75230             if (languageVersion <= 1 && (facts & 7))
75231                 facts |= 128;
75232             return facts;
75233         }
75234         function hasTypeScriptClassSyntax(node) {
75235             return !!(node.transformFlags & 4096);
75236         }
75237         function isClassLikeDeclarationWithTypeScriptSyntax(node) {
75238             return ts.some(node.decorators)
75239                 || ts.some(node.typeParameters)
75240                 || ts.some(node.heritageClauses, hasTypeScriptClassSyntax)
75241                 || ts.some(node.members, hasTypeScriptClassSyntax);
75242         }
75243         function visitClassDeclaration(node) {
75244             if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && ts.hasSyntacticModifier(node, 1))) {
75245                 return ts.visitEachChild(node, visitor, context);
75246             }
75247             var staticProperties = ts.getProperties(node, true, true);
75248             var facts = getClassFacts(node, staticProperties);
75249             if (facts & 128) {
75250                 context.startLexicalEnvironment();
75251             }
75252             var name = node.name || (facts & 5 ? factory.getGeneratedNameForNode(node) : undefined);
75253             var classStatement = facts & 2
75254                 ? createClassDeclarationHeadWithDecorators(node, name)
75255                 : createClassDeclarationHeadWithoutDecorators(node, name, facts);
75256             var statements = [classStatement];
75257             addClassElementDecorationStatements(statements, node, false);
75258             addClassElementDecorationStatements(statements, node, true);
75259             addConstructorDecorationStatement(statements, node);
75260             if (facts & 128) {
75261                 var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentSourceFile.text, node.members.end), 19);
75262                 var localName = factory.getInternalName(node);
75263                 var outer = factory.createPartiallyEmittedExpression(localName);
75264                 ts.setTextRangeEnd(outer, closingBraceLocation.end);
75265                 ts.setEmitFlags(outer, 1536);
75266                 var statement = factory.createReturnStatement(outer);
75267                 ts.setTextRangePos(statement, closingBraceLocation.pos);
75268                 ts.setEmitFlags(statement, 1536 | 384);
75269                 statements.push(statement);
75270                 ts.insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment());
75271                 var iife = factory.createImmediatelyInvokedArrowFunction(statements);
75272                 ts.setEmitFlags(iife, 33554432);
75273                 var varStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
75274                     factory.createVariableDeclaration(factory.getLocalName(node, false, false), undefined, undefined, iife)
75275                 ]));
75276                 ts.setOriginalNode(varStatement, node);
75277                 ts.setCommentRange(varStatement, node);
75278                 ts.setSourceMapRange(varStatement, ts.moveRangePastDecorators(node));
75279                 ts.startOnNewLine(varStatement);
75280                 statements = [varStatement];
75281             }
75282             if (facts & 8) {
75283                 addExportMemberAssignment(statements, node);
75284             }
75285             else if (facts & 128 || facts & 2) {
75286                 if (facts & 32) {
75287                     statements.push(factory.createExportDefault(factory.getLocalName(node, false, true)));
75288                 }
75289                 else if (facts & 16) {
75290                     statements.push(factory.createExternalModuleExport(factory.getLocalName(node, false, true)));
75291                 }
75292             }
75293             if (statements.length > 1) {
75294                 statements.push(factory.createEndOfDeclarationMarker(node));
75295                 ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 4194304);
75296             }
75297             return ts.singleOrMany(statements);
75298         }
75299         function createClassDeclarationHeadWithoutDecorators(node, name, facts) {
75300             var modifiers = !(facts & 128)
75301                 ? ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier)
75302                 : undefined;
75303             var classDeclaration = factory.createClassDeclaration(undefined, modifiers, name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node));
75304             var emitFlags = ts.getEmitFlags(node);
75305             if (facts & 1) {
75306                 emitFlags |= 32;
75307             }
75308             ts.setTextRange(classDeclaration, node);
75309             ts.setOriginalNode(classDeclaration, node);
75310             ts.setEmitFlags(classDeclaration, emitFlags);
75311             return classDeclaration;
75312         }
75313         function createClassDeclarationHeadWithDecorators(node, name) {
75314             var location = ts.moveRangePastDecorators(node);
75315             var classAlias = getClassAliasIfNeeded(node);
75316             var declName = languageVersion <= 2 ?
75317                 factory.getInternalName(node, false, true) :
75318                 factory.getLocalName(node, false, true);
75319             var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
75320             var members = transformClassMembers(node);
75321             var classExpression = factory.createClassExpression(undefined, undefined, name, undefined, heritageClauses, members);
75322             ts.setOriginalNode(classExpression, node);
75323             ts.setTextRange(classExpression, location);
75324             var statement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
75325                 factory.createVariableDeclaration(declName, undefined, undefined, classAlias ? factory.createAssignment(classAlias, classExpression) : classExpression)
75326             ], 1));
75327             ts.setOriginalNode(statement, node);
75328             ts.setTextRange(statement, location);
75329             ts.setCommentRange(statement, node);
75330             return statement;
75331         }
75332         function visitClassExpression(node) {
75333             if (!isClassLikeDeclarationWithTypeScriptSyntax(node)) {
75334                 return ts.visitEachChild(node, visitor, context);
75335             }
75336             var classExpression = factory.createClassExpression(undefined, undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node));
75337             ts.setOriginalNode(classExpression, node);
75338             ts.setTextRange(classExpression, node);
75339             return classExpression;
75340         }
75341         function transformClassMembers(node) {
75342             var members = [];
75343             var constructor = ts.getFirstConstructorWithBody(node);
75344             var parametersWithPropertyAssignments = constructor &&
75345                 ts.filter(constructor.parameters, function (p) { return ts.isParameterPropertyDeclaration(p, constructor); });
75346             if (parametersWithPropertyAssignments) {
75347                 for (var _i = 0, parametersWithPropertyAssignments_1 = parametersWithPropertyAssignments; _i < parametersWithPropertyAssignments_1.length; _i++) {
75348                     var parameter = parametersWithPropertyAssignments_1[_i];
75349                     if (ts.isIdentifier(parameter.name)) {
75350                         members.push(ts.setOriginalNode(factory.createPropertyDeclaration(undefined, undefined, parameter.name, undefined, undefined, undefined), parameter));
75351                     }
75352                 }
75353             }
75354             ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement));
75355             return ts.setTextRange(factory.createNodeArray(members), node.members);
75356         }
75357         function getDecoratedClassElements(node, isStatic) {
75358             return ts.filter(node.members, isStatic ? function (m) { return isStaticDecoratedClassElement(m, node); } : function (m) { return isInstanceDecoratedClassElement(m, node); });
75359         }
75360         function isStaticDecoratedClassElement(member, parent) {
75361             return isDecoratedClassElement(member, true, parent);
75362         }
75363         function isInstanceDecoratedClassElement(member, parent) {
75364             return isDecoratedClassElement(member, false, parent);
75365         }
75366         function isDecoratedClassElement(member, isStaticElement, parent) {
75367             return ts.nodeOrChildIsDecorated(member, parent)
75368                 && isStaticElement === ts.isStatic(member);
75369         }
75370         function getDecoratorsOfParameters(node) {
75371             var decorators;
75372             if (node) {
75373                 var parameters = node.parameters;
75374                 var firstParameterIsThis = parameters.length > 0 && ts.parameterIsThisKeyword(parameters[0]);
75375                 var firstParameterOffset = firstParameterIsThis ? 1 : 0;
75376                 var numParameters = firstParameterIsThis ? parameters.length - 1 : parameters.length;
75377                 for (var i = 0; i < numParameters; i++) {
75378                     var parameter = parameters[i + firstParameterOffset];
75379                     if (decorators || parameter.decorators) {
75380                         if (!decorators) {
75381                             decorators = new Array(numParameters);
75382                         }
75383                         decorators[i] = parameter.decorators;
75384                     }
75385                 }
75386             }
75387             return decorators;
75388         }
75389         function getAllDecoratorsOfConstructor(node) {
75390             var decorators = node.decorators;
75391             var parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node));
75392             if (!decorators && !parameters) {
75393                 return undefined;
75394             }
75395             return {
75396                 decorators: decorators,
75397                 parameters: parameters
75398             };
75399         }
75400         function getAllDecoratorsOfClassElement(node, member) {
75401             switch (member.kind) {
75402                 case 171:
75403                 case 172:
75404                     return getAllDecoratorsOfAccessors(node, member);
75405                 case 168:
75406                     return getAllDecoratorsOfMethod(member);
75407                 case 166:
75408                     return getAllDecoratorsOfProperty(member);
75409                 default:
75410                     return undefined;
75411             }
75412         }
75413         function getAllDecoratorsOfAccessors(node, accessor) {
75414             if (!accessor.body) {
75415                 return undefined;
75416             }
75417             var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor;
75418             var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined;
75419             if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) {
75420                 return undefined;
75421             }
75422             var decorators = firstAccessorWithDecorators.decorators;
75423             var parameters = getDecoratorsOfParameters(setAccessor);
75424             if (!decorators && !parameters) {
75425                 return undefined;
75426             }
75427             return { decorators: decorators, parameters: parameters };
75428         }
75429         function getAllDecoratorsOfMethod(method) {
75430             if (!method.body) {
75431                 return undefined;
75432             }
75433             var decorators = method.decorators;
75434             var parameters = getDecoratorsOfParameters(method);
75435             if (!decorators && !parameters) {
75436                 return undefined;
75437             }
75438             return { decorators: decorators, parameters: parameters };
75439         }
75440         function getAllDecoratorsOfProperty(property) {
75441             var decorators = property.decorators;
75442             if (!decorators) {
75443                 return undefined;
75444             }
75445             return { decorators: decorators };
75446         }
75447         function transformAllDecoratorsOfDeclaration(node, container, allDecorators) {
75448             if (!allDecorators) {
75449                 return undefined;
75450             }
75451             var decoratorExpressions = [];
75452             ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator));
75453             ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter));
75454             addTypeMetadata(node, container, decoratorExpressions);
75455             return decoratorExpressions;
75456         }
75457         function addClassElementDecorationStatements(statements, node, isStatic) {
75458             ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement));
75459         }
75460         function generateClassElementDecorationExpressions(node, isStatic) {
75461             var members = getDecoratedClassElements(node, isStatic);
75462             var expressions;
75463             for (var _i = 0, members_6 = members; _i < members_6.length; _i++) {
75464                 var member = members_6[_i];
75465                 var expression = generateClassElementDecorationExpression(node, member);
75466                 if (expression) {
75467                     if (!expressions) {
75468                         expressions = [expression];
75469                     }
75470                     else {
75471                         expressions.push(expression);
75472                     }
75473                 }
75474             }
75475             return expressions;
75476         }
75477         function generateClassElementDecorationExpression(node, member) {
75478             var allDecorators = getAllDecoratorsOfClassElement(node, member);
75479             var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators);
75480             if (!decoratorExpressions) {
75481                 return undefined;
75482             }
75483             var prefix = getClassMemberPrefix(node, member);
75484             var memberName = getExpressionForPropertyName(member, true);
75485             var descriptor = languageVersion > 0
75486                 ? member.kind === 166
75487                     ? factory.createVoidZero()
75488                     : factory.createNull()
75489                 : undefined;
75490             var helper = emitHelpers().createDecorateHelper(decoratorExpressions, prefix, memberName, descriptor);
75491             ts.setTextRange(helper, ts.moveRangePastDecorators(member));
75492             ts.setEmitFlags(helper, 1536);
75493             return helper;
75494         }
75495         function addConstructorDecorationStatement(statements, node) {
75496             var expression = generateConstructorDecorationExpression(node);
75497             if (expression) {
75498                 statements.push(ts.setOriginalNode(factory.createExpressionStatement(expression), node));
75499             }
75500         }
75501         function generateConstructorDecorationExpression(node) {
75502             var allDecorators = getAllDecoratorsOfConstructor(node);
75503             var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators);
75504             if (!decoratorExpressions) {
75505                 return undefined;
75506             }
75507             var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)];
75508             var localName = languageVersion <= 2 ?
75509                 factory.getInternalName(node, false, true) :
75510                 factory.getLocalName(node, false, true);
75511             var decorate = emitHelpers().createDecorateHelper(decoratorExpressions, localName);
75512             var expression = factory.createAssignment(localName, classAlias ? factory.createAssignment(classAlias, decorate) : decorate);
75513             ts.setEmitFlags(expression, 1536);
75514             ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node));
75515             return expression;
75516         }
75517         function transformDecorator(decorator) {
75518             return ts.visitNode(decorator.expression, visitor, ts.isExpression);
75519         }
75520         function transformDecoratorsOfParameter(decorators, parameterOffset) {
75521             var expressions;
75522             if (decorators) {
75523                 expressions = [];
75524                 for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) {
75525                     var decorator = decorators_1[_i];
75526                     var helper = emitHelpers().createParamHelper(transformDecorator(decorator), parameterOffset);
75527                     ts.setTextRange(helper, decorator.expression);
75528                     ts.setEmitFlags(helper, 1536);
75529                     expressions.push(helper);
75530                 }
75531             }
75532             return expressions;
75533         }
75534         function addTypeMetadata(node, container, decoratorExpressions) {
75535             if (USE_NEW_TYPE_METADATA_FORMAT) {
75536                 addNewTypeMetadata(node, container, decoratorExpressions);
75537             }
75538             else {
75539                 addOldTypeMetadata(node, container, decoratorExpressions);
75540             }
75541         }
75542         function addOldTypeMetadata(node, container, decoratorExpressions) {
75543             if (compilerOptions.emitDecoratorMetadata) {
75544                 if (shouldAddTypeMetadata(node)) {
75545                     decoratorExpressions.push(emitHelpers().createMetadataHelper("design:type", serializeTypeOfNode(node)));
75546                 }
75547                 if (shouldAddParamTypesMetadata(node)) {
75548                     decoratorExpressions.push(emitHelpers().createMetadataHelper("design:paramtypes", serializeParameterTypesOfNode(node, container)));
75549                 }
75550                 if (shouldAddReturnTypeMetadata(node)) {
75551                     decoratorExpressions.push(emitHelpers().createMetadataHelper("design:returntype", serializeReturnTypeOfNode(node)));
75552                 }
75553             }
75554         }
75555         function addNewTypeMetadata(node, container, decoratorExpressions) {
75556             if (compilerOptions.emitDecoratorMetadata) {
75557                 var properties = void 0;
75558                 if (shouldAddTypeMetadata(node)) {
75559                     (properties || (properties = [])).push(factory.createPropertyAssignment("type", factory.createArrowFunction(undefined, undefined, [], undefined, factory.createToken(38), serializeTypeOfNode(node))));
75560                 }
75561                 if (shouldAddParamTypesMetadata(node)) {
75562                     (properties || (properties = [])).push(factory.createPropertyAssignment("paramTypes", factory.createArrowFunction(undefined, undefined, [], undefined, factory.createToken(38), serializeParameterTypesOfNode(node, container))));
75563                 }
75564                 if (shouldAddReturnTypeMetadata(node)) {
75565                     (properties || (properties = [])).push(factory.createPropertyAssignment("returnType", factory.createArrowFunction(undefined, undefined, [], undefined, factory.createToken(38), serializeReturnTypeOfNode(node))));
75566                 }
75567                 if (properties) {
75568                     decoratorExpressions.push(emitHelpers().createMetadataHelper("design:typeinfo", factory.createObjectLiteralExpression(properties, true)));
75569                 }
75570             }
75571         }
75572         function shouldAddTypeMetadata(node) {
75573             var kind = node.kind;
75574             return kind === 168
75575                 || kind === 171
75576                 || kind === 172
75577                 || kind === 166;
75578         }
75579         function shouldAddReturnTypeMetadata(node) {
75580             return node.kind === 168;
75581         }
75582         function shouldAddParamTypesMetadata(node) {
75583             switch (node.kind) {
75584                 case 256:
75585                 case 225:
75586                     return ts.getFirstConstructorWithBody(node) !== undefined;
75587                 case 168:
75588                 case 171:
75589                 case 172:
75590                     return true;
75591             }
75592             return false;
75593         }
75594         function getAccessorTypeNode(node) {
75595             var accessors = resolver.getAllAccessorDeclarations(node);
75596             return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor)
75597                 || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor);
75598         }
75599         function serializeTypeOfNode(node) {
75600             switch (node.kind) {
75601                 case 166:
75602                 case 163:
75603                     return serializeTypeNode(node.type);
75604                 case 172:
75605                 case 171:
75606                     return serializeTypeNode(getAccessorTypeNode(node));
75607                 case 256:
75608                 case 225:
75609                 case 168:
75610                     return factory.createIdentifier("Function");
75611                 default:
75612                     return factory.createVoidZero();
75613             }
75614         }
75615         function serializeParameterTypesOfNode(node, container) {
75616             var valueDeclaration = ts.isClassLike(node)
75617                 ? ts.getFirstConstructorWithBody(node)
75618                 : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)
75619                     ? node
75620                     : undefined;
75621             var expressions = [];
75622             if (valueDeclaration) {
75623                 var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container);
75624                 var numParameters = parameters.length;
75625                 for (var i = 0; i < numParameters; i++) {
75626                     var parameter = parameters[i];
75627                     if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.escapedText === "this") {
75628                         continue;
75629                     }
75630                     if (parameter.dotDotDotToken) {
75631                         expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type)));
75632                     }
75633                     else {
75634                         expressions.push(serializeTypeOfNode(parameter));
75635                     }
75636                 }
75637             }
75638             return factory.createArrayLiteralExpression(expressions);
75639         }
75640         function getParametersOfDecoratedDeclaration(node, container) {
75641             if (container && node.kind === 171) {
75642                 var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
75643                 if (setAccessor) {
75644                     return setAccessor.parameters;
75645                 }
75646             }
75647             return node.parameters;
75648         }
75649         function serializeReturnTypeOfNode(node) {
75650             if (ts.isFunctionLike(node) && node.type) {
75651                 return serializeTypeNode(node.type);
75652             }
75653             else if (ts.isAsyncFunction(node)) {
75654                 return factory.createIdentifier("Promise");
75655             }
75656             return factory.createVoidZero();
75657         }
75658         function serializeTypeNode(node) {
75659             if (node === undefined) {
75660                 return factory.createIdentifier("Object");
75661             }
75662             switch (node.kind) {
75663                 case 114:
75664                 case 152:
75665                 case 143:
75666                     return factory.createVoidZero();
75667                 case 190:
75668                     return serializeTypeNode(node.type);
75669                 case 178:
75670                 case 179:
75671                     return factory.createIdentifier("Function");
75672                 case 182:
75673                 case 183:
75674                     return factory.createIdentifier("Array");
75675                 case 176:
75676                 case 133:
75677                     return factory.createIdentifier("Boolean");
75678                 case 149:
75679                     return factory.createIdentifier("String");
75680                 case 147:
75681                     return factory.createIdentifier("Object");
75682                 case 195:
75683                     switch (node.literal.kind) {
75684                         case 10:
75685                         case 14:
75686                             return factory.createIdentifier("String");
75687                         case 218:
75688                         case 8:
75689                             return factory.createIdentifier("Number");
75690                         case 9:
75691                             return getGlobalBigIntNameWithFallback();
75692                         case 110:
75693                         case 95:
75694                             return factory.createIdentifier("Boolean");
75695                         case 104:
75696                             return factory.createVoidZero();
75697                         default:
75698                             return ts.Debug.failBadSyntaxKind(node.literal);
75699                     }
75700                 case 146:
75701                     return factory.createIdentifier("Number");
75702                 case 157:
75703                     return getGlobalBigIntNameWithFallback();
75704                 case 150:
75705                     return languageVersion < 2
75706                         ? getGlobalSymbolNameWithFallback()
75707                         : factory.createIdentifier("Symbol");
75708                 case 177:
75709                     return serializeTypeReferenceNode(node);
75710                 case 187:
75711                 case 186:
75712                     return serializeTypeList(node.types);
75713                 case 188:
75714                     return serializeTypeList([node.trueType, node.falseType]);
75715                 case 192:
75716                     if (node.operator === 144) {
75717                         return serializeTypeNode(node.type);
75718                     }
75719                     break;
75720                 case 180:
75721                 case 193:
75722                 case 194:
75723                 case 181:
75724                 case 130:
75725                 case 154:
75726                 case 191:
75727                 case 199:
75728                     break;
75729                 case 310:
75730                 case 311:
75731                 case 315:
75732                 case 316:
75733                 case 317:
75734                     break;
75735                 case 312:
75736                 case 313:
75737                 case 314:
75738                     return serializeTypeNode(node.type);
75739                 default:
75740                     return ts.Debug.failBadSyntaxKind(node);
75741             }
75742             return factory.createIdentifier("Object");
75743         }
75744         function serializeTypeList(types) {
75745             var serializedUnion;
75746             for (var _i = 0, types_23 = types; _i < types_23.length; _i++) {
75747                 var typeNode = types_23[_i];
75748                 while (typeNode.kind === 190) {
75749                     typeNode = typeNode.type;
75750                 }
75751                 if (typeNode.kind === 143) {
75752                     continue;
75753                 }
75754                 if (!strictNullChecks && (typeNode.kind === 195 && typeNode.literal.kind === 104 || typeNode.kind === 152)) {
75755                     continue;
75756                 }
75757                 var serializedIndividual = serializeTypeNode(typeNode);
75758                 if (ts.isIdentifier(serializedIndividual) && serializedIndividual.escapedText === "Object") {
75759                     return serializedIndividual;
75760                 }
75761                 else if (serializedUnion) {
75762                     if (!ts.isIdentifier(serializedUnion) ||
75763                         !ts.isIdentifier(serializedIndividual) ||
75764                         serializedUnion.escapedText !== serializedIndividual.escapedText) {
75765                         return factory.createIdentifier("Object");
75766                     }
75767                 }
75768                 else {
75769                     serializedUnion = serializedIndividual;
75770                 }
75771             }
75772             return serializedUnion || factory.createVoidZero();
75773         }
75774         function serializeTypeReferenceNode(node) {
75775             var kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentNameScope || currentLexicalScope);
75776             switch (kind) {
75777                 case ts.TypeReferenceSerializationKind.Unknown:
75778                     if (ts.findAncestor(node, function (n) { return n.parent && ts.isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n); })) {
75779                         return factory.createIdentifier("Object");
75780                     }
75781                     var serialized = serializeEntityNameAsExpressionFallback(node.typeName);
75782                     var temp = factory.createTempVariable(hoistVariableDeclaration);
75783                     return factory.createConditionalExpression(factory.createTypeCheck(factory.createAssignment(temp, serialized), "function"), undefined, temp, undefined, factory.createIdentifier("Object"));
75784                 case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:
75785                     return serializeEntityNameAsExpression(node.typeName);
75786                 case ts.TypeReferenceSerializationKind.VoidNullableOrNeverType:
75787                     return factory.createVoidZero();
75788                 case ts.TypeReferenceSerializationKind.BigIntLikeType:
75789                     return getGlobalBigIntNameWithFallback();
75790                 case ts.TypeReferenceSerializationKind.BooleanType:
75791                     return factory.createIdentifier("Boolean");
75792                 case ts.TypeReferenceSerializationKind.NumberLikeType:
75793                     return factory.createIdentifier("Number");
75794                 case ts.TypeReferenceSerializationKind.StringLikeType:
75795                     return factory.createIdentifier("String");
75796                 case ts.TypeReferenceSerializationKind.ArrayLikeType:
75797                     return factory.createIdentifier("Array");
75798                 case ts.TypeReferenceSerializationKind.ESSymbolType:
75799                     return languageVersion < 2
75800                         ? getGlobalSymbolNameWithFallback()
75801                         : factory.createIdentifier("Symbol");
75802                 case ts.TypeReferenceSerializationKind.TypeWithCallSignature:
75803                     return factory.createIdentifier("Function");
75804                 case ts.TypeReferenceSerializationKind.Promise:
75805                     return factory.createIdentifier("Promise");
75806                 case ts.TypeReferenceSerializationKind.ObjectType:
75807                     return factory.createIdentifier("Object");
75808                 default:
75809                     return ts.Debug.assertNever(kind);
75810             }
75811         }
75812         function createCheckedValue(left, right) {
75813             return factory.createLogicalAnd(factory.createStrictInequality(factory.createTypeOfExpression(left), factory.createStringLiteral("undefined")), right);
75814         }
75815         function serializeEntityNameAsExpressionFallback(node) {
75816             if (node.kind === 79) {
75817                 var copied = serializeEntityNameAsExpression(node);
75818                 return createCheckedValue(copied, copied);
75819             }
75820             if (node.left.kind === 79) {
75821                 return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
75822             }
75823             var left = serializeEntityNameAsExpressionFallback(node.left);
75824             var temp = factory.createTempVariable(hoistVariableDeclaration);
75825             return factory.createLogicalAnd(factory.createLogicalAnd(left.left, factory.createStrictInequality(factory.createAssignment(temp, left.right), factory.createVoidZero())), factory.createPropertyAccessExpression(temp, node.right));
75826         }
75827         function serializeEntityNameAsExpression(node) {
75828             switch (node.kind) {
75829                 case 79:
75830                     var name = ts.setParent(ts.setTextRange(ts.parseNodeFactory.cloneNode(node), node), node.parent);
75831                     name.original = undefined;
75832                     ts.setParent(name, ts.getParseTreeNode(currentLexicalScope));
75833                     return name;
75834                 case 160:
75835                     return serializeQualifiedNameAsExpression(node);
75836             }
75837         }
75838         function serializeQualifiedNameAsExpression(node) {
75839             return factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right);
75840         }
75841         function getGlobalSymbolNameWithFallback() {
75842             return factory.createConditionalExpression(factory.createTypeCheck(factory.createIdentifier("Symbol"), "function"), undefined, factory.createIdentifier("Symbol"), undefined, factory.createIdentifier("Object"));
75843         }
75844         function getGlobalBigIntNameWithFallback() {
75845             return languageVersion < 99
75846                 ? factory.createConditionalExpression(factory.createTypeCheck(factory.createIdentifier("BigInt"), "function"), undefined, factory.createIdentifier("BigInt"), undefined, factory.createIdentifier("Object"))
75847                 : factory.createIdentifier("BigInt");
75848         }
75849         function getExpressionForPropertyName(member, generateNameForComputedPropertyName) {
75850             var name = member.name;
75851             if (ts.isPrivateIdentifier(name)) {
75852                 return factory.createIdentifier("");
75853             }
75854             else if (ts.isComputedPropertyName(name)) {
75855                 return generateNameForComputedPropertyName && !ts.isSimpleInlineableExpression(name.expression)
75856                     ? factory.getGeneratedNameForNode(name)
75857                     : name.expression;
75858             }
75859             else if (ts.isIdentifier(name)) {
75860                 return factory.createStringLiteral(ts.idText(name));
75861             }
75862             else {
75863                 return factory.cloneNode(name);
75864             }
75865         }
75866         function visitPropertyNameOfClassElement(member) {
75867             var name = member.name;
75868             if (ts.isComputedPropertyName(name) && ((!ts.hasStaticModifier(member) && currentClassHasParameterProperties) || ts.some(member.decorators))) {
75869                 var expression = ts.visitNode(name.expression, visitor, ts.isExpression);
75870                 var innerExpression = ts.skipPartiallyEmittedExpressions(expression);
75871                 if (!ts.isSimpleInlineableExpression(innerExpression)) {
75872                     var generatedName = factory.getGeneratedNameForNode(name);
75873                     hoistVariableDeclaration(generatedName);
75874                     return factory.updateComputedPropertyName(name, factory.createAssignment(generatedName, expression));
75875                 }
75876             }
75877             return ts.visitNode(name, visitor, ts.isPropertyName);
75878         }
75879         function visitHeritageClause(node) {
75880             if (node.token === 117) {
75881                 return undefined;
75882             }
75883             return ts.visitEachChild(node, visitor, context);
75884         }
75885         function visitExpressionWithTypeArguments(node) {
75886             return factory.updateExpressionWithTypeArguments(node, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression), undefined);
75887         }
75888         function shouldEmitFunctionLikeDeclaration(node) {
75889             return !ts.nodeIsMissing(node.body);
75890         }
75891         function visitPropertyDeclaration(node) {
75892             if (node.flags & 8388608 || ts.hasSyntacticModifier(node, 128)) {
75893                 return undefined;
75894             }
75895             var updated = factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitNode(node.initializer, visitor));
75896             if (updated !== node) {
75897                 ts.setCommentRange(updated, node);
75898                 ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
75899             }
75900             return updated;
75901         }
75902         function visitConstructor(node) {
75903             if (!shouldEmitFunctionLikeDeclaration(node)) {
75904                 return undefined;
75905             }
75906             return factory.updateConstructorDeclaration(node, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), transformConstructorBody(node.body, node));
75907         }
75908         function transformConstructorBody(body, constructor) {
75909             var parametersWithPropertyAssignments = constructor &&
75910                 ts.filter(constructor.parameters, function (p) { return ts.isParameterPropertyDeclaration(p, constructor); });
75911             if (!ts.some(parametersWithPropertyAssignments)) {
75912                 return ts.visitFunctionBody(body, visitor, context);
75913             }
75914             var statements = [];
75915             var indexOfFirstStatement = 0;
75916             resumeLexicalEnvironment();
75917             indexOfFirstStatement = ts.addPrologueDirectivesAndInitialSuperCall(factory, constructor, statements, visitor);
75918             ts.addRange(statements, ts.map(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment));
75919             ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexOfFirstStatement));
75920             statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
75921             var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
75922             ts.setTextRange(block, body);
75923             ts.setOriginalNode(block, body);
75924             return block;
75925         }
75926         function transformParameterWithPropertyAssignment(node) {
75927             var name = node.name;
75928             if (!ts.isIdentifier(name)) {
75929                 return undefined;
75930             }
75931             var propertyName = ts.setParent(ts.setTextRange(factory.cloneNode(name), name), name.parent);
75932             ts.setEmitFlags(propertyName, 1536 | 48);
75933             var localName = ts.setParent(ts.setTextRange(factory.cloneNode(name), name), name.parent);
75934             ts.setEmitFlags(localName, 1536);
75935             return ts.startOnNewLine(ts.removeAllComments(ts.setTextRange(ts.setOriginalNode(factory.createExpressionStatement(factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createThis(), propertyName), node.name), localName)), node), ts.moveRangePos(node, -1))));
75936         }
75937         function visitMethodDeclaration(node) {
75938             if (!shouldEmitFunctionLikeDeclaration(node)) {
75939                 return undefined;
75940             }
75941             var updated = factory.updateMethodDeclaration(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));
75942             if (updated !== node) {
75943                 ts.setCommentRange(updated, node);
75944                 ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
75945             }
75946             return updated;
75947         }
75948         function shouldEmitAccessorDeclaration(node) {
75949             return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128));
75950         }
75951         function visitGetAccessor(node) {
75952             if (!shouldEmitAccessorDeclaration(node)) {
75953                 return undefined;
75954             }
75955             var updated = factory.updateGetAccessorDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || factory.createBlock([]));
75956             if (updated !== node) {
75957                 ts.setCommentRange(updated, node);
75958                 ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
75959             }
75960             return updated;
75961         }
75962         function visitSetAccessor(node) {
75963             if (!shouldEmitAccessorDeclaration(node)) {
75964                 return undefined;
75965             }
75966             var updated = factory.updateSetAccessorDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context) || factory.createBlock([]));
75967             if (updated !== node) {
75968                 ts.setCommentRange(updated, node);
75969                 ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node));
75970             }
75971             return updated;
75972         }
75973         function visitFunctionDeclaration(node) {
75974             if (!shouldEmitFunctionLikeDeclaration(node)) {
75975                 return factory.createNotEmittedStatement(node);
75976             }
75977             var updated = factory.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) || factory.createBlock([]));
75978             if (isExportOfNamespace(node)) {
75979                 var statements = [updated];
75980                 addExportMemberAssignment(statements, node);
75981                 return statements;
75982             }
75983             return updated;
75984         }
75985         function visitFunctionExpression(node) {
75986             if (!shouldEmitFunctionLikeDeclaration(node)) {
75987                 return factory.createOmittedExpression();
75988             }
75989             var updated = factory.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) || factory.createBlock([]));
75990             return updated;
75991         }
75992         function visitArrowFunction(node) {
75993             var updated = factory.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, ts.visitFunctionBody(node.body, visitor, context));
75994             return updated;
75995         }
75996         function visitParameter(node) {
75997             if (ts.parameterIsThisKeyword(node)) {
75998                 return undefined;
75999             }
76000             var updated = factory.updateParameterDeclaration(node, undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
76001             if (updated !== node) {
76002                 ts.setCommentRange(updated, node);
76003                 ts.setTextRange(updated, ts.moveRangePastModifiers(node));
76004                 ts.setSourceMapRange(updated, ts.moveRangePastModifiers(node));
76005                 ts.setEmitFlags(updated.name, 32);
76006             }
76007             return updated;
76008         }
76009         function visitVariableStatement(node) {
76010             if (isExportOfNamespace(node)) {
76011                 var variables = ts.getInitializedVariables(node.declarationList);
76012                 if (variables.length === 0) {
76013                     return undefined;
76014                 }
76015                 return ts.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(ts.map(variables, transformInitializedVariable))), node);
76016             }
76017             else {
76018                 return ts.visitEachChild(node, visitor, context);
76019             }
76020         }
76021         function transformInitializedVariable(node) {
76022             var name = node.name;
76023             if (ts.isBindingPattern(name)) {
76024                 return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression);
76025             }
76026             else {
76027                 return ts.setTextRange(factory.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node);
76028             }
76029         }
76030         function visitVariableDeclaration(node) {
76031             return factory.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
76032         }
76033         function visitParenthesizedExpression(node) {
76034             var innerExpression = ts.skipOuterExpressions(node.expression, ~6);
76035             if (ts.isAssertionExpression(innerExpression)) {
76036                 var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
76037                 if (ts.length(ts.getLeadingCommentRangesOfNode(expression, currentSourceFile))) {
76038                     return factory.updateParenthesizedExpression(node, expression);
76039                 }
76040                 return factory.createPartiallyEmittedExpression(expression, node);
76041             }
76042             return ts.visitEachChild(node, visitor, context);
76043         }
76044         function visitAssertionExpression(node) {
76045             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
76046             return factory.createPartiallyEmittedExpression(expression, node);
76047         }
76048         function visitNonNullExpression(node) {
76049             var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression);
76050             return factory.createPartiallyEmittedExpression(expression, node);
76051         }
76052         function visitCallExpression(node) {
76053             return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
76054         }
76055         function visitNewExpression(node) {
76056             return factory.updateNewExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
76057         }
76058         function visitTaggedTemplateExpression(node) {
76059             return factory.updateTaggedTemplateExpression(node, ts.visitNode(node.tag, visitor, ts.isExpression), undefined, ts.visitNode(node.template, visitor, ts.isExpression));
76060         }
76061         function visitJsxSelfClosingElement(node) {
76062             return factory.updateJsxSelfClosingElement(node, ts.visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), undefined, ts.visitNode(node.attributes, visitor, ts.isJsxAttributes));
76063         }
76064         function visitJsxJsxOpeningElement(node) {
76065             return factory.updateJsxOpeningElement(node, ts.visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), undefined, ts.visitNode(node.attributes, visitor, ts.isJsxAttributes));
76066         }
76067         function shouldEmitEnumDeclaration(node) {
76068             return !ts.isEnumConst(node)
76069                 || ts.shouldPreserveConstEnums(compilerOptions);
76070         }
76071         function visitEnumDeclaration(node) {
76072             if (!shouldEmitEnumDeclaration(node)) {
76073                 return factory.createNotEmittedStatement(node);
76074             }
76075             var statements = [];
76076             var emitFlags = 2;
76077             var varAdded = addVarForEnumOrModuleDeclaration(statements, node);
76078             if (varAdded) {
76079                 if (moduleKind !== ts.ModuleKind.System || currentLexicalScope !== currentSourceFile) {
76080                     emitFlags |= 512;
76081                 }
76082             }
76083             var parameterName = getNamespaceParameterName(node);
76084             var containerName = getNamespaceContainerName(node);
76085             var exportName = ts.hasSyntacticModifier(node, 1)
76086                 ? factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)
76087                 : factory.getLocalName(node, false, true);
76088             var moduleArg = factory.createLogicalOr(exportName, factory.createAssignment(exportName, factory.createObjectLiteralExpression()));
76089             if (hasNamespaceQualifiedExportName(node)) {
76090                 var localName = factory.getLocalName(node, false, true);
76091                 moduleArg = factory.createAssignment(localName, moduleArg);
76092             }
76093             var enumStatement = factory.createExpressionStatement(factory.createCallExpression(factory.createFunctionExpression(undefined, undefined, undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]));
76094             ts.setOriginalNode(enumStatement, node);
76095             if (varAdded) {
76096                 ts.setSyntheticLeadingComments(enumStatement, undefined);
76097                 ts.setSyntheticTrailingComments(enumStatement, undefined);
76098             }
76099             ts.setTextRange(enumStatement, node);
76100             ts.addEmitFlags(enumStatement, emitFlags);
76101             statements.push(enumStatement);
76102             statements.push(factory.createEndOfDeclarationMarker(node));
76103             return statements;
76104         }
76105         function transformEnumBody(node, localName) {
76106             var savedCurrentNamespaceLocalName = currentNamespaceContainerName;
76107             currentNamespaceContainerName = localName;
76108             var statements = [];
76109             startLexicalEnvironment();
76110             var members = ts.map(node.members, transformEnumMember);
76111             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
76112             ts.addRange(statements, members);
76113             currentNamespaceContainerName = savedCurrentNamespaceLocalName;
76114             return factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), node.members), true);
76115         }
76116         function transformEnumMember(member) {
76117             var name = getExpressionForPropertyName(member, false);
76118             var valueExpression = transformEnumMemberDeclarationValue(member);
76119             var innerAssignment = factory.createAssignment(factory.createElementAccessExpression(currentNamespaceContainerName, name), valueExpression);
76120             var outerAssignment = valueExpression.kind === 10 ?
76121                 innerAssignment :
76122                 factory.createAssignment(factory.createElementAccessExpression(currentNamespaceContainerName, innerAssignment), name);
76123             return ts.setTextRange(factory.createExpressionStatement(ts.setTextRange(outerAssignment, member)), member);
76124         }
76125         function transformEnumMemberDeclarationValue(member) {
76126             var value = resolver.getConstantValue(member);
76127             if (value !== undefined) {
76128                 return typeof value === "string" ? factory.createStringLiteral(value) : factory.createNumericLiteral(value);
76129             }
76130             else {
76131                 enableSubstitutionForNonQualifiedEnumMembers();
76132                 if (member.initializer) {
76133                     return ts.visitNode(member.initializer, visitor, ts.isExpression);
76134                 }
76135                 else {
76136                     return factory.createVoidZero();
76137                 }
76138             }
76139         }
76140         function shouldEmitModuleDeclaration(nodeIn) {
76141             var node = ts.getParseTreeNode(nodeIn, ts.isModuleDeclaration);
76142             if (!node) {
76143                 return true;
76144             }
76145             return ts.isInstantiatedModule(node, ts.shouldPreserveConstEnums(compilerOptions));
76146         }
76147         function hasNamespaceQualifiedExportName(node) {
76148             return isExportOfNamespace(node)
76149                 || (isExternalModuleExport(node)
76150                     && moduleKind !== ts.ModuleKind.ES2015
76151                     && moduleKind !== ts.ModuleKind.ES2020
76152                     && moduleKind !== ts.ModuleKind.ES2022
76153                     && moduleKind !== ts.ModuleKind.ESNext
76154                     && moduleKind !== ts.ModuleKind.System);
76155         }
76156         function recordEmittedDeclarationInScope(node) {
76157             if (!currentScopeFirstDeclarationsOfName) {
76158                 currentScopeFirstDeclarationsOfName = new ts.Map();
76159             }
76160             var name = declaredNameInScope(node);
76161             if (!currentScopeFirstDeclarationsOfName.has(name)) {
76162                 currentScopeFirstDeclarationsOfName.set(name, node);
76163             }
76164         }
76165         function isFirstEmittedDeclarationInScope(node) {
76166             if (currentScopeFirstDeclarationsOfName) {
76167                 var name = declaredNameInScope(node);
76168                 return currentScopeFirstDeclarationsOfName.get(name) === node;
76169             }
76170             return true;
76171         }
76172         function declaredNameInScope(node) {
76173             ts.Debug.assertNode(node.name, ts.isIdentifier);
76174             return node.name.escapedText;
76175         }
76176         function addVarForEnumOrModuleDeclaration(statements, node) {
76177             var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([
76178                 factory.createVariableDeclaration(factory.getLocalName(node, false, true))
76179             ], currentLexicalScope.kind === 303 ? 0 : 1));
76180             ts.setOriginalNode(statement, node);
76181             recordEmittedDeclarationInScope(node);
76182             if (isFirstEmittedDeclarationInScope(node)) {
76183                 if (node.kind === 259) {
76184                     ts.setSourceMapRange(statement.declarationList, node);
76185                 }
76186                 else {
76187                     ts.setSourceMapRange(statement, node);
76188                 }
76189                 ts.setCommentRange(statement, node);
76190                 ts.addEmitFlags(statement, 1024 | 4194304);
76191                 statements.push(statement);
76192                 return true;
76193             }
76194             else {
76195                 var mergeMarker = factory.createMergeDeclarationMarker(statement);
76196                 ts.setEmitFlags(mergeMarker, 1536 | 4194304);
76197                 statements.push(mergeMarker);
76198                 return false;
76199             }
76200         }
76201         function visitModuleDeclaration(node) {
76202             if (!shouldEmitModuleDeclaration(node)) {
76203                 return factory.createNotEmittedStatement(node);
76204             }
76205             ts.Debug.assertNode(node.name, ts.isIdentifier, "A TypeScript namespace should have an Identifier name.");
76206             enableSubstitutionForNamespaceExports();
76207             var statements = [];
76208             var emitFlags = 2;
76209             var varAdded = addVarForEnumOrModuleDeclaration(statements, node);
76210             if (varAdded) {
76211                 if (moduleKind !== ts.ModuleKind.System || currentLexicalScope !== currentSourceFile) {
76212                     emitFlags |= 512;
76213                 }
76214             }
76215             var parameterName = getNamespaceParameterName(node);
76216             var containerName = getNamespaceContainerName(node);
76217             var exportName = ts.hasSyntacticModifier(node, 1)
76218                 ? factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true)
76219                 : factory.getLocalName(node, false, true);
76220             var moduleArg = factory.createLogicalOr(exportName, factory.createAssignment(exportName, factory.createObjectLiteralExpression()));
76221             if (hasNamespaceQualifiedExportName(node)) {
76222                 var localName = factory.getLocalName(node, false, true);
76223                 moduleArg = factory.createAssignment(localName, moduleArg);
76224             }
76225             var moduleStatement = factory.createExpressionStatement(factory.createCallExpression(factory.createFunctionExpression(undefined, undefined, undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]));
76226             ts.setOriginalNode(moduleStatement, node);
76227             if (varAdded) {
76228                 ts.setSyntheticLeadingComments(moduleStatement, undefined);
76229                 ts.setSyntheticTrailingComments(moduleStatement, undefined);
76230             }
76231             ts.setTextRange(moduleStatement, node);
76232             ts.addEmitFlags(moduleStatement, emitFlags);
76233             statements.push(moduleStatement);
76234             statements.push(factory.createEndOfDeclarationMarker(node));
76235             return statements;
76236         }
76237         function transformModuleBody(node, namespaceLocalName) {
76238             var savedCurrentNamespaceContainerName = currentNamespaceContainerName;
76239             var savedCurrentNamespace = currentNamespace;
76240             var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
76241             currentNamespaceContainerName = namespaceLocalName;
76242             currentNamespace = node;
76243             currentScopeFirstDeclarationsOfName = undefined;
76244             var statements = [];
76245             startLexicalEnvironment();
76246             var statementsLocation;
76247             var blockLocation;
76248             if (node.body) {
76249                 if (node.body.kind === 261) {
76250                     saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
76251                     statementsLocation = node.body.statements;
76252                     blockLocation = node.body;
76253                 }
76254                 else {
76255                     var result = visitModuleDeclaration(node.body);
76256                     if (result) {
76257                         if (ts.isArray(result)) {
76258                             ts.addRange(statements, result);
76259                         }
76260                         else {
76261                             statements.push(result);
76262                         }
76263                     }
76264                     var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body;
76265                     statementsLocation = ts.moveRangePos(moduleBlock.statements, -1);
76266                 }
76267             }
76268             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
76269             currentNamespaceContainerName = savedCurrentNamespaceContainerName;
76270             currentNamespace = savedCurrentNamespace;
76271             currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
76272             var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true);
76273             ts.setTextRange(block, blockLocation);
76274             if (!node.body || node.body.kind !== 261) {
76275                 ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);
76276             }
76277             return block;
76278         }
76279         function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
76280             if (moduleDeclaration.body.kind === 260) {
76281                 var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
76282                 return recursiveInnerModule || moduleDeclaration.body;
76283             }
76284         }
76285         function visitImportDeclaration(node) {
76286             if (!node.importClause) {
76287                 return node;
76288             }
76289             if (node.importClause.isTypeOnly) {
76290                 return undefined;
76291             }
76292             var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause);
76293             return importClause ||
76294                 compilerOptions.importsNotUsedAsValues === 1 ||
76295                 compilerOptions.importsNotUsedAsValues === 2
76296                 ? factory.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier, node.assertClause)
76297                 : undefined;
76298         }
76299         function visitImportClause(node) {
76300             ts.Debug.assert(!node.isTypeOnly);
76301             var name = shouldEmitAliasDeclaration(node) ? node.name : undefined;
76302             var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings);
76303             return (name || namedBindings) ? factory.updateImportClause(node, false, name, namedBindings) : undefined;
76304         }
76305         function visitNamedImportBindings(node) {
76306             if (node.kind === 267) {
76307                 return shouldEmitAliasDeclaration(node) ? node : undefined;
76308             }
76309             else {
76310                 var allowEmpty = compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === 1 ||
76311                     compilerOptions.importsNotUsedAsValues === 2);
76312                 var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);
76313                 return allowEmpty || ts.some(elements) ? factory.updateNamedImports(node, elements) : undefined;
76314             }
76315         }
76316         function visitImportSpecifier(node) {
76317             return !node.isTypeOnly && shouldEmitAliasDeclaration(node) ? node : undefined;
76318         }
76319         function visitExportAssignment(node) {
76320             return resolver.isValueAliasDeclaration(node)
76321                 ? ts.visitEachChild(node, visitor, context)
76322                 : undefined;
76323         }
76324         function visitExportDeclaration(node) {
76325             if (node.isTypeOnly) {
76326                 return undefined;
76327             }
76328             if (!node.exportClause || ts.isNamespaceExport(node.exportClause)) {
76329                 return node;
76330             }
76331             var allowEmpty = !!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === 1 ||
76332                 compilerOptions.importsNotUsedAsValues === 2);
76333             var exportClause = ts.visitNode(node.exportClause, function (bindings) { return visitNamedExportBindings(bindings, allowEmpty); }, ts.isNamedExportBindings);
76334             return exportClause
76335                 ? factory.updateExportDeclaration(node, undefined, undefined, node.isTypeOnly, exportClause, node.moduleSpecifier, node.assertClause)
76336                 : undefined;
76337         }
76338         function visitNamedExports(node, allowEmpty) {
76339             var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);
76340             return allowEmpty || ts.some(elements) ? factory.updateNamedExports(node, elements) : undefined;
76341         }
76342         function visitNamespaceExports(node) {
76343             return factory.updateNamespaceExport(node, ts.visitNode(node.name, visitor, ts.isIdentifier));
76344         }
76345         function visitNamedExportBindings(node, allowEmpty) {
76346             return ts.isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty);
76347         }
76348         function visitExportSpecifier(node) {
76349             return !node.isTypeOnly && resolver.isValueAliasDeclaration(node) ? node : undefined;
76350         }
76351         function shouldEmitImportEqualsDeclaration(node) {
76352             return shouldEmitAliasDeclaration(node)
76353                 || (!ts.isExternalModule(currentSourceFile)
76354                     && resolver.isTopLevelValueImportEqualsWithEntityName(node));
76355         }
76356         function visitImportEqualsDeclaration(node) {
76357             if (node.isTypeOnly) {
76358                 return undefined;
76359             }
76360             if (ts.isExternalModuleImportEqualsDeclaration(node)) {
76361                 var isReferenced = shouldEmitAliasDeclaration(node);
76362                 if (!isReferenced && compilerOptions.importsNotUsedAsValues === 1) {
76363                     return ts.setOriginalNode(ts.setTextRange(factory.createImportDeclaration(undefined, undefined, undefined, node.moduleReference.expression, undefined), node), node);
76364                 }
76365                 return isReferenced ? ts.visitEachChild(node, visitor, context) : undefined;
76366             }
76367             if (!shouldEmitImportEqualsDeclaration(node)) {
76368                 return undefined;
76369             }
76370             var moduleReference = ts.createExpressionFromEntityName(factory, node.moduleReference);
76371             ts.setEmitFlags(moduleReference, 1536 | 2048);
76372             if (isNamedExternalModuleExport(node) || !isExportOfNamespace(node)) {
76373                 return ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([
76374                     ts.setOriginalNode(factory.createVariableDeclaration(node.name, undefined, undefined, moduleReference), node)
76375                 ])), node), node);
76376             }
76377             else {
76378                 return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node);
76379             }
76380         }
76381         function isExportOfNamespace(node) {
76382             return currentNamespace !== undefined && ts.hasSyntacticModifier(node, 1);
76383         }
76384         function isExternalModuleExport(node) {
76385             return currentNamespace === undefined && ts.hasSyntacticModifier(node, 1);
76386         }
76387         function isNamedExternalModuleExport(node) {
76388             return isExternalModuleExport(node)
76389                 && !ts.hasSyntacticModifier(node, 512);
76390         }
76391         function isDefaultExternalModuleExport(node) {
76392             return isExternalModuleExport(node)
76393                 && ts.hasSyntacticModifier(node, 512);
76394         }
76395         function expressionToStatement(expression) {
76396             return factory.createExpressionStatement(expression);
76397         }
76398         function addExportMemberAssignment(statements, node) {
76399             var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), factory.getLocalName(node));
76400             ts.setSourceMapRange(expression, ts.createRange(node.name ? node.name.pos : node.pos, node.end));
76401             var statement = factory.createExpressionStatement(expression);
76402             ts.setSourceMapRange(statement, ts.createRange(-1, node.end));
76403             statements.push(statement);
76404         }
76405         function createNamespaceExport(exportName, exportValue, location) {
76406             return ts.setTextRange(factory.createExpressionStatement(factory.createAssignment(factory.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue)), location);
76407         }
76408         function createNamespaceExportExpression(exportName, exportValue, location) {
76409             return ts.setTextRange(factory.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location);
76410         }
76411         function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) {
76412             return factory.getNamespaceMemberName(currentNamespaceContainerName, name, false, true);
76413         }
76414         function getNamespaceParameterName(node) {
76415             var name = factory.getGeneratedNameForNode(node);
76416             ts.setSourceMapRange(name, node.name);
76417             return name;
76418         }
76419         function getNamespaceContainerName(node) {
76420             return factory.getGeneratedNameForNode(node);
76421         }
76422         function getClassAliasIfNeeded(node) {
76423             if (resolver.getNodeCheckFlags(node) & 16777216) {
76424                 enableSubstitutionForClassAliases();
76425                 var classAlias = factory.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.idText(node.name) : "default");
76426                 classAliases[ts.getOriginalNodeId(node)] = classAlias;
76427                 hoistVariableDeclaration(classAlias);
76428                 return classAlias;
76429             }
76430         }
76431         function getClassPrototype(node) {
76432             return factory.createPropertyAccessExpression(factory.getDeclarationName(node), "prototype");
76433         }
76434         function getClassMemberPrefix(node, member) {
76435             return ts.isStatic(member)
76436                 ? factory.getDeclarationName(node)
76437                 : getClassPrototype(node);
76438         }
76439         function enableSubstitutionForNonQualifiedEnumMembers() {
76440             if ((enabledSubstitutions & 8) === 0) {
76441                 enabledSubstitutions |= 8;
76442                 context.enableSubstitution(79);
76443             }
76444         }
76445         function enableSubstitutionForClassAliases() {
76446             if ((enabledSubstitutions & 1) === 0) {
76447                 enabledSubstitutions |= 1;
76448                 context.enableSubstitution(79);
76449                 classAliases = [];
76450             }
76451         }
76452         function enableSubstitutionForNamespaceExports() {
76453             if ((enabledSubstitutions & 2) === 0) {
76454                 enabledSubstitutions |= 2;
76455                 context.enableSubstitution(79);
76456                 context.enableSubstitution(295);
76457                 context.enableEmitNotification(260);
76458             }
76459         }
76460         function isTransformedModuleDeclaration(node) {
76461             return ts.getOriginalNode(node).kind === 260;
76462         }
76463         function isTransformedEnumDeclaration(node) {
76464             return ts.getOriginalNode(node).kind === 259;
76465         }
76466         function onEmitNode(hint, node, emitCallback) {
76467             var savedApplicableSubstitutions = applicableSubstitutions;
76468             var savedCurrentSourceFile = currentSourceFile;
76469             if (ts.isSourceFile(node)) {
76470                 currentSourceFile = node;
76471             }
76472             if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) {
76473                 applicableSubstitutions |= 2;
76474             }
76475             if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) {
76476                 applicableSubstitutions |= 8;
76477             }
76478             previousOnEmitNode(hint, node, emitCallback);
76479             applicableSubstitutions = savedApplicableSubstitutions;
76480             currentSourceFile = savedCurrentSourceFile;
76481         }
76482         function onSubstituteNode(hint, node) {
76483             node = previousOnSubstituteNode(hint, node);
76484             if (hint === 1) {
76485                 return substituteExpression(node);
76486             }
76487             else if (ts.isShorthandPropertyAssignment(node)) {
76488                 return substituteShorthandPropertyAssignment(node);
76489             }
76490             return node;
76491         }
76492         function substituteShorthandPropertyAssignment(node) {
76493             if (enabledSubstitutions & 2) {
76494                 var name = node.name;
76495                 var exportedName = trySubstituteNamespaceExportedName(name);
76496                 if (exportedName) {
76497                     if (node.objectAssignmentInitializer) {
76498                         var initializer = factory.createAssignment(exportedName, node.objectAssignmentInitializer);
76499                         return ts.setTextRange(factory.createPropertyAssignment(name, initializer), node);
76500                     }
76501                     return ts.setTextRange(factory.createPropertyAssignment(name, exportedName), node);
76502                 }
76503             }
76504             return node;
76505         }
76506         function substituteExpression(node) {
76507             switch (node.kind) {
76508                 case 79:
76509                     return substituteExpressionIdentifier(node);
76510                 case 205:
76511                     return substitutePropertyAccessExpression(node);
76512                 case 206:
76513                     return substituteElementAccessExpression(node);
76514             }
76515             return node;
76516         }
76517         function substituteExpressionIdentifier(node) {
76518             return trySubstituteClassAlias(node)
76519                 || trySubstituteNamespaceExportedName(node)
76520                 || node;
76521         }
76522         function trySubstituteClassAlias(node) {
76523             if (enabledSubstitutions & 1) {
76524                 if (resolver.getNodeCheckFlags(node) & 33554432) {
76525                     var declaration = resolver.getReferencedValueDeclaration(node);
76526                     if (declaration) {
76527                         var classAlias = classAliases[declaration.id];
76528                         if (classAlias) {
76529                             var clone_2 = factory.cloneNode(classAlias);
76530                             ts.setSourceMapRange(clone_2, node);
76531                             ts.setCommentRange(clone_2, node);
76532                             return clone_2;
76533                         }
76534                     }
76535                 }
76536             }
76537             return undefined;
76538         }
76539         function trySubstituteNamespaceExportedName(node) {
76540             if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
76541                 var container = resolver.getReferencedExportContainer(node, false);
76542                 if (container && container.kind !== 303) {
76543                     var substitute = (applicableSubstitutions & 2 && container.kind === 260) ||
76544                         (applicableSubstitutions & 8 && container.kind === 259);
76545                     if (substitute) {
76546                         return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), node);
76547                     }
76548                 }
76549             }
76550             return undefined;
76551         }
76552         function substitutePropertyAccessExpression(node) {
76553             return substituteConstantValue(node);
76554         }
76555         function substituteElementAccessExpression(node) {
76556             return substituteConstantValue(node);
76557         }
76558         function substituteConstantValue(node) {
76559             var constantValue = tryGetConstEnumValue(node);
76560             if (constantValue !== undefined) {
76561                 ts.setConstantValue(node, constantValue);
76562                 var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
76563                 if (!compilerOptions.removeComments) {
76564                     var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
76565                     var propertyName = ts.isPropertyAccessExpression(originalNode)
76566                         ? ts.declarationNameToString(originalNode.name)
76567                         : ts.getTextOfNode(originalNode.argumentExpression);
76568                     ts.addSyntheticTrailingComment(substitute, 3, " ".concat(propertyName, " "));
76569                 }
76570                 return substitute;
76571             }
76572             return node;
76573         }
76574         function tryGetConstEnumValue(node) {
76575             if (compilerOptions.isolatedModules) {
76576                 return undefined;
76577             }
76578             return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
76579         }
76580         function shouldEmitAliasDeclaration(node) {
76581             return compilerOptions.preserveValueImports
76582                 ? resolver.isValueAliasDeclaration(node)
76583                 : resolver.isReferencedAliasDeclaration(node);
76584         }
76585     }
76586     ts.transformTypeScript = transformTypeScript;
76587 })(ts || (ts = {}));
76588 var ts;
76589 (function (ts) {
76590     function transformClassFields(context) {
76591         var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration, endLexicalEnvironment = context.endLexicalEnvironment, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, addBlockScopedVariable = context.addBlockScopedVariable;
76592         var resolver = context.getEmitResolver();
76593         var compilerOptions = context.getCompilerOptions();
76594         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
76595         var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
76596         var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 99;
76597         var shouldTransformSuperInStaticInitializers = (languageVersion <= 8 || !useDefineForClassFields) && languageVersion >= 2;
76598         var shouldTransformThisInStaticInitializers = languageVersion <= 8 || !useDefineForClassFields;
76599         var previousOnSubstituteNode = context.onSubstituteNode;
76600         context.onSubstituteNode = onSubstituteNode;
76601         var previousOnEmitNode = context.onEmitNode;
76602         context.onEmitNode = onEmitNode;
76603         var enabledSubstitutions;
76604         var classAliases;
76605         var pendingExpressions;
76606         var pendingStatements;
76607         var classLexicalEnvironmentStack = [];
76608         var classLexicalEnvironmentMap = new ts.Map();
76609         var currentClassLexicalEnvironment;
76610         var currentComputedPropertyNameClassLexicalEnvironment;
76611         var currentStaticPropertyDeclarationOrStaticBlock;
76612         return ts.chainBundle(context, transformSourceFile);
76613         function transformSourceFile(node) {
76614             var options = context.getCompilerOptions();
76615             if (node.isDeclarationFile
76616                 || useDefineForClassFields && ts.getEmitScriptTarget(options) === 99) {
76617                 return node;
76618             }
76619             var visited = ts.visitEachChild(node, visitor, context);
76620             ts.addEmitHelpers(visited, context.readEmitHelpers());
76621             return visited;
76622         }
76623         function visitorWorker(node, valueIsDiscarded) {
76624             if (node.transformFlags & 8388608) {
76625                 switch (node.kind) {
76626                     case 225:
76627                     case 256:
76628                         return visitClassLike(node);
76629                     case 166:
76630                         return visitPropertyDeclaration(node);
76631                     case 236:
76632                         return visitVariableStatement(node);
76633                     case 80:
76634                         return visitPrivateIdentifier(node);
76635                     case 169:
76636                         return visitClassStaticBlockDeclaration(node);
76637                 }
76638             }
76639             if (node.transformFlags & 8388608 ||
76640                 node.transformFlags & 33554432 &&
76641                     shouldTransformSuperInStaticInitializers &&
76642                     currentStaticPropertyDeclarationOrStaticBlock &&
76643                     currentClassLexicalEnvironment) {
76644                 switch (node.kind) {
76645                     case 218:
76646                     case 219:
76647                         return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded);
76648                     case 220:
76649                         return visitBinaryExpression(node, valueIsDiscarded);
76650                     case 207:
76651                         return visitCallExpression(node);
76652                     case 209:
76653                         return visitTaggedTemplateExpression(node);
76654                     case 205:
76655                         return visitPropertyAccessExpression(node);
76656                     case 206:
76657                         return visitElementAccessExpression(node);
76658                     case 237:
76659                         return visitExpressionStatement(node);
76660                     case 241:
76661                         return visitForStatement(node);
76662                     case 255:
76663                     case 212:
76664                     case 170:
76665                     case 168:
76666                     case 171:
76667                     case 172: {
76668                         var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock;
76669                         currentStaticPropertyDeclarationOrStaticBlock = undefined;
76670                         var result = ts.visitEachChild(node, visitor, context);
76671                         currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock;
76672                         return result;
76673                     }
76674                 }
76675             }
76676             return ts.visitEachChild(node, visitor, context);
76677         }
76678         function discardedValueVisitor(node) {
76679             return visitorWorker(node, true);
76680         }
76681         function visitor(node) {
76682             return visitorWorker(node, false);
76683         }
76684         function heritageClauseVisitor(node) {
76685             switch (node.kind) {
76686                 case 290:
76687                     return ts.visitEachChild(node, heritageClauseVisitor, context);
76688                 case 227:
76689                     return visitExpressionWithTypeArguments(node);
76690             }
76691             return visitor(node);
76692         }
76693         function visitorDestructuringTarget(node) {
76694             switch (node.kind) {
76695                 case 204:
76696                 case 203:
76697                     return visitAssignmentPattern(node);
76698                 default:
76699                     return visitor(node);
76700             }
76701         }
76702         function visitPrivateIdentifier(node) {
76703             if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
76704                 return node;
76705             }
76706             if (ts.isStatement(node.parent)) {
76707                 return node;
76708             }
76709             return ts.setOriginalNode(factory.createIdentifier(""), node);
76710         }
76711         function visitPrivateIdentifierInInExpression(node) {
76712             if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
76713                 return node;
76714             }
76715             var privId = node.left;
76716             ts.Debug.assertNode(privId, ts.isPrivateIdentifier);
76717             ts.Debug.assert(node.operatorToken.kind === 101);
76718             var info = accessPrivateIdentifier(privId);
76719             if (info) {
76720                 var receiver = ts.visitNode(node.right, visitor, ts.isExpression);
76721                 return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node);
76722             }
76723             return ts.visitEachChild(node, visitor, context);
76724         }
76725         function classElementVisitor(node) {
76726             switch (node.kind) {
76727                 case 170:
76728                     return undefined;
76729                 case 171:
76730                 case 172:
76731                 case 168:
76732                     return visitMethodOrAccessorDeclaration(node);
76733                 case 166:
76734                     return visitPropertyDeclaration(node);
76735                 case 161:
76736                     return visitComputedPropertyName(node);
76737                 case 233:
76738                     return node;
76739                 default:
76740                     return visitor(node);
76741             }
76742         }
76743         function visitVariableStatement(node) {
76744             var savedPendingStatements = pendingStatements;
76745             pendingStatements = [];
76746             var visitedNode = ts.visitEachChild(node, visitor, context);
76747             var statement = ts.some(pendingStatements) ? __spreadArray([visitedNode], pendingStatements, true) :
76748                 visitedNode;
76749             pendingStatements = savedPendingStatements;
76750             return statement;
76751         }
76752         function visitComputedPropertyName(name) {
76753             var node = ts.visitEachChild(name, visitor, context);
76754             if (ts.some(pendingExpressions)) {
76755                 var expressions = pendingExpressions;
76756                 expressions.push(node.expression);
76757                 pendingExpressions = [];
76758                 node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions));
76759             }
76760             return node;
76761         }
76762         function visitMethodOrAccessorDeclaration(node) {
76763             ts.Debug.assert(!ts.some(node.decorators));
76764             if (!shouldTransformPrivateElementsOrClassStaticBlocks || !ts.isPrivateIdentifier(node.name)) {
76765                 return ts.visitEachChild(node, classElementVisitor, context);
76766             }
76767             var info = accessPrivateIdentifier(node.name);
76768             ts.Debug.assert(info, "Undeclared private name for property declaration.");
76769             if (!info.isValid) {
76770                 return node;
76771             }
76772             var functionName = getHoistedFunctionName(node);
76773             if (functionName) {
76774                 getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return !ts.isStaticModifier(m); }), node.asteriskToken, functionName, undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), undefined, ts.visitFunctionBody(node.body, classElementVisitor, context))));
76775             }
76776             return undefined;
76777         }
76778         function getHoistedFunctionName(node) {
76779             ts.Debug.assert(ts.isPrivateIdentifier(node.name));
76780             var info = accessPrivateIdentifier(node.name);
76781             ts.Debug.assert(info, "Undeclared private name for property declaration.");
76782             if (info.kind === "m") {
76783                 return info.methodName;
76784             }
76785             if (info.kind === "a") {
76786                 if (ts.isGetAccessor(node)) {
76787                     return info.getterName;
76788                 }
76789                 if (ts.isSetAccessor(node)) {
76790                     return info.setterName;
76791                 }
76792             }
76793         }
76794         function visitPropertyDeclaration(node) {
76795             ts.Debug.assert(!ts.some(node.decorators));
76796             if (ts.isPrivateIdentifier(node.name)) {
76797                 if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
76798                     return factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, undefined, undefined);
76799                 }
76800                 var info = accessPrivateIdentifier(node.name);
76801                 ts.Debug.assert(info, "Undeclared private name for property declaration.");
76802                 if (!info.isValid) {
76803                     return node;
76804                 }
76805             }
76806             var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields);
76807             if (expr && !ts.isSimpleInlineableExpression(expr)) {
76808                 getPendingExpressions().push(expr);
76809             }
76810             return undefined;
76811         }
76812         function createPrivateIdentifierAccess(info, receiver) {
76813             return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression));
76814         }
76815         function createPrivateIdentifierAccessHelper(info, receiver) {
76816             ts.setCommentRange(receiver, ts.moveRangePos(receiver, -1));
76817             switch (info.kind) {
76818                 case "a":
76819                     return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.getterName);
76820                 case "m":
76821                     return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.methodName);
76822                 case "f":
76823                     return context.getEmitHelperFactory().createClassPrivateFieldGetHelper(receiver, info.brandCheckIdentifier, info.kind, info.variableName);
76824                 default:
76825                     ts.Debug.assertNever(info, "Unknown private element type");
76826             }
76827         }
76828         function visitPropertyAccessExpression(node) {
76829             if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifier(node.name)) {
76830                 var privateIdentifierInfo = accessPrivateIdentifier(node.name);
76831                 if (privateIdentifierInfo) {
76832                     return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAccess(privateIdentifierInfo, node.expression), node), node);
76833                 }
76834             }
76835             if (shouldTransformSuperInStaticInitializers &&
76836                 ts.isSuperProperty(node) &&
76837                 ts.isIdentifier(node.name) &&
76838                 currentStaticPropertyDeclarationOrStaticBlock &&
76839                 currentClassLexicalEnvironment) {
76840                 var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
76841                 if (facts & 1) {
76842                     return visitInvalidSuperProperty(node);
76843                 }
76844                 if (classConstructor && superClassReference) {
76845                     var superProperty = factory.createReflectGetCall(superClassReference, factory.createStringLiteralFromNode(node.name), classConstructor);
76846                     ts.setOriginalNode(superProperty, node.expression);
76847                     ts.setTextRange(superProperty, node.expression);
76848                     return superProperty;
76849                 }
76850             }
76851             return ts.visitEachChild(node, visitor, context);
76852         }
76853         function visitElementAccessExpression(node) {
76854             if (shouldTransformSuperInStaticInitializers &&
76855                 ts.isSuperProperty(node) &&
76856                 currentStaticPropertyDeclarationOrStaticBlock &&
76857                 currentClassLexicalEnvironment) {
76858                 var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
76859                 if (facts & 1) {
76860                     return visitInvalidSuperProperty(node);
76861                 }
76862                 if (classConstructor && superClassReference) {
76863                     var superProperty = factory.createReflectGetCall(superClassReference, ts.visitNode(node.argumentExpression, visitor, ts.isExpression), classConstructor);
76864                     ts.setOriginalNode(superProperty, node.expression);
76865                     ts.setTextRange(superProperty, node.expression);
76866                     return superProperty;
76867                 }
76868             }
76869             return ts.visitEachChild(node, visitor, context);
76870         }
76871         function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) {
76872             if (node.operator === 45 || node.operator === 46) {
76873                 if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.operand)) {
76874                     var info = void 0;
76875                     if (info = accessPrivateIdentifier(node.operand.name)) {
76876                         var receiver = ts.visitNode(node.operand.expression, visitor, ts.isExpression);
76877                         var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
76878                         var expression = createPrivateIdentifierAccess(info, readExpression);
76879                         var temp = ts.isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
76880                         expression = ts.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp);
76881                         expression = createPrivateIdentifierAssignment(info, initializeExpression || readExpression, expression, 63);
76882                         ts.setOriginalNode(expression, node);
76883                         ts.setTextRange(expression, node);
76884                         if (temp) {
76885                             expression = factory.createComma(expression, temp);
76886                             ts.setTextRange(expression, node);
76887                         }
76888                         return expression;
76889                     }
76890                 }
76891                 else if (shouldTransformSuperInStaticInitializers &&
76892                     ts.isSuperProperty(node.operand) &&
76893                     currentStaticPropertyDeclarationOrStaticBlock &&
76894                     currentClassLexicalEnvironment) {
76895                     var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
76896                     if (facts & 1) {
76897                         var operand = visitInvalidSuperProperty(node.operand);
76898                         return ts.isPrefixUnaryExpression(node) ?
76899                             factory.updatePrefixUnaryExpression(node, operand) :
76900                             factory.updatePostfixUnaryExpression(node, operand);
76901                     }
76902                     if (classConstructor && superClassReference) {
76903                         var setterName = void 0;
76904                         var getterName = void 0;
76905                         if (ts.isPropertyAccessExpression(node.operand)) {
76906                             if (ts.isIdentifier(node.operand.name)) {
76907                                 getterName = setterName = factory.createStringLiteralFromNode(node.operand.name);
76908                             }
76909                         }
76910                         else {
76911                             if (ts.isSimpleInlineableExpression(node.operand.argumentExpression)) {
76912                                 getterName = setterName = node.operand.argumentExpression;
76913                             }
76914                             else {
76915                                 getterName = factory.createTempVariable(hoistVariableDeclaration);
76916                                 setterName = factory.createAssignment(getterName, ts.visitNode(node.operand.argumentExpression, visitor, ts.isExpression));
76917                             }
76918                         }
76919                         if (setterName && getterName) {
76920                             var expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
76921                             ts.setTextRange(expression, node.operand);
76922                             var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
76923                             expression = ts.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp);
76924                             expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
76925                             ts.setOriginalNode(expression, node);
76926                             ts.setTextRange(expression, node);
76927                             if (temp) {
76928                                 expression = factory.createComma(expression, temp);
76929                                 ts.setTextRange(expression, node);
76930                             }
76931                             return expression;
76932                         }
76933                     }
76934                 }
76935             }
76936             return ts.visitEachChild(node, visitor, context);
76937         }
76938         function visitForStatement(node) {
76939             return factory.updateForStatement(node, ts.visitNode(node.initializer, discardedValueVisitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, discardedValueVisitor, ts.isExpression), ts.visitIterationBody(node.statement, visitor, context));
76940         }
76941         function visitExpressionStatement(node) {
76942             return factory.updateExpressionStatement(node, ts.visitNode(node.expression, discardedValueVisitor, ts.isExpression));
76943         }
76944         function createCopiableReceiverExpr(receiver) {
76945             var clone = ts.nodeIsSynthesized(receiver) ? receiver : factory.cloneNode(receiver);
76946             if (ts.isSimpleInlineableExpression(receiver)) {
76947                 return { readExpression: clone, initializeExpression: undefined };
76948             }
76949             var readExpression = factory.createTempVariable(hoistVariableDeclaration);
76950             var initializeExpression = factory.createAssignment(readExpression, clone);
76951             return { readExpression: readExpression, initializeExpression: initializeExpression };
76952         }
76953         function visitCallExpression(node) {
76954             if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) {
76955                 var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target;
76956                 if (ts.isCallChain(node)) {
76957                     return factory.updateCallChain(node, factory.createPropertyAccessChain(ts.visitNode(target, visitor), node.questionDotToken, "call"), undefined, undefined, __spreadArray([ts.visitNode(thisArg, visitor, ts.isExpression)], ts.visitNodes(node.arguments, visitor, ts.isExpression), true));
76958                 }
76959                 return factory.updateCallExpression(node, factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "call"), undefined, __spreadArray([ts.visitNode(thisArg, visitor, ts.isExpression)], ts.visitNodes(node.arguments, visitor, ts.isExpression), true));
76960             }
76961             if (shouldTransformSuperInStaticInitializers &&
76962                 ts.isSuperProperty(node.expression) &&
76963                 currentStaticPropertyDeclarationOrStaticBlock &&
76964                 (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) {
76965                 var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression));
76966                 ts.setOriginalNode(invocation, node);
76967                 ts.setTextRange(invocation, node);
76968                 return invocation;
76969             }
76970             return ts.visitEachChild(node, visitor, context);
76971         }
76972         function visitTaggedTemplateExpression(node) {
76973             if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) {
76974                 var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target;
76975                 return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), undefined, [ts.visitNode(thisArg, visitor, ts.isExpression)]), undefined, ts.visitNode(node.template, visitor, ts.isTemplateLiteral));
76976             }
76977             if (shouldTransformSuperInStaticInitializers &&
76978                 ts.isSuperProperty(node.tag) &&
76979                 currentStaticPropertyDeclarationOrStaticBlock &&
76980                 (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) {
76981                 var invocation = factory.createFunctionBindCall(ts.visitNode(node.tag, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, []);
76982                 ts.setOriginalNode(invocation, node);
76983                 ts.setTextRange(invocation, node);
76984                 return factory.updateTaggedTemplateExpression(node, invocation, undefined, ts.visitNode(node.template, visitor, ts.isTemplateLiteral));
76985             }
76986             return ts.visitEachChild(node, visitor, context);
76987         }
76988         function transformClassStaticBlockDeclaration(node) {
76989             if (shouldTransformPrivateElementsOrClassStaticBlocks) {
76990                 if (currentClassLexicalEnvironment) {
76991                     classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment);
76992                 }
76993                 startLexicalEnvironment();
76994                 var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock;
76995                 currentStaticPropertyDeclarationOrStaticBlock = node;
76996                 var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement);
76997                 statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
76998                 currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock;
76999                 var iife = factory.createImmediatelyInvokedArrowFunction(statements);
77000                 ts.setOriginalNode(iife, node);
77001                 ts.setTextRange(iife, node);
77002                 ts.addEmitFlags(iife, 2);
77003                 return iife;
77004             }
77005         }
77006         function visitBinaryExpression(node, valueIsDiscarded) {
77007             if (ts.isDestructuringAssignment(node)) {
77008                 var savedPendingExpressions = pendingExpressions;
77009                 pendingExpressions = undefined;
77010                 node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor));
77011                 var expr = ts.some(pendingExpressions) ?
77012                     factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) :
77013                     node;
77014                 pendingExpressions = savedPendingExpressions;
77015                 return expr;
77016             }
77017             if (ts.isAssignmentExpression(node)) {
77018                 if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) {
77019                     var info = accessPrivateIdentifier(node.left.name);
77020                     if (info) {
77021                         return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node);
77022                     }
77023                 }
77024                 else if (shouldTransformSuperInStaticInitializers &&
77025                     ts.isSuperProperty(node.left) &&
77026                     currentStaticPropertyDeclarationOrStaticBlock &&
77027                     currentClassLexicalEnvironment) {
77028                     var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
77029                     if (facts & 1) {
77030                         return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression));
77031                     }
77032                     if (classConstructor && superClassReference) {
77033                         var setterName = ts.isElementAccessExpression(node.left) ? ts.visitNode(node.left.argumentExpression, visitor, ts.isExpression) :
77034                             ts.isIdentifier(node.left.name) ? factory.createStringLiteralFromNode(node.left.name) :
77035                                 undefined;
77036                         if (setterName) {
77037                             var expression = ts.visitNode(node.right, visitor, ts.isExpression);
77038                             if (ts.isCompoundAssignment(node.operatorToken.kind)) {
77039                                 var getterName = setterName;
77040                                 if (!ts.isSimpleInlineableExpression(setterName)) {
77041                                     getterName = factory.createTempVariable(hoistVariableDeclaration);
77042                                     setterName = factory.createAssignment(getterName, setterName);
77043                                 }
77044                                 var superPropertyGet = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
77045                                 ts.setOriginalNode(superPropertyGet, node.left);
77046                                 ts.setTextRange(superPropertyGet, node.left);
77047                                 expression = factory.createBinaryExpression(superPropertyGet, ts.getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind), expression);
77048                                 ts.setTextRange(expression, node);
77049                             }
77050                             var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
77051                             if (temp) {
77052                                 expression = factory.createAssignment(temp, expression);
77053                                 ts.setTextRange(temp, node);
77054                             }
77055                             expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
77056                             ts.setOriginalNode(expression, node);
77057                             ts.setTextRange(expression, node);
77058                             if (temp) {
77059                                 expression = factory.createComma(expression, temp);
77060                                 ts.setTextRange(expression, node);
77061                             }
77062                             return expression;
77063                         }
77064                     }
77065                 }
77066             }
77067             if (node.operatorToken.kind === 101 && ts.isPrivateIdentifier(node.left)) {
77068                 return visitPrivateIdentifierInInExpression(node);
77069             }
77070             return ts.visitEachChild(node, visitor, context);
77071         }
77072         function createPrivateIdentifierAssignment(info, receiver, right, operator) {
77073             receiver = ts.visitNode(receiver, visitor, ts.isExpression);
77074             right = ts.visitNode(right, visitor, ts.isExpression);
77075             if (ts.isCompoundAssignment(operator)) {
77076                 var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
77077                 receiver = initializeExpression || readExpression;
77078                 right = factory.createBinaryExpression(createPrivateIdentifierAccessHelper(info, readExpression), ts.getNonAssignmentOperatorForCompoundAssignment(operator), right);
77079             }
77080             ts.setCommentRange(receiver, ts.moveRangePos(receiver, -1));
77081             switch (info.kind) {
77082                 case "a":
77083                     return context.getEmitHelperFactory().createClassPrivateFieldSetHelper(receiver, info.brandCheckIdentifier, right, info.kind, info.setterName);
77084                 case "m":
77085                     return context.getEmitHelperFactory().createClassPrivateFieldSetHelper(receiver, info.brandCheckIdentifier, right, info.kind, undefined);
77086                 case "f":
77087                     return context.getEmitHelperFactory().createClassPrivateFieldSetHelper(receiver, info.brandCheckIdentifier, right, info.kind, info.variableName);
77088                 default:
77089                     ts.Debug.assertNever(info, "Unknown private element type");
77090             }
77091         }
77092         function visitClassLike(node) {
77093             if (!ts.forEach(node.members, doesClassElementNeedTransform)) {
77094                 return ts.visitEachChild(node, visitor, context);
77095             }
77096             var savedPendingExpressions = pendingExpressions;
77097             pendingExpressions = undefined;
77098             startClassLexicalEnvironment();
77099             if (shouldTransformPrivateElementsOrClassStaticBlocks) {
77100                 var name = ts.getNameOfDeclaration(node);
77101                 if (name && ts.isIdentifier(name)) {
77102                     getPrivateIdentifierEnvironment().className = ts.idText(name);
77103                 }
77104                 var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node);
77105                 if (ts.some(privateInstanceMethodsAndAccessors)) {
77106                     getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name);
77107                 }
77108             }
77109             var result = ts.isClassDeclaration(node) ?
77110                 visitClassDeclaration(node) :
77111                 visitClassExpression(node);
77112             endClassLexicalEnvironment();
77113             pendingExpressions = savedPendingExpressions;
77114             return result;
77115         }
77116         function doesClassElementNeedTransform(node) {
77117             return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name));
77118         }
77119         function getPrivateInstanceMethodsAndAccessors(node) {
77120             return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName);
77121         }
77122         function getClassFacts(node) {
77123             var facts = 0;
77124             var original = ts.getOriginalNode(node);
77125             if (ts.isClassDeclaration(original) && ts.classOrConstructorParameterIsDecorated(original)) {
77126                 facts |= 1;
77127             }
77128             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
77129                 var member = _a[_i];
77130                 if (!ts.isStatic(member))
77131                     continue;
77132                 if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) {
77133                     facts |= 2;
77134                 }
77135                 if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) {
77136                     if (shouldTransformThisInStaticInitializers && member.transformFlags & 8192) {
77137                         facts |= 8;
77138                         if (!(facts & 1)) {
77139                             facts |= 2;
77140                         }
77141                     }
77142                     if (shouldTransformSuperInStaticInitializers && member.transformFlags & 33554432) {
77143                         if (!(facts & 1)) {
77144                             facts |= 2 | 4;
77145                         }
77146                     }
77147                 }
77148             }
77149             return facts;
77150         }
77151         function visitExpressionWithTypeArguments(node) {
77152             var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0;
77153             if (facts & 4) {
77154                 var temp = factory.createTempVariable(hoistVariableDeclaration, true);
77155                 getClassLexicalEnvironment().superClassReference = temp;
77156                 return factory.updateExpressionWithTypeArguments(node, factory.createAssignment(temp, ts.visitNode(node.expression, visitor, ts.isExpression)), undefined);
77157             }
77158             return ts.visitEachChild(node, visitor, context);
77159         }
77160         function visitClassDeclaration(node) {
77161             var facts = getClassFacts(node);
77162             if (facts) {
77163                 getClassLexicalEnvironment().facts = facts;
77164             }
77165             if (facts & 8) {
77166                 enableSubstitutionForClassStaticThisOrSuperReference();
77167             }
77168             var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node);
77169             var pendingClassReferenceAssignment;
77170             if (facts & 2) {
77171                 var temp = factory.createTempVariable(hoistVariableDeclaration, true);
77172                 getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp);
77173                 pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node));
77174             }
77175             var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
77176             var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104);
77177             var statements = [
77178                 factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass))
77179             ];
77180             if (pendingClassReferenceAssignment) {
77181                 getPendingExpressions().unshift(pendingClassReferenceAssignment);
77182             }
77183             if (ts.some(pendingExpressions)) {
77184                 statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
77185             }
77186             if (ts.some(staticProperties)) {
77187                 addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node));
77188             }
77189             return statements;
77190         }
77191         function visitClassExpression(node) {
77192             var facts = getClassFacts(node);
77193             if (facts) {
77194                 getClassLexicalEnvironment().facts = facts;
77195             }
77196             if (facts & 8) {
77197                 enableSubstitutionForClassStaticThisOrSuperReference();
77198             }
77199             var isDecoratedClassDeclaration = !!(facts & 1);
77200             var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node);
77201             var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
77202             var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104);
77203             var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216;
77204             var temp;
77205             function createClassTempVar() {
77206                 var classCheckFlags = resolver.getNodeCheckFlags(node);
77207                 var isClassWithConstructorReference = classCheckFlags & 16777216;
77208                 var requiresBlockScopedVar = classCheckFlags & 524288;
77209                 return factory.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference);
77210             }
77211             if (facts & 2) {
77212                 temp = createClassTempVar();
77213                 getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp);
77214             }
77215             var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass));
77216             var hasTransformableStatics = ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifier(p.name)); });
77217             if (hasTransformableStatics || ts.some(pendingExpressions)) {
77218                 if (isDecoratedClassDeclaration) {
77219                     ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration.");
77220                     if (pendingStatements && pendingExpressions && ts.some(pendingExpressions)) {
77221                         pendingStatements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
77222                     }
77223                     if (pendingStatements && ts.some(staticPropertiesOrClassStaticBlocks)) {
77224                         addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node));
77225                     }
77226                     if (temp) {
77227                         return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]);
77228                     }
77229                     return classExpression;
77230                 }
77231                 else {
77232                     var expressions = [];
77233                     temp || (temp = createClassTempVar());
77234                     if (isClassWithConstructorReference) {
77235                         enableSubstitutionForClassAliases();
77236                         var alias = factory.cloneNode(temp);
77237                         alias.autoGenerateFlags &= ~8;
77238                         classAliases[ts.getOriginalNodeId(node)] = alias;
77239                     }
77240                     ts.setEmitFlags(classExpression, 65536 | ts.getEmitFlags(classExpression));
77241                     expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)));
77242                     ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine));
77243                     ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp));
77244                     expressions.push(ts.startOnNewLine(temp));
77245                     return factory.inlineExpressions(expressions);
77246                 }
77247             }
77248             return classExpression;
77249         }
77250         function visitClassStaticBlockDeclaration(node) {
77251             if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
77252                 return ts.visitEachChild(node, classElementVisitor, context);
77253             }
77254             return undefined;
77255         }
77256         function transformClassMembers(node, isDerivedClass) {
77257             if (shouldTransformPrivateElementsOrClassStaticBlocks) {
77258                 for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
77259                     var member = _a[_i];
77260                     if (ts.isPrivateIdentifierClassElementDeclaration(member)) {
77261                         addPrivateIdentifierToEnvironment(member);
77262                     }
77263                 }
77264                 if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) {
77265                     createBrandCheckWeakSetForPrivateMethods();
77266                 }
77267             }
77268             var members = [];
77269             var constructor = transformConstructor(node, isDerivedClass);
77270             if (constructor) {
77271                 members.push(constructor);
77272             }
77273             ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement));
77274             return ts.setTextRange(factory.createNodeArray(members), node.members);
77275         }
77276         function createBrandCheckWeakSetForPrivateMethods() {
77277             var weakSetName = getPrivateIdentifierEnvironment().weakSetName;
77278             ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
77279             getPendingExpressions().push(factory.createAssignment(weakSetName, factory.createNewExpression(factory.createIdentifier("WeakSet"), undefined, [])));
77280         }
77281         function isClassElementThatRequiresConstructorStatement(member) {
77282             if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128)) {
77283                 return false;
77284             }
77285             if (useDefineForClassFields) {
77286                 return languageVersion < 99;
77287             }
77288             return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member);
77289         }
77290         function transformConstructor(node, isDerivedClass) {
77291             var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration);
77292             var elements = node.members.filter(isClassElementThatRequiresConstructorStatement);
77293             if (!ts.some(elements)) {
77294                 return constructor;
77295             }
77296             var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context);
77297             var body = transformConstructorBody(node, constructor, isDerivedClass);
77298             if (!body) {
77299                 return undefined;
77300             }
77301             return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor));
77302         }
77303         function transformConstructorBody(node, constructor, isDerivedClass) {
77304             var properties = ts.getProperties(node, false, false);
77305             if (!useDefineForClassFields) {
77306                 properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); });
77307             }
77308             var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node);
77309             var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors);
77310             if (!constructor && !needsConstructorBody) {
77311                 return ts.visitFunctionBody(undefined, visitor, context);
77312             }
77313             resumeLexicalEnvironment();
77314             var indexOfFirstStatement = 0;
77315             var statements = [];
77316             if (!constructor && isDerivedClass) {
77317                 statements.push(factory.createExpressionStatement(factory.createCallExpression(factory.createSuper(), undefined, [factory.createSpreadElement(factory.createIdentifier("arguments"))])));
77318             }
77319             if (constructor) {
77320                 indexOfFirstStatement = ts.addPrologueDirectivesAndInitialSuperCall(factory, constructor, statements, visitor);
77321             }
77322             if (constructor === null || constructor === void 0 ? void 0 : constructor.body) {
77323                 var afterParameterProperties = ts.findIndex(constructor.body.statements, function (s) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(s), constructor); }, indexOfFirstStatement);
77324                 if (afterParameterProperties === -1) {
77325                     afterParameterProperties = constructor.body.statements.length;
77326                 }
77327                 if (afterParameterProperties > indexOfFirstStatement) {
77328                     if (!useDefineForClassFields) {
77329                         ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement, afterParameterProperties - indexOfFirstStatement));
77330                     }
77331                     indexOfFirstStatement = afterParameterProperties;
77332                 }
77333             }
77334             var receiver = factory.createThis();
77335             addMethodStatements(statements, privateMethodsAndAccessors, receiver);
77336             addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
77337             if (constructor) {
77338                 ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement));
77339             }
77340             statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
77341             return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined);
77342         }
77343         function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
77344             for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
77345                 var property = properties_7[_i];
77346                 var expression = ts.isClassStaticBlockDeclaration(property) ?
77347                     transformClassStaticBlockDeclaration(property) :
77348                     transformProperty(property, receiver);
77349                 if (!expression) {
77350                     continue;
77351                 }
77352                 var statement = factory.createExpressionStatement(expression);
77353                 ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
77354                 ts.setCommentRange(statement, property);
77355                 ts.setOriginalNode(statement, property);
77356                 statements.push(statement);
77357             }
77358         }
77359         function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) {
77360             var expressions = [];
77361             for (var _i = 0, propertiesOrClassStaticBlocks_1 = propertiesOrClassStaticBlocks; _i < propertiesOrClassStaticBlocks_1.length; _i++) {
77362                 var property = propertiesOrClassStaticBlocks_1[_i];
77363                 var expression = ts.isClassStaticBlockDeclaration(property) ? transformClassStaticBlockDeclaration(property) : transformProperty(property, receiver);
77364                 if (!expression) {
77365                     continue;
77366                 }
77367                 ts.startOnNewLine(expression);
77368                 ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
77369                 ts.setCommentRange(expression, property);
77370                 ts.setOriginalNode(expression, property);
77371                 expressions.push(expression);
77372             }
77373             return expressions;
77374         }
77375         function transformProperty(property, receiver) {
77376             var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock;
77377             var transformed = transformPropertyWorker(property, receiver);
77378             if (transformed && ts.hasStaticModifier(property) && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts)) {
77379                 ts.setOriginalNode(transformed, property);
77380                 ts.addEmitFlags(transformed, 2);
77381                 classLexicalEnvironmentMap.set(ts.getOriginalNodeId(transformed), currentClassLexicalEnvironment);
77382             }
77383             currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock;
77384             return transformed;
77385         }
77386         function transformPropertyWorker(property, receiver) {
77387             var _a;
77388             var emitAssignment = !useDefineForClassFields;
77389             var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression)
77390                 ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name))
77391                 : property.name;
77392             if (ts.hasStaticModifier(property)) {
77393                 currentStaticPropertyDeclarationOrStaticBlock = property;
77394             }
77395             if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifier(propertyName)) {
77396                 var privateIdentifierInfo = accessPrivateIdentifier(propertyName);
77397                 if (privateIdentifierInfo) {
77398                     if (privateIdentifierInfo.kind === "f") {
77399                         if (!privateIdentifierInfo.isStatic) {
77400                             return createPrivateInstanceFieldInitializer(receiver, ts.visitNode(property.initializer, visitor, ts.isExpression), privateIdentifierInfo.brandCheckIdentifier);
77401                         }
77402                         else {
77403                             return createPrivateStaticFieldInitializer(privateIdentifierInfo.variableName, ts.visitNode(property.initializer, visitor, ts.isExpression));
77404                         }
77405                     }
77406                     else {
77407                         return undefined;
77408                     }
77409                 }
77410                 else {
77411                     ts.Debug.fail("Undeclared private name for property declaration.");
77412                 }
77413             }
77414             if ((ts.isPrivateIdentifier(propertyName) || ts.hasStaticModifier(property)) && !property.initializer) {
77415                 return undefined;
77416             }
77417             var propertyOriginalNode = ts.getOriginalNode(property);
77418             if (ts.hasSyntacticModifier(propertyOriginalNode, 128)) {
77419                 return undefined;
77420             }
77421             var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero()
77422                 : ts.isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && ts.isIdentifier(propertyName) ? propertyName
77423                     : factory.createVoidZero();
77424             if (emitAssignment || ts.isPrivateIdentifier(propertyName)) {
77425                 var memberAccess = ts.createMemberAccessForPropertyName(factory, receiver, propertyName, propertyName);
77426                 return factory.createAssignment(memberAccess, initializer);
77427             }
77428             else {
77429                 var name = ts.isComputedPropertyName(propertyName) ? propertyName.expression
77430                     : ts.isIdentifier(propertyName) ? factory.createStringLiteral(ts.unescapeLeadingUnderscores(propertyName.escapedText))
77431                         : propertyName;
77432                 var descriptor = factory.createPropertyDescriptor({ value: initializer, configurable: true, writable: true, enumerable: true });
77433                 return factory.createObjectDefinePropertyCall(receiver, name, descriptor);
77434             }
77435         }
77436         function enableSubstitutionForClassAliases() {
77437             if ((enabledSubstitutions & 1) === 0) {
77438                 enabledSubstitutions |= 1;
77439                 context.enableSubstitution(79);
77440                 classAliases = [];
77441             }
77442         }
77443         function enableSubstitutionForClassStaticThisOrSuperReference() {
77444             if ((enabledSubstitutions & 2) === 0) {
77445                 enabledSubstitutions |= 2;
77446                 context.enableSubstitution(108);
77447                 context.enableEmitNotification(255);
77448                 context.enableEmitNotification(212);
77449                 context.enableEmitNotification(170);
77450                 context.enableEmitNotification(171);
77451                 context.enableEmitNotification(172);
77452                 context.enableEmitNotification(168);
77453                 context.enableEmitNotification(166);
77454                 context.enableEmitNotification(161);
77455             }
77456         }
77457         function addMethodStatements(statements, methods, receiver) {
77458             if (!shouldTransformPrivateElementsOrClassStaticBlocks || !ts.some(methods)) {
77459                 return;
77460             }
77461             var weakSetName = getPrivateIdentifierEnvironment().weakSetName;
77462             ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
77463             statements.push(factory.createExpressionStatement(createPrivateInstanceMethodInitializer(receiver, weakSetName)));
77464         }
77465         function visitInvalidSuperProperty(node) {
77466             return ts.isPropertyAccessExpression(node) ?
77467                 factory.updatePropertyAccessExpression(node, factory.createVoidZero(), node.name) :
77468                 factory.updateElementAccessExpression(node, factory.createVoidZero(), ts.visitNode(node.argumentExpression, visitor, ts.isExpression));
77469         }
77470         function onEmitNode(hint, node, emitCallback) {
77471             var original = ts.getOriginalNode(node);
77472             if (original.id) {
77473                 var classLexicalEnvironment = classLexicalEnvironmentMap.get(original.id);
77474                 if (classLexicalEnvironment) {
77475                     var savedClassLexicalEnvironment = currentClassLexicalEnvironment;
77476                     var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment;
77477                     currentClassLexicalEnvironment = classLexicalEnvironment;
77478                     currentComputedPropertyNameClassLexicalEnvironment = classLexicalEnvironment;
77479                     previousOnEmitNode(hint, node, emitCallback);
77480                     currentClassLexicalEnvironment = savedClassLexicalEnvironment;
77481                     currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment;
77482                     return;
77483                 }
77484             }
77485             switch (node.kind) {
77486                 case 212:
77487                     if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144) {
77488                         break;
77489                     }
77490                 case 255:
77491                 case 170: {
77492                     var savedClassLexicalEnvironment = currentClassLexicalEnvironment;
77493                     var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment;
77494                     currentClassLexicalEnvironment = undefined;
77495                     currentComputedPropertyNameClassLexicalEnvironment = undefined;
77496                     previousOnEmitNode(hint, node, emitCallback);
77497                     currentClassLexicalEnvironment = savedClassLexicalEnvironment;
77498                     currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment;
77499                     return;
77500                 }
77501                 case 171:
77502                 case 172:
77503                 case 168:
77504                 case 166: {
77505                     var savedClassLexicalEnvironment = currentClassLexicalEnvironment;
77506                     var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment;
77507                     currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment;
77508                     currentClassLexicalEnvironment = undefined;
77509                     previousOnEmitNode(hint, node, emitCallback);
77510                     currentClassLexicalEnvironment = savedClassLexicalEnvironment;
77511                     currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment;
77512                     return;
77513                 }
77514                 case 161: {
77515                     var savedClassLexicalEnvironment = currentClassLexicalEnvironment;
77516                     var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment;
77517                     currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment;
77518                     currentComputedPropertyNameClassLexicalEnvironment = undefined;
77519                     previousOnEmitNode(hint, node, emitCallback);
77520                     currentClassLexicalEnvironment = savedClassLexicalEnvironment;
77521                     currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment;
77522                     return;
77523                 }
77524             }
77525             previousOnEmitNode(hint, node, emitCallback);
77526         }
77527         function onSubstituteNode(hint, node) {
77528             node = previousOnSubstituteNode(hint, node);
77529             if (hint === 1) {
77530                 return substituteExpression(node);
77531             }
77532             return node;
77533         }
77534         function substituteExpression(node) {
77535             switch (node.kind) {
77536                 case 79:
77537                     return substituteExpressionIdentifier(node);
77538                 case 108:
77539                     return substituteThisExpression(node);
77540             }
77541             return node;
77542         }
77543         function substituteThisExpression(node) {
77544             if (enabledSubstitutions & 2 && currentClassLexicalEnvironment) {
77545                 var facts = currentClassLexicalEnvironment.facts, classConstructor = currentClassLexicalEnvironment.classConstructor;
77546                 if (facts & 1) {
77547                     return factory.createParenthesizedExpression(factory.createVoidZero());
77548                 }
77549                 if (classConstructor) {
77550                     return ts.setTextRange(ts.setOriginalNode(factory.cloneNode(classConstructor), node), node);
77551                 }
77552             }
77553             return node;
77554         }
77555         function substituteExpressionIdentifier(node) {
77556             return trySubstituteClassAlias(node) || node;
77557         }
77558         function trySubstituteClassAlias(node) {
77559             if (enabledSubstitutions & 1) {
77560                 if (resolver.getNodeCheckFlags(node) & 33554432) {
77561                     var declaration = resolver.getReferencedValueDeclaration(node);
77562                     if (declaration) {
77563                         var classAlias = classAliases[declaration.id];
77564                         if (classAlias) {
77565                             var clone_3 = factory.cloneNode(classAlias);
77566                             ts.setSourceMapRange(clone_3, node);
77567                             ts.setCommentRange(clone_3, node);
77568                             return clone_3;
77569                         }
77570                     }
77571                 }
77572             }
77573             return undefined;
77574         }
77575         function getPropertyNameExpressionIfNeeded(name, shouldHoist) {
77576             if (ts.isComputedPropertyName(name)) {
77577                 var expression = ts.visitNode(name.expression, visitor, ts.isExpression);
77578                 var innerExpression = ts.skipPartiallyEmittedExpressions(expression);
77579                 var inlinable = ts.isSimpleInlineableExpression(innerExpression);
77580                 var alreadyTransformed = ts.isAssignmentExpression(innerExpression) && ts.isGeneratedIdentifier(innerExpression.left);
77581                 if (!alreadyTransformed && !inlinable && shouldHoist) {
77582                     var generatedName = factory.getGeneratedNameForNode(name);
77583                     if (resolver.getNodeCheckFlags(name) & 524288) {
77584                         addBlockScopedVariable(generatedName);
77585                     }
77586                     else {
77587                         hoistVariableDeclaration(generatedName);
77588                     }
77589                     return factory.createAssignment(generatedName, expression);
77590                 }
77591                 return (inlinable || ts.isIdentifier(innerExpression)) ? undefined : expression;
77592             }
77593         }
77594         function startClassLexicalEnvironment() {
77595             classLexicalEnvironmentStack.push(currentClassLexicalEnvironment);
77596             currentClassLexicalEnvironment = undefined;
77597         }
77598         function endClassLexicalEnvironment() {
77599             currentClassLexicalEnvironment = classLexicalEnvironmentStack.pop();
77600         }
77601         function getClassLexicalEnvironment() {
77602             return currentClassLexicalEnvironment || (currentClassLexicalEnvironment = {
77603                 facts: 0,
77604                 classConstructor: undefined,
77605                 superClassReference: undefined,
77606                 privateIdentifierEnvironment: undefined,
77607             });
77608         }
77609         function getPrivateIdentifierEnvironment() {
77610             var lex = getClassLexicalEnvironment();
77611             lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = {
77612                 className: "",
77613                 identifiers: new ts.Map()
77614             });
77615             return lex.privateIdentifierEnvironment;
77616         }
77617         function getPendingExpressions() {
77618             return pendingExpressions || (pendingExpressions = []);
77619         }
77620         function addPrivateIdentifierToEnvironment(node) {
77621             var _a;
77622             var text = ts.getTextOfPropertyName(node.name);
77623             var lex = getClassLexicalEnvironment();
77624             var classConstructor = lex.classConstructor;
77625             var privateEnv = getPrivateIdentifierEnvironment();
77626             var weakSetName = privateEnv.weakSetName;
77627             var assignmentExpressions = [];
77628             var privateName = node.name.escapedText;
77629             var previousInfo = privateEnv.identifiers.get(privateName);
77630             var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined;
77631             if (ts.hasStaticModifier(node)) {
77632                 ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment");
77633                 if (ts.isPropertyDeclaration(node)) {
77634                     var variableName = createHoistedVariableForPrivateName(text, node);
77635                     privateEnv.identifiers.set(privateName, {
77636                         kind: "f",
77637                         variableName: variableName,
77638                         brandCheckIdentifier: classConstructor,
77639                         isStatic: true,
77640                         isValid: isValid,
77641                     });
77642                 }
77643                 else if (ts.isMethodDeclaration(node)) {
77644                     var functionName = createHoistedVariableForPrivateName(text, node);
77645                     privateEnv.identifiers.set(privateName, {
77646                         kind: "m",
77647                         methodName: functionName,
77648                         brandCheckIdentifier: classConstructor,
77649                         isStatic: true,
77650                         isValid: isValid,
77651                     });
77652                 }
77653                 else if (ts.isGetAccessorDeclaration(node)) {
77654                     var getterName = createHoistedVariableForPrivateName(text + "_get", node);
77655                     if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.getterName) {
77656                         previousInfo.getterName = getterName;
77657                     }
77658                     else {
77659                         privateEnv.identifiers.set(privateName, {
77660                             kind: "a",
77661                             getterName: getterName,
77662                             setterName: undefined,
77663                             brandCheckIdentifier: classConstructor,
77664                             isStatic: true,
77665                             isValid: isValid,
77666                         });
77667                     }
77668                 }
77669                 else if (ts.isSetAccessorDeclaration(node)) {
77670                     var setterName = createHoistedVariableForPrivateName(text + "_set", node);
77671                     if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.setterName) {
77672                         previousInfo.setterName = setterName;
77673                     }
77674                     else {
77675                         privateEnv.identifiers.set(privateName, {
77676                             kind: "a",
77677                             getterName: undefined,
77678                             setterName: setterName,
77679                             brandCheckIdentifier: classConstructor,
77680                             isStatic: true,
77681                             isValid: isValid,
77682                         });
77683                     }
77684                 }
77685                 else {
77686                     ts.Debug.assertNever(node, "Unknown class element type.");
77687                 }
77688             }
77689             else if (ts.isPropertyDeclaration(node)) {
77690                 var weakMapName = createHoistedVariableForPrivateName(text, node);
77691                 privateEnv.identifiers.set(privateName, {
77692                     kind: "f",
77693                     brandCheckIdentifier: weakMapName,
77694                     isStatic: false,
77695                     variableName: undefined,
77696                     isValid: isValid,
77697                 });
77698                 assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), undefined, [])));
77699             }
77700             else if (ts.isMethodDeclaration(node)) {
77701                 ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
77702                 privateEnv.identifiers.set(privateName, {
77703                     kind: "m",
77704                     methodName: createHoistedVariableForPrivateName(text, node),
77705                     brandCheckIdentifier: weakSetName,
77706                     isStatic: false,
77707                     isValid: isValid,
77708                 });
77709             }
77710             else if (ts.isAccessor(node)) {
77711                 ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
77712                 if (ts.isGetAccessor(node)) {
77713                     var getterName = createHoistedVariableForPrivateName(text + "_get", node);
77714                     if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.getterName) {
77715                         previousInfo.getterName = getterName;
77716                     }
77717                     else {
77718                         privateEnv.identifiers.set(privateName, {
77719                             kind: "a",
77720                             getterName: getterName,
77721                             setterName: undefined,
77722                             brandCheckIdentifier: weakSetName,
77723                             isStatic: false,
77724                             isValid: isValid,
77725                         });
77726                     }
77727                 }
77728                 else {
77729                     var setterName = createHoistedVariableForPrivateName(text + "_set", node);
77730                     if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.setterName) {
77731                         previousInfo.setterName = setterName;
77732                     }
77733                     else {
77734                         privateEnv.identifiers.set(privateName, {
77735                             kind: "a",
77736                             getterName: undefined,
77737                             setterName: setterName,
77738                             brandCheckIdentifier: weakSetName,
77739                             isStatic: false,
77740                             isValid: isValid,
77741                         });
77742                     }
77743                 }
77744             }
77745             else {
77746                 ts.Debug.assertNever(node, "Unknown class element type.");
77747             }
77748             (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions);
77749         }
77750         function createHoistedVariableForClass(name, node) {
77751             var className = getPrivateIdentifierEnvironment().className;
77752             var prefix = className ? "_".concat(className) : "";
77753             var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16);
77754             if (resolver.getNodeCheckFlags(node) & 524288) {
77755                 addBlockScopedVariable(identifier);
77756             }
77757             else {
77758                 hoistVariableDeclaration(identifier);
77759             }
77760             return identifier;
77761         }
77762         function createHoistedVariableForPrivateName(privateName, node) {
77763             return createHoistedVariableForClass(privateName.substring(1), node.name);
77764         }
77765         function accessPrivateIdentifier(name) {
77766             var _a;
77767             if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) {
77768                 var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText);
77769                 if (info) {
77770                     return info;
77771                 }
77772             }
77773             for (var i = classLexicalEnvironmentStack.length - 1; i >= 0; --i) {
77774                 var env = classLexicalEnvironmentStack[i];
77775                 if (!env) {
77776                     continue;
77777                 }
77778                 var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText);
77779                 if (info) {
77780                     return info;
77781                 }
77782             }
77783             return undefined;
77784         }
77785         function wrapPrivateIdentifierForDestructuringTarget(node) {
77786             var parameter = factory.getGeneratedNameForNode(node);
77787             var info = accessPrivateIdentifier(node.name);
77788             if (!info) {
77789                 return ts.visitEachChild(node, visitor, context);
77790             }
77791             var receiver = node.expression;
77792             if (ts.isThisProperty(node) || ts.isSuperProperty(node) || !ts.isSimpleCopiableExpression(node.expression)) {
77793                 receiver = factory.createTempVariable(hoistVariableDeclaration, true);
77794                 getPendingExpressions().push(factory.createBinaryExpression(receiver, 63, ts.visitNode(node.expression, visitor, ts.isExpression)));
77795             }
77796             return factory.createAssignmentTargetWrapper(parameter, createPrivateIdentifierAssignment(info, receiver, parameter, 63));
77797         }
77798         function visitArrayAssignmentTarget(node) {
77799             var target = ts.getTargetOfBindingOrAssignmentElement(node);
77800             if (target) {
77801                 var wrapped = void 0;
77802                 if (ts.isPrivateIdentifierPropertyAccessExpression(target)) {
77803                     wrapped = wrapPrivateIdentifierForDestructuringTarget(target);
77804                 }
77805                 else if (shouldTransformSuperInStaticInitializers &&
77806                     ts.isSuperProperty(target) &&
77807                     currentStaticPropertyDeclarationOrStaticBlock &&
77808                     currentClassLexicalEnvironment) {
77809                     var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
77810                     if (facts & 1) {
77811                         wrapped = visitInvalidSuperProperty(target);
77812                     }
77813                     else if (classConstructor && superClassReference) {
77814                         var name = ts.isElementAccessExpression(target) ? ts.visitNode(target.argumentExpression, visitor, ts.isExpression) :
77815                             ts.isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) :
77816                                 undefined;
77817                         if (name) {
77818                             var temp = factory.createTempVariable(undefined);
77819                             wrapped = factory.createAssignmentTargetWrapper(temp, factory.createReflectSetCall(superClassReference, name, temp, classConstructor));
77820                         }
77821                     }
77822                 }
77823                 if (wrapped) {
77824                     if (ts.isAssignmentExpression(node)) {
77825                         return factory.updateBinaryExpression(node, wrapped, node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression));
77826                     }
77827                     else if (ts.isSpreadElement(node)) {
77828                         return factory.updateSpreadElement(node, wrapped);
77829                     }
77830                     else {
77831                         return wrapped;
77832                     }
77833                 }
77834             }
77835             return ts.visitNode(node, visitorDestructuringTarget);
77836         }
77837         function visitObjectAssignmentTarget(node) {
77838             if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) {
77839                 var target = ts.getTargetOfBindingOrAssignmentElement(node);
77840                 var wrapped = void 0;
77841                 if (target) {
77842                     if (ts.isPrivateIdentifierPropertyAccessExpression(target)) {
77843                         wrapped = wrapPrivateIdentifierForDestructuringTarget(target);
77844                     }
77845                     else if (shouldTransformSuperInStaticInitializers &&
77846                         ts.isSuperProperty(target) &&
77847                         currentStaticPropertyDeclarationOrStaticBlock &&
77848                         currentClassLexicalEnvironment) {
77849                         var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
77850                         if (facts & 1) {
77851                             wrapped = visitInvalidSuperProperty(target);
77852                         }
77853                         else if (classConstructor && superClassReference) {
77854                             var name = ts.isElementAccessExpression(target) ? ts.visitNode(target.argumentExpression, visitor, ts.isExpression) :
77855                                 ts.isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) :
77856                                     undefined;
77857                             if (name) {
77858                                 var temp = factory.createTempVariable(undefined);
77859                                 wrapped = factory.createAssignmentTargetWrapper(temp, factory.createReflectSetCall(superClassReference, name, temp, classConstructor));
77860                             }
77861                         }
77862                     }
77863                 }
77864                 if (ts.isPropertyAssignment(node)) {
77865                     var initializer = ts.getInitializerOfBindingOrAssignmentElement(node);
77866                     return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ?
77867                         initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped :
77868                         ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression));
77869                 }
77870                 if (ts.isSpreadAssignment(node)) {
77871                     return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression));
77872                 }
77873                 ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target");
77874             }
77875             return ts.visitNode(node, visitor);
77876         }
77877         function visitAssignmentPattern(node) {
77878             if (ts.isArrayLiteralExpression(node)) {
77879                 return factory.updateArrayLiteralExpression(node, ts.visitNodes(node.elements, visitArrayAssignmentTarget, ts.isExpression));
77880             }
77881             else {
77882                 return factory.updateObjectLiteralExpression(node, ts.visitNodes(node.properties, visitObjectAssignmentTarget, ts.isObjectLiteralElementLike));
77883             }
77884         }
77885     }
77886     ts.transformClassFields = transformClassFields;
77887     function createPrivateStaticFieldInitializer(variableName, initializer) {
77888         return ts.factory.createAssignment(variableName, ts.factory.createObjectLiteralExpression([
77889             ts.factory.createPropertyAssignment("value", initializer || ts.factory.createVoidZero())
77890         ]));
77891     }
77892     function createPrivateInstanceFieldInitializer(receiver, initializer, weakMapName) {
77893         return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(weakMapName, "set"), undefined, [receiver, initializer || ts.factory.createVoidZero()]);
77894     }
77895     function createPrivateInstanceMethodInitializer(receiver, weakSetName) {
77896         return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(weakSetName, "add"), undefined, [receiver]);
77897     }
77898     function isReservedPrivateName(node) {
77899         return node.escapedText === "#constructor";
77900     }
77901 })(ts || (ts = {}));
77902 var ts;
77903 (function (ts) {
77904     function transformES2017(context) {
77905         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
77906         var resolver = context.getEmitResolver();
77907         var compilerOptions = context.getCompilerOptions();
77908         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
77909         var enabledSubstitutions;
77910         var enclosingSuperContainerFlags = 0;
77911         var enclosingFunctionParameterNames;
77912         var capturedSuperProperties;
77913         var hasSuperElementAccess;
77914         var substitutedSuperAccessors = [];
77915         var contextFlags = 0;
77916         var previousOnEmitNode = context.onEmitNode;
77917         var previousOnSubstituteNode = context.onSubstituteNode;
77918         context.onEmitNode = onEmitNode;
77919         context.onSubstituteNode = onSubstituteNode;
77920         return ts.chainBundle(context, transformSourceFile);
77921         function transformSourceFile(node) {
77922             if (node.isDeclarationFile) {
77923                 return node;
77924             }
77925             setContextFlag(1, false);
77926             setContextFlag(2, !ts.isEffectiveStrictModeSourceFile(node, compilerOptions));
77927             var visited = ts.visitEachChild(node, visitor, context);
77928             ts.addEmitHelpers(visited, context.readEmitHelpers());
77929             return visited;
77930         }
77931         function setContextFlag(flag, val) {
77932             contextFlags = val ? contextFlags | flag : contextFlags & ~flag;
77933         }
77934         function inContext(flags) {
77935             return (contextFlags & flags) !== 0;
77936         }
77937         function inTopLevelContext() {
77938             return !inContext(1);
77939         }
77940         function inHasLexicalThisContext() {
77941             return inContext(2);
77942         }
77943         function doWithContext(flags, cb, value) {
77944             var contextFlagsToSet = flags & ~contextFlags;
77945             if (contextFlagsToSet) {
77946                 setContextFlag(contextFlagsToSet, true);
77947                 var result = cb(value);
77948                 setContextFlag(contextFlagsToSet, false);
77949                 return result;
77950             }
77951             return cb(value);
77952         }
77953         function visitDefault(node) {
77954             return ts.visitEachChild(node, visitor, context);
77955         }
77956         function visitor(node) {
77957             if ((node.transformFlags & 128) === 0) {
77958                 return node;
77959             }
77960             switch (node.kind) {
77961                 case 131:
77962                     return undefined;
77963                 case 217:
77964                     return visitAwaitExpression(node);
77965                 case 168:
77966                     return doWithContext(1 | 2, visitMethodDeclaration, node);
77967                 case 255:
77968                     return doWithContext(1 | 2, visitFunctionDeclaration, node);
77969                 case 212:
77970                     return doWithContext(1 | 2, visitFunctionExpression, node);
77971                 case 213:
77972                     return doWithContext(1, visitArrowFunction, node);
77973                 case 205:
77974                     if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) {
77975                         capturedSuperProperties.add(node.name.escapedText);
77976                     }
77977                     return ts.visitEachChild(node, visitor, context);
77978                 case 206:
77979                     if (capturedSuperProperties && node.expression.kind === 106) {
77980                         hasSuperElementAccess = true;
77981                     }
77982                     return ts.visitEachChild(node, visitor, context);
77983                 case 171:
77984                 case 172:
77985                 case 170:
77986                 case 256:
77987                 case 225:
77988                     return doWithContext(1 | 2, visitDefault, node);
77989                 default:
77990                     return ts.visitEachChild(node, visitor, context);
77991             }
77992         }
77993         function asyncBodyVisitor(node) {
77994             if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
77995                 switch (node.kind) {
77996                     case 236:
77997                         return visitVariableStatementInAsyncBody(node);
77998                     case 241:
77999                         return visitForStatementInAsyncBody(node);
78000                     case 242:
78001                         return visitForInStatementInAsyncBody(node);
78002                     case 243:
78003                         return visitForOfStatementInAsyncBody(node);
78004                     case 291:
78005                         return visitCatchClauseInAsyncBody(node);
78006                     case 234:
78007                     case 248:
78008                     case 262:
78009                     case 288:
78010                     case 289:
78011                     case 251:
78012                     case 239:
78013                     case 240:
78014                     case 238:
78015                     case 247:
78016                     case 249:
78017                         return ts.visitEachChild(node, asyncBodyVisitor, context);
78018                     default:
78019                         return ts.Debug.assertNever(node, "Unhandled node.");
78020                 }
78021             }
78022             return visitor(node);
78023         }
78024         function visitCatchClauseInAsyncBody(node) {
78025             var catchClauseNames = new ts.Set();
78026             recordDeclarationName(node.variableDeclaration, catchClauseNames);
78027             var catchClauseUnshadowedNames;
78028             catchClauseNames.forEach(function (_, escapedName) {
78029                 if (enclosingFunctionParameterNames.has(escapedName)) {
78030                     if (!catchClauseUnshadowedNames) {
78031                         catchClauseUnshadowedNames = new ts.Set(enclosingFunctionParameterNames);
78032                     }
78033                     catchClauseUnshadowedNames.delete(escapedName);
78034                 }
78035             });
78036             if (catchClauseUnshadowedNames) {
78037                 var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
78038                 enclosingFunctionParameterNames = catchClauseUnshadowedNames;
78039                 var result = ts.visitEachChild(node, asyncBodyVisitor, context);
78040                 enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
78041                 return result;
78042             }
78043             else {
78044                 return ts.visitEachChild(node, asyncBodyVisitor, context);
78045             }
78046         }
78047         function visitVariableStatementInAsyncBody(node) {
78048             if (isVariableDeclarationListWithCollidingName(node.declarationList)) {
78049                 var expression = visitVariableDeclarationListWithCollidingNames(node.declarationList, false);
78050                 return expression ? factory.createExpressionStatement(expression) : undefined;
78051             }
78052             return ts.visitEachChild(node, visitor, context);
78053         }
78054         function visitForInStatementInAsyncBody(node) {
78055             return factory.updateForInStatement(node, isVariableDeclarationListWithCollidingName(node.initializer)
78056                 ? visitVariableDeclarationListWithCollidingNames(node.initializer, true)
78057                 : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, asyncBodyVisitor, context));
78058         }
78059         function visitForOfStatementInAsyncBody(node) {
78060             return factory.updateForOfStatement(node, ts.visitNode(node.awaitModifier, visitor, ts.isToken), isVariableDeclarationListWithCollidingName(node.initializer)
78061                 ? visitVariableDeclarationListWithCollidingNames(node.initializer, true)
78062                 : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, asyncBodyVisitor, context));
78063         }
78064         function visitForStatementInAsyncBody(node) {
78065             var initializer = node.initializer;
78066             return factory.updateForStatement(node, isVariableDeclarationListWithCollidingName(initializer)
78067                 ? visitVariableDeclarationListWithCollidingNames(initializer, false)
78068                 : ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitIterationBody(node.statement, asyncBodyVisitor, context));
78069         }
78070         function visitAwaitExpression(node) {
78071             if (inTopLevelContext()) {
78072                 return ts.visitEachChild(node, visitor, context);
78073             }
78074             return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
78075         }
78076         function visitMethodDeclaration(node) {
78077             return factory.updateMethodDeclaration(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
78078                 ? transformAsyncFunctionBody(node)
78079                 : ts.visitFunctionBody(node.body, visitor, context));
78080         }
78081         function visitFunctionDeclaration(node) {
78082             return factory.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
78083                 ? transformAsyncFunctionBody(node)
78084                 : ts.visitFunctionBody(node.body, visitor, context));
78085         }
78086         function visitFunctionExpression(node) {
78087             return factory.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
78088                 ? transformAsyncFunctionBody(node)
78089                 : ts.visitFunctionBody(node.body, visitor, context));
78090         }
78091         function visitArrowFunction(node) {
78092             return factory.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, ts.getFunctionFlags(node) & 2
78093                 ? transformAsyncFunctionBody(node)
78094                 : ts.visitFunctionBody(node.body, visitor, context));
78095         }
78096         function recordDeclarationName(_a, names) {
78097             var name = _a.name;
78098             if (ts.isIdentifier(name)) {
78099                 names.add(name.escapedText);
78100             }
78101             else {
78102                 for (var _i = 0, _b = name.elements; _i < _b.length; _i++) {
78103                     var element = _b[_i];
78104                     if (!ts.isOmittedExpression(element)) {
78105                         recordDeclarationName(element, names);
78106                     }
78107                 }
78108             }
78109         }
78110         function isVariableDeclarationListWithCollidingName(node) {
78111             return !!node
78112                 && ts.isVariableDeclarationList(node)
78113                 && !(node.flags & 3)
78114                 && node.declarations.some(collidesWithParameterName);
78115         }
78116         function visitVariableDeclarationListWithCollidingNames(node, hasReceiver) {
78117             hoistVariableDeclarationList(node);
78118             var variables = ts.getInitializedVariables(node);
78119             if (variables.length === 0) {
78120                 if (hasReceiver) {
78121                     return ts.visitNode(factory.converters.convertToAssignmentElementTarget(node.declarations[0].name), visitor, ts.isExpression);
78122                 }
78123                 return undefined;
78124             }
78125             return factory.inlineExpressions(ts.map(variables, transformInitializedVariable));
78126         }
78127         function hoistVariableDeclarationList(node) {
78128             ts.forEach(node.declarations, hoistVariable);
78129         }
78130         function hoistVariable(_a) {
78131             var name = _a.name;
78132             if (ts.isIdentifier(name)) {
78133                 hoistVariableDeclaration(name);
78134             }
78135             else {
78136                 for (var _i = 0, _b = name.elements; _i < _b.length; _i++) {
78137                     var element = _b[_i];
78138                     if (!ts.isOmittedExpression(element)) {
78139                         hoistVariable(element);
78140                     }
78141                 }
78142             }
78143         }
78144         function transformInitializedVariable(node) {
78145             var converted = ts.setSourceMapRange(factory.createAssignment(factory.converters.convertToAssignmentElementTarget(node.name), node.initializer), node);
78146             return ts.visitNode(converted, visitor, ts.isExpression);
78147         }
78148         function collidesWithParameterName(_a) {
78149             var name = _a.name;
78150             if (ts.isIdentifier(name)) {
78151                 return enclosingFunctionParameterNames.has(name.escapedText);
78152             }
78153             else {
78154                 for (var _i = 0, _b = name.elements; _i < _b.length; _i++) {
78155                     var element = _b[_i];
78156                     if (!ts.isOmittedExpression(element) && collidesWithParameterName(element)) {
78157                         return true;
78158                     }
78159                 }
78160             }
78161             return false;
78162         }
78163         function transformAsyncFunctionBody(node) {
78164             resumeLexicalEnvironment();
78165             var original = ts.getOriginalNode(node, ts.isFunctionLike);
78166             var nodeType = original.type;
78167             var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
78168             var isArrowFunction = node.kind === 213;
78169             var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
78170             var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
78171             enclosingFunctionParameterNames = new ts.Set();
78172             for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
78173                 var parameter = _a[_i];
78174                 recordDeclarationName(parameter, enclosingFunctionParameterNames);
78175             }
78176             var savedCapturedSuperProperties = capturedSuperProperties;
78177             var savedHasSuperElementAccess = hasSuperElementAccess;
78178             if (!isArrowFunction) {
78179                 capturedSuperProperties = new ts.Set();
78180                 hasSuperElementAccess = false;
78181             }
78182             var result;
78183             if (!isArrowFunction) {
78184                 var statements = [];
78185                 var statementOffset = factory.copyPrologue(node.body.statements, statements, false, visitor);
78186                 statements.push(factory.createReturnStatement(emitHelpers().createAwaiterHelper(inHasLexicalThisContext(), hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body, statementOffset))));
78187                 ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
78188                 var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048);
78189                 if (emitSuperHelpers) {
78190                     enableSubstitutionForAsyncMethodsWithSuper();
78191                     if (capturedSuperProperties.size) {
78192                         var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
78193                         substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
78194                         ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
78195                     }
78196                 }
78197                 var block = factory.createBlock(statements, true);
78198                 ts.setTextRange(block, node.body);
78199                 if (emitSuperHelpers && hasSuperElementAccess) {
78200                     if (resolver.getNodeCheckFlags(node) & 4096) {
78201                         ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
78202                     }
78203                     else if (resolver.getNodeCheckFlags(node) & 2048) {
78204                         ts.addEmitHelper(block, ts.asyncSuperHelper);
78205                     }
78206                 }
78207                 result = block;
78208             }
78209             else {
78210                 var expression = emitHelpers().createAwaiterHelper(inHasLexicalThisContext(), hasLexicalArguments, promiseConstructor, transformAsyncFunctionBodyWorker(node.body));
78211                 var declarations = endLexicalEnvironment();
78212                 if (ts.some(declarations)) {
78213                     var block = factory.converters.convertToFunctionBlock(expression);
78214                     result = factory.updateBlock(block, ts.setTextRange(factory.createNodeArray(ts.concatenate(declarations, block.statements)), block.statements));
78215                 }
78216                 else {
78217                     result = expression;
78218                 }
78219             }
78220             enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
78221             if (!isArrowFunction) {
78222                 capturedSuperProperties = savedCapturedSuperProperties;
78223                 hasSuperElementAccess = savedHasSuperElementAccess;
78224             }
78225             return result;
78226         }
78227         function transformAsyncFunctionBodyWorker(body, start) {
78228             if (ts.isBlock(body)) {
78229                 return factory.updateBlock(body, ts.visitNodes(body.statements, asyncBodyVisitor, ts.isStatement, start));
78230             }
78231             else {
78232                 return factory.converters.convertToFunctionBlock(ts.visitNode(body, asyncBodyVisitor, ts.isConciseBody));
78233             }
78234         }
78235         function getPromiseConstructor(type) {
78236             var typeName = type && ts.getEntityNameFromTypeNode(type);
78237             if (typeName && ts.isEntityName(typeName)) {
78238                 var serializationKind = resolver.getTypeReferenceSerializationKind(typeName);
78239                 if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue
78240                     || serializationKind === ts.TypeReferenceSerializationKind.Unknown) {
78241                     return typeName;
78242                 }
78243             }
78244             return undefined;
78245         }
78246         function enableSubstitutionForAsyncMethodsWithSuper() {
78247             if ((enabledSubstitutions & 1) === 0) {
78248                 enabledSubstitutions |= 1;
78249                 context.enableSubstitution(207);
78250                 context.enableSubstitution(205);
78251                 context.enableSubstitution(206);
78252                 context.enableEmitNotification(256);
78253                 context.enableEmitNotification(168);
78254                 context.enableEmitNotification(171);
78255                 context.enableEmitNotification(172);
78256                 context.enableEmitNotification(170);
78257                 context.enableEmitNotification(236);
78258             }
78259         }
78260         function onEmitNode(hint, node, emitCallback) {
78261             if (enabledSubstitutions & 1 && isSuperContainer(node)) {
78262                 var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096);
78263                 if (superContainerFlags !== enclosingSuperContainerFlags) {
78264                     var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
78265                     enclosingSuperContainerFlags = superContainerFlags;
78266                     previousOnEmitNode(hint, node, emitCallback);
78267                     enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
78268                     return;
78269                 }
78270             }
78271             else if (enabledSubstitutions && substitutedSuperAccessors[ts.getNodeId(node)]) {
78272                 var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
78273                 enclosingSuperContainerFlags = 0;
78274                 previousOnEmitNode(hint, node, emitCallback);
78275                 enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
78276                 return;
78277             }
78278             previousOnEmitNode(hint, node, emitCallback);
78279         }
78280         function onSubstituteNode(hint, node) {
78281             node = previousOnSubstituteNode(hint, node);
78282             if (hint === 1 && enclosingSuperContainerFlags) {
78283                 return substituteExpression(node);
78284             }
78285             return node;
78286         }
78287         function substituteExpression(node) {
78288             switch (node.kind) {
78289                 case 205:
78290                     return substitutePropertyAccessExpression(node);
78291                 case 206:
78292                     return substituteElementAccessExpression(node);
78293                 case 207:
78294                     return substituteCallExpression(node);
78295             }
78296             return node;
78297         }
78298         function substitutePropertyAccessExpression(node) {
78299             if (node.expression.kind === 106) {
78300                 return ts.setTextRange(factory.createPropertyAccessExpression(factory.createUniqueName("_super", 16 | 32), node.name), node);
78301             }
78302             return node;
78303         }
78304         function substituteElementAccessExpression(node) {
78305             if (node.expression.kind === 106) {
78306                 return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
78307             }
78308             return node;
78309         }
78310         function substituteCallExpression(node) {
78311             var expression = node.expression;
78312             if (ts.isSuperProperty(expression)) {
78313                 var argumentExpression = ts.isPropertyAccessExpression(expression)
78314                     ? substitutePropertyAccessExpression(expression)
78315                     : substituteElementAccessExpression(expression);
78316                 return factory.createCallExpression(factory.createPropertyAccessExpression(argumentExpression, "call"), undefined, __spreadArray([
78317                     factory.createThis()
78318                 ], node.arguments, true));
78319             }
78320             return node;
78321         }
78322         function isSuperContainer(node) {
78323             var kind = node.kind;
78324             return kind === 256
78325                 || kind === 170
78326                 || kind === 168
78327                 || kind === 171
78328                 || kind === 172;
78329         }
78330         function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
78331             if (enclosingSuperContainerFlags & 4096) {
78332                 return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 | 32), undefined, [argumentExpression]), "value"), location);
78333             }
78334             else {
78335                 return ts.setTextRange(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 | 32), undefined, [argumentExpression]), location);
78336             }
78337         }
78338     }
78339     ts.transformES2017 = transformES2017;
78340     function createSuperAccessVariableStatement(factory, resolver, node, names) {
78341         var hasBinding = (resolver.getNodeCheckFlags(node) & 4096) !== 0;
78342         var accessors = [];
78343         names.forEach(function (_, key) {
78344             var name = ts.unescapeLeadingUnderscores(key);
78345             var getterAndSetter = [];
78346             getterAndSetter.push(factory.createPropertyAssignment("get", factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.setEmitFlags(factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createSuper(), 4), name), 4))));
78347             if (hasBinding) {
78348                 getterAndSetter.push(factory.createPropertyAssignment("set", factory.createArrowFunction(undefined, undefined, [
78349                     factory.createParameterDeclaration(undefined, undefined, undefined, "v", undefined, undefined, undefined)
78350                 ], undefined, undefined, factory.createAssignment(ts.setEmitFlags(factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createSuper(), 4), name), 4), factory.createIdentifier("v")))));
78351             }
78352             accessors.push(factory.createPropertyAssignment(name, factory.createObjectLiteralExpression(getterAndSetter)));
78353         });
78354         return factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
78355             factory.createVariableDeclaration(factory.createUniqueName("_super", 16 | 32), undefined, undefined, factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "create"), undefined, [
78356                 factory.createNull(),
78357                 factory.createObjectLiteralExpression(accessors, true)
78358             ]))
78359         ], 2));
78360     }
78361     ts.createSuperAccessVariableStatement = createSuperAccessVariableStatement;
78362 })(ts || (ts = {}));
78363 var ts;
78364 (function (ts) {
78365     function transformES2018(context) {
78366         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
78367         var resolver = context.getEmitResolver();
78368         var compilerOptions = context.getCompilerOptions();
78369         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
78370         var previousOnEmitNode = context.onEmitNode;
78371         context.onEmitNode = onEmitNode;
78372         var previousOnSubstituteNode = context.onSubstituteNode;
78373         context.onSubstituteNode = onSubstituteNode;
78374         var exportedVariableStatement = false;
78375         var enabledSubstitutions;
78376         var enclosingFunctionFlags;
78377         var enclosingSuperContainerFlags = 0;
78378         var hierarchyFacts = 0;
78379         var currentSourceFile;
78380         var taggedTemplateStringDeclarations;
78381         var capturedSuperProperties;
78382         var hasSuperElementAccess;
78383         var substitutedSuperAccessors = [];
78384         return ts.chainBundle(context, transformSourceFile);
78385         function affectsSubtree(excludeFacts, includeFacts) {
78386             return hierarchyFacts !== (hierarchyFacts & ~excludeFacts | includeFacts);
78387         }
78388         function enterSubtree(excludeFacts, includeFacts) {
78389             var ancestorFacts = hierarchyFacts;
78390             hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 3;
78391             return ancestorFacts;
78392         }
78393         function exitSubtree(ancestorFacts) {
78394             hierarchyFacts = ancestorFacts;
78395         }
78396         function recordTaggedTemplateString(temp) {
78397             taggedTemplateStringDeclarations = ts.append(taggedTemplateStringDeclarations, factory.createVariableDeclaration(temp));
78398         }
78399         function transformSourceFile(node) {
78400             if (node.isDeclarationFile) {
78401                 return node;
78402             }
78403             currentSourceFile = node;
78404             var visited = visitSourceFile(node);
78405             ts.addEmitHelpers(visited, context.readEmitHelpers());
78406             currentSourceFile = undefined;
78407             taggedTemplateStringDeclarations = undefined;
78408             return visited;
78409         }
78410         function visitor(node) {
78411             return visitorWorker(node, false);
78412         }
78413         function visitorWithUnusedExpressionResult(node) {
78414             return visitorWorker(node, true);
78415         }
78416         function visitorNoAsyncModifier(node) {
78417             if (node.kind === 131) {
78418                 return undefined;
78419             }
78420             return node;
78421         }
78422         function doWithHierarchyFacts(cb, value, excludeFacts, includeFacts) {
78423             if (affectsSubtree(excludeFacts, includeFacts)) {
78424                 var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
78425                 var result = cb(value);
78426                 exitSubtree(ancestorFacts);
78427                 return result;
78428             }
78429             return cb(value);
78430         }
78431         function visitDefault(node) {
78432             return ts.visitEachChild(node, visitor, context);
78433         }
78434         function visitorWorker(node, expressionResultIsUnused) {
78435             if ((node.transformFlags & 64) === 0) {
78436                 return node;
78437             }
78438             switch (node.kind) {
78439                 case 217:
78440                     return visitAwaitExpression(node);
78441                 case 223:
78442                     return visitYieldExpression(node);
78443                 case 246:
78444                     return visitReturnStatement(node);
78445                 case 249:
78446                     return visitLabeledStatement(node);
78447                 case 204:
78448                     return visitObjectLiteralExpression(node);
78449                 case 220:
78450                     return visitBinaryExpression(node, expressionResultIsUnused);
78451                 case 349:
78452                     return visitCommaListExpression(node, expressionResultIsUnused);
78453                 case 291:
78454                     return visitCatchClause(node);
78455                 case 236:
78456                     return visitVariableStatement(node);
78457                 case 253:
78458                     return visitVariableDeclaration(node);
78459                 case 239:
78460                 case 240:
78461                 case 242:
78462                     return doWithHierarchyFacts(visitDefault, node, 0, 2);
78463                 case 243:
78464                     return visitForOfStatement(node, undefined);
78465                 case 241:
78466                     return doWithHierarchyFacts(visitForStatement, node, 0, 2);
78467                 case 216:
78468                     return visitVoidExpression(node);
78469                 case 170:
78470                     return doWithHierarchyFacts(visitConstructorDeclaration, node, 2, 1);
78471                 case 168:
78472                     return doWithHierarchyFacts(visitMethodDeclaration, node, 2, 1);
78473                 case 171:
78474                     return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2, 1);
78475                 case 172:
78476                     return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2, 1);
78477                 case 255:
78478                     return doWithHierarchyFacts(visitFunctionDeclaration, node, 2, 1);
78479                 case 212:
78480                     return doWithHierarchyFacts(visitFunctionExpression, node, 2, 1);
78481                 case 213:
78482                     return doWithHierarchyFacts(visitArrowFunction, node, 2, 0);
78483                 case 163:
78484                     return visitParameter(node);
78485                 case 237:
78486                     return visitExpressionStatement(node);
78487                 case 211:
78488                     return visitParenthesizedExpression(node, expressionResultIsUnused);
78489                 case 209:
78490                     return visitTaggedTemplateExpression(node);
78491                 case 205:
78492                     if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) {
78493                         capturedSuperProperties.add(node.name.escapedText);
78494                     }
78495                     return ts.visitEachChild(node, visitor, context);
78496                 case 206:
78497                     if (capturedSuperProperties && node.expression.kind === 106) {
78498                         hasSuperElementAccess = true;
78499                     }
78500                     return ts.visitEachChild(node, visitor, context);
78501                 case 256:
78502                 case 225:
78503                     return doWithHierarchyFacts(visitDefault, node, 2, 1);
78504                 default:
78505                     return ts.visitEachChild(node, visitor, context);
78506             }
78507         }
78508         function visitAwaitExpression(node) {
78509             if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78510                 return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, emitHelpers().createAwaitHelper(ts.visitNode(node.expression, visitor, ts.isExpression))), node), node);
78511             }
78512             return ts.visitEachChild(node, visitor, context);
78513         }
78514         function visitYieldExpression(node) {
78515             if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78516                 if (node.asteriskToken) {
78517                     var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
78518                     return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
78519                 }
78520                 return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, createDownlevelAwait(node.expression
78521                     ? ts.visitNode(node.expression, visitor, ts.isExpression)
78522                     : factory.createVoidZero())), node), node);
78523             }
78524             return ts.visitEachChild(node, visitor, context);
78525         }
78526         function visitReturnStatement(node) {
78527             if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78528                 return factory.updateReturnStatement(node, createDownlevelAwait(node.expression ? ts.visitNode(node.expression, visitor, ts.isExpression) : factory.createVoidZero()));
78529             }
78530             return ts.visitEachChild(node, visitor, context);
78531         }
78532         function visitLabeledStatement(node) {
78533             if (enclosingFunctionFlags & 2) {
78534                 var statement = ts.unwrapInnermostStatementOfLabel(node);
78535                 if (statement.kind === 243 && statement.awaitModifier) {
78536                     return visitForOfStatement(statement, node);
78537                 }
78538                 return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node);
78539             }
78540             return ts.visitEachChild(node, visitor, context);
78541         }
78542         function chunkObjectLiteralElements(elements) {
78543             var chunkObject;
78544             var objects = [];
78545             for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
78546                 var e = elements_4[_i];
78547                 if (e.kind === 296) {
78548                     if (chunkObject) {
78549                         objects.push(factory.createObjectLiteralExpression(chunkObject));
78550                         chunkObject = undefined;
78551                     }
78552                     var target = e.expression;
78553                     objects.push(ts.visitNode(target, visitor, ts.isExpression));
78554                 }
78555                 else {
78556                     chunkObject = ts.append(chunkObject, e.kind === 294
78557                         ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
78558                         : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
78559                 }
78560             }
78561             if (chunkObject) {
78562                 objects.push(factory.createObjectLiteralExpression(chunkObject));
78563             }
78564             return objects;
78565         }
78566         function visitObjectLiteralExpression(node) {
78567             if (node.transformFlags & 32768) {
78568                 var objects = chunkObjectLiteralElements(node.properties);
78569                 if (objects.length && objects[0].kind !== 204) {
78570                     objects.unshift(factory.createObjectLiteralExpression());
78571                 }
78572                 var expression = objects[0];
78573                 if (objects.length > 1) {
78574                     for (var i = 1; i < objects.length; i++) {
78575                         expression = emitHelpers().createAssignHelper([expression, objects[i]]);
78576                     }
78577                     return expression;
78578                 }
78579                 else {
78580                     return emitHelpers().createAssignHelper(objects);
78581                 }
78582             }
78583             return ts.visitEachChild(node, visitor, context);
78584         }
78585         function visitExpressionStatement(node) {
78586             return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
78587         }
78588         function visitParenthesizedExpression(node, expressionResultIsUnused) {
78589             return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context);
78590         }
78591         function visitSourceFile(node) {
78592             var ancestorFacts = enterSubtree(2, ts.isEffectiveStrictModeSourceFile(node, compilerOptions) ?
78593                 0 :
78594                 1);
78595             exportedVariableStatement = false;
78596             var visited = ts.visitEachChild(node, visitor, context);
78597             var statement = ts.concatenate(visited.statements, taggedTemplateStringDeclarations && [
78598                 factory.createVariableStatement(undefined, factory.createVariableDeclarationList(taggedTemplateStringDeclarations))
78599             ]);
78600             var result = factory.updateSourceFile(visited, ts.setTextRange(factory.createNodeArray(statement), node.statements));
78601             exitSubtree(ancestorFacts);
78602             return result;
78603         }
78604         function visitTaggedTemplateExpression(node) {
78605             return ts.processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, ts.ProcessLevel.LiftRestriction);
78606         }
78607         function visitBinaryExpression(node, expressionResultIsUnused) {
78608             if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 32768) {
78609                 return ts.flattenDestructuringAssignment(node, visitor, context, 1, !expressionResultIsUnused);
78610             }
78611             if (node.operatorToken.kind === 27) {
78612                 return factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorWithUnusedExpressionResult, ts.isExpression), node.operatorToken, ts.visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, ts.isExpression));
78613             }
78614             return ts.visitEachChild(node, visitor, context);
78615         }
78616         function visitCommaListExpression(node, expressionResultIsUnused) {
78617             if (expressionResultIsUnused) {
78618                 return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
78619             }
78620             var result;
78621             for (var i = 0; i < node.elements.length; i++) {
78622                 var element = node.elements[i];
78623                 var visited = ts.visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, ts.isExpression);
78624                 if (result || visited !== element) {
78625                     result || (result = node.elements.slice(0, i));
78626                     result.push(visited);
78627                 }
78628             }
78629             var elements = result ? ts.setTextRange(factory.createNodeArray(result), node.elements) : node.elements;
78630             return factory.updateCommaListExpression(node, elements);
78631         }
78632         function visitCatchClause(node) {
78633             if (node.variableDeclaration &&
78634                 ts.isBindingPattern(node.variableDeclaration.name) &&
78635                 node.variableDeclaration.name.transformFlags & 32768) {
78636                 var name = factory.getGeneratedNameForNode(node.variableDeclaration.name);
78637                 var updatedDecl = factory.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, undefined, undefined, name);
78638                 var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1);
78639                 var block = ts.visitNode(node.block, visitor, ts.isBlock);
78640                 if (ts.some(visitedBindings)) {
78641                     block = factory.updateBlock(block, __spreadArray([
78642                         factory.createVariableStatement(undefined, visitedBindings)
78643                     ], block.statements, true));
78644                 }
78645                 return factory.updateCatchClause(node, factory.updateVariableDeclaration(node.variableDeclaration, name, undefined, undefined, undefined), block);
78646             }
78647             return ts.visitEachChild(node, visitor, context);
78648         }
78649         function visitVariableStatement(node) {
78650             if (ts.hasSyntacticModifier(node, 1)) {
78651                 var savedExportedVariableStatement = exportedVariableStatement;
78652                 exportedVariableStatement = true;
78653                 var visited = ts.visitEachChild(node, visitor, context);
78654                 exportedVariableStatement = savedExportedVariableStatement;
78655                 return visited;
78656             }
78657             return ts.visitEachChild(node, visitor, context);
78658         }
78659         function visitVariableDeclaration(node) {
78660             if (exportedVariableStatement) {
78661                 var savedExportedVariableStatement = exportedVariableStatement;
78662                 exportedVariableStatement = false;
78663                 var visited = visitVariableDeclarationWorker(node, true);
78664                 exportedVariableStatement = savedExportedVariableStatement;
78665                 return visited;
78666             }
78667             return visitVariableDeclarationWorker(node, false);
78668         }
78669         function visitVariableDeclarationWorker(node, exportedVariableStatement) {
78670             if (ts.isBindingPattern(node.name) && node.name.transformFlags & 32768) {
78671                 return ts.flattenDestructuringBinding(node, visitor, context, 1, undefined, exportedVariableStatement);
78672             }
78673             return ts.visitEachChild(node, visitor, context);
78674         }
78675         function visitForStatement(node) {
78676             return factory.updateForStatement(node, ts.visitNode(node.initializer, visitorWithUnusedExpressionResult, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitorWithUnusedExpressionResult, ts.isExpression), ts.visitIterationBody(node.statement, visitor, context));
78677         }
78678         function visitVoidExpression(node) {
78679             return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
78680         }
78681         function visitForOfStatement(node, outermostLabeledStatement) {
78682             var ancestorFacts = enterSubtree(0, 2);
78683             if (node.initializer.transformFlags & 32768) {
78684                 node = transformForOfStatementWithObjectRest(node);
78685             }
78686             var result = node.awaitModifier ?
78687                 transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) :
78688                 factory.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement);
78689             exitSubtree(ancestorFacts);
78690             return result;
78691         }
78692         function transformForOfStatementWithObjectRest(node) {
78693             var initializerWithoutParens = ts.skipParentheses(node.initializer);
78694             if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) {
78695                 var bodyLocation = void 0;
78696                 var statementsLocation = void 0;
78697                 var temp = factory.createTempVariable(undefined);
78698                 var statements = [ts.createForOfBindingStatement(factory, initializerWithoutParens, temp)];
78699                 if (ts.isBlock(node.statement)) {
78700                     ts.addRange(statements, node.statement.statements);
78701                     bodyLocation = node.statement;
78702                     statementsLocation = node.statement.statements;
78703                 }
78704                 else if (node.statement) {
78705                     ts.append(statements, node.statement);
78706                     bodyLocation = node.statement;
78707                     statementsLocation = node.statement;
78708                 }
78709                 return factory.updateForOfStatement(node, node.awaitModifier, ts.setTextRange(factory.createVariableDeclarationList([
78710                     ts.setTextRange(factory.createVariableDeclaration(temp), node.initializer)
78711                 ], 1), node.initializer), node.expression, ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true), bodyLocation));
78712             }
78713             return node;
78714         }
78715         function convertForOfStatementHead(node, boundValue) {
78716             var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue);
78717             var bodyLocation;
78718             var statementsLocation;
78719             var statements = [ts.visitNode(binding, visitor, ts.isStatement)];
78720             var statement = ts.visitIterationBody(node.statement, visitor, context);
78721             if (ts.isBlock(statement)) {
78722                 ts.addRange(statements, statement.statements);
78723                 bodyLocation = statement;
78724                 statementsLocation = statement.statements;
78725             }
78726             else {
78727                 statements.push(statement);
78728             }
78729             return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384);
78730         }
78731         function createDownlevelAwait(expression) {
78732             return enclosingFunctionFlags & 1
78733                 ? factory.createYieldExpression(undefined, emitHelpers().createAwaitHelper(expression))
78734                 : factory.createAwaitExpression(expression);
78735         }
78736         function transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) {
78737             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
78738             var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(undefined);
78739             var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(undefined);
78740             var errorRecord = factory.createUniqueName("e");
78741             var catchVariable = factory.getGeneratedNameForNode(errorRecord);
78742             var returnMethod = factory.createTempVariable(undefined);
78743             var callValues = ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), node.expression);
78744             var callNext = factory.createCallExpression(factory.createPropertyAccessExpression(iterator, "next"), undefined, []);
78745             var getDone = factory.createPropertyAccessExpression(result, "done");
78746             var getValue = factory.createPropertyAccessExpression(result, "value");
78747             var callReturn = factory.createFunctionCallCall(returnMethod, iterator, []);
78748             hoistVariableDeclaration(errorRecord);
78749             hoistVariableDeclaration(returnMethod);
78750             var initializer = ancestorFacts & 2 ?
78751                 factory.inlineExpressions([factory.createAssignment(errorRecord, factory.createVoidZero()), callValues]) :
78752                 callValues;
78753             var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement(ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([
78754                 ts.setTextRange(factory.createVariableDeclaration(iterator, undefined, undefined, initializer), node.expression),
78755                 factory.createVariableDeclaration(result)
78756             ]), node.expression), 2097152), factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), undefined, convertForOfStatementHead(node, getValue)), node), 256);
78757             return factory.createTryStatement(factory.createBlock([
78758                 factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement)
78759             ]), factory.createCatchClause(factory.createVariableDeclaration(catchVariable), ts.setEmitFlags(factory.createBlock([
78760                 factory.createExpressionStatement(factory.createAssignment(errorRecord, factory.createObjectLiteralExpression([
78761                     factory.createPropertyAssignment("error", catchVariable)
78762                 ])))
78763             ]), 1)), factory.createBlock([
78764                 factory.createTryStatement(factory.createBlock([
78765                     ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1)
78766                 ]), undefined, ts.setEmitFlags(factory.createBlock([
78767                     ts.setEmitFlags(factory.createIfStatement(errorRecord, factory.createThrowStatement(factory.createPropertyAccessExpression(errorRecord, "error"))), 1)
78768                 ]), 1))
78769             ]));
78770         }
78771         function visitParameter(node) {
78772             if (node.transformFlags & 32768) {
78773                 return factory.updateParameterDeclaration(node, undefined, undefined, node.dotDotDotToken, factory.getGeneratedNameForNode(node), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression));
78774             }
78775             return ts.visitEachChild(node, visitor, context);
78776         }
78777         function visitConstructorDeclaration(node) {
78778             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78779             enclosingFunctionFlags = 0;
78780             var updated = factory.updateConstructorDeclaration(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
78781             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78782             return updated;
78783         }
78784         function visitGetAccessorDeclaration(node) {
78785             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78786             enclosingFunctionFlags = 0;
78787             var updated = factory.updateGetAccessorDeclaration(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
78788             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78789             return updated;
78790         }
78791         function visitSetAccessorDeclaration(node) {
78792             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78793             enclosingFunctionFlags = 0;
78794             var updated = factory.updateSetAccessorDeclaration(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node));
78795             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78796             return updated;
78797         }
78798         function visitMethodDeclaration(node) {
78799             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78800             enclosingFunctionFlags = ts.getFunctionFlags(node);
78801             var updated = factory.updateMethodDeclaration(node, undefined, enclosingFunctionFlags & 1
78802                 ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier)
78803                 : node.modifiers, enclosingFunctionFlags & 2
78804                 ? undefined
78805                 : 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
78806                 ? transformAsyncGeneratorFunctionBody(node)
78807                 : transformFunctionBody(node));
78808             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78809             return updated;
78810         }
78811         function visitFunctionDeclaration(node) {
78812             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78813             enclosingFunctionFlags = ts.getFunctionFlags(node);
78814             var updated = factory.updateFunctionDeclaration(node, undefined, enclosingFunctionFlags & 1
78815                 ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier)
78816                 : node.modifiers, enclosingFunctionFlags & 2
78817                 ? undefined
78818                 : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1
78819                 ? transformAsyncGeneratorFunctionBody(node)
78820                 : transformFunctionBody(node));
78821             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78822             return updated;
78823         }
78824         function visitArrowFunction(node) {
78825             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78826             enclosingFunctionFlags = ts.getFunctionFlags(node);
78827             var updated = factory.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, transformFunctionBody(node));
78828             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78829             return updated;
78830         }
78831         function visitFunctionExpression(node) {
78832             var savedEnclosingFunctionFlags = enclosingFunctionFlags;
78833             enclosingFunctionFlags = ts.getFunctionFlags(node);
78834             var updated = factory.updateFunctionExpression(node, enclosingFunctionFlags & 1
78835                 ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier)
78836                 : node.modifiers, enclosingFunctionFlags & 2
78837                 ? undefined
78838                 : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1
78839                 ? transformAsyncGeneratorFunctionBody(node)
78840                 : transformFunctionBody(node));
78841             enclosingFunctionFlags = savedEnclosingFunctionFlags;
78842             return updated;
78843         }
78844         function transformAsyncGeneratorFunctionBody(node) {
78845             resumeLexicalEnvironment();
78846             var statements = [];
78847             var statementOffset = factory.copyPrologue(node.body.statements, statements, false, visitor);
78848             appendObjectRestAssignmentsIfNeeded(statements, node);
78849             var savedCapturedSuperProperties = capturedSuperProperties;
78850             var savedHasSuperElementAccess = hasSuperElementAccess;
78851             capturedSuperProperties = new ts.Set();
78852             hasSuperElementAccess = false;
78853             var returnStatement = factory.createReturnStatement(emitHelpers().createAsyncGeneratorHelper(factory.createFunctionExpression(undefined, factory.createToken(41), node.name && factory.getGeneratedNameForNode(node.name), undefined, [], undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1)));
78854             var emitSuperHelpers = languageVersion >= 2 && resolver.getNodeCheckFlags(node) & (4096 | 2048);
78855             if (emitSuperHelpers) {
78856                 enableSubstitutionForAsyncMethodsWithSuper();
78857                 var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
78858                 substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
78859                 ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
78860             }
78861             statements.push(returnStatement);
78862             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
78863             var block = factory.updateBlock(node.body, statements);
78864             if (emitSuperHelpers && hasSuperElementAccess) {
78865                 if (resolver.getNodeCheckFlags(node) & 4096) {
78866                     ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
78867                 }
78868                 else if (resolver.getNodeCheckFlags(node) & 2048) {
78869                     ts.addEmitHelper(block, ts.asyncSuperHelper);
78870                 }
78871             }
78872             capturedSuperProperties = savedCapturedSuperProperties;
78873             hasSuperElementAccess = savedHasSuperElementAccess;
78874             return block;
78875         }
78876         function transformFunctionBody(node) {
78877             var _a;
78878             resumeLexicalEnvironment();
78879             var statementOffset = 0;
78880             var statements = [];
78881             var body = (_a = ts.visitNode(node.body, visitor, ts.isConciseBody)) !== null && _a !== void 0 ? _a : factory.createBlock([]);
78882             if (ts.isBlock(body)) {
78883                 statementOffset = factory.copyPrologue(body.statements, statements, false, visitor);
78884             }
78885             ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(undefined, node));
78886             var leadingStatements = endLexicalEnvironment();
78887             if (statementOffset > 0 || ts.some(statements) || ts.some(leadingStatements)) {
78888                 var block = factory.converters.convertToFunctionBlock(body, true);
78889                 ts.insertStatementsAfterStandardPrologue(statements, leadingStatements);
78890                 ts.addRange(statements, block.statements.slice(statementOffset));
78891                 return factory.updateBlock(block, ts.setTextRange(factory.createNodeArray(statements), block.statements));
78892             }
78893             return body;
78894         }
78895         function appendObjectRestAssignmentsIfNeeded(statements, node) {
78896             for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
78897                 var parameter = _a[_i];
78898                 if (parameter.transformFlags & 32768) {
78899                     var temp = factory.getGeneratedNameForNode(parameter);
78900                     var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true);
78901                     if (ts.some(declarations)) {
78902                         var statement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList(declarations));
78903                         ts.setEmitFlags(statement, 1048576);
78904                         statements = ts.append(statements, statement);
78905                     }
78906                 }
78907             }
78908             return statements;
78909         }
78910         function enableSubstitutionForAsyncMethodsWithSuper() {
78911             if ((enabledSubstitutions & 1) === 0) {
78912                 enabledSubstitutions |= 1;
78913                 context.enableSubstitution(207);
78914                 context.enableSubstitution(205);
78915                 context.enableSubstitution(206);
78916                 context.enableEmitNotification(256);
78917                 context.enableEmitNotification(168);
78918                 context.enableEmitNotification(171);
78919                 context.enableEmitNotification(172);
78920                 context.enableEmitNotification(170);
78921                 context.enableEmitNotification(236);
78922             }
78923         }
78924         function onEmitNode(hint, node, emitCallback) {
78925             if (enabledSubstitutions & 1 && isSuperContainer(node)) {
78926                 var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096);
78927                 if (superContainerFlags !== enclosingSuperContainerFlags) {
78928                     var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
78929                     enclosingSuperContainerFlags = superContainerFlags;
78930                     previousOnEmitNode(hint, node, emitCallback);
78931                     enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
78932                     return;
78933                 }
78934             }
78935             else if (enabledSubstitutions && substitutedSuperAccessors[ts.getNodeId(node)]) {
78936                 var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
78937                 enclosingSuperContainerFlags = 0;
78938                 previousOnEmitNode(hint, node, emitCallback);
78939                 enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
78940                 return;
78941             }
78942             previousOnEmitNode(hint, node, emitCallback);
78943         }
78944         function onSubstituteNode(hint, node) {
78945             node = previousOnSubstituteNode(hint, node);
78946             if (hint === 1 && enclosingSuperContainerFlags) {
78947                 return substituteExpression(node);
78948             }
78949             return node;
78950         }
78951         function substituteExpression(node) {
78952             switch (node.kind) {
78953                 case 205:
78954                     return substitutePropertyAccessExpression(node);
78955                 case 206:
78956                     return substituteElementAccessExpression(node);
78957                 case 207:
78958                     return substituteCallExpression(node);
78959             }
78960             return node;
78961         }
78962         function substitutePropertyAccessExpression(node) {
78963             if (node.expression.kind === 106) {
78964                 return ts.setTextRange(factory.createPropertyAccessExpression(factory.createUniqueName("_super", 16 | 32), node.name), node);
78965             }
78966             return node;
78967         }
78968         function substituteElementAccessExpression(node) {
78969             if (node.expression.kind === 106) {
78970                 return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
78971             }
78972             return node;
78973         }
78974         function substituteCallExpression(node) {
78975             var expression = node.expression;
78976             if (ts.isSuperProperty(expression)) {
78977                 var argumentExpression = ts.isPropertyAccessExpression(expression)
78978                     ? substitutePropertyAccessExpression(expression)
78979                     : substituteElementAccessExpression(expression);
78980                 return factory.createCallExpression(factory.createPropertyAccessExpression(argumentExpression, "call"), undefined, __spreadArray([
78981                     factory.createThis()
78982                 ], node.arguments, true));
78983             }
78984             return node;
78985         }
78986         function isSuperContainer(node) {
78987             var kind = node.kind;
78988             return kind === 256
78989                 || kind === 170
78990                 || kind === 168
78991                 || kind === 171
78992                 || kind === 172;
78993         }
78994         function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
78995             if (enclosingSuperContainerFlags & 4096) {
78996                 return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), undefined, [argumentExpression]), "value"), location);
78997             }
78998             else {
78999                 return ts.setTextRange(factory.createCallExpression(factory.createIdentifier("_superIndex"), undefined, [argumentExpression]), location);
79000             }
79001         }
79002     }
79003     ts.transformES2018 = transformES2018;
79004 })(ts || (ts = {}));
79005 var ts;
79006 (function (ts) {
79007     function transformES2019(context) {
79008         var factory = context.factory;
79009         return ts.chainBundle(context, transformSourceFile);
79010         function transformSourceFile(node) {
79011             if (node.isDeclarationFile) {
79012                 return node;
79013             }
79014             return ts.visitEachChild(node, visitor, context);
79015         }
79016         function visitor(node) {
79017             if ((node.transformFlags & 32) === 0) {
79018                 return node;
79019             }
79020             switch (node.kind) {
79021                 case 291:
79022                     return visitCatchClause(node);
79023                 default:
79024                     return ts.visitEachChild(node, visitor, context);
79025             }
79026         }
79027         function visitCatchClause(node) {
79028             if (!node.variableDeclaration) {
79029                 return factory.updateCatchClause(node, factory.createVariableDeclaration(factory.createTempVariable(undefined)), ts.visitNode(node.block, visitor, ts.isBlock));
79030             }
79031             return ts.visitEachChild(node, visitor, context);
79032         }
79033     }
79034     ts.transformES2019 = transformES2019;
79035 })(ts || (ts = {}));
79036 var ts;
79037 (function (ts) {
79038     function transformES2020(context) {
79039         var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration;
79040         return ts.chainBundle(context, transformSourceFile);
79041         function transformSourceFile(node) {
79042             if (node.isDeclarationFile) {
79043                 return node;
79044             }
79045             return ts.visitEachChild(node, visitor, context);
79046         }
79047         function visitor(node) {
79048             if ((node.transformFlags & 16) === 0) {
79049                 return node;
79050             }
79051             switch (node.kind) {
79052                 case 207: {
79053                     var updated = visitNonOptionalCallExpression(node, false);
79054                     ts.Debug.assertNotNode(updated, ts.isSyntheticReference);
79055                     return updated;
79056                 }
79057                 case 205:
79058                 case 206:
79059                     if (ts.isOptionalChain(node)) {
79060                         var updated = visitOptionalExpression(node, false, false);
79061                         ts.Debug.assertNotNode(updated, ts.isSyntheticReference);
79062                         return updated;
79063                     }
79064                     return ts.visitEachChild(node, visitor, context);
79065                 case 220:
79066                     if (node.operatorToken.kind === 60) {
79067                         return transformNullishCoalescingExpression(node);
79068                     }
79069                     return ts.visitEachChild(node, visitor, context);
79070                 case 214:
79071                     return visitDeleteExpression(node);
79072                 default:
79073                     return ts.visitEachChild(node, visitor, context);
79074             }
79075         }
79076         function flattenChain(chain) {
79077             ts.Debug.assertNotNode(chain, ts.isNonNullChain);
79078             var links = [chain];
79079             while (!chain.questionDotToken && !ts.isTaggedTemplateExpression(chain)) {
79080                 chain = ts.cast(ts.skipPartiallyEmittedExpressions(chain.expression), ts.isOptionalChain);
79081                 ts.Debug.assertNotNode(chain, ts.isNonNullChain);
79082                 links.unshift(chain);
79083             }
79084             return { expression: chain.expression, chain: links };
79085         }
79086         function visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete) {
79087             var expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
79088             if (ts.isSyntheticReference(expression)) {
79089                 return factory.createSyntheticReferenceExpression(factory.updateParenthesizedExpression(node, expression.expression), expression.thisArg);
79090             }
79091             return factory.updateParenthesizedExpression(node, expression);
79092         }
79093         function visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete) {
79094             if (ts.isOptionalChain(node)) {
79095                 return visitOptionalExpression(node, captureThisArg, isDelete);
79096             }
79097             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
79098             ts.Debug.assertNotNode(expression, ts.isSyntheticReference);
79099             var thisArg;
79100             if (captureThisArg) {
79101                 if (!ts.isSimpleCopiableExpression(expression)) {
79102                     thisArg = factory.createTempVariable(hoistVariableDeclaration);
79103                     expression = factory.createAssignment(thisArg, expression);
79104                 }
79105                 else {
79106                     thisArg = expression;
79107                 }
79108             }
79109             expression = node.kind === 205
79110                 ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier))
79111                 : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression));
79112             return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression;
79113         }
79114         function visitNonOptionalCallExpression(node, captureThisArg) {
79115             if (ts.isOptionalChain(node)) {
79116                 return visitOptionalExpression(node, captureThisArg, false);
79117             }
79118             if (ts.isParenthesizedExpression(node.expression) && ts.isOptionalChain(ts.skipParentheses(node.expression))) {
79119                 var expression = visitNonOptionalParenthesizedExpression(node.expression, true, false);
79120                 var args = ts.visitNodes(node.arguments, visitor, ts.isExpression);
79121                 if (ts.isSyntheticReference(expression)) {
79122                     return ts.setTextRange(factory.createFunctionCallCall(expression.expression, expression.thisArg, args), node);
79123                 }
79124                 return factory.updateCallExpression(node, expression, undefined, args);
79125             }
79126             return ts.visitEachChild(node, visitor, context);
79127         }
79128         function visitNonOptionalExpression(node, captureThisArg, isDelete) {
79129             switch (node.kind) {
79130                 case 211: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete);
79131                 case 205:
79132                 case 206: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete);
79133                 case 207: return visitNonOptionalCallExpression(node, captureThisArg);
79134                 default: return ts.visitNode(node, visitor, ts.isExpression);
79135             }
79136         }
79137         function visitOptionalExpression(node, captureThisArg, isDelete) {
79138             var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
79139             var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), false);
79140             var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
79141             var leftExpression = ts.isSyntheticReference(left) ? left.expression : left;
79142             var capturedLeft = leftExpression;
79143             if (!ts.isSimpleCopiableExpression(leftExpression)) {
79144                 capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
79145                 leftExpression = factory.createAssignment(capturedLeft, leftExpression);
79146             }
79147             var rightExpression = capturedLeft;
79148             var thisArg;
79149             for (var i = 0; i < chain.length; i++) {
79150                 var segment = chain[i];
79151                 switch (segment.kind) {
79152                     case 205:
79153                     case 206:
79154                         if (i === chain.length - 1 && captureThisArg) {
79155                             if (!ts.isSimpleCopiableExpression(rightExpression)) {
79156                                 thisArg = factory.createTempVariable(hoistVariableDeclaration);
79157                                 rightExpression = factory.createAssignment(thisArg, rightExpression);
79158                             }
79159                             else {
79160                                 thisArg = rightExpression;
79161                             }
79162                         }
79163                         rightExpression = segment.kind === 205
79164                             ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier))
79165                             : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression));
79166                         break;
79167                     case 207:
79168                         if (i === 0 && leftThisArg) {
79169                             rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
79170                         }
79171                         else {
79172                             rightExpression = factory.createCallExpression(rightExpression, undefined, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
79173                         }
79174                         break;
79175                 }
79176                 ts.setOriginalNode(rightExpression, segment);
79177             }
79178             var target = isDelete
79179                 ? factory.createConditionalExpression(createNotNullCondition(leftExpression, capturedLeft, true), undefined, factory.createTrue(), undefined, factory.createDeleteExpression(rightExpression))
79180                 : factory.createConditionalExpression(createNotNullCondition(leftExpression, capturedLeft, true), undefined, factory.createVoidZero(), undefined, rightExpression);
79181             ts.setTextRange(target, node);
79182             return thisArg ? factory.createSyntheticReferenceExpression(target, thisArg) : target;
79183         }
79184         function createNotNullCondition(left, right, invert) {
79185             return factory.createBinaryExpression(factory.createBinaryExpression(left, factory.createToken(invert ? 36 : 37), factory.createNull()), factory.createToken(invert ? 56 : 55), factory.createBinaryExpression(right, factory.createToken(invert ? 36 : 37), factory.createVoidZero()));
79186         }
79187         function transformNullishCoalescingExpression(node) {
79188             var left = ts.visitNode(node.left, visitor, ts.isExpression);
79189             var right = left;
79190             if (!ts.isSimpleCopiableExpression(left)) {
79191                 right = factory.createTempVariable(hoistVariableDeclaration);
79192                 left = factory.createAssignment(right, left);
79193             }
79194             return ts.setTextRange(factory.createConditionalExpression(createNotNullCondition(left, right), undefined, right, undefined, ts.visitNode(node.right, visitor, ts.isExpression)), node);
79195         }
79196         function visitDeleteExpression(node) {
79197             return ts.isOptionalChain(ts.skipParentheses(node.expression))
79198                 ? ts.setOriginalNode(visitNonOptionalExpression(node.expression, false, true), node)
79199                 : factory.updateDeleteExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression));
79200         }
79201     }
79202     ts.transformES2020 = transformES2020;
79203 })(ts || (ts = {}));
79204 var ts;
79205 (function (ts) {
79206     function transformES2021(context) {
79207         var hoistVariableDeclaration = context.hoistVariableDeclaration, factory = context.factory;
79208         return ts.chainBundle(context, transformSourceFile);
79209         function transformSourceFile(node) {
79210             if (node.isDeclarationFile) {
79211                 return node;
79212             }
79213             return ts.visitEachChild(node, visitor, context);
79214         }
79215         function visitor(node) {
79216             if ((node.transformFlags & 8) === 0) {
79217                 return node;
79218             }
79219             switch (node.kind) {
79220                 case 220:
79221                     var binaryExpression = node;
79222                     if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) {
79223                         return transformLogicalAssignment(binaryExpression);
79224                     }
79225                 default:
79226                     return ts.visitEachChild(node, visitor, context);
79227             }
79228         }
79229         function transformLogicalAssignment(binaryExpression) {
79230             var operator = binaryExpression.operatorToken;
79231             var nonAssignmentOperator = ts.getNonAssignmentOperatorForCompoundAssignment(operator.kind);
79232             var left = ts.skipParentheses(ts.visitNode(binaryExpression.left, visitor, ts.isLeftHandSideExpression));
79233             var assignmentTarget = left;
79234             var right = ts.skipParentheses(ts.visitNode(binaryExpression.right, visitor, ts.isExpression));
79235             if (ts.isAccessExpression(left)) {
79236                 var propertyAccessTargetSimpleCopiable = ts.isSimpleCopiableExpression(left.expression);
79237                 var propertyAccessTarget = propertyAccessTargetSimpleCopiable ? left.expression :
79238                     factory.createTempVariable(hoistVariableDeclaration);
79239                 var propertyAccessTargetAssignment = propertyAccessTargetSimpleCopiable ? left.expression : factory.createAssignment(propertyAccessTarget, left.expression);
79240                 if (ts.isPropertyAccessExpression(left)) {
79241                     assignmentTarget = factory.createPropertyAccessExpression(propertyAccessTarget, left.name);
79242                     left = factory.createPropertyAccessExpression(propertyAccessTargetAssignment, left.name);
79243                 }
79244                 else {
79245                     var elementAccessArgumentSimpleCopiable = ts.isSimpleCopiableExpression(left.argumentExpression);
79246                     var elementAccessArgument = elementAccessArgumentSimpleCopiable ? left.argumentExpression :
79247                         factory.createTempVariable(hoistVariableDeclaration);
79248                     assignmentTarget = factory.createElementAccessExpression(propertyAccessTarget, elementAccessArgument);
79249                     left = factory.createElementAccessExpression(propertyAccessTargetAssignment, elementAccessArgumentSimpleCopiable ? left.argumentExpression : factory.createAssignment(elementAccessArgument, left.argumentExpression));
79250                 }
79251             }
79252             return factory.createBinaryExpression(left, nonAssignmentOperator, factory.createParenthesizedExpression(factory.createAssignment(assignmentTarget, right)));
79253         }
79254     }
79255     ts.transformES2021 = transformES2021;
79256 })(ts || (ts = {}));
79257 var ts;
79258 (function (ts) {
79259     function transformESNext(context) {
79260         return ts.chainBundle(context, transformSourceFile);
79261         function transformSourceFile(node) {
79262             if (node.isDeclarationFile) {
79263                 return node;
79264             }
79265             return ts.visitEachChild(node, visitor, context);
79266         }
79267         function visitor(node) {
79268             if ((node.transformFlags & 4) === 0) {
79269                 return node;
79270             }
79271             switch (node.kind) {
79272                 default:
79273                     return ts.visitEachChild(node, visitor, context);
79274             }
79275         }
79276     }
79277     ts.transformESNext = transformESNext;
79278 })(ts || (ts = {}));
79279 var ts;
79280 (function (ts) {
79281     function transformJsx(context) {
79282         var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
79283         var compilerOptions = context.getCompilerOptions();
79284         var currentSourceFile;
79285         var currentFileState;
79286         return ts.chainBundle(context, transformSourceFile);
79287         function getCurrentFileNameExpression() {
79288             if (currentFileState.filenameDeclaration) {
79289                 return currentFileState.filenameDeclaration.name;
79290             }
79291             var declaration = factory.createVariableDeclaration(factory.createUniqueName("_jsxFileName", 16 | 32), undefined, undefined, factory.createStringLiteral(currentSourceFile.fileName));
79292             currentFileState.filenameDeclaration = declaration;
79293             return currentFileState.filenameDeclaration.name;
79294         }
79295         function getJsxFactoryCalleePrimitive(isStaticChildren) {
79296             return compilerOptions.jsx === 5 ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
79297         }
79298         function getJsxFactoryCallee(isStaticChildren) {
79299             var type = getJsxFactoryCalleePrimitive(isStaticChildren);
79300             return getImplicitImportForName(type);
79301         }
79302         function getImplicitJsxFragmentReference() {
79303             return getImplicitImportForName("Fragment");
79304         }
79305         function getImplicitImportForName(name) {
79306             var _a, _b;
79307             var importSource = name === "createElement"
79308                 ? currentFileState.importSpecifier
79309                 : ts.getJSXRuntimeImport(currentFileState.importSpecifier, compilerOptions);
79310             var existing = (_b = (_a = currentFileState.utilizedImplicitRuntimeImports) === null || _a === void 0 ? void 0 : _a.get(importSource)) === null || _b === void 0 ? void 0 : _b.get(name);
79311             if (existing) {
79312                 return existing.name;
79313             }
79314             if (!currentFileState.utilizedImplicitRuntimeImports) {
79315                 currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
79316             }
79317             var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
79318             if (!specifierSourceImports) {
79319                 specifierSourceImports = ts.createMap();
79320                 currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
79321             }
79322             var generatedName = factory.createUniqueName("_".concat(name), 16 | 32 | 64);
79323             var specifier = factory.createImportSpecifier(false, factory.createIdentifier(name), generatedName);
79324             generatedName.generatedImportReference = specifier;
79325             specifierSourceImports.set(name, specifier);
79326             return generatedName;
79327         }
79328         function transformSourceFile(node) {
79329             if (node.isDeclarationFile) {
79330                 return node;
79331             }
79332             currentSourceFile = node;
79333             currentFileState = {};
79334             currentFileState.importSpecifier = ts.getJSXImplicitImportBase(compilerOptions, node);
79335             var visited = ts.visitEachChild(node, visitor, context);
79336             ts.addEmitHelpers(visited, context.readEmitHelpers());
79337             var statements = visited.statements;
79338             if (currentFileState.filenameDeclaration) {
79339                 statements = ts.insertStatementAfterCustomPrologue(statements.slice(), factory.createVariableStatement(undefined, factory.createVariableDeclarationList([currentFileState.filenameDeclaration], 2)));
79340             }
79341             if (currentFileState.utilizedImplicitRuntimeImports) {
79342                 for (var _i = 0, _a = ts.arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries()); _i < _a.length; _i++) {
79343                     var _b = _a[_i], importSource = _b[0], importSpecifiersMap = _b[1];
79344                     if (ts.isExternalModule(node)) {
79345                         var importStatement = factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports(ts.arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), undefined);
79346                         ts.setParentRecursive(importStatement, false);
79347                         statements = ts.insertStatementAfterCustomPrologue(statements.slice(), importStatement);
79348                     }
79349                     else if (ts.isExternalOrCommonJsModule(node)) {
79350                         var requireStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
79351                             factory.createVariableDeclaration(factory.createObjectBindingPattern(ts.map(ts.arrayFrom(importSpecifiersMap.values()), function (s) { return factory.createBindingElement(undefined, s.propertyName, s.name); })), undefined, undefined, factory.createCallExpression(factory.createIdentifier("require"), undefined, [factory.createStringLiteral(importSource)]))
79352                         ], 2));
79353                         ts.setParentRecursive(requireStatement, false);
79354                         statements = ts.insertStatementAfterCustomPrologue(statements.slice(), requireStatement);
79355                     }
79356                     else {
79357                     }
79358                 }
79359             }
79360             if (statements !== visited.statements) {
79361                 visited = factory.updateSourceFile(visited, statements);
79362             }
79363             currentFileState = undefined;
79364             return visited;
79365         }
79366         function visitor(node) {
79367             if (node.transformFlags & 2) {
79368                 return visitorWorker(node);
79369             }
79370             else {
79371                 return node;
79372             }
79373         }
79374         function visitorWorker(node) {
79375             switch (node.kind) {
79376                 case 277:
79377                     return visitJsxElement(node, false);
79378                 case 278:
79379                     return visitJsxSelfClosingElement(node, false);
79380                 case 281:
79381                     return visitJsxFragment(node, false);
79382                 case 287:
79383                     return visitJsxExpression(node);
79384                 default:
79385                     return ts.visitEachChild(node, visitor, context);
79386             }
79387         }
79388         function transformJsxChildToExpression(node) {
79389             switch (node.kind) {
79390                 case 11:
79391                     return visitJsxText(node);
79392                 case 287:
79393                     return visitJsxExpression(node);
79394                 case 277:
79395                     return visitJsxElement(node, true);
79396                 case 278:
79397                     return visitJsxSelfClosingElement(node, true);
79398                 case 281:
79399                     return visitJsxFragment(node, true);
79400                 default:
79401                     return ts.Debug.failBadSyntaxKind(node);
79402             }
79403         }
79404         function hasKeyAfterPropsSpread(node) {
79405             var spread = false;
79406             for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
79407                 var elem = _a[_i];
79408                 if (ts.isJsxSpreadAttribute(elem)) {
79409                     spread = true;
79410                 }
79411                 else if (spread && ts.isJsxAttribute(elem) && elem.name.escapedText === "key") {
79412                     return true;
79413                 }
79414             }
79415             return false;
79416         }
79417         function shouldUseCreateElement(node) {
79418             return currentFileState.importSpecifier === undefined || hasKeyAfterPropsSpread(node);
79419         }
79420         function visitJsxElement(node, isChild) {
79421             var tagTransform = shouldUseCreateElement(node.openingElement) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX;
79422             return tagTransform(node.openingElement, node.children, isChild, node);
79423         }
79424         function visitJsxSelfClosingElement(node, isChild) {
79425             var tagTransform = shouldUseCreateElement(node) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX;
79426             return tagTransform(node, undefined, isChild, node);
79427         }
79428         function visitJsxFragment(node, isChild) {
79429             var tagTransform = currentFileState.importSpecifier === undefined ? visitJsxOpeningFragmentCreateElement : visitJsxOpeningFragmentJSX;
79430             return tagTransform(node.openingFragment, node.children, isChild, node);
79431         }
79432         function convertJsxChildrenToChildrenPropObject(children) {
79433             var prop = convertJsxChildrenToChildrenPropAssignment(children);
79434             return prop && factory.createObjectLiteralExpression([prop]);
79435         }
79436         function convertJsxChildrenToChildrenPropAssignment(children) {
79437             var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
79438             if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
79439                 var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
79440                 return result_12 && factory.createPropertyAssignment("children", result_12);
79441             }
79442             var result = ts.mapDefined(children, transformJsxChildToExpression);
79443             return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
79444         }
79445         function visitJsxOpeningLikeElementJSX(node, children, isChild, location) {
79446             var tagName = getTagName(node);
79447             var childrenProp = children && children.length ? convertJsxChildrenToChildrenPropAssignment(children) : undefined;
79448             var keyAttr = ts.find(node.attributes.properties, function (p) { return !!p.name && ts.isIdentifier(p.name) && p.name.escapedText === "key"; });
79449             var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
79450             var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
79451                 factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray);
79452             return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
79453         }
79454         function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
79455             var _a;
79456             var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
79457             var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
79458             var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
79459             if (compilerOptions.jsx === 5) {
79460                 var originalFile = ts.getOriginalNode(currentSourceFile);
79461                 if (originalFile && ts.isSourceFile(originalFile)) {
79462                     args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
79463                     var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
79464                     args.push(factory.createObjectLiteralExpression([
79465                         factory.createPropertyAssignment("fileName", getCurrentFileNameExpression()),
79466                         factory.createPropertyAssignment("lineNumber", factory.createNumericLiteral(lineCol.line + 1)),
79467                         factory.createPropertyAssignment("columnNumber", factory.createNumericLiteral(lineCol.character + 1))
79468                     ]));
79469                     args.push(factory.createThis());
79470                 }
79471             }
79472             var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), undefined, args), location);
79473             if (isChild) {
79474                 ts.startOnNewLine(element);
79475             }
79476             return element;
79477         }
79478         function visitJsxOpeningLikeElementCreateElement(node, children, isChild, location) {
79479             var tagName = getTagName(node);
79480             var attrs = node.attributes.properties;
79481             var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs) :
79482                 factory.createNull();
79483             var callee = currentFileState.importSpecifier === undefined
79484                 ? ts.createJsxFactoryExpression(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, node)
79485                 : getImplicitImportForName("createElement");
79486             var element = ts.createExpressionForJsxElement(factory, callee, tagName, objectProperties, ts.mapDefined(children, transformJsxChildToExpression), location);
79487             if (isChild) {
79488                 ts.startOnNewLine(element);
79489             }
79490             return element;
79491         }
79492         function visitJsxOpeningFragmentJSX(_node, children, isChild, location) {
79493             var childrenProps;
79494             if (children && children.length) {
79495                 var result = convertJsxChildrenToChildrenPropObject(children);
79496                 if (result) {
79497                     childrenProps = result;
79498                 }
79499             }
79500             return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]), undefined, children, isChild, location);
79501         }
79502         function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
79503             var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, ts.mapDefined(children, transformJsxChildToExpression), node, location);
79504             if (isChild) {
79505                 ts.startOnNewLine(element);
79506             }
79507             return element;
79508         }
79509         function transformJsxSpreadAttributeToSpreadAssignment(node) {
79510             return factory.createSpreadAssignment(ts.visitNode(node.expression, visitor, ts.isExpression));
79511         }
79512         function transformJsxAttributesToObjectProps(attrs, children) {
79513             var target = ts.getEmitScriptTarget(compilerOptions);
79514             return target && target >= 5 ? factory.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) :
79515                 transformJsxAttributesToExpression(attrs, children);
79516         }
79517         function transformJsxAttributesToProps(attrs, children) {
79518             var props = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) {
79519                 return ts.map(attrs, function (attr) { return isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr); });
79520             }));
79521             if (children) {
79522                 props.push(children);
79523             }
79524             return props;
79525         }
79526         function transformJsxAttributesToExpression(attrs, children) {
79527             var expressions = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread
79528                 ? ts.map(attrs, transformJsxSpreadAttributeToExpression)
79529                 : factory.createObjectLiteralExpression(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); }));
79530             if (ts.isJsxSpreadAttribute(attrs[0])) {
79531                 expressions.unshift(factory.createObjectLiteralExpression());
79532             }
79533             if (children) {
79534                 expressions.push(factory.createObjectLiteralExpression([children]));
79535             }
79536             return ts.singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions);
79537         }
79538         function transformJsxSpreadAttributeToExpression(node) {
79539             return ts.visitNode(node.expression, visitor, ts.isExpression);
79540         }
79541         function transformJsxAttributeToObjectLiteralElement(node) {
79542             var name = getAttributeName(node);
79543             var expression = transformJsxAttributeInitializer(node.initializer);
79544             return factory.createPropertyAssignment(name, expression);
79545         }
79546         function transformJsxAttributeInitializer(node) {
79547             if (node === undefined) {
79548                 return factory.createTrue();
79549             }
79550             else if (node.kind === 10) {
79551                 var singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
79552                 var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
79553                 return ts.setTextRange(literal, node);
79554             }
79555             else if (node.kind === 287) {
79556                 if (node.expression === undefined) {
79557                     return factory.createTrue();
79558                 }
79559                 return ts.visitNode(node.expression, visitor, ts.isExpression);
79560             }
79561             else {
79562                 return ts.Debug.failBadSyntaxKind(node);
79563             }
79564         }
79565         function visitJsxText(node) {
79566             var fixed = fixupWhitespaceAndDecodeEntities(node.text);
79567             return fixed === undefined ? undefined : factory.createStringLiteral(fixed);
79568         }
79569         function fixupWhitespaceAndDecodeEntities(text) {
79570             var acc;
79571             var firstNonWhitespace = 0;
79572             var lastNonWhitespace = -1;
79573             for (var i = 0; i < text.length; i++) {
79574                 var c = text.charCodeAt(i);
79575                 if (ts.isLineBreak(c)) {
79576                     if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) {
79577                         acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1));
79578                     }
79579                     firstNonWhitespace = -1;
79580                 }
79581                 else if (!ts.isWhiteSpaceSingleLine(c)) {
79582                     lastNonWhitespace = i;
79583                     if (firstNonWhitespace === -1) {
79584                         firstNonWhitespace = i;
79585                     }
79586                 }
79587             }
79588             return firstNonWhitespace !== -1
79589                 ? addLineOfJsxText(acc, text.substr(firstNonWhitespace))
79590                 : acc;
79591         }
79592         function addLineOfJsxText(acc, trimmedLine) {
79593             var decoded = decodeEntities(trimmedLine);
79594             return acc === undefined ? decoded : acc + " " + decoded;
79595         }
79596         function decodeEntities(text) {
79597             return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) {
79598                 if (decimal) {
79599                     return ts.utf16EncodeAsString(parseInt(decimal, 10));
79600                 }
79601                 else if (hex) {
79602                     return ts.utf16EncodeAsString(parseInt(hex, 16));
79603                 }
79604                 else {
79605                     var ch = entities.get(word);
79606                     return ch ? ts.utf16EncodeAsString(ch) : match;
79607                 }
79608             });
79609         }
79610         function tryDecodeEntities(text) {
79611             var decoded = decodeEntities(text);
79612             return decoded === text ? undefined : decoded;
79613         }
79614         function getTagName(node) {
79615             if (node.kind === 277) {
79616                 return getTagName(node.openingElement);
79617             }
79618             else {
79619                 var name = node.tagName;
79620                 if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.escapedText)) {
79621                     return factory.createStringLiteral(ts.idText(name));
79622                 }
79623                 else {
79624                     return ts.createExpressionFromEntityName(factory, name);
79625                 }
79626             }
79627         }
79628         function getAttributeName(node) {
79629             var name = node.name;
79630             var text = ts.idText(name);
79631             if (/^[A-Za-z_]\w*$/.test(text)) {
79632                 return name;
79633             }
79634             else {
79635                 return factory.createStringLiteral(text);
79636             }
79637         }
79638         function visitJsxExpression(node) {
79639             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
79640             return node.dotDotDotToken ? factory.createSpreadElement(expression) : expression;
79641         }
79642     }
79643     ts.transformJsx = transformJsx;
79644     var entities = new ts.Map(ts.getEntries({
79645         quot: 0x0022,
79646         amp: 0x0026,
79647         apos: 0x0027,
79648         lt: 0x003C,
79649         gt: 0x003E,
79650         nbsp: 0x00A0,
79651         iexcl: 0x00A1,
79652         cent: 0x00A2,
79653         pound: 0x00A3,
79654         curren: 0x00A4,
79655         yen: 0x00A5,
79656         brvbar: 0x00A6,
79657         sect: 0x00A7,
79658         uml: 0x00A8,
79659         copy: 0x00A9,
79660         ordf: 0x00AA,
79661         laquo: 0x00AB,
79662         not: 0x00AC,
79663         shy: 0x00AD,
79664         reg: 0x00AE,
79665         macr: 0x00AF,
79666         deg: 0x00B0,
79667         plusmn: 0x00B1,
79668         sup2: 0x00B2,
79669         sup3: 0x00B3,
79670         acute: 0x00B4,
79671         micro: 0x00B5,
79672         para: 0x00B6,
79673         middot: 0x00B7,
79674         cedil: 0x00B8,
79675         sup1: 0x00B9,
79676         ordm: 0x00BA,
79677         raquo: 0x00BB,
79678         frac14: 0x00BC,
79679         frac12: 0x00BD,
79680         frac34: 0x00BE,
79681         iquest: 0x00BF,
79682         Agrave: 0x00C0,
79683         Aacute: 0x00C1,
79684         Acirc: 0x00C2,
79685         Atilde: 0x00C3,
79686         Auml: 0x00C4,
79687         Aring: 0x00C5,
79688         AElig: 0x00C6,
79689         Ccedil: 0x00C7,
79690         Egrave: 0x00C8,
79691         Eacute: 0x00C9,
79692         Ecirc: 0x00CA,
79693         Euml: 0x00CB,
79694         Igrave: 0x00CC,
79695         Iacute: 0x00CD,
79696         Icirc: 0x00CE,
79697         Iuml: 0x00CF,
79698         ETH: 0x00D0,
79699         Ntilde: 0x00D1,
79700         Ograve: 0x00D2,
79701         Oacute: 0x00D3,
79702         Ocirc: 0x00D4,
79703         Otilde: 0x00D5,
79704         Ouml: 0x00D6,
79705         times: 0x00D7,
79706         Oslash: 0x00D8,
79707         Ugrave: 0x00D9,
79708         Uacute: 0x00DA,
79709         Ucirc: 0x00DB,
79710         Uuml: 0x00DC,
79711         Yacute: 0x00DD,
79712         THORN: 0x00DE,
79713         szlig: 0x00DF,
79714         agrave: 0x00E0,
79715         aacute: 0x00E1,
79716         acirc: 0x00E2,
79717         atilde: 0x00E3,
79718         auml: 0x00E4,
79719         aring: 0x00E5,
79720         aelig: 0x00E6,
79721         ccedil: 0x00E7,
79722         egrave: 0x00E8,
79723         eacute: 0x00E9,
79724         ecirc: 0x00EA,
79725         euml: 0x00EB,
79726         igrave: 0x00EC,
79727         iacute: 0x00ED,
79728         icirc: 0x00EE,
79729         iuml: 0x00EF,
79730         eth: 0x00F0,
79731         ntilde: 0x00F1,
79732         ograve: 0x00F2,
79733         oacute: 0x00F3,
79734         ocirc: 0x00F4,
79735         otilde: 0x00F5,
79736         ouml: 0x00F6,
79737         divide: 0x00F7,
79738         oslash: 0x00F8,
79739         ugrave: 0x00F9,
79740         uacute: 0x00FA,
79741         ucirc: 0x00FB,
79742         uuml: 0x00FC,
79743         yacute: 0x00FD,
79744         thorn: 0x00FE,
79745         yuml: 0x00FF,
79746         OElig: 0x0152,
79747         oelig: 0x0153,
79748         Scaron: 0x0160,
79749         scaron: 0x0161,
79750         Yuml: 0x0178,
79751         fnof: 0x0192,
79752         circ: 0x02C6,
79753         tilde: 0x02DC,
79754         Alpha: 0x0391,
79755         Beta: 0x0392,
79756         Gamma: 0x0393,
79757         Delta: 0x0394,
79758         Epsilon: 0x0395,
79759         Zeta: 0x0396,
79760         Eta: 0x0397,
79761         Theta: 0x0398,
79762         Iota: 0x0399,
79763         Kappa: 0x039A,
79764         Lambda: 0x039B,
79765         Mu: 0x039C,
79766         Nu: 0x039D,
79767         Xi: 0x039E,
79768         Omicron: 0x039F,
79769         Pi: 0x03A0,
79770         Rho: 0x03A1,
79771         Sigma: 0x03A3,
79772         Tau: 0x03A4,
79773         Upsilon: 0x03A5,
79774         Phi: 0x03A6,
79775         Chi: 0x03A7,
79776         Psi: 0x03A8,
79777         Omega: 0x03A9,
79778         alpha: 0x03B1,
79779         beta: 0x03B2,
79780         gamma: 0x03B3,
79781         delta: 0x03B4,
79782         epsilon: 0x03B5,
79783         zeta: 0x03B6,
79784         eta: 0x03B7,
79785         theta: 0x03B8,
79786         iota: 0x03B9,
79787         kappa: 0x03BA,
79788         lambda: 0x03BB,
79789         mu: 0x03BC,
79790         nu: 0x03BD,
79791         xi: 0x03BE,
79792         omicron: 0x03BF,
79793         pi: 0x03C0,
79794         rho: 0x03C1,
79795         sigmaf: 0x03C2,
79796         sigma: 0x03C3,
79797         tau: 0x03C4,
79798         upsilon: 0x03C5,
79799         phi: 0x03C6,
79800         chi: 0x03C7,
79801         psi: 0x03C8,
79802         omega: 0x03C9,
79803         thetasym: 0x03D1,
79804         upsih: 0x03D2,
79805         piv: 0x03D6,
79806         ensp: 0x2002,
79807         emsp: 0x2003,
79808         thinsp: 0x2009,
79809         zwnj: 0x200C,
79810         zwj: 0x200D,
79811         lrm: 0x200E,
79812         rlm: 0x200F,
79813         ndash: 0x2013,
79814         mdash: 0x2014,
79815         lsquo: 0x2018,
79816         rsquo: 0x2019,
79817         sbquo: 0x201A,
79818         ldquo: 0x201C,
79819         rdquo: 0x201D,
79820         bdquo: 0x201E,
79821         dagger: 0x2020,
79822         Dagger: 0x2021,
79823         bull: 0x2022,
79824         hellip: 0x2026,
79825         permil: 0x2030,
79826         prime: 0x2032,
79827         Prime: 0x2033,
79828         lsaquo: 0x2039,
79829         rsaquo: 0x203A,
79830         oline: 0x203E,
79831         frasl: 0x2044,
79832         euro: 0x20AC,
79833         image: 0x2111,
79834         weierp: 0x2118,
79835         real: 0x211C,
79836         trade: 0x2122,
79837         alefsym: 0x2135,
79838         larr: 0x2190,
79839         uarr: 0x2191,
79840         rarr: 0x2192,
79841         darr: 0x2193,
79842         harr: 0x2194,
79843         crarr: 0x21B5,
79844         lArr: 0x21D0,
79845         uArr: 0x21D1,
79846         rArr: 0x21D2,
79847         dArr: 0x21D3,
79848         hArr: 0x21D4,
79849         forall: 0x2200,
79850         part: 0x2202,
79851         exist: 0x2203,
79852         empty: 0x2205,
79853         nabla: 0x2207,
79854         isin: 0x2208,
79855         notin: 0x2209,
79856         ni: 0x220B,
79857         prod: 0x220F,
79858         sum: 0x2211,
79859         minus: 0x2212,
79860         lowast: 0x2217,
79861         radic: 0x221A,
79862         prop: 0x221D,
79863         infin: 0x221E,
79864         ang: 0x2220,
79865         and: 0x2227,
79866         or: 0x2228,
79867         cap: 0x2229,
79868         cup: 0x222A,
79869         int: 0x222B,
79870         there4: 0x2234,
79871         sim: 0x223C,
79872         cong: 0x2245,
79873         asymp: 0x2248,
79874         ne: 0x2260,
79875         equiv: 0x2261,
79876         le: 0x2264,
79877         ge: 0x2265,
79878         sub: 0x2282,
79879         sup: 0x2283,
79880         nsub: 0x2284,
79881         sube: 0x2286,
79882         supe: 0x2287,
79883         oplus: 0x2295,
79884         otimes: 0x2297,
79885         perp: 0x22A5,
79886         sdot: 0x22C5,
79887         lceil: 0x2308,
79888         rceil: 0x2309,
79889         lfloor: 0x230A,
79890         rfloor: 0x230B,
79891         lang: 0x2329,
79892         rang: 0x232A,
79893         loz: 0x25CA,
79894         spades: 0x2660,
79895         clubs: 0x2663,
79896         hearts: 0x2665,
79897         diams: 0x2666
79898     }));
79899 })(ts || (ts = {}));
79900 var ts;
79901 (function (ts) {
79902     function transformES2016(context) {
79903         var factory = context.factory, hoistVariableDeclaration = context.hoistVariableDeclaration;
79904         return ts.chainBundle(context, transformSourceFile);
79905         function transformSourceFile(node) {
79906             if (node.isDeclarationFile) {
79907                 return node;
79908             }
79909             return ts.visitEachChild(node, visitor, context);
79910         }
79911         function visitor(node) {
79912             if ((node.transformFlags & 256) === 0) {
79913                 return node;
79914             }
79915             switch (node.kind) {
79916                 case 220:
79917                     return visitBinaryExpression(node);
79918                 default:
79919                     return ts.visitEachChild(node, visitor, context);
79920             }
79921         }
79922         function visitBinaryExpression(node) {
79923             switch (node.operatorToken.kind) {
79924                 case 67:
79925                     return visitExponentiationAssignmentExpression(node);
79926                 case 42:
79927                     return visitExponentiationExpression(node);
79928                 default:
79929                     return ts.visitEachChild(node, visitor, context);
79930             }
79931         }
79932         function visitExponentiationAssignmentExpression(node) {
79933             var target;
79934             var value;
79935             var left = ts.visitNode(node.left, visitor, ts.isExpression);
79936             var right = ts.visitNode(node.right, visitor, ts.isExpression);
79937             if (ts.isElementAccessExpression(left)) {
79938                 var expressionTemp = factory.createTempVariable(hoistVariableDeclaration);
79939                 var argumentExpressionTemp = factory.createTempVariable(hoistVariableDeclaration);
79940                 target = ts.setTextRange(factory.createElementAccessExpression(ts.setTextRange(factory.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(factory.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left);
79941                 value = ts.setTextRange(factory.createElementAccessExpression(expressionTemp, argumentExpressionTemp), left);
79942             }
79943             else if (ts.isPropertyAccessExpression(left)) {
79944                 var expressionTemp = factory.createTempVariable(hoistVariableDeclaration);
79945                 target = ts.setTextRange(factory.createPropertyAccessExpression(ts.setTextRange(factory.createAssignment(expressionTemp, left.expression), left.expression), left.name), left);
79946                 value = ts.setTextRange(factory.createPropertyAccessExpression(expressionTemp, left.name), left);
79947             }
79948             else {
79949                 target = left;
79950                 value = left;
79951             }
79952             return ts.setTextRange(factory.createAssignment(target, ts.setTextRange(factory.createGlobalMethodCall("Math", "pow", [value, right]), node)), node);
79953         }
79954         function visitExponentiationExpression(node) {
79955             var left = ts.visitNode(node.left, visitor, ts.isExpression);
79956             var right = ts.visitNode(node.right, visitor, ts.isExpression);
79957             return ts.setTextRange(factory.createGlobalMethodCall("Math", "pow", [left, right]), node);
79958         }
79959     }
79960     ts.transformES2016 = transformES2016;
79961 })(ts || (ts = {}));
79962 var ts;
79963 (function (ts) {
79964     function createSpreadSegment(kind, expression) {
79965         return { kind: kind, expression: expression };
79966     }
79967     function transformES2015(context) {
79968         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
79969         var compilerOptions = context.getCompilerOptions();
79970         var resolver = context.getEmitResolver();
79971         var previousOnSubstituteNode = context.onSubstituteNode;
79972         var previousOnEmitNode = context.onEmitNode;
79973         context.onEmitNode = onEmitNode;
79974         context.onSubstituteNode = onSubstituteNode;
79975         var currentSourceFile;
79976         var currentText;
79977         var hierarchyFacts;
79978         var taggedTemplateStringDeclarations;
79979         function recordTaggedTemplateString(temp) {
79980             taggedTemplateStringDeclarations = ts.append(taggedTemplateStringDeclarations, factory.createVariableDeclaration(temp));
79981         }
79982         var convertedLoopState;
79983         var enabledSubstitutions;
79984         return ts.chainBundle(context, transformSourceFile);
79985         function transformSourceFile(node) {
79986             if (node.isDeclarationFile) {
79987                 return node;
79988             }
79989             currentSourceFile = node;
79990             currentText = node.text;
79991             var visited = visitSourceFile(node);
79992             ts.addEmitHelpers(visited, context.readEmitHelpers());
79993             currentSourceFile = undefined;
79994             currentText = undefined;
79995             taggedTemplateStringDeclarations = undefined;
79996             hierarchyFacts = 0;
79997             return visited;
79998         }
79999         function enterSubtree(excludeFacts, includeFacts) {
80000             var ancestorFacts = hierarchyFacts;
80001             hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 32767;
80002             return ancestorFacts;
80003         }
80004         function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
80005             hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 | ancestorFacts;
80006         }
80007         function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
80008             return (hierarchyFacts & 8192) !== 0
80009                 && node.kind === 246
80010                 && !node.expression;
80011         }
80012         function isOrMayContainReturnCompletion(node) {
80013             return node.transformFlags & 2097152
80014                 && (ts.isReturnStatement(node)
80015                     || ts.isIfStatement(node)
80016                     || ts.isWithStatement(node)
80017                     || ts.isSwitchStatement(node)
80018                     || ts.isCaseBlock(node)
80019                     || ts.isCaseClause(node)
80020                     || ts.isDefaultClause(node)
80021                     || ts.isTryStatement(node)
80022                     || ts.isCatchClause(node)
80023                     || ts.isLabeledStatement(node)
80024                     || ts.isIterationStatement(node, false)
80025                     || ts.isBlock(node));
80026         }
80027         function shouldVisitNode(node) {
80028             return (node.transformFlags & 512) !== 0
80029                 || convertedLoopState !== undefined
80030                 || (hierarchyFacts & 8192 && isOrMayContainReturnCompletion(node))
80031                 || (ts.isIterationStatement(node, false) && shouldConvertIterationStatement(node))
80032                 || (ts.getEmitFlags(node) & 33554432) !== 0;
80033         }
80034         function visitor(node) {
80035             return shouldVisitNode(node) ? visitorWorker(node, false) : node;
80036         }
80037         function visitorWithUnusedExpressionResult(node) {
80038             return shouldVisitNode(node) ? visitorWorker(node, true) : node;
80039         }
80040         function classWrapperStatementVisitor(node) {
80041             if (shouldVisitNode(node)) {
80042                 var original = ts.getOriginalNode(node);
80043                 if (ts.isPropertyDeclaration(original) && ts.hasStaticModifier(original)) {
80044                     var ancestorFacts = enterSubtree(32670, 16449);
80045                     var result = visitorWorker(node, false);
80046                     exitSubtree(ancestorFacts, 98304, 0);
80047                     return result;
80048                 }
80049                 return visitorWorker(node, false);
80050             }
80051             return node;
80052         }
80053         function callExpressionVisitor(node) {
80054             if (node.kind === 106) {
80055                 return visitSuperKeyword(true);
80056             }
80057             return visitor(node);
80058         }
80059         function visitorWorker(node, expressionResultIsUnused) {
80060             switch (node.kind) {
80061                 case 124:
80062                     return undefined;
80063                 case 256:
80064                     return visitClassDeclaration(node);
80065                 case 225:
80066                     return visitClassExpression(node);
80067                 case 163:
80068                     return visitParameter(node);
80069                 case 255:
80070                     return visitFunctionDeclaration(node);
80071                 case 213:
80072                     return visitArrowFunction(node);
80073                 case 212:
80074                     return visitFunctionExpression(node);
80075                 case 253:
80076                     return visitVariableDeclaration(node);
80077                 case 79:
80078                     return visitIdentifier(node);
80079                 case 254:
80080                     return visitVariableDeclarationList(node);
80081                 case 248:
80082                     return visitSwitchStatement(node);
80083                 case 262:
80084                     return visitCaseBlock(node);
80085                 case 234:
80086                     return visitBlock(node, false);
80087                 case 245:
80088                 case 244:
80089                     return visitBreakOrContinueStatement(node);
80090                 case 249:
80091                     return visitLabeledStatement(node);
80092                 case 239:
80093                 case 240:
80094                     return visitDoOrWhileStatement(node, undefined);
80095                 case 241:
80096                     return visitForStatement(node, undefined);
80097                 case 242:
80098                     return visitForInStatement(node, undefined);
80099                 case 243:
80100                     return visitForOfStatement(node, undefined);
80101                 case 237:
80102                     return visitExpressionStatement(node);
80103                 case 204:
80104                     return visitObjectLiteralExpression(node);
80105                 case 291:
80106                     return visitCatchClause(node);
80107                 case 295:
80108                     return visitShorthandPropertyAssignment(node);
80109                 case 161:
80110                     return visitComputedPropertyName(node);
80111                 case 203:
80112                     return visitArrayLiteralExpression(node);
80113                 case 207:
80114                     return visitCallExpression(node);
80115                 case 208:
80116                     return visitNewExpression(node);
80117                 case 211:
80118                     return visitParenthesizedExpression(node, expressionResultIsUnused);
80119                 case 220:
80120                     return visitBinaryExpression(node, expressionResultIsUnused);
80121                 case 349:
80122                     return visitCommaListExpression(node, expressionResultIsUnused);
80123                 case 14:
80124                 case 15:
80125                 case 16:
80126                 case 17:
80127                     return visitTemplateLiteral(node);
80128                 case 10:
80129                     return visitStringLiteral(node);
80130                 case 8:
80131                     return visitNumericLiteral(node);
80132                 case 209:
80133                     return visitTaggedTemplateExpression(node);
80134                 case 222:
80135                     return visitTemplateExpression(node);
80136                 case 223:
80137                     return visitYieldExpression(node);
80138                 case 224:
80139                     return visitSpreadElement(node);
80140                 case 106:
80141                     return visitSuperKeyword(false);
80142                 case 108:
80143                     return visitThisKeyword(node);
80144                 case 230:
80145                     return visitMetaProperty(node);
80146                 case 168:
80147                     return visitMethodDeclaration(node);
80148                 case 171:
80149                 case 172:
80150                     return visitAccessorDeclaration(node);
80151                 case 236:
80152                     return visitVariableStatement(node);
80153                 case 246:
80154                     return visitReturnStatement(node);
80155                 case 216:
80156                     return visitVoidExpression(node);
80157                 default:
80158                     return ts.visitEachChild(node, visitor, context);
80159             }
80160         }
80161         function visitSourceFile(node) {
80162             var ancestorFacts = enterSubtree(8064, 64);
80163             var prologue = [];
80164             var statements = [];
80165             startLexicalEnvironment();
80166             var statementOffset = factory.copyPrologue(node.statements, prologue, false, visitor);
80167             ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
80168             if (taggedTemplateStringDeclarations) {
80169                 statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList(taggedTemplateStringDeclarations)));
80170             }
80171             factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
80172             insertCaptureThisForNodeIfNeeded(prologue, node);
80173             exitSubtree(ancestorFacts, 0, 0);
80174             return factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray(ts.concatenate(prologue, statements)), node.statements));
80175         }
80176         function visitSwitchStatement(node) {
80177             if (convertedLoopState !== undefined) {
80178                 var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
80179                 convertedLoopState.allowedNonLabeledJumps |= 2;
80180                 var result = ts.visitEachChild(node, visitor, context);
80181                 convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps;
80182                 return result;
80183             }
80184             return ts.visitEachChild(node, visitor, context);
80185         }
80186         function visitCaseBlock(node) {
80187             var ancestorFacts = enterSubtree(7104, 0);
80188             var updated = ts.visitEachChild(node, visitor, context);
80189             exitSubtree(ancestorFacts, 0, 0);
80190             return updated;
80191         }
80192         function returnCapturedThis(node) {
80193             return ts.setOriginalNode(factory.createReturnStatement(factory.createUniqueName("_this", 16 | 32)), node);
80194         }
80195         function visitReturnStatement(node) {
80196             if (convertedLoopState) {
80197                 convertedLoopState.nonLocalJumps |= 8;
80198                 if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {
80199                     node = returnCapturedThis(node);
80200                 }
80201                 return factory.createReturnStatement(factory.createObjectLiteralExpression([
80202                     factory.createPropertyAssignment(factory.createIdentifier("value"), node.expression
80203                         ? ts.visitNode(node.expression, visitor, ts.isExpression)
80204                         : factory.createVoidZero())
80205                 ]));
80206             }
80207             else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) {
80208                 return returnCapturedThis(node);
80209             }
80210             return ts.visitEachChild(node, visitor, context);
80211         }
80212         function visitThisKeyword(node) {
80213             if (hierarchyFacts & 2 && !(hierarchyFacts & 16384)) {
80214                 hierarchyFacts |= 65536;
80215             }
80216             if (convertedLoopState) {
80217                 if (hierarchyFacts & 2) {
80218                     convertedLoopState.containsLexicalThis = true;
80219                     return node;
80220                 }
80221                 return convertedLoopState.thisName || (convertedLoopState.thisName = factory.createUniqueName("this"));
80222             }
80223             return node;
80224         }
80225         function visitVoidExpression(node) {
80226             return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
80227         }
80228         function visitIdentifier(node) {
80229             if (!convertedLoopState) {
80230                 return node;
80231             }
80232             if (resolver.isArgumentsLocalBinding(node)) {
80233                 return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
80234             }
80235             return node;
80236         }
80237         function visitBreakOrContinueStatement(node) {
80238             if (convertedLoopState) {
80239                 var jump = node.kind === 245 ? 2 : 4;
80240                 var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
80241                     (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
80242                 if (!canUseBreakOrContinue) {
80243                     var labelMarker = void 0;
80244                     var label = node.label;
80245                     if (!label) {
80246                         if (node.kind === 245) {
80247                             convertedLoopState.nonLocalJumps |= 2;
80248                             labelMarker = "break";
80249                         }
80250                         else {
80251                             convertedLoopState.nonLocalJumps |= 4;
80252                             labelMarker = "continue";
80253                         }
80254                     }
80255                     else {
80256                         if (node.kind === 245) {
80257                             labelMarker = "break-".concat(label.escapedText);
80258                             setLabeledJump(convertedLoopState, true, ts.idText(label), labelMarker);
80259                         }
80260                         else {
80261                             labelMarker = "continue-".concat(label.escapedText);
80262                             setLabeledJump(convertedLoopState, false, ts.idText(label), labelMarker);
80263                         }
80264                     }
80265                     var returnExpression = factory.createStringLiteral(labelMarker);
80266                     if (convertedLoopState.loopOutParameters.length) {
80267                         var outParams = convertedLoopState.loopOutParameters;
80268                         var expr = void 0;
80269                         for (var i = 0; i < outParams.length; i++) {
80270                             var copyExpr = copyOutParameter(outParams[i], 1);
80271                             if (i === 0) {
80272                                 expr = copyExpr;
80273                             }
80274                             else {
80275                                 expr = factory.createBinaryExpression(expr, 27, copyExpr);
80276                             }
80277                         }
80278                         returnExpression = factory.createBinaryExpression(expr, 27, returnExpression);
80279                     }
80280                     return factory.createReturnStatement(returnExpression);
80281                 }
80282             }
80283             return ts.visitEachChild(node, visitor, context);
80284         }
80285         function visitClassDeclaration(node) {
80286             var variable = factory.createVariableDeclaration(factory.getLocalName(node, true), undefined, undefined, transformClassLikeDeclarationToExpression(node));
80287             ts.setOriginalNode(variable, node);
80288             var statements = [];
80289             var statement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([variable]));
80290             ts.setOriginalNode(statement, node);
80291             ts.setTextRange(statement, node);
80292             ts.startOnNewLine(statement);
80293             statements.push(statement);
80294             if (ts.hasSyntacticModifier(node, 1)) {
80295                 var exportStatement = ts.hasSyntacticModifier(node, 512)
80296                     ? factory.createExportDefault(factory.getLocalName(node))
80297                     : factory.createExternalModuleExport(factory.getLocalName(node));
80298                 ts.setOriginalNode(exportStatement, statement);
80299                 statements.push(exportStatement);
80300             }
80301             var emitFlags = ts.getEmitFlags(node);
80302             if ((emitFlags & 4194304) === 0) {
80303                 statements.push(factory.createEndOfDeclarationMarker(node));
80304                 ts.setEmitFlags(statement, emitFlags | 4194304);
80305             }
80306             return ts.singleOrMany(statements);
80307         }
80308         function visitClassExpression(node) {
80309             return transformClassLikeDeclarationToExpression(node);
80310         }
80311         function transformClassLikeDeclarationToExpression(node) {
80312             if (node.name) {
80313                 enableSubstitutionsForBlockScopedBindings();
80314             }
80315             var extendsClauseElement = ts.getClassExtendsHeritageElement(node);
80316             var classFunction = factory.createFunctionExpression(undefined, undefined, undefined, undefined, extendsClauseElement ? [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createUniqueName("_super", 16 | 32))] : [], undefined, transformClassBody(node, extendsClauseElement));
80317             ts.setEmitFlags(classFunction, (ts.getEmitFlags(node) & 65536) | 524288);
80318             var inner = factory.createPartiallyEmittedExpression(classFunction);
80319             ts.setTextRangeEnd(inner, node.end);
80320             ts.setEmitFlags(inner, 1536);
80321             var outer = factory.createPartiallyEmittedExpression(inner);
80322             ts.setTextRangeEnd(outer, ts.skipTrivia(currentText, node.pos));
80323             ts.setEmitFlags(outer, 1536);
80324             var result = factory.createParenthesizedExpression(factory.createCallExpression(outer, undefined, extendsClauseElement
80325                 ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)]
80326                 : []));
80327             ts.addSyntheticLeadingComment(result, 3, "* @class ");
80328             return result;
80329         }
80330         function transformClassBody(node, extendsClauseElement) {
80331             var statements = [];
80332             var name = factory.getInternalName(node);
80333             var constructorLikeName = ts.isIdentifierANonContextualKeyword(name) ? factory.getGeneratedNameForNode(name) : name;
80334             startLexicalEnvironment();
80335             addExtendsHelperIfNeeded(statements, node, extendsClauseElement);
80336             addConstructor(statements, node, constructorLikeName, extendsClauseElement);
80337             addClassMembers(statements, node);
80338             var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 19);
80339             var outer = factory.createPartiallyEmittedExpression(constructorLikeName);
80340             ts.setTextRangeEnd(outer, closingBraceLocation.end);
80341             ts.setEmitFlags(outer, 1536);
80342             var statement = factory.createReturnStatement(outer);
80343             ts.setTextRangePos(statement, closingBraceLocation.pos);
80344             ts.setEmitFlags(statement, 1536 | 384);
80345             statements.push(statement);
80346             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
80347             var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), node.members), true);
80348             ts.setEmitFlags(block, 1536);
80349             return block;
80350         }
80351         function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) {
80352             if (extendsClauseElement) {
80353                 statements.push(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createExtendsHelper(factory.getInternalName(node))), extendsClauseElement));
80354             }
80355         }
80356         function addConstructor(statements, node, name, extendsClauseElement) {
80357             var savedConvertedLoopState = convertedLoopState;
80358             convertedLoopState = undefined;
80359             var ancestorFacts = enterSubtree(32662, 73);
80360             var constructor = ts.getFirstConstructorWithBody(node);
80361             var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
80362             var constructorFunction = factory.createFunctionDeclaration(undefined, undefined, undefined, name, undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper));
80363             ts.setTextRange(constructorFunction, constructor || node);
80364             if (extendsClauseElement) {
80365                 ts.setEmitFlags(constructorFunction, 8);
80366             }
80367             statements.push(constructorFunction);
80368             exitSubtree(ancestorFacts, 98304, 0);
80369             convertedLoopState = savedConvertedLoopState;
80370         }
80371         function transformConstructorParameters(constructor, hasSynthesizedSuper) {
80372             return ts.visitParameterList(constructor && !hasSynthesizedSuper ? constructor.parameters : undefined, visitor, context)
80373                 || [];
80374         }
80375         function createDefaultConstructorBody(node, isDerivedClass) {
80376             var statements = [];
80377             resumeLexicalEnvironment();
80378             factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
80379             if (isDerivedClass) {
80380                 statements.push(factory.createReturnStatement(createDefaultSuperCallOrThis()));
80381             }
80382             var statementsArray = factory.createNodeArray(statements);
80383             ts.setTextRange(statementsArray, node.members);
80384             var block = factory.createBlock(statementsArray, true);
80385             ts.setTextRange(block, node);
80386             ts.setEmitFlags(block, 1536);
80387             return block;
80388         }
80389         function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
80390             var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104;
80391             if (!constructor)
80392                 return createDefaultConstructorBody(node, isDerivedClass);
80393             var prologue = [];
80394             var statements = [];
80395             resumeLexicalEnvironment();
80396             var statementOffset = 0;
80397             if (!hasSynthesizedSuper)
80398                 statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, false);
80399             addDefaultValueAssignmentsIfNeeded(statements, constructor);
80400             addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
80401             if (!hasSynthesizedSuper)
80402                 statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor);
80403             var superCallExpression;
80404             if (hasSynthesizedSuper) {
80405                 superCallExpression = createDefaultSuperCallOrThis();
80406             }
80407             else if (isDerivedClass && statementOffset < constructor.body.statements.length) {
80408                 var firstStatement = constructor.body.statements[statementOffset];
80409                 if (ts.isExpressionStatement(firstStatement) && ts.isSuperCall(firstStatement.expression)) {
80410                     superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression);
80411                 }
80412             }
80413             if (superCallExpression) {
80414                 hierarchyFacts |= 8192;
80415                 statementOffset++;
80416             }
80417             ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset));
80418             factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
80419             insertCaptureNewTargetIfNeeded(prologue, constructor, false);
80420             if (isDerivedClass) {
80421                 if (superCallExpression && statementOffset === constructor.body.statements.length && !(constructor.body.transformFlags & 8192)) {
80422                     var superCall = ts.cast(ts.cast(superCallExpression, ts.isBinaryExpression).left, ts.isCallExpression);
80423                     var returnStatement = factory.createReturnStatement(superCallExpression);
80424                     ts.setCommentRange(returnStatement, ts.getCommentRange(superCall));
80425                     ts.setEmitFlags(superCall, 1536);
80426                     statements.push(returnStatement);
80427                 }
80428                 else {
80429                     insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis());
80430                     if (!isSufficientlyCoveredByReturnStatements(constructor.body)) {
80431                         statements.push(factory.createReturnStatement(factory.createUniqueName("_this", 16 | 32)));
80432                     }
80433                 }
80434             }
80435             else {
80436                 insertCaptureThisForNodeIfNeeded(prologue, constructor);
80437             }
80438             var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(ts.concatenate(prologue, statements)), constructor.body.statements), true);
80439             ts.setTextRange(block, constructor.body);
80440             return block;
80441         }
80442         function isSufficientlyCoveredByReturnStatements(statement) {
80443             if (statement.kind === 246) {
80444                 return true;
80445             }
80446             else if (statement.kind === 238) {
80447                 var ifStatement = statement;
80448                 if (ifStatement.elseStatement) {
80449                     return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
80450                         isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
80451                 }
80452             }
80453             else if (statement.kind === 234) {
80454                 var lastStatement = ts.lastOrUndefined(statement.statements);
80455                 if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
80456                     return true;
80457                 }
80458             }
80459             return false;
80460         }
80461         function createActualThis() {
80462             return ts.setEmitFlags(factory.createThis(), 4);
80463         }
80464         function createDefaultSuperCallOrThis() {
80465             return factory.createLogicalOr(factory.createLogicalAnd(factory.createStrictInequality(factory.createUniqueName("_super", 16 | 32), factory.createNull()), factory.createFunctionApplyCall(factory.createUniqueName("_super", 16 | 32), createActualThis(), factory.createIdentifier("arguments"))), createActualThis());
80466         }
80467         function visitParameter(node) {
80468             if (node.dotDotDotToken) {
80469                 return undefined;
80470             }
80471             else if (ts.isBindingPattern(node.name)) {
80472                 return ts.setOriginalNode(ts.setTextRange(factory.createParameterDeclaration(undefined, undefined, undefined, factory.getGeneratedNameForNode(node), undefined, undefined, undefined), node), node);
80473             }
80474             else if (node.initializer) {
80475                 return ts.setOriginalNode(ts.setTextRange(factory.createParameterDeclaration(undefined, undefined, undefined, node.name, undefined, undefined, undefined), node), node);
80476             }
80477             else {
80478                 return node;
80479             }
80480         }
80481         function hasDefaultValueOrBindingPattern(node) {
80482             return node.initializer !== undefined
80483                 || ts.isBindingPattern(node.name);
80484         }
80485         function addDefaultValueAssignmentsIfNeeded(statements, node) {
80486             if (!ts.some(node.parameters, hasDefaultValueOrBindingPattern)) {
80487                 return false;
80488             }
80489             var added = false;
80490             for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) {
80491                 var parameter = _a[_i];
80492                 var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken;
80493                 if (dotDotDotToken) {
80494                     continue;
80495                 }
80496                 if (ts.isBindingPattern(name)) {
80497                     added = insertDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) || added;
80498                 }
80499                 else if (initializer) {
80500                     insertDefaultValueAssignmentForInitializer(statements, parameter, name, initializer);
80501                     added = true;
80502                 }
80503             }
80504             return added;
80505         }
80506         function insertDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer) {
80507             if (name.elements.length > 0) {
80508                 ts.insertStatementAfterCustomPrologue(statements, ts.setEmitFlags(factory.createVariableStatement(undefined, factory.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, factory.getGeneratedNameForNode(parameter)))), 1048576));
80509                 return true;
80510             }
80511             else if (initializer) {
80512                 ts.insertStatementAfterCustomPrologue(statements, ts.setEmitFlags(factory.createExpressionStatement(factory.createAssignment(factory.getGeneratedNameForNode(parameter), ts.visitNode(initializer, visitor, ts.isExpression))), 1048576));
80513                 return true;
80514             }
80515             return false;
80516         }
80517         function insertDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) {
80518             initializer = ts.visitNode(initializer, visitor, ts.isExpression);
80519             var statement = factory.createIfStatement(factory.createTypeCheck(factory.cloneNode(name), "undefined"), ts.setEmitFlags(ts.setTextRange(factory.createBlock([
80520                 factory.createExpressionStatement(ts.setEmitFlags(ts.setTextRange(factory.createAssignment(ts.setEmitFlags(ts.setParent(ts.setTextRange(factory.cloneNode(name), name), name.parent), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer) | 1536)), parameter), 1536))
80521             ]), parameter), 1 | 32 | 384 | 1536));
80522             ts.startOnNewLine(statement);
80523             ts.setTextRange(statement, parameter);
80524             ts.setEmitFlags(statement, 384 | 32 | 1048576 | 1536);
80525             ts.insertStatementAfterCustomPrologue(statements, statement);
80526         }
80527         function shouldAddRestParameter(node, inConstructorWithSynthesizedSuper) {
80528             return !!(node && node.dotDotDotToken && !inConstructorWithSynthesizedSuper);
80529         }
80530         function addRestParameterIfNeeded(statements, node, inConstructorWithSynthesizedSuper) {
80531             var prologueStatements = [];
80532             var parameter = ts.lastOrUndefined(node.parameters);
80533             if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
80534                 return false;
80535             }
80536             var declarationName = parameter.name.kind === 79 ? ts.setParent(ts.setTextRange(factory.cloneNode(parameter.name), parameter.name), parameter.name.parent) : factory.createTempVariable(undefined);
80537             ts.setEmitFlags(declarationName, 48);
80538             var expressionName = parameter.name.kind === 79 ? factory.cloneNode(parameter.name) : declarationName;
80539             var restIndex = node.parameters.length - 1;
80540             var temp = factory.createLoopVariable();
80541             prologueStatements.push(ts.setEmitFlags(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
80542                 factory.createVariableDeclaration(declarationName, undefined, undefined, factory.createArrayLiteralExpression([]))
80543             ])), parameter), 1048576));
80544             var forStatement = factory.createForStatement(ts.setTextRange(factory.createVariableDeclarationList([
80545                 factory.createVariableDeclaration(temp, undefined, undefined, factory.createNumericLiteral(restIndex))
80546             ]), parameter), ts.setTextRange(factory.createLessThan(temp, factory.createPropertyAccessExpression(factory.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(factory.createPostfixIncrement(temp), parameter), factory.createBlock([
80547                 ts.startOnNewLine(ts.setTextRange(factory.createExpressionStatement(factory.createAssignment(factory.createElementAccessExpression(expressionName, restIndex === 0
80548                     ? temp
80549                     : factory.createSubtract(temp, factory.createNumericLiteral(restIndex))), factory.createElementAccessExpression(factory.createIdentifier("arguments"), temp))), parameter))
80550             ]));
80551             ts.setEmitFlags(forStatement, 1048576);
80552             ts.startOnNewLine(forStatement);
80553             prologueStatements.push(forStatement);
80554             if (parameter.name.kind !== 79) {
80555                 prologueStatements.push(ts.setEmitFlags(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, expressionName))), parameter), 1048576));
80556             }
80557             ts.insertStatementsAfterCustomPrologue(statements, prologueStatements);
80558             return true;
80559         }
80560         function insertCaptureThisForNodeIfNeeded(statements, node) {
80561             if (hierarchyFacts & 65536 && node.kind !== 213) {
80562                 insertCaptureThisForNode(statements, node, factory.createThis());
80563                 return true;
80564             }
80565             return false;
80566         }
80567         function insertCaptureThisForNode(statements, node, initializer) {
80568             enableSubstitutionsForCapturedThis();
80569             var captureThisStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
80570                 factory.createVariableDeclaration(factory.createUniqueName("_this", 16 | 32), undefined, undefined, initializer)
80571             ]));
80572             ts.setEmitFlags(captureThisStatement, 1536 | 1048576);
80573             ts.setSourceMapRange(captureThisStatement, node);
80574             ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
80575         }
80576         function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
80577             if (hierarchyFacts & 32768) {
80578                 var newTarget = void 0;
80579                 switch (node.kind) {
80580                     case 213:
80581                         return statements;
80582                     case 168:
80583                     case 171:
80584                     case 172:
80585                         newTarget = factory.createVoidZero();
80586                         break;
80587                     case 170:
80588                         newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor");
80589                         break;
80590                     case 255:
80591                     case 212:
80592                         newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4), 102, factory.getLocalName(node))), undefined, factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor"), undefined, factory.createVoidZero());
80593                         break;
80594                     default:
80595                         return ts.Debug.failBadSyntaxKind(node);
80596                 }
80597                 var captureNewTargetStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
80598                     factory.createVariableDeclaration(factory.createUniqueName("_newTarget", 16 | 32), undefined, undefined, newTarget)
80599                 ]));
80600                 ts.setEmitFlags(captureNewTargetStatement, 1536 | 1048576);
80601                 if (copyOnWrite) {
80602                     statements = statements.slice();
80603                 }
80604                 ts.insertStatementAfterCustomPrologue(statements, captureNewTargetStatement);
80605             }
80606             return statements;
80607         }
80608         function addClassMembers(statements, node) {
80609             for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
80610                 var member = _a[_i];
80611                 switch (member.kind) {
80612                     case 233:
80613                         statements.push(transformSemicolonClassElementToStatement(member));
80614                         break;
80615                     case 168:
80616                         statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
80617                         break;
80618                     case 171:
80619                     case 172:
80620                         var accessors = ts.getAllAccessorDeclarations(node.members, member);
80621                         if (member === accessors.firstAccessor) {
80622                             statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
80623                         }
80624                         break;
80625                     case 170:
80626                     case 169:
80627                         break;
80628                     default:
80629                         ts.Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName);
80630                         break;
80631                 }
80632             }
80633         }
80634         function transformSemicolonClassElementToStatement(member) {
80635             return ts.setTextRange(factory.createEmptyStatement(), member);
80636         }
80637         function transformClassMethodDeclarationToStatement(receiver, member, container) {
80638             var commentRange = ts.getCommentRange(member);
80639             var sourceMapRange = ts.getSourceMapRange(member);
80640             var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container);
80641             var propertyName = ts.visitNode(member.name, visitor, ts.isPropertyName);
80642             var e;
80643             if (!ts.isPrivateIdentifier(propertyName) && ts.getUseDefineForClassFields(context.getCompilerOptions())) {
80644                 var name = ts.isComputedPropertyName(propertyName) ? propertyName.expression
80645                     : ts.isIdentifier(propertyName) ? factory.createStringLiteral(ts.unescapeLeadingUnderscores(propertyName.escapedText))
80646                         : propertyName;
80647                 e = factory.createObjectDefinePropertyCall(receiver, name, factory.createPropertyDescriptor({ value: memberFunction, enumerable: false, writable: true, configurable: true }));
80648             }
80649             else {
80650                 var memberName = ts.createMemberAccessForPropertyName(factory, receiver, propertyName, member.name);
80651                 e = factory.createAssignment(memberName, memberFunction);
80652             }
80653             ts.setEmitFlags(memberFunction, 1536);
80654             ts.setSourceMapRange(memberFunction, sourceMapRange);
80655             var statement = ts.setTextRange(factory.createExpressionStatement(e), member);
80656             ts.setOriginalNode(statement, member);
80657             ts.setCommentRange(statement, commentRange);
80658             ts.setEmitFlags(statement, 48);
80659             return statement;
80660         }
80661         function transformAccessorsToStatement(receiver, accessors, container) {
80662             var statement = factory.createExpressionStatement(transformAccessorsToExpression(receiver, accessors, container, false));
80663             ts.setEmitFlags(statement, 1536);
80664             ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor));
80665             return statement;
80666         }
80667         function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) {
80668             var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
80669             var target = ts.setParent(ts.setTextRange(factory.cloneNode(receiver), receiver), receiver.parent);
80670             ts.setEmitFlags(target, 1536 | 32);
80671             ts.setSourceMapRange(target, firstAccessor.name);
80672             var visitedAccessorName = ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName);
80673             if (ts.isPrivateIdentifier(visitedAccessorName)) {
80674                 return ts.Debug.failBadSyntaxKind(visitedAccessorName, "Encountered unhandled private identifier while transforming ES2015.");
80675             }
80676             var propertyName = ts.createExpressionForPropertyName(factory, visitedAccessorName);
80677             ts.setEmitFlags(propertyName, 1536 | 16);
80678             ts.setSourceMapRange(propertyName, firstAccessor.name);
80679             var properties = [];
80680             if (getAccessor) {
80681                 var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container);
80682                 ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor));
80683                 ts.setEmitFlags(getterFunction, 512);
80684                 var getter = factory.createPropertyAssignment("get", getterFunction);
80685                 ts.setCommentRange(getter, ts.getCommentRange(getAccessor));
80686                 properties.push(getter);
80687             }
80688             if (setAccessor) {
80689                 var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container);
80690                 ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor));
80691                 ts.setEmitFlags(setterFunction, 512);
80692                 var setter = factory.createPropertyAssignment("set", setterFunction);
80693                 ts.setCommentRange(setter, ts.getCommentRange(setAccessor));
80694                 properties.push(setter);
80695             }
80696             properties.push(factory.createPropertyAssignment("enumerable", getAccessor || setAccessor ? factory.createFalse() : factory.createTrue()), factory.createPropertyAssignment("configurable", factory.createTrue()));
80697             var call = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), undefined, [
80698                 target,
80699                 propertyName,
80700                 factory.createObjectLiteralExpression(properties, true)
80701             ]);
80702             if (startsOnNewLine) {
80703                 ts.startOnNewLine(call);
80704             }
80705             return call;
80706         }
80707         function visitArrowFunction(node) {
80708             if (node.transformFlags & 8192 && !(hierarchyFacts & 16384)) {
80709                 hierarchyFacts |= 65536;
80710             }
80711             var savedConvertedLoopState = convertedLoopState;
80712             convertedLoopState = undefined;
80713             var ancestorFacts = enterSubtree(15232, 66);
80714             var func = factory.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
80715             ts.setTextRange(func, node);
80716             ts.setOriginalNode(func, node);
80717             ts.setEmitFlags(func, 8);
80718             exitSubtree(ancestorFacts, 0, 0);
80719             convertedLoopState = savedConvertedLoopState;
80720             return func;
80721         }
80722         function visitFunctionExpression(node) {
80723             var ancestorFacts = ts.getEmitFlags(node) & 262144
80724                 ? enterSubtree(32662, 69)
80725                 : enterSubtree(32670, 65);
80726             var savedConvertedLoopState = convertedLoopState;
80727             convertedLoopState = undefined;
80728             var parameters = ts.visitParameterList(node.parameters, visitor, context);
80729             var body = transformFunctionBody(node);
80730             var name = hierarchyFacts & 32768
80731                 ? factory.getLocalName(node)
80732                 : node.name;
80733             exitSubtree(ancestorFacts, 98304, 0);
80734             convertedLoopState = savedConvertedLoopState;
80735             return factory.updateFunctionExpression(node, undefined, node.asteriskToken, name, undefined, parameters, undefined, body);
80736         }
80737         function visitFunctionDeclaration(node) {
80738             var savedConvertedLoopState = convertedLoopState;
80739             convertedLoopState = undefined;
80740             var ancestorFacts = enterSubtree(32670, 65);
80741             var parameters = ts.visitParameterList(node.parameters, visitor, context);
80742             var body = transformFunctionBody(node);
80743             var name = hierarchyFacts & 32768
80744                 ? factory.getLocalName(node)
80745                 : node.name;
80746             exitSubtree(ancestorFacts, 98304, 0);
80747             convertedLoopState = savedConvertedLoopState;
80748             return factory.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, undefined, parameters, undefined, body);
80749         }
80750         function transformFunctionLikeToExpression(node, location, name, container) {
80751             var savedConvertedLoopState = convertedLoopState;
80752             convertedLoopState = undefined;
80753             var ancestorFacts = container && ts.isClassLike(container) && !ts.isStatic(node)
80754                 ? enterSubtree(32670, 65 | 8)
80755                 : enterSubtree(32670, 65);
80756             var parameters = ts.visitParameterList(node.parameters, visitor, context);
80757             var body = transformFunctionBody(node);
80758             if (hierarchyFacts & 32768 && !name && (node.kind === 255 || node.kind === 212)) {
80759                 name = factory.getGeneratedNameForNode(node);
80760             }
80761             exitSubtree(ancestorFacts, 98304, 0);
80762             convertedLoopState = savedConvertedLoopState;
80763             return ts.setOriginalNode(ts.setTextRange(factory.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body), location), node);
80764         }
80765         function transformFunctionBody(node) {
80766             var multiLine = false;
80767             var singleLine = false;
80768             var statementsLocation;
80769             var closeBraceLocation;
80770             var prologue = [];
80771             var statements = [];
80772             var body = node.body;
80773             var statementOffset;
80774             resumeLexicalEnvironment();
80775             if (ts.isBlock(body)) {
80776                 statementOffset = factory.copyStandardPrologue(body.statements, prologue, false);
80777                 statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedFunction);
80778                 statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedVariableStatement);
80779             }
80780             multiLine = addDefaultValueAssignmentsIfNeeded(statements, node) || multiLine;
80781             multiLine = addRestParameterIfNeeded(statements, node, false) || multiLine;
80782             if (ts.isBlock(body)) {
80783                 statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor);
80784                 statementsLocation = body.statements;
80785                 ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset));
80786                 if (!multiLine && body.multiLine) {
80787                     multiLine = true;
80788                 }
80789             }
80790             else {
80791                 ts.Debug.assert(node.kind === 213);
80792                 statementsLocation = ts.moveRangeEnd(body, -1);
80793                 var equalsGreaterThanToken = node.equalsGreaterThanToken;
80794                 if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
80795                     if (ts.rangeEndIsOnSameLineAsRangeStart(equalsGreaterThanToken, body, currentSourceFile)) {
80796                         singleLine = true;
80797                     }
80798                     else {
80799                         multiLine = true;
80800                     }
80801                 }
80802                 var expression = ts.visitNode(body, visitor, ts.isExpression);
80803                 var returnStatement = factory.createReturnStatement(expression);
80804                 ts.setTextRange(returnStatement, body);
80805                 ts.moveSyntheticComments(returnStatement, body);
80806                 ts.setEmitFlags(returnStatement, 384 | 32 | 1024);
80807                 statements.push(returnStatement);
80808                 closeBraceLocation = body;
80809             }
80810             factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
80811             insertCaptureNewTargetIfNeeded(prologue, node, false);
80812             insertCaptureThisForNodeIfNeeded(prologue, node);
80813             if (ts.some(prologue)) {
80814                 multiLine = true;
80815             }
80816             statements.unshift.apply(statements, prologue);
80817             if (ts.isBlock(body) && ts.arrayIsEqualTo(statements, body.statements)) {
80818                 return body;
80819             }
80820             var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), multiLine);
80821             ts.setTextRange(block, node.body);
80822             if (!multiLine && singleLine) {
80823                 ts.setEmitFlags(block, 1);
80824             }
80825             if (closeBraceLocation) {
80826                 ts.setTokenSourceMapRange(block, 19, closeBraceLocation);
80827             }
80828             ts.setOriginalNode(block, node.body);
80829             return block;
80830         }
80831         function visitBlock(node, isFunctionBody) {
80832             if (isFunctionBody) {
80833                 return ts.visitEachChild(node, visitor, context);
80834             }
80835             var ancestorFacts = hierarchyFacts & 256
80836                 ? enterSubtree(7104, 512)
80837                 : enterSubtree(6976, 128);
80838             var updated = ts.visitEachChild(node, visitor, context);
80839             exitSubtree(ancestorFacts, 0, 0);
80840             return updated;
80841         }
80842         function visitExpressionStatement(node) {
80843             return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
80844         }
80845         function visitParenthesizedExpression(node, expressionResultIsUnused) {
80846             return ts.visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context);
80847         }
80848         function visitBinaryExpression(node, expressionResultIsUnused) {
80849             if (ts.isDestructuringAssignment(node)) {
80850                 return ts.flattenDestructuringAssignment(node, visitor, context, 0, !expressionResultIsUnused);
80851             }
80852             if (node.operatorToken.kind === 27) {
80853                 return factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorWithUnusedExpressionResult, ts.isExpression), node.operatorToken, ts.visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, ts.isExpression));
80854             }
80855             return ts.visitEachChild(node, visitor, context);
80856         }
80857         function visitCommaListExpression(node, expressionResultIsUnused) {
80858             if (expressionResultIsUnused) {
80859                 return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
80860             }
80861             var result;
80862             for (var i = 0; i < node.elements.length; i++) {
80863                 var element = node.elements[i];
80864                 var visited = ts.visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, ts.isExpression);
80865                 if (result || visited !== element) {
80866                     result || (result = node.elements.slice(0, i));
80867                     result.push(visited);
80868                 }
80869             }
80870             var elements = result ? ts.setTextRange(factory.createNodeArray(result), node.elements) : node.elements;
80871             return factory.updateCommaListExpression(node, elements);
80872         }
80873         function isVariableStatementOfTypeScriptClassWrapper(node) {
80874             return node.declarationList.declarations.length === 1
80875                 && !!node.declarationList.declarations[0].initializer
80876                 && !!(ts.getEmitFlags(node.declarationList.declarations[0].initializer) & 33554432);
80877         }
80878         function visitVariableStatement(node) {
80879             var ancestorFacts = enterSubtree(0, ts.hasSyntacticModifier(node, 1) ? 32 : 0);
80880             var updated;
80881             if (convertedLoopState && (node.declarationList.flags & 3) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) {
80882                 var assignments = void 0;
80883                 for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
80884                     var decl = _a[_i];
80885                     hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl);
80886                     if (decl.initializer) {
80887                         var assignment = void 0;
80888                         if (ts.isBindingPattern(decl.name)) {
80889                             assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);
80890                         }
80891                         else {
80892                             assignment = factory.createBinaryExpression(decl.name, 63, ts.visitNode(decl.initializer, visitor, ts.isExpression));
80893                             ts.setTextRange(assignment, decl);
80894                         }
80895                         assignments = ts.append(assignments, assignment);
80896                     }
80897                 }
80898                 if (assignments) {
80899                     updated = ts.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(assignments)), node);
80900                 }
80901                 else {
80902                     updated = undefined;
80903                 }
80904             }
80905             else {
80906                 updated = ts.visitEachChild(node, visitor, context);
80907             }
80908             exitSubtree(ancestorFacts, 0, 0);
80909             return updated;
80910         }
80911         function visitVariableDeclarationList(node) {
80912             if (node.flags & 3 || node.transformFlags & 262144) {
80913                 if (node.flags & 3) {
80914                     enableSubstitutionsForBlockScopedBindings();
80915                 }
80916                 var declarations = ts.flatMap(node.declarations, node.flags & 1
80917                     ? visitVariableDeclarationInLetDeclarationList
80918                     : visitVariableDeclaration);
80919                 var declarationList = factory.createVariableDeclarationList(declarations);
80920                 ts.setOriginalNode(declarationList, node);
80921                 ts.setTextRange(declarationList, node);
80922                 ts.setCommentRange(declarationList, node);
80923                 if (node.transformFlags & 262144
80924                     && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.last(node.declarations).name))) {
80925                     ts.setSourceMapRange(declarationList, getRangeUnion(declarations));
80926                 }
80927                 return declarationList;
80928             }
80929             return ts.visitEachChild(node, visitor, context);
80930         }
80931         function getRangeUnion(declarations) {
80932             var pos = -1, end = -1;
80933             for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) {
80934                 var node = declarations_9[_i];
80935                 pos = pos === -1 ? node.pos : node.pos === -1 ? pos : Math.min(pos, node.pos);
80936                 end = Math.max(end, node.end);
80937             }
80938             return ts.createRange(pos, end);
80939         }
80940         function shouldEmitExplicitInitializerForLetDeclaration(node) {
80941             var flags = resolver.getNodeCheckFlags(node);
80942             var isCapturedInFunction = flags & 262144;
80943             var isDeclaredInLoop = flags & 524288;
80944             var emittedAsTopLevel = (hierarchyFacts & 64) !== 0
80945                 || (isCapturedInFunction
80946                     && isDeclaredInLoop
80947                     && (hierarchyFacts & 512) !== 0);
80948             var emitExplicitInitializer = !emittedAsTopLevel
80949                 && (hierarchyFacts & 4096) === 0
80950                 && (!resolver.isDeclarationWithCollidingName(node)
80951                     || (isDeclaredInLoop
80952                         && !isCapturedInFunction
80953                         && (hierarchyFacts & (2048 | 4096)) === 0));
80954             return emitExplicitInitializer;
80955         }
80956         function visitVariableDeclarationInLetDeclarationList(node) {
80957             var name = node.name;
80958             if (ts.isBindingPattern(name)) {
80959                 return visitVariableDeclaration(node);
80960             }
80961             if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) {
80962                 return factory.updateVariableDeclaration(node, node.name, undefined, undefined, factory.createVoidZero());
80963             }
80964             return ts.visitEachChild(node, visitor, context);
80965         }
80966         function visitVariableDeclaration(node) {
80967             var ancestorFacts = enterSubtree(32, 0);
80968             var updated;
80969             if (ts.isBindingPattern(node.name)) {
80970                 updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0);
80971             }
80972             else {
80973                 updated = ts.visitEachChild(node, visitor, context);
80974             }
80975             exitSubtree(ancestorFacts, 0, 0);
80976             return updated;
80977         }
80978         function recordLabel(node) {
80979             convertedLoopState.labels.set(ts.idText(node.label), true);
80980         }
80981         function resetLabel(node) {
80982             convertedLoopState.labels.set(ts.idText(node.label), false);
80983         }
80984         function visitLabeledStatement(node) {
80985             if (convertedLoopState && !convertedLoopState.labels) {
80986                 convertedLoopState.labels = new ts.Map();
80987             }
80988             var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel);
80989             return ts.isIterationStatement(statement, false)
80990                 ? visitIterationStatement(statement, node)
80991                 : factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node, convertedLoopState && resetLabel);
80992         }
80993         function visitIterationStatement(node, outermostLabeledStatement) {
80994             switch (node.kind) {
80995                 case 239:
80996                 case 240:
80997                     return visitDoOrWhileStatement(node, outermostLabeledStatement);
80998                 case 241:
80999                     return visitForStatement(node, outermostLabeledStatement);
81000                 case 242:
81001                     return visitForInStatement(node, outermostLabeledStatement);
81002                 case 243:
81003                     return visitForOfStatement(node, outermostLabeledStatement);
81004             }
81005         }
81006         function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
81007             var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
81008             var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
81009             exitSubtree(ancestorFacts, 0, 0);
81010             return updated;
81011         }
81012         function visitDoOrWhileStatement(node, outermostLabeledStatement) {
81013             return visitIterationStatementWithFacts(0, 1280, node, outermostLabeledStatement);
81014         }
81015         function visitForStatement(node, outermostLabeledStatement) {
81016             return visitIterationStatementWithFacts(5056, 3328, node, outermostLabeledStatement);
81017         }
81018         function visitEachChildOfForStatement(node) {
81019             return factory.updateForStatement(node, ts.visitNode(node.initializer, visitorWithUnusedExpressionResult, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitorWithUnusedExpressionResult, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock));
81020         }
81021         function visitForInStatement(node, outermostLabeledStatement) {
81022             return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement);
81023         }
81024         function visitForOfStatement(node, outermostLabeledStatement) {
81025             return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
81026         }
81027         function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
81028             var statements = [];
81029             var initializer = node.initializer;
81030             if (ts.isVariableDeclarationList(initializer)) {
81031                 if (node.initializer.flags & 3) {
81032                     enableSubstitutionsForBlockScopedBindings();
81033                 }
81034                 var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations);
81035                 if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) {
81036                     var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue);
81037                     var declarationList = ts.setTextRange(factory.createVariableDeclarationList(declarations), node.initializer);
81038                     ts.setOriginalNode(declarationList, node.initializer);
81039                     ts.setSourceMapRange(declarationList, ts.createRange(declarations[0].pos, ts.last(declarations).end));
81040                     statements.push(factory.createVariableStatement(undefined, declarationList));
81041                 }
81042                 else {
81043                     statements.push(ts.setTextRange(factory.createVariableStatement(undefined, ts.setOriginalNode(ts.setTextRange(factory.createVariableDeclarationList([
81044                         factory.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : factory.createTempVariable(undefined), undefined, undefined, boundValue)
81045                     ]), ts.moveRangePos(initializer, -1)), initializer)), ts.moveRangeEnd(initializer, -1)));
81046                 }
81047             }
81048             else {
81049                 var assignment = factory.createAssignment(initializer, boundValue);
81050                 if (ts.isDestructuringAssignment(assignment)) {
81051                     statements.push(factory.createExpressionStatement(visitBinaryExpression(assignment, true)));
81052                 }
81053                 else {
81054                     ts.setTextRangeEnd(assignment, initializer.end);
81055                     statements.push(ts.setTextRange(factory.createExpressionStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(initializer, -1)));
81056                 }
81057             }
81058             if (convertedLoopBodyStatements) {
81059                 return createSyntheticBlockForConvertedStatements(ts.addRange(statements, convertedLoopBodyStatements));
81060             }
81061             else {
81062                 var statement = ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock);
81063                 if (ts.isBlock(statement)) {
81064                     return factory.updateBlock(statement, ts.setTextRange(factory.createNodeArray(ts.concatenate(statements, statement.statements)), statement.statements));
81065                 }
81066                 else {
81067                     statements.push(statement);
81068                     return createSyntheticBlockForConvertedStatements(statements);
81069                 }
81070             }
81071         }
81072         function createSyntheticBlockForConvertedStatements(statements) {
81073             return ts.setEmitFlags(factory.createBlock(factory.createNodeArray(statements), true), 48 | 384);
81074         }
81075         function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) {
81076             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
81077             var counter = factory.createLoopVariable();
81078             var rhsReference = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(undefined);
81079             ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression));
81080             var forStatement = ts.setTextRange(factory.createForStatement(ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([
81081                 ts.setTextRange(factory.createVariableDeclaration(counter, undefined, undefined, factory.createNumericLiteral(0)), ts.moveRangePos(node.expression, -1)),
81082                 ts.setTextRange(factory.createVariableDeclaration(rhsReference, undefined, undefined, expression), node.expression)
81083             ]), node.expression), 2097152), ts.setTextRange(factory.createLessThan(counter, factory.createPropertyAccessExpression(rhsReference, "length")), node.expression), ts.setTextRange(factory.createPostfixIncrement(counter), node.expression), convertForOfStatementHead(node, factory.createElementAccessExpression(rhsReference, counter), convertedLoopBodyStatements)), node);
81084             ts.setEmitFlags(forStatement, 256);
81085             ts.setTextRange(forStatement, node);
81086             return factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
81087         }
81088         function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
81089             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
81090             var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(undefined);
81091             var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(undefined);
81092             var errorRecord = factory.createUniqueName("e");
81093             var catchVariable = factory.getGeneratedNameForNode(errorRecord);
81094             var returnMethod = factory.createTempVariable(undefined);
81095             var values = ts.setTextRange(emitHelpers().createValuesHelper(expression), node.expression);
81096             var next = factory.createCallExpression(factory.createPropertyAccessExpression(iterator, "next"), undefined, []);
81097             hoistVariableDeclaration(errorRecord);
81098             hoistVariableDeclaration(returnMethod);
81099             var initializer = ancestorFacts & 1024
81100                 ? factory.inlineExpressions([factory.createAssignment(errorRecord, factory.createVoidZero()), values])
81101                 : values;
81102             var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement(ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([
81103                 ts.setTextRange(factory.createVariableDeclaration(iterator, undefined, undefined, initializer), node.expression),
81104                 factory.createVariableDeclaration(result, undefined, undefined, next)
81105             ]), node.expression), 2097152), factory.createLogicalNot(factory.createPropertyAccessExpression(result, "done")), factory.createAssignment(result, next), convertForOfStatementHead(node, factory.createPropertyAccessExpression(result, "value"), convertedLoopBodyStatements)), node), 256);
81106             return factory.createTryStatement(factory.createBlock([
81107                 factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel)
81108             ]), factory.createCatchClause(factory.createVariableDeclaration(catchVariable), ts.setEmitFlags(factory.createBlock([
81109                 factory.createExpressionStatement(factory.createAssignment(errorRecord, factory.createObjectLiteralExpression([
81110                     factory.createPropertyAssignment("error", catchVariable)
81111                 ])))
81112             ]), 1)), factory.createBlock([
81113                 factory.createTryStatement(factory.createBlock([
81114                     ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(factory.createPropertyAccessExpression(result, "done"))), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(factory.createFunctionCallCall(returnMethod, iterator, []))), 1),
81115                 ]), undefined, ts.setEmitFlags(factory.createBlock([
81116                     ts.setEmitFlags(factory.createIfStatement(errorRecord, factory.createThrowStatement(factory.createPropertyAccessExpression(errorRecord, "error"))), 1)
81117                 ]), 1))
81118             ]));
81119         }
81120         function visitObjectLiteralExpression(node) {
81121             var properties = node.properties;
81122             var numInitialProperties = -1, hasComputed = false;
81123             for (var i = 0; i < properties.length; i++) {
81124                 var property = properties[i];
81125                 if ((property.transformFlags & 524288 &&
81126                     hierarchyFacts & 4)
81127                     || (hasComputed = ts.Debug.checkDefined(property.name).kind === 161)) {
81128                     numInitialProperties = i;
81129                     break;
81130                 }
81131             }
81132             if (numInitialProperties < 0) {
81133                 return ts.visitEachChild(node, visitor, context);
81134             }
81135             var temp = factory.createTempVariable(hoistVariableDeclaration);
81136             var expressions = [];
81137             var assignment = factory.createAssignment(temp, ts.setEmitFlags(factory.createObjectLiteralExpression(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), hasComputed ? 65536 : 0));
81138             if (node.multiLine) {
81139                 ts.startOnNewLine(assignment);
81140             }
81141             expressions.push(assignment);
81142             addObjectLiteralMembers(expressions, node, temp, numInitialProperties);
81143             expressions.push(node.multiLine ? ts.startOnNewLine(ts.setParent(ts.setTextRange(factory.cloneNode(temp), temp), temp.parent)) : temp);
81144             return factory.inlineExpressions(expressions);
81145         }
81146         function shouldConvertPartOfIterationStatement(node) {
81147             return (resolver.getNodeCheckFlags(node) & 131072) !== 0;
81148         }
81149         function shouldConvertInitializerOfForStatement(node) {
81150             return ts.isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
81151         }
81152         function shouldConvertConditionOfForStatement(node) {
81153             return ts.isForStatement(node) && !!node.condition && shouldConvertPartOfIterationStatement(node.condition);
81154         }
81155         function shouldConvertIncrementorOfForStatement(node) {
81156             return ts.isForStatement(node) && !!node.incrementor && shouldConvertPartOfIterationStatement(node.incrementor);
81157         }
81158         function shouldConvertIterationStatement(node) {
81159             return shouldConvertBodyOfIterationStatement(node)
81160                 || shouldConvertInitializerOfForStatement(node);
81161         }
81162         function shouldConvertBodyOfIterationStatement(node) {
81163             return (resolver.getNodeCheckFlags(node) & 65536) !== 0;
81164         }
81165         function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
81166             if (!state.hoistedLocalVariables) {
81167                 state.hoistedLocalVariables = [];
81168             }
81169             visit(node.name);
81170             function visit(node) {
81171                 if (node.kind === 79) {
81172                     state.hoistedLocalVariables.push(node);
81173                 }
81174                 else {
81175                     for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
81176                         var element = _a[_i];
81177                         if (!ts.isOmittedExpression(element)) {
81178                             visit(element.name);
81179                         }
81180                     }
81181                 }
81182             }
81183         }
81184         function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
81185             if (!shouldConvertIterationStatement(node)) {
81186                 var saveAllowedNonLabeledJumps = void 0;
81187                 if (convertedLoopState) {
81188                     saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps;
81189                     convertedLoopState.allowedNonLabeledJumps = 2 | 4;
81190                 }
81191                 var result = convert
81192                     ? convert(node, outermostLabeledStatement, undefined, ancestorFacts)
81193                     : factory.restoreEnclosingLabel(ts.isForStatement(node) ? visitEachChildOfForStatement(node) : ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
81194                 if (convertedLoopState) {
81195                     convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
81196                 }
81197                 return result;
81198             }
81199             var currentState = createConvertedLoopState(node);
81200             var statements = [];
81201             var outerConvertedLoopState = convertedLoopState;
81202             convertedLoopState = currentState;
81203             var initializerFunction = shouldConvertInitializerOfForStatement(node) ? createFunctionForInitializerOfForStatement(node, currentState) : undefined;
81204             var bodyFunction = shouldConvertBodyOfIterationStatement(node) ? createFunctionForBodyOfIterationStatement(node, currentState, outerConvertedLoopState) : undefined;
81205             convertedLoopState = outerConvertedLoopState;
81206             if (initializerFunction)
81207                 statements.push(initializerFunction.functionDeclaration);
81208             if (bodyFunction)
81209                 statements.push(bodyFunction.functionDeclaration);
81210             addExtraDeclarationsForConvertedLoop(statements, currentState, outerConvertedLoopState);
81211             if (initializerFunction) {
81212                 statements.push(generateCallToConvertedLoopInitializer(initializerFunction.functionName, initializerFunction.containsYield));
81213             }
81214             var loop;
81215             if (bodyFunction) {
81216                 if (convert) {
81217                     loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
81218                 }
81219                 else {
81220                     var clone_4 = convertIterationStatementCore(node, initializerFunction, factory.createBlock(bodyFunction.part, true));
81221                     loop = factory.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel);
81222                 }
81223             }
81224             else {
81225                 var clone_5 = convertIterationStatementCore(node, initializerFunction, ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock));
81226                 loop = factory.restoreEnclosingLabel(clone_5, outermostLabeledStatement, convertedLoopState && resetLabel);
81227             }
81228             statements.push(loop);
81229             return statements;
81230         }
81231         function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
81232             switch (node.kind) {
81233                 case 241: return convertForStatement(node, initializerFunction, convertedLoopBody);
81234                 case 242: return convertForInStatement(node, convertedLoopBody);
81235                 case 243: return convertForOfStatement(node, convertedLoopBody);
81236                 case 239: return convertDoStatement(node, convertedLoopBody);
81237                 case 240: return convertWhileStatement(node, convertedLoopBody);
81238                 default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
81239             }
81240         }
81241         function convertForStatement(node, initializerFunction, convertedLoopBody) {
81242             var shouldConvertCondition = node.condition && shouldConvertPartOfIterationStatement(node.condition);
81243             var shouldConvertIncrementor = shouldConvertCondition || node.incrementor && shouldConvertPartOfIterationStatement(node.incrementor);
81244             return factory.updateForStatement(node, ts.visitNode(initializerFunction ? initializerFunction.part : node.initializer, visitorWithUnusedExpressionResult, ts.isForInitializer), ts.visitNode(shouldConvertCondition ? undefined : node.condition, visitor, ts.isExpression), ts.visitNode(shouldConvertIncrementor ? undefined : node.incrementor, visitorWithUnusedExpressionResult, ts.isExpression), convertedLoopBody);
81245         }
81246         function convertForOfStatement(node, convertedLoopBody) {
81247             return factory.updateForOfStatement(node, undefined, ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), convertedLoopBody);
81248         }
81249         function convertForInStatement(node, convertedLoopBody) {
81250             return factory.updateForInStatement(node, ts.visitNode(node.initializer, visitor, ts.isForInitializer), ts.visitNode(node.expression, visitor, ts.isExpression), convertedLoopBody);
81251         }
81252         function convertDoStatement(node, convertedLoopBody) {
81253             return factory.updateDoStatement(node, convertedLoopBody, ts.visitNode(node.expression, visitor, ts.isExpression));
81254         }
81255         function convertWhileStatement(node, convertedLoopBody) {
81256             return factory.updateWhileStatement(node, ts.visitNode(node.expression, visitor, ts.isExpression), convertedLoopBody);
81257         }
81258         function createConvertedLoopState(node) {
81259             var loopInitializer;
81260             switch (node.kind) {
81261                 case 241:
81262                 case 242:
81263                 case 243:
81264                     var initializer = node.initializer;
81265                     if (initializer && initializer.kind === 254) {
81266                         loopInitializer = initializer;
81267                     }
81268                     break;
81269             }
81270             var loopParameters = [];
81271             var loopOutParameters = [];
81272             if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3)) {
81273                 var hasCapturedBindingsInForInitializer = shouldConvertInitializerOfForStatement(node);
81274                 for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) {
81275                     var decl = _a[_i];
81276                     processLoopVariableDeclaration(node, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForInitializer);
81277                 }
81278             }
81279             var currentState = { loopParameters: loopParameters, loopOutParameters: loopOutParameters };
81280             if (convertedLoopState) {
81281                 if (convertedLoopState.argumentsName) {
81282                     currentState.argumentsName = convertedLoopState.argumentsName;
81283                 }
81284                 if (convertedLoopState.thisName) {
81285                     currentState.thisName = convertedLoopState.thisName;
81286                 }
81287                 if (convertedLoopState.hoistedLocalVariables) {
81288                     currentState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables;
81289                 }
81290             }
81291             return currentState;
81292         }
81293         function addExtraDeclarationsForConvertedLoop(statements, state, outerState) {
81294             var extraVariableDeclarations;
81295             if (state.argumentsName) {
81296                 if (outerState) {
81297                     outerState.argumentsName = state.argumentsName;
81298                 }
81299                 else {
81300                     (extraVariableDeclarations || (extraVariableDeclarations = [])).push(factory.createVariableDeclaration(state.argumentsName, undefined, undefined, factory.createIdentifier("arguments")));
81301                 }
81302             }
81303             if (state.thisName) {
81304                 if (outerState) {
81305                     outerState.thisName = state.thisName;
81306                 }
81307                 else {
81308                     (extraVariableDeclarations || (extraVariableDeclarations = [])).push(factory.createVariableDeclaration(state.thisName, undefined, undefined, factory.createIdentifier("this")));
81309                 }
81310             }
81311             if (state.hoistedLocalVariables) {
81312                 if (outerState) {
81313                     outerState.hoistedLocalVariables = state.hoistedLocalVariables;
81314                 }
81315                 else {
81316                     if (!extraVariableDeclarations) {
81317                         extraVariableDeclarations = [];
81318                     }
81319                     for (var _i = 0, _a = state.hoistedLocalVariables; _i < _a.length; _i++) {
81320                         var identifier = _a[_i];
81321                         extraVariableDeclarations.push(factory.createVariableDeclaration(identifier));
81322                     }
81323                 }
81324             }
81325             if (state.loopOutParameters.length) {
81326                 if (!extraVariableDeclarations) {
81327                     extraVariableDeclarations = [];
81328                 }
81329                 for (var _b = 0, _c = state.loopOutParameters; _b < _c.length; _b++) {
81330                     var outParam = _c[_b];
81331                     extraVariableDeclarations.push(factory.createVariableDeclaration(outParam.outParamName));
81332                 }
81333             }
81334             if (state.conditionVariable) {
81335                 if (!extraVariableDeclarations) {
81336                     extraVariableDeclarations = [];
81337                 }
81338                 extraVariableDeclarations.push(factory.createVariableDeclaration(state.conditionVariable, undefined, undefined, factory.createFalse()));
81339             }
81340             if (extraVariableDeclarations) {
81341                 statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList(extraVariableDeclarations)));
81342             }
81343         }
81344         function createOutVariable(p) {
81345             return factory.createVariableDeclaration(p.originalName, undefined, undefined, p.outParamName);
81346         }
81347         function createFunctionForInitializerOfForStatement(node, currentState) {
81348             var functionName = factory.createUniqueName("_loop_init");
81349             var containsYield = (node.initializer.transformFlags & 524288) !== 0;
81350             var emitFlags = 0;
81351             if (currentState.containsLexicalThis)
81352                 emitFlags |= 8;
81353             if (containsYield && hierarchyFacts & 4)
81354                 emitFlags |= 262144;
81355             var statements = [];
81356             statements.push(factory.createVariableStatement(undefined, node.initializer));
81357             copyOutParameters(currentState.loopOutParameters, 2, 1, statements);
81358             var functionDeclaration = factory.createVariableStatement(undefined, ts.setEmitFlags(factory.createVariableDeclarationList([
81359                 factory.createVariableDeclaration(functionName, undefined, undefined, ts.setEmitFlags(factory.createFunctionExpression(undefined, containsYield ? factory.createToken(41) : undefined, undefined, undefined, undefined, undefined, ts.visitNode(factory.createBlock(statements, true), visitor, ts.isBlock)), emitFlags))
81360             ]), 2097152));
81361             var part = factory.createVariableDeclarationList(ts.map(currentState.loopOutParameters, createOutVariable));
81362             return { functionName: functionName, containsYield: containsYield, functionDeclaration: functionDeclaration, part: part };
81363         }
81364         function createFunctionForBodyOfIterationStatement(node, currentState, outerState) {
81365             var functionName = factory.createUniqueName("_loop");
81366             startLexicalEnvironment();
81367             var statement = ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock);
81368             var lexicalEnvironment = endLexicalEnvironment();
81369             var statements = [];
81370             if (shouldConvertConditionOfForStatement(node) || shouldConvertIncrementorOfForStatement(node)) {
81371                 currentState.conditionVariable = factory.createUniqueName("inc");
81372                 if (node.incrementor) {
81373                     statements.push(factory.createIfStatement(currentState.conditionVariable, factory.createExpressionStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), factory.createExpressionStatement(factory.createAssignment(currentState.conditionVariable, factory.createTrue()))));
81374                 }
81375                 else {
81376                     statements.push(factory.createIfStatement(factory.createLogicalNot(currentState.conditionVariable), factory.createExpressionStatement(factory.createAssignment(currentState.conditionVariable, factory.createTrue()))));
81377                 }
81378                 if (shouldConvertConditionOfForStatement(node)) {
81379                     statements.push(factory.createIfStatement(factory.createPrefixUnaryExpression(53, ts.visitNode(node.condition, visitor, ts.isExpression)), ts.visitNode(factory.createBreakStatement(), visitor, ts.isStatement)));
81380                 }
81381             }
81382             if (ts.isBlock(statement)) {
81383                 ts.addRange(statements, statement.statements);
81384             }
81385             else {
81386                 statements.push(statement);
81387             }
81388             copyOutParameters(currentState.loopOutParameters, 1, 1, statements);
81389             ts.insertStatementsAfterStandardPrologue(statements, lexicalEnvironment);
81390             var loopBody = factory.createBlock(statements, true);
81391             if (ts.isBlock(statement))
81392                 ts.setOriginalNode(loopBody, statement);
81393             var containsYield = (node.statement.transformFlags & 524288) !== 0;
81394             var emitFlags = 524288;
81395             if (currentState.containsLexicalThis)
81396                 emitFlags |= 8;
81397             if (containsYield && (hierarchyFacts & 4) !== 0)
81398                 emitFlags |= 262144;
81399             var functionDeclaration = factory.createVariableStatement(undefined, ts.setEmitFlags(factory.createVariableDeclarationList([
81400                 factory.createVariableDeclaration(functionName, undefined, undefined, ts.setEmitFlags(factory.createFunctionExpression(undefined, containsYield ? factory.createToken(41) : undefined, undefined, undefined, currentState.loopParameters, undefined, loopBody), emitFlags))
81401             ]), 2097152));
81402             var part = generateCallToConvertedLoop(functionName, currentState, outerState, containsYield);
81403             return { functionName: functionName, containsYield: containsYield, functionDeclaration: functionDeclaration, part: part };
81404         }
81405         function copyOutParameter(outParam, copyDirection) {
81406             var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;
81407             var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;
81408             return factory.createBinaryExpression(target, 63, source);
81409         }
81410         function copyOutParameters(outParams, partFlags, copyDirection, statements) {
81411             for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
81412                 var outParam = outParams_1[_i];
81413                 if (outParam.flags & partFlags) {
81414                     statements.push(factory.createExpressionStatement(copyOutParameter(outParam, copyDirection)));
81415                 }
81416             }
81417         }
81418         function generateCallToConvertedLoopInitializer(initFunctionExpressionName, containsYield) {
81419             var call = factory.createCallExpression(initFunctionExpressionName, undefined, []);
81420             var callResult = containsYield
81421                 ? factory.createYieldExpression(factory.createToken(41), ts.setEmitFlags(call, 8388608))
81422                 : call;
81423             return factory.createExpressionStatement(callResult);
81424         }
81425         function generateCallToConvertedLoop(loopFunctionExpressionName, state, outerState, containsYield) {
81426             var statements = [];
81427             var isSimpleLoop = !(state.nonLocalJumps & ~4) &&
81428                 !state.labeledNonLocalBreaks &&
81429                 !state.labeledNonLocalContinues;
81430             var call = factory.createCallExpression(loopFunctionExpressionName, undefined, ts.map(state.loopParameters, function (p) { return p.name; }));
81431             var callResult = containsYield
81432                 ? factory.createYieldExpression(factory.createToken(41), ts.setEmitFlags(call, 8388608))
81433                 : call;
81434             if (isSimpleLoop) {
81435                 statements.push(factory.createExpressionStatement(callResult));
81436                 copyOutParameters(state.loopOutParameters, 1, 0, statements);
81437             }
81438             else {
81439                 var loopResultName = factory.createUniqueName("state");
81440                 var stateVariable = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([factory.createVariableDeclaration(loopResultName, undefined, undefined, callResult)]));
81441                 statements.push(stateVariable);
81442                 copyOutParameters(state.loopOutParameters, 1, 0, statements);
81443                 if (state.nonLocalJumps & 8) {
81444                     var returnStatement = void 0;
81445                     if (outerState) {
81446                         outerState.nonLocalJumps |= 8;
81447                         returnStatement = factory.createReturnStatement(loopResultName);
81448                     }
81449                     else {
81450                         returnStatement = factory.createReturnStatement(factory.createPropertyAccessExpression(loopResultName, "value"));
81451                     }
81452                     statements.push(factory.createIfStatement(factory.createTypeCheck(loopResultName, "object"), returnStatement));
81453                 }
81454                 if (state.nonLocalJumps & 2) {
81455                     statements.push(factory.createIfStatement(factory.createStrictEquality(loopResultName, factory.createStringLiteral("break")), factory.createBreakStatement()));
81456                 }
81457                 if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) {
81458                     var caseClauses = [];
81459                     processLabeledJumps(state.labeledNonLocalBreaks, true, loopResultName, outerState, caseClauses);
81460                     processLabeledJumps(state.labeledNonLocalContinues, false, loopResultName, outerState, caseClauses);
81461                     statements.push(factory.createSwitchStatement(loopResultName, factory.createCaseBlock(caseClauses)));
81462                 }
81463             }
81464             return statements;
81465         }
81466         function setLabeledJump(state, isBreak, labelText, labelMarker) {
81467             if (isBreak) {
81468                 if (!state.labeledNonLocalBreaks) {
81469                     state.labeledNonLocalBreaks = new ts.Map();
81470                 }
81471                 state.labeledNonLocalBreaks.set(labelText, labelMarker);
81472             }
81473             else {
81474                 if (!state.labeledNonLocalContinues) {
81475                     state.labeledNonLocalContinues = new ts.Map();
81476                 }
81477                 state.labeledNonLocalContinues.set(labelText, labelMarker);
81478             }
81479         }
81480         function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {
81481             if (!table) {
81482                 return;
81483             }
81484             table.forEach(function (labelMarker, labelText) {
81485                 var statements = [];
81486                 if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) {
81487                     var label = factory.createIdentifier(labelText);
81488                     statements.push(isBreak ? factory.createBreakStatement(label) : factory.createContinueStatement(label));
81489                 }
81490                 else {
81491                     setLabeledJump(outerLoop, isBreak, labelText, labelMarker);
81492                     statements.push(factory.createReturnStatement(loopResultName));
81493                 }
81494                 caseClauses.push(factory.createCaseClause(factory.createStringLiteral(labelMarker), statements));
81495             });
81496         }
81497         function processLoopVariableDeclaration(container, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForInitializer) {
81498             var name = decl.name;
81499             if (ts.isBindingPattern(name)) {
81500                 for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
81501                     var element = _a[_i];
81502                     if (!ts.isOmittedExpression(element)) {
81503                         processLoopVariableDeclaration(container, element, loopParameters, loopOutParameters, hasCapturedBindingsInForInitializer);
81504                     }
81505                 }
81506             }
81507             else {
81508                 loopParameters.push(factory.createParameterDeclaration(undefined, undefined, undefined, name));
81509                 var checkFlags = resolver.getNodeCheckFlags(decl);
81510                 if (checkFlags & 4194304 || hasCapturedBindingsInForInitializer) {
81511                     var outParamName = factory.createUniqueName("out_" + ts.idText(name));
81512                     var flags = 0;
81513                     if (checkFlags & 4194304) {
81514                         flags |= 1;
81515                     }
81516                     if (ts.isForStatement(container) && container.initializer && resolver.isBindingCapturedByNode(container.initializer, decl)) {
81517                         flags |= 2;
81518                     }
81519                     loopOutParameters.push({ flags: flags, originalName: name, outParamName: outParamName });
81520                 }
81521             }
81522         }
81523         function addObjectLiteralMembers(expressions, node, receiver, start) {
81524             var properties = node.properties;
81525             var numProperties = properties.length;
81526             for (var i = start; i < numProperties; i++) {
81527                 var property = properties[i];
81528                 switch (property.kind) {
81529                     case 171:
81530                     case 172:
81531                         var accessors = ts.getAllAccessorDeclarations(node.properties, property);
81532                         if (property === accessors.firstAccessor) {
81533                             expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
81534                         }
81535                         break;
81536                     case 168:
81537                         expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
81538                         break;
81539                     case 294:
81540                         expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
81541                         break;
81542                     case 295:
81543                         expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
81544                         break;
81545                     default:
81546                         ts.Debug.failBadSyntaxKind(node);
81547                         break;
81548                 }
81549             }
81550         }
81551         function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
81552             var expression = factory.createAssignment(ts.createMemberAccessForPropertyName(factory, receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression));
81553             ts.setTextRange(expression, property);
81554             if (startsOnNewLine) {
81555                 ts.startOnNewLine(expression);
81556             }
81557             return expression;
81558         }
81559         function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) {
81560             var expression = factory.createAssignment(ts.createMemberAccessForPropertyName(factory, receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), factory.cloneNode(property.name));
81561             ts.setTextRange(expression, property);
81562             if (startsOnNewLine) {
81563                 ts.startOnNewLine(expression);
81564             }
81565             return expression;
81566         }
81567         function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) {
81568             var expression = factory.createAssignment(ts.createMemberAccessForPropertyName(factory, receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container));
81569             ts.setTextRange(expression, method);
81570             if (startsOnNewLine) {
81571                 ts.startOnNewLine(expression);
81572             }
81573             return expression;
81574         }
81575         function visitCatchClause(node) {
81576             var ancestorFacts = enterSubtree(7104, 0);
81577             var updated;
81578             ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
81579             if (ts.isBindingPattern(node.variableDeclaration.name)) {
81580                 var temp = factory.createTempVariable(undefined);
81581                 var newVariableDeclaration = factory.createVariableDeclaration(temp);
81582                 ts.setTextRange(newVariableDeclaration, node.variableDeclaration);
81583                 var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp);
81584                 var list = factory.createVariableDeclarationList(vars);
81585                 ts.setTextRange(list, node.variableDeclaration);
81586                 var destructure = factory.createVariableStatement(undefined, list);
81587                 updated = factory.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure));
81588             }
81589             else {
81590                 updated = ts.visitEachChild(node, visitor, context);
81591             }
81592             exitSubtree(ancestorFacts, 0, 0);
81593             return updated;
81594         }
81595         function addStatementToStartOfBlock(block, statement) {
81596             var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement);
81597             return factory.updateBlock(block, __spreadArray([statement], transformedStatements, true));
81598         }
81599         function visitMethodDeclaration(node) {
81600             ts.Debug.assert(!ts.isComputedPropertyName(node.name));
81601             var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined);
81602             ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression));
81603             return ts.setTextRange(factory.createPropertyAssignment(node.name, functionExpression), node);
81604         }
81605         function visitAccessorDeclaration(node) {
81606             ts.Debug.assert(!ts.isComputedPropertyName(node.name));
81607             var savedConvertedLoopState = convertedLoopState;
81608             convertedLoopState = undefined;
81609             var ancestorFacts = enterSubtree(32670, 65);
81610             var updated;
81611             var parameters = ts.visitParameterList(node.parameters, visitor, context);
81612             var body = transformFunctionBody(node);
81613             if (node.kind === 171) {
81614                 updated = factory.updateGetAccessorDeclaration(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
81615             }
81616             else {
81617                 updated = factory.updateSetAccessorDeclaration(node, node.decorators, node.modifiers, node.name, parameters, body);
81618             }
81619             exitSubtree(ancestorFacts, 98304, 0);
81620             convertedLoopState = savedConvertedLoopState;
81621             return updated;
81622         }
81623         function visitShorthandPropertyAssignment(node) {
81624             return ts.setTextRange(factory.createPropertyAssignment(node.name, visitIdentifier(factory.cloneNode(node.name))), node);
81625         }
81626         function visitComputedPropertyName(node) {
81627             return ts.visitEachChild(node, visitor, context);
81628         }
81629         function visitYieldExpression(node) {
81630             return ts.visitEachChild(node, visitor, context);
81631         }
81632         function visitArrayLiteralExpression(node) {
81633             if (ts.some(node.elements, ts.isSpreadElement)) {
81634                 return transformAndSpreadElements(node.elements, false, !!node.multiLine, !!node.elements.hasTrailingComma);
81635             }
81636             return ts.visitEachChild(node, visitor, context);
81637         }
81638         function visitCallExpression(node) {
81639             if (ts.getEmitFlags(node) & 33554432) {
81640                 return visitTypeScriptClassWrapper(node);
81641             }
81642             var expression = ts.skipOuterExpressions(node.expression);
81643             if (expression.kind === 106 ||
81644                 ts.isSuperProperty(expression) ||
81645                 ts.some(node.arguments, ts.isSpreadElement)) {
81646                 return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);
81647             }
81648             return factory.updateCallExpression(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression));
81649         }
81650         function visitTypeScriptClassWrapper(node) {
81651             var body = ts.cast(ts.cast(ts.skipOuterExpressions(node.expression), ts.isArrowFunction).body, ts.isBlock);
81652             var isVariableStatementWithInitializer = function (stmt) { return ts.isVariableStatement(stmt) && !!ts.first(stmt.declarationList.declarations).initializer; };
81653             var savedConvertedLoopState = convertedLoopState;
81654             convertedLoopState = undefined;
81655             var bodyStatements = ts.visitNodes(body.statements, classWrapperStatementVisitor, ts.isStatement);
81656             convertedLoopState = savedConvertedLoopState;
81657             var classStatements = ts.filter(bodyStatements, isVariableStatementWithInitializer);
81658             var remainingStatements = ts.filter(bodyStatements, function (stmt) { return !isVariableStatementWithInitializer(stmt); });
81659             var varStatement = ts.cast(ts.first(classStatements), ts.isVariableStatement);
81660             var variable = varStatement.declarationList.declarations[0];
81661             var initializer = ts.skipOuterExpressions(variable.initializer);
81662             var aliasAssignment = ts.tryCast(initializer, ts.isAssignmentExpression);
81663             if (!aliasAssignment && ts.isBinaryExpression(initializer) && initializer.operatorToken.kind === 27) {
81664                 aliasAssignment = ts.tryCast(initializer.left, ts.isAssignmentExpression);
81665             }
81666             var call = ts.cast(aliasAssignment ? ts.skipOuterExpressions(aliasAssignment.right) : initializer, ts.isCallExpression);
81667             var func = ts.cast(ts.skipOuterExpressions(call.expression), ts.isFunctionExpression);
81668             var funcStatements = func.body.statements;
81669             var classBodyStart = 0;
81670             var classBodyEnd = -1;
81671             var statements = [];
81672             if (aliasAssignment) {
81673                 var extendsCall = ts.tryCast(funcStatements[classBodyStart], ts.isExpressionStatement);
81674                 if (extendsCall) {
81675                     statements.push(extendsCall);
81676                     classBodyStart++;
81677                 }
81678                 statements.push(funcStatements[classBodyStart]);
81679                 classBodyStart++;
81680                 statements.push(factory.createExpressionStatement(factory.createAssignment(aliasAssignment.left, ts.cast(variable.name, ts.isIdentifier))));
81681             }
81682             while (!ts.isReturnStatement(ts.elementAt(funcStatements, classBodyEnd))) {
81683                 classBodyEnd--;
81684             }
81685             ts.addRange(statements, funcStatements, classBodyStart, classBodyEnd);
81686             if (classBodyEnd < -1) {
81687                 ts.addRange(statements, funcStatements, classBodyEnd + 1);
81688             }
81689             ts.addRange(statements, remainingStatements);
81690             ts.addRange(statements, classStatements, 1);
81691             return factory.restoreOuterExpressions(node.expression, factory.restoreOuterExpressions(variable.initializer, factory.restoreOuterExpressions(aliasAssignment && aliasAssignment.right, factory.updateCallExpression(call, factory.restoreOuterExpressions(call.expression, factory.updateFunctionExpression(func, undefined, undefined, undefined, undefined, func.parameters, undefined, factory.updateBlock(func.body, statements))), undefined, call.arguments))));
81692         }
81693         function visitImmediateSuperCallInBody(node) {
81694             return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);
81695         }
81696         function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
81697             if (node.transformFlags & 16384 ||
81698                 node.expression.kind === 106 ||
81699                 ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
81700                 var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
81701                 if (node.expression.kind === 106) {
81702                     ts.setEmitFlags(thisArg, 4);
81703                 }
81704                 var resultingCall = void 0;
81705                 if (node.transformFlags & 16384) {
81706                     resultingCall = factory.createFunctionApplyCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 106 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, true, false, false));
81707                 }
81708                 else {
81709                     resultingCall = ts.setTextRange(factory.createFunctionCallCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 106 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression)), node);
81710                 }
81711                 if (node.expression.kind === 106) {
81712                     var initializer = factory.createLogicalOr(resultingCall, createActualThis());
81713                     resultingCall = assignToCapturedThis
81714                         ? factory.createAssignment(factory.createUniqueName("_this", 16 | 32), initializer)
81715                         : initializer;
81716                 }
81717                 return ts.setOriginalNode(resultingCall, node);
81718             }
81719             return ts.visitEachChild(node, visitor, context);
81720         }
81721         function visitNewExpression(node) {
81722             if (ts.some(node.arguments, ts.isSpreadElement)) {
81723                 var _a = factory.createCallBinding(factory.createPropertyAccessExpression(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
81724                 return factory.createNewExpression(factory.createFunctionApplyCall(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(factory.createNodeArray(__spreadArray([factory.createVoidZero()], node.arguments, true)), true, false, false)), undefined, []);
81725             }
81726             return ts.visitEachChild(node, visitor, context);
81727         }
81728         function transformAndSpreadElements(elements, isArgumentList, multiLine, hasTrailingComma) {
81729             var numElements = elements.length;
81730             var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) {
81731                 return visitPartition(partition, multiLine, hasTrailingComma && end === numElements);
81732             }));
81733             if (segments.length === 1) {
81734                 var firstSegment = segments[0];
81735                 if (isArgumentList && !compilerOptions.downlevelIteration
81736                     || ts.isPackedArrayLiteral(firstSegment.expression)
81737                     || ts.isCallToHelper(firstSegment.expression, "___spreadArray")) {
81738                     return firstSegment.expression;
81739                 }
81740             }
81741             var helpers = emitHelpers();
81742             var startsWithSpread = segments[0].kind !== 0;
81743             var expression = startsWithSpread ? factory.createArrayLiteralExpression() :
81744                 segments[0].expression;
81745             for (var i = startsWithSpread ? 0 : 1; i < segments.length; i++) {
81746                 var segment = segments[i];
81747                 expression = helpers.createSpreadArrayHelper(expression, segment.expression, segment.kind === 1 && !isArgumentList);
81748             }
81749             return expression;
81750         }
81751         function partitionSpread(node) {
81752             return ts.isSpreadElement(node)
81753                 ? visitSpanOfSpreads
81754                 : visitSpanOfNonSpreads;
81755         }
81756         function visitSpanOfSpreads(chunk) {
81757             return ts.map(chunk, visitExpressionOfSpread);
81758         }
81759         function visitExpressionOfSpread(node) {
81760             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
81761             var isCallToReadHelper = ts.isCallToHelper(expression, "___read");
81762             var kind = isCallToReadHelper || ts.isPackedArrayLiteral(expression) ? 2 : 1;
81763             if (compilerOptions.downlevelIteration && kind === 1 && !ts.isArrayLiteralExpression(expression) && !isCallToReadHelper) {
81764                 expression = emitHelpers().createReadHelper(expression, undefined);
81765                 kind = 2;
81766             }
81767             return createSpreadSegment(kind, expression);
81768         }
81769         function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) {
81770             var expression = factory.createArrayLiteralExpression(ts.visitNodes(factory.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine);
81771             return createSpreadSegment(0, expression);
81772         }
81773         function visitSpreadElement(node) {
81774             return ts.visitNode(node.expression, visitor, ts.isExpression);
81775         }
81776         function visitTemplateLiteral(node) {
81777             return ts.setTextRange(factory.createStringLiteral(node.text), node);
81778         }
81779         function visitStringLiteral(node) {
81780             if (node.hasExtendedUnicodeEscape) {
81781                 return ts.setTextRange(factory.createStringLiteral(node.text), node);
81782             }
81783             return node;
81784         }
81785         function visitNumericLiteral(node) {
81786             if (node.numericLiteralFlags & 384) {
81787                 return ts.setTextRange(factory.createNumericLiteral(node.text), node);
81788             }
81789             return node;
81790         }
81791         function visitTaggedTemplateExpression(node) {
81792             return ts.processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, ts.ProcessLevel.All);
81793         }
81794         function visitTemplateExpression(node) {
81795             var expression = factory.createStringLiteral(node.head.text);
81796             for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
81797                 var span = _a[_i];
81798                 var args = [ts.visitNode(span.expression, visitor, ts.isExpression)];
81799                 if (span.literal.text.length > 0) {
81800                     args.push(factory.createStringLiteral(span.literal.text));
81801                 }
81802                 expression = factory.createCallExpression(factory.createPropertyAccessExpression(expression, "concat"), undefined, args);
81803             }
81804             return ts.setTextRange(expression, node);
81805         }
81806         function visitSuperKeyword(isExpressionOfCall) {
81807             return hierarchyFacts & 8
81808                 && !isExpressionOfCall
81809                 ? factory.createPropertyAccessExpression(factory.createUniqueName("_super", 16 | 32), "prototype")
81810                 : factory.createUniqueName("_super", 16 | 32);
81811         }
81812         function visitMetaProperty(node) {
81813             if (node.keywordToken === 103 && node.name.escapedText === "target") {
81814                 hierarchyFacts |= 32768;
81815                 return factory.createUniqueName("_newTarget", 16 | 32);
81816             }
81817             return node;
81818         }
81819         function onEmitNode(hint, node, emitCallback) {
81820             if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
81821                 var ancestorFacts = enterSubtree(32670, ts.getEmitFlags(node) & 8
81822                     ? 65 | 16
81823                     : 65);
81824                 previousOnEmitNode(hint, node, emitCallback);
81825                 exitSubtree(ancestorFacts, 0, 0);
81826                 return;
81827             }
81828             previousOnEmitNode(hint, node, emitCallback);
81829         }
81830         function enableSubstitutionsForBlockScopedBindings() {
81831             if ((enabledSubstitutions & 2) === 0) {
81832                 enabledSubstitutions |= 2;
81833                 context.enableSubstitution(79);
81834             }
81835         }
81836         function enableSubstitutionsForCapturedThis() {
81837             if ((enabledSubstitutions & 1) === 0) {
81838                 enabledSubstitutions |= 1;
81839                 context.enableSubstitution(108);
81840                 context.enableEmitNotification(170);
81841                 context.enableEmitNotification(168);
81842                 context.enableEmitNotification(171);
81843                 context.enableEmitNotification(172);
81844                 context.enableEmitNotification(213);
81845                 context.enableEmitNotification(212);
81846                 context.enableEmitNotification(255);
81847             }
81848         }
81849         function onSubstituteNode(hint, node) {
81850             node = previousOnSubstituteNode(hint, node);
81851             if (hint === 1) {
81852                 return substituteExpression(node);
81853             }
81854             if (ts.isIdentifier(node)) {
81855                 return substituteIdentifier(node);
81856             }
81857             return node;
81858         }
81859         function substituteIdentifier(node) {
81860             if (enabledSubstitutions & 2 && !ts.isInternalName(node)) {
81861                 var original = ts.getParseTreeNode(node, ts.isIdentifier);
81862                 if (original && isNameOfDeclarationWithCollidingName(original)) {
81863                     return ts.setTextRange(factory.getGeneratedNameForNode(original), node);
81864                 }
81865             }
81866             return node;
81867         }
81868         function isNameOfDeclarationWithCollidingName(node) {
81869             switch (node.parent.kind) {
81870                 case 202:
81871                 case 256:
81872                 case 259:
81873                 case 253:
81874                     return node.parent.name === node
81875                         && resolver.isDeclarationWithCollidingName(node.parent);
81876             }
81877             return false;
81878         }
81879         function substituteExpression(node) {
81880             switch (node.kind) {
81881                 case 79:
81882                     return substituteExpressionIdentifier(node);
81883                 case 108:
81884                     return substituteThisKeyword(node);
81885             }
81886             return node;
81887         }
81888         function substituteExpressionIdentifier(node) {
81889             if (enabledSubstitutions & 2 && !ts.isInternalName(node)) {
81890                 var declaration = resolver.getReferencedDeclarationWithCollidingName(node);
81891                 if (declaration && !(ts.isClassLike(declaration) && isPartOfClassBody(declaration, node))) {
81892                     return ts.setTextRange(factory.getGeneratedNameForNode(ts.getNameOfDeclaration(declaration)), node);
81893                 }
81894             }
81895             return node;
81896         }
81897         function isPartOfClassBody(declaration, node) {
81898             var currentNode = ts.getParseTreeNode(node);
81899             if (!currentNode || currentNode === declaration || currentNode.end <= declaration.pos || currentNode.pos >= declaration.end) {
81900                 return false;
81901             }
81902             var blockScope = ts.getEnclosingBlockScopeContainer(declaration);
81903             while (currentNode) {
81904                 if (currentNode === blockScope || currentNode === declaration) {
81905                     return false;
81906                 }
81907                 if (ts.isClassElement(currentNode) && currentNode.parent === declaration) {
81908                     return true;
81909                 }
81910                 currentNode = currentNode.parent;
81911             }
81912             return false;
81913         }
81914         function substituteThisKeyword(node) {
81915             if (enabledSubstitutions & 1
81916                 && hierarchyFacts & 16) {
81917                 return ts.setTextRange(factory.createUniqueName("_this", 16 | 32), node);
81918             }
81919             return node;
81920         }
81921         function getClassMemberPrefix(node, member) {
81922             return ts.isStatic(member)
81923                 ? factory.getInternalName(node)
81924                 : factory.createPropertyAccessExpression(factory.getInternalName(node), "prototype");
81925         }
81926         function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) {
81927             if (!constructor || !hasExtendsClause) {
81928                 return false;
81929             }
81930             if (ts.some(constructor.parameters)) {
81931                 return false;
81932             }
81933             var statement = ts.firstOrUndefined(constructor.body.statements);
81934             if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 237) {
81935                 return false;
81936             }
81937             var statementExpression = statement.expression;
81938             if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 207) {
81939                 return false;
81940             }
81941             var callTarget = statementExpression.expression;
81942             if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 106) {
81943                 return false;
81944             }
81945             var callArgument = ts.singleOrUndefined(statementExpression.arguments);
81946             if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 224) {
81947                 return false;
81948             }
81949             var expression = callArgument.expression;
81950             return ts.isIdentifier(expression) && expression.escapedText === "arguments";
81951         }
81952     }
81953     ts.transformES2015 = transformES2015;
81954 })(ts || (ts = {}));
81955 var ts;
81956 (function (ts) {
81957     function transformES5(context) {
81958         var factory = context.factory;
81959         var compilerOptions = context.getCompilerOptions();
81960         var previousOnEmitNode;
81961         var noSubstitution;
81962         if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) {
81963             previousOnEmitNode = context.onEmitNode;
81964             context.onEmitNode = onEmitNode;
81965             context.enableEmitNotification(279);
81966             context.enableEmitNotification(280);
81967             context.enableEmitNotification(278);
81968             noSubstitution = [];
81969         }
81970         var previousOnSubstituteNode = context.onSubstituteNode;
81971         context.onSubstituteNode = onSubstituteNode;
81972         context.enableSubstitution(205);
81973         context.enableSubstitution(294);
81974         return ts.chainBundle(context, transformSourceFile);
81975         function transformSourceFile(node) {
81976             return node;
81977         }
81978         function onEmitNode(hint, node, emitCallback) {
81979             switch (node.kind) {
81980                 case 279:
81981                 case 280:
81982                 case 278:
81983                     var tagName = node.tagName;
81984                     noSubstitution[ts.getOriginalNodeId(tagName)] = true;
81985                     break;
81986             }
81987             previousOnEmitNode(hint, node, emitCallback);
81988         }
81989         function onSubstituteNode(hint, node) {
81990             if (node.id && noSubstitution && noSubstitution[node.id]) {
81991                 return previousOnSubstituteNode(hint, node);
81992             }
81993             node = previousOnSubstituteNode(hint, node);
81994             if (ts.isPropertyAccessExpression(node)) {
81995                 return substitutePropertyAccessExpression(node);
81996             }
81997             else if (ts.isPropertyAssignment(node)) {
81998                 return substitutePropertyAssignment(node);
81999             }
82000             return node;
82001         }
82002         function substitutePropertyAccessExpression(node) {
82003             if (ts.isPrivateIdentifier(node.name)) {
82004                 return node;
82005             }
82006             var literalName = trySubstituteReservedName(node.name);
82007             if (literalName) {
82008                 return ts.setTextRange(factory.createElementAccessExpression(node.expression, literalName), node);
82009             }
82010             return node;
82011         }
82012         function substitutePropertyAssignment(node) {
82013             var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name);
82014             if (literalName) {
82015                 return factory.updatePropertyAssignment(node, literalName, node.initializer);
82016             }
82017             return node;
82018         }
82019         function trySubstituteReservedName(name) {
82020             var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
82021             if (token !== undefined && token >= 81 && token <= 116) {
82022                 return ts.setTextRange(factory.createStringLiteralFromNode(name), name);
82023             }
82024             return undefined;
82025         }
82026     }
82027     ts.transformES5 = transformES5;
82028 })(ts || (ts = {}));
82029 var ts;
82030 (function (ts) {
82031     function getInstructionName(instruction) {
82032         switch (instruction) {
82033             case 2: return "return";
82034             case 3: return "break";
82035             case 4: return "yield";
82036             case 5: return "yield*";
82037             case 7: return "endfinally";
82038             default: return undefined;
82039         }
82040     }
82041     function transformGenerators(context) {
82042         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration;
82043         var compilerOptions = context.getCompilerOptions();
82044         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
82045         var resolver = context.getEmitResolver();
82046         var previousOnSubstituteNode = context.onSubstituteNode;
82047         context.onSubstituteNode = onSubstituteNode;
82048         var renamedCatchVariables;
82049         var renamedCatchVariableDeclarations;
82050         var inGeneratorFunctionBody;
82051         var inStatementContainingYield;
82052         var blocks;
82053         var blockOffsets;
82054         var blockActions;
82055         var blockStack;
82056         var labelOffsets;
82057         var labelExpressions;
82058         var nextLabelId = 1;
82059         var operations;
82060         var operationArguments;
82061         var operationLocations;
82062         var state;
82063         var blockIndex = 0;
82064         var labelNumber = 0;
82065         var labelNumbers;
82066         var lastOperationWasAbrupt;
82067         var lastOperationWasCompletion;
82068         var clauses;
82069         var statements;
82070         var exceptionBlockStack;
82071         var currentExceptionBlock;
82072         var withBlockStack;
82073         return ts.chainBundle(context, transformSourceFile);
82074         function transformSourceFile(node) {
82075             if (node.isDeclarationFile || (node.transformFlags & 1024) === 0) {
82076                 return node;
82077             }
82078             var visited = ts.visitEachChild(node, visitor, context);
82079             ts.addEmitHelpers(visited, context.readEmitHelpers());
82080             return visited;
82081         }
82082         function visitor(node) {
82083             var transformFlags = node.transformFlags;
82084             if (inStatementContainingYield) {
82085                 return visitJavaScriptInStatementContainingYield(node);
82086             }
82087             else if (inGeneratorFunctionBody) {
82088                 return visitJavaScriptInGeneratorFunctionBody(node);
82089             }
82090             else if (ts.isFunctionLikeDeclaration(node) && node.asteriskToken) {
82091                 return visitGenerator(node);
82092             }
82093             else if (transformFlags & 1024) {
82094                 return ts.visitEachChild(node, visitor, context);
82095             }
82096             else {
82097                 return node;
82098             }
82099         }
82100         function visitJavaScriptInStatementContainingYield(node) {
82101             switch (node.kind) {
82102                 case 239:
82103                     return visitDoStatement(node);
82104                 case 240:
82105                     return visitWhileStatement(node);
82106                 case 248:
82107                     return visitSwitchStatement(node);
82108                 case 249:
82109                     return visitLabeledStatement(node);
82110                 default:
82111                     return visitJavaScriptInGeneratorFunctionBody(node);
82112             }
82113         }
82114         function visitJavaScriptInGeneratorFunctionBody(node) {
82115             switch (node.kind) {
82116                 case 255:
82117                     return visitFunctionDeclaration(node);
82118                 case 212:
82119                     return visitFunctionExpression(node);
82120                 case 171:
82121                 case 172:
82122                     return visitAccessorDeclaration(node);
82123                 case 236:
82124                     return visitVariableStatement(node);
82125                 case 241:
82126                     return visitForStatement(node);
82127                 case 242:
82128                     return visitForInStatement(node);
82129                 case 245:
82130                     return visitBreakStatement(node);
82131                 case 244:
82132                     return visitContinueStatement(node);
82133                 case 246:
82134                     return visitReturnStatement(node);
82135                 default:
82136                     if (node.transformFlags & 524288) {
82137                         return visitJavaScriptContainingYield(node);
82138                     }
82139                     else if (node.transformFlags & (1024 | 2097152)) {
82140                         return ts.visitEachChild(node, visitor, context);
82141                     }
82142                     else {
82143                         return node;
82144                     }
82145             }
82146         }
82147         function visitJavaScriptContainingYield(node) {
82148             switch (node.kind) {
82149                 case 220:
82150                     return visitBinaryExpression(node);
82151                 case 349:
82152                     return visitCommaListExpression(node);
82153                 case 221:
82154                     return visitConditionalExpression(node);
82155                 case 223:
82156                     return visitYieldExpression(node);
82157                 case 203:
82158                     return visitArrayLiteralExpression(node);
82159                 case 204:
82160                     return visitObjectLiteralExpression(node);
82161                 case 206:
82162                     return visitElementAccessExpression(node);
82163                 case 207:
82164                     return visitCallExpression(node);
82165                 case 208:
82166                     return visitNewExpression(node);
82167                 default:
82168                     return ts.visitEachChild(node, visitor, context);
82169             }
82170         }
82171         function visitGenerator(node) {
82172             switch (node.kind) {
82173                 case 255:
82174                     return visitFunctionDeclaration(node);
82175                 case 212:
82176                     return visitFunctionExpression(node);
82177                 default:
82178                     return ts.Debug.failBadSyntaxKind(node);
82179             }
82180         }
82181         function visitFunctionDeclaration(node) {
82182             if (node.asteriskToken) {
82183                 node = ts.setOriginalNode(ts.setTextRange(factory.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node);
82184             }
82185             else {
82186                 var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
82187                 var savedInStatementContainingYield = inStatementContainingYield;
82188                 inGeneratorFunctionBody = false;
82189                 inStatementContainingYield = false;
82190                 node = ts.visitEachChild(node, visitor, context);
82191                 inGeneratorFunctionBody = savedInGeneratorFunctionBody;
82192                 inStatementContainingYield = savedInStatementContainingYield;
82193             }
82194             if (inGeneratorFunctionBody) {
82195                 hoistFunctionDeclaration(node);
82196                 return undefined;
82197             }
82198             else {
82199                 return node;
82200             }
82201         }
82202         function visitFunctionExpression(node) {
82203             if (node.asteriskToken) {
82204                 node = ts.setOriginalNode(ts.setTextRange(factory.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node);
82205             }
82206             else {
82207                 var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
82208                 var savedInStatementContainingYield = inStatementContainingYield;
82209                 inGeneratorFunctionBody = false;
82210                 inStatementContainingYield = false;
82211                 node = ts.visitEachChild(node, visitor, context);
82212                 inGeneratorFunctionBody = savedInGeneratorFunctionBody;
82213                 inStatementContainingYield = savedInStatementContainingYield;
82214             }
82215             return node;
82216         }
82217         function visitAccessorDeclaration(node) {
82218             var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
82219             var savedInStatementContainingYield = inStatementContainingYield;
82220             inGeneratorFunctionBody = false;
82221             inStatementContainingYield = false;
82222             node = ts.visitEachChild(node, visitor, context);
82223             inGeneratorFunctionBody = savedInGeneratorFunctionBody;
82224             inStatementContainingYield = savedInStatementContainingYield;
82225             return node;
82226         }
82227         function transformGeneratorFunctionBody(body) {
82228             var statements = [];
82229             var savedInGeneratorFunctionBody = inGeneratorFunctionBody;
82230             var savedInStatementContainingYield = inStatementContainingYield;
82231             var savedBlocks = blocks;
82232             var savedBlockOffsets = blockOffsets;
82233             var savedBlockActions = blockActions;
82234             var savedBlockStack = blockStack;
82235             var savedLabelOffsets = labelOffsets;
82236             var savedLabelExpressions = labelExpressions;
82237             var savedNextLabelId = nextLabelId;
82238             var savedOperations = operations;
82239             var savedOperationArguments = operationArguments;
82240             var savedOperationLocations = operationLocations;
82241             var savedState = state;
82242             inGeneratorFunctionBody = true;
82243             inStatementContainingYield = false;
82244             blocks = undefined;
82245             blockOffsets = undefined;
82246             blockActions = undefined;
82247             blockStack = undefined;
82248             labelOffsets = undefined;
82249             labelExpressions = undefined;
82250             nextLabelId = 1;
82251             operations = undefined;
82252             operationArguments = undefined;
82253             operationLocations = undefined;
82254             state = factory.createTempVariable(undefined);
82255             resumeLexicalEnvironment();
82256             var statementOffset = factory.copyPrologue(body.statements, statements, false, visitor);
82257             transformAndEmitStatements(body.statements, statementOffset);
82258             var buildResult = build();
82259             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
82260             statements.push(factory.createReturnStatement(buildResult));
82261             inGeneratorFunctionBody = savedInGeneratorFunctionBody;
82262             inStatementContainingYield = savedInStatementContainingYield;
82263             blocks = savedBlocks;
82264             blockOffsets = savedBlockOffsets;
82265             blockActions = savedBlockActions;
82266             blockStack = savedBlockStack;
82267             labelOffsets = savedLabelOffsets;
82268             labelExpressions = savedLabelExpressions;
82269             nextLabelId = savedNextLabelId;
82270             operations = savedOperations;
82271             operationArguments = savedOperationArguments;
82272             operationLocations = savedOperationLocations;
82273             state = savedState;
82274             return ts.setTextRange(factory.createBlock(statements, body.multiLine), body);
82275         }
82276         function visitVariableStatement(node) {
82277             if (node.transformFlags & 524288) {
82278                 transformAndEmitVariableDeclarationList(node.declarationList);
82279                 return undefined;
82280             }
82281             else {
82282                 if (ts.getEmitFlags(node) & 1048576) {
82283                     return node;
82284                 }
82285                 for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
82286                     var variable = _a[_i];
82287                     hoistVariableDeclaration(variable.name);
82288                 }
82289                 var variables = ts.getInitializedVariables(node.declarationList);
82290                 if (variables.length === 0) {
82291                     return undefined;
82292                 }
82293                 return ts.setSourceMapRange(factory.createExpressionStatement(factory.inlineExpressions(ts.map(variables, transformInitializedVariable))), node);
82294             }
82295         }
82296         function visitBinaryExpression(node) {
82297             var assoc = ts.getExpressionAssociativity(node);
82298             switch (assoc) {
82299                 case 0:
82300                     return visitLeftAssociativeBinaryExpression(node);
82301                 case 1:
82302                     return visitRightAssociativeBinaryExpression(node);
82303                 default:
82304                     return ts.Debug.assertNever(assoc);
82305             }
82306         }
82307         function visitRightAssociativeBinaryExpression(node) {
82308             var left = node.left, right = node.right;
82309             if (containsYield(right)) {
82310                 var target = void 0;
82311                 switch (left.kind) {
82312                     case 205:
82313                         target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
82314                         break;
82315                     case 206:
82316                         target = factory.updateElementAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));
82317                         break;
82318                     default:
82319                         target = ts.visitNode(left, visitor, ts.isExpression);
82320                         break;
82321                 }
82322                 var operator = node.operatorToken.kind;
82323                 if (ts.isCompoundAssignment(operator)) {
82324                     return ts.setTextRange(factory.createAssignment(target, ts.setTextRange(factory.createBinaryExpression(cacheExpression(target), ts.getNonAssignmentOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node);
82325                 }
82326                 else {
82327                     return factory.updateBinaryExpression(node, target, node.operatorToken, ts.visitNode(right, visitor, ts.isExpression));
82328                 }
82329             }
82330             return ts.visitEachChild(node, visitor, context);
82331         }
82332         function visitLeftAssociativeBinaryExpression(node) {
82333             if (containsYield(node.right)) {
82334                 if (ts.isLogicalOperator(node.operatorToken.kind)) {
82335                     return visitLogicalBinaryExpression(node);
82336                 }
82337                 else if (node.operatorToken.kind === 27) {
82338                     return visitCommaExpression(node);
82339                 }
82340                 return factory.updateBinaryExpression(node, cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression));
82341             }
82342             return ts.visitEachChild(node, visitor, context);
82343         }
82344         function visitCommaExpression(node) {
82345             var pendingExpressions = [];
82346             visit(node.left);
82347             visit(node.right);
82348             return factory.inlineExpressions(pendingExpressions);
82349             function visit(node) {
82350                 if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27) {
82351                     visit(node.left);
82352                     visit(node.right);
82353                 }
82354                 else {
82355                     if (containsYield(node) && pendingExpressions.length > 0) {
82356                         emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]);
82357                         pendingExpressions = [];
82358                     }
82359                     pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression));
82360                 }
82361             }
82362         }
82363         function visitCommaListExpression(node) {
82364             var pendingExpressions = [];
82365             for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
82366                 var elem = _a[_i];
82367                 if (ts.isBinaryExpression(elem) && elem.operatorToken.kind === 27) {
82368                     pendingExpressions.push(visitCommaExpression(elem));
82369                 }
82370                 else {
82371                     if (containsYield(elem) && pendingExpressions.length > 0) {
82372                         emitWorker(1, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]);
82373                         pendingExpressions = [];
82374                     }
82375                     pendingExpressions.push(ts.visitNode(elem, visitor, ts.isExpression));
82376                 }
82377             }
82378             return factory.inlineExpressions(pendingExpressions);
82379         }
82380         function visitLogicalBinaryExpression(node) {
82381             var resultLabel = defineLabel();
82382             var resultLocal = declareLocal();
82383             emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), node.left);
82384             if (node.operatorToken.kind === 55) {
82385                 emitBreakWhenFalse(resultLabel, resultLocal, node.left);
82386             }
82387             else {
82388                 emitBreakWhenTrue(resultLabel, resultLocal, node.left);
82389             }
82390             emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), node.right);
82391             markLabel(resultLabel);
82392             return resultLocal;
82393         }
82394         function visitConditionalExpression(node) {
82395             if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) {
82396                 var whenFalseLabel = defineLabel();
82397                 var resultLabel = defineLabel();
82398                 var resultLocal = declareLocal();
82399                 emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), node.condition);
82400                 emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), node.whenTrue);
82401                 emitBreak(resultLabel);
82402                 markLabel(whenFalseLabel);
82403                 emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), node.whenFalse);
82404                 markLabel(resultLabel);
82405                 return resultLocal;
82406             }
82407             return ts.visitEachChild(node, visitor, context);
82408         }
82409         function visitYieldExpression(node) {
82410             var resumeLabel = defineLabel();
82411             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
82412             if (node.asteriskToken) {
82413                 var iterator = (ts.getEmitFlags(node.expression) & 8388608) === 0
82414                     ? ts.setTextRange(emitHelpers().createValuesHelper(expression), node)
82415                     : expression;
82416                 emitYieldStar(iterator, node);
82417             }
82418             else {
82419                 emitYield(expression, node);
82420             }
82421             markLabel(resumeLabel);
82422             return createGeneratorResume(node);
82423         }
82424         function visitArrayLiteralExpression(node) {
82425             return visitElements(node.elements, undefined, undefined, node.multiLine);
82426         }
82427         function visitElements(elements, leadingElement, location, multiLine) {
82428             var numInitialElements = countInitialNodesWithoutYield(elements);
82429             var temp;
82430             if (numInitialElements > 0) {
82431                 temp = declareLocal();
82432                 var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements);
82433                 emitAssignment(temp, factory.createArrayLiteralExpression(leadingElement
82434                     ? __spreadArray([leadingElement], initialElements, true) : initialElements));
82435                 leadingElement = undefined;
82436             }
82437             var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements);
82438             return temp
82439                 ? factory.createArrayConcatCall(temp, [factory.createArrayLiteralExpression(expressions, multiLine)])
82440                 : ts.setTextRange(factory.createArrayLiteralExpression(leadingElement ? __spreadArray([leadingElement], expressions, true) : expressions, multiLine), location);
82441             function reduceElement(expressions, element) {
82442                 if (containsYield(element) && expressions.length > 0) {
82443                     var hasAssignedTemp = temp !== undefined;
82444                     if (!temp) {
82445                         temp = declareLocal();
82446                     }
82447                     emitAssignment(temp, hasAssignedTemp
82448                         ? factory.createArrayConcatCall(temp, [factory.createArrayLiteralExpression(expressions, multiLine)])
82449                         : factory.createArrayLiteralExpression(leadingElement ? __spreadArray([leadingElement], expressions, true) : expressions, multiLine));
82450                     leadingElement = undefined;
82451                     expressions = [];
82452                 }
82453                 expressions.push(ts.visitNode(element, visitor, ts.isExpression));
82454                 return expressions;
82455             }
82456         }
82457         function visitObjectLiteralExpression(node) {
82458             var properties = node.properties;
82459             var multiLine = node.multiLine;
82460             var numInitialProperties = countInitialNodesWithoutYield(properties);
82461             var temp = declareLocal();
82462             emitAssignment(temp, factory.createObjectLiteralExpression(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine));
82463             var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties);
82464             expressions.push(multiLine ? ts.startOnNewLine(ts.setParent(ts.setTextRange(factory.cloneNode(temp), temp), temp.parent)) : temp);
82465             return factory.inlineExpressions(expressions);
82466             function reduceProperty(expressions, property) {
82467                 if (containsYield(property) && expressions.length > 0) {
82468                     emitStatement(factory.createExpressionStatement(factory.inlineExpressions(expressions)));
82469                     expressions = [];
82470                 }
82471                 var expression = ts.createExpressionForObjectLiteralElementLike(factory, node, property, temp);
82472                 var visited = ts.visitNode(expression, visitor, ts.isExpression);
82473                 if (visited) {
82474                     if (multiLine) {
82475                         ts.startOnNewLine(visited);
82476                     }
82477                     expressions.push(visited);
82478                 }
82479                 return expressions;
82480             }
82481         }
82482         function visitElementAccessExpression(node) {
82483             if (containsYield(node.argumentExpression)) {
82484                 return factory.updateElementAccessExpression(node, cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)), ts.visitNode(node.argumentExpression, visitor, ts.isExpression));
82485             }
82486             return ts.visitEachChild(node, visitor, context);
82487         }
82488         function visitCallExpression(node) {
82489             if (!ts.isImportCall(node) && ts.forEach(node.arguments, containsYield)) {
82490                 var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, true), target = _a.target, thisArg = _a.thisArg;
82491                 return ts.setOriginalNode(ts.setTextRange(factory.createFunctionApplyCall(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments)), node), node);
82492             }
82493             return ts.visitEachChild(node, visitor, context);
82494         }
82495         function visitNewExpression(node) {
82496             if (ts.forEach(node.arguments, containsYield)) {
82497                 var _a = factory.createCallBinding(factory.createPropertyAccessExpression(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
82498                 return ts.setOriginalNode(ts.setTextRange(factory.createNewExpression(factory.createFunctionApplyCall(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, factory.createVoidZero())), undefined, []), node), node);
82499             }
82500             return ts.visitEachChild(node, visitor, context);
82501         }
82502         function transformAndEmitStatements(statements, start) {
82503             if (start === void 0) { start = 0; }
82504             var numStatements = statements.length;
82505             for (var i = start; i < numStatements; i++) {
82506                 transformAndEmitStatement(statements[i]);
82507             }
82508         }
82509         function transformAndEmitEmbeddedStatement(node) {
82510             if (ts.isBlock(node)) {
82511                 transformAndEmitStatements(node.statements);
82512             }
82513             else {
82514                 transformAndEmitStatement(node);
82515             }
82516         }
82517         function transformAndEmitStatement(node) {
82518             var savedInStatementContainingYield = inStatementContainingYield;
82519             if (!inStatementContainingYield) {
82520                 inStatementContainingYield = containsYield(node);
82521             }
82522             transformAndEmitStatementWorker(node);
82523             inStatementContainingYield = savedInStatementContainingYield;
82524         }
82525         function transformAndEmitStatementWorker(node) {
82526             switch (node.kind) {
82527                 case 234:
82528                     return transformAndEmitBlock(node);
82529                 case 237:
82530                     return transformAndEmitExpressionStatement(node);
82531                 case 238:
82532                     return transformAndEmitIfStatement(node);
82533                 case 239:
82534                     return transformAndEmitDoStatement(node);
82535                 case 240:
82536                     return transformAndEmitWhileStatement(node);
82537                 case 241:
82538                     return transformAndEmitForStatement(node);
82539                 case 242:
82540                     return transformAndEmitForInStatement(node);
82541                 case 244:
82542                     return transformAndEmitContinueStatement(node);
82543                 case 245:
82544                     return transformAndEmitBreakStatement(node);
82545                 case 246:
82546                     return transformAndEmitReturnStatement(node);
82547                 case 247:
82548                     return transformAndEmitWithStatement(node);
82549                 case 248:
82550                     return transformAndEmitSwitchStatement(node);
82551                 case 249:
82552                     return transformAndEmitLabeledStatement(node);
82553                 case 250:
82554                     return transformAndEmitThrowStatement(node);
82555                 case 251:
82556                     return transformAndEmitTryStatement(node);
82557                 default:
82558                     return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82559             }
82560         }
82561         function transformAndEmitBlock(node) {
82562             if (containsYield(node)) {
82563                 transformAndEmitStatements(node.statements);
82564             }
82565             else {
82566                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82567             }
82568         }
82569         function transformAndEmitExpressionStatement(node) {
82570             emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82571         }
82572         function transformAndEmitVariableDeclarationList(node) {
82573             for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {
82574                 var variable = _a[_i];
82575                 var name = factory.cloneNode(variable.name);
82576                 ts.setCommentRange(name, variable.name);
82577                 hoistVariableDeclaration(name);
82578             }
82579             var variables = ts.getInitializedVariables(node);
82580             var numVariables = variables.length;
82581             var variablesWritten = 0;
82582             var pendingExpressions = [];
82583             while (variablesWritten < numVariables) {
82584                 for (var i = variablesWritten; i < numVariables; i++) {
82585                     var variable = variables[i];
82586                     if (containsYield(variable.initializer) && pendingExpressions.length > 0) {
82587                         break;
82588                     }
82589                     pendingExpressions.push(transformInitializedVariable(variable));
82590                 }
82591                 if (pendingExpressions.length) {
82592                     emitStatement(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
82593                     variablesWritten += pendingExpressions.length;
82594                     pendingExpressions = [];
82595                 }
82596             }
82597             return undefined;
82598         }
82599         function transformInitializedVariable(node) {
82600             return ts.setSourceMapRange(factory.createAssignment(ts.setSourceMapRange(factory.cloneNode(node.name), node.name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node);
82601         }
82602         function transformAndEmitIfStatement(node) {
82603             if (containsYield(node)) {
82604                 if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) {
82605                     var endLabel = defineLabel();
82606                     var elseLabel = node.elseStatement ? defineLabel() : undefined;
82607                     emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression);
82608                     transformAndEmitEmbeddedStatement(node.thenStatement);
82609                     if (node.elseStatement) {
82610                         emitBreak(endLabel);
82611                         markLabel(elseLabel);
82612                         transformAndEmitEmbeddedStatement(node.elseStatement);
82613                     }
82614                     markLabel(endLabel);
82615                 }
82616                 else {
82617                     emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82618                 }
82619             }
82620             else {
82621                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82622             }
82623         }
82624         function transformAndEmitDoStatement(node) {
82625             if (containsYield(node)) {
82626                 var conditionLabel = defineLabel();
82627                 var loopLabel = defineLabel();
82628                 beginLoopBlock(conditionLabel);
82629                 markLabel(loopLabel);
82630                 transformAndEmitEmbeddedStatement(node.statement);
82631                 markLabel(conditionLabel);
82632                 emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression));
82633                 endLoopBlock();
82634             }
82635             else {
82636                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82637             }
82638         }
82639         function visitDoStatement(node) {
82640             if (inStatementContainingYield) {
82641                 beginScriptLoopBlock();
82642                 node = ts.visitEachChild(node, visitor, context);
82643                 endLoopBlock();
82644                 return node;
82645             }
82646             else {
82647                 return ts.visitEachChild(node, visitor, context);
82648             }
82649         }
82650         function transformAndEmitWhileStatement(node) {
82651             if (containsYield(node)) {
82652                 var loopLabel = defineLabel();
82653                 var endLabel = beginLoopBlock(loopLabel);
82654                 markLabel(loopLabel);
82655                 emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression));
82656                 transformAndEmitEmbeddedStatement(node.statement);
82657                 emitBreak(loopLabel);
82658                 endLoopBlock();
82659             }
82660             else {
82661                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82662             }
82663         }
82664         function visitWhileStatement(node) {
82665             if (inStatementContainingYield) {
82666                 beginScriptLoopBlock();
82667                 node = ts.visitEachChild(node, visitor, context);
82668                 endLoopBlock();
82669                 return node;
82670             }
82671             else {
82672                 return ts.visitEachChild(node, visitor, context);
82673             }
82674         }
82675         function transformAndEmitForStatement(node) {
82676             if (containsYield(node)) {
82677                 var conditionLabel = defineLabel();
82678                 var incrementLabel = defineLabel();
82679                 var endLabel = beginLoopBlock(incrementLabel);
82680                 if (node.initializer) {
82681                     var initializer = node.initializer;
82682                     if (ts.isVariableDeclarationList(initializer)) {
82683                         transformAndEmitVariableDeclarationList(initializer);
82684                     }
82685                     else {
82686                         emitStatement(ts.setTextRange(factory.createExpressionStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer));
82687                     }
82688                 }
82689                 markLabel(conditionLabel);
82690                 if (node.condition) {
82691                     emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression));
82692                 }
82693                 transformAndEmitEmbeddedStatement(node.statement);
82694                 markLabel(incrementLabel);
82695                 if (node.incrementor) {
82696                     emitStatement(ts.setTextRange(factory.createExpressionStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor));
82697                 }
82698                 emitBreak(conditionLabel);
82699                 endLoopBlock();
82700             }
82701             else {
82702                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82703             }
82704         }
82705         function visitForStatement(node) {
82706             if (inStatementContainingYield) {
82707                 beginScriptLoopBlock();
82708             }
82709             var initializer = node.initializer;
82710             if (initializer && ts.isVariableDeclarationList(initializer)) {
82711                 for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
82712                     var variable = _a[_i];
82713                     hoistVariableDeclaration(variable.name);
82714                 }
82715                 var variables = ts.getInitializedVariables(initializer);
82716                 node = factory.updateForStatement(node, variables.length > 0
82717                     ? factory.inlineExpressions(ts.map(variables, transformInitializedVariable))
82718                     : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitIterationBody(node.statement, visitor, context));
82719             }
82720             else {
82721                 node = ts.visitEachChild(node, visitor, context);
82722             }
82723             if (inStatementContainingYield) {
82724                 endLoopBlock();
82725             }
82726             return node;
82727         }
82728         function transformAndEmitForInStatement(node) {
82729             if (containsYield(node)) {
82730                 var keysArray = declareLocal();
82731                 var key = declareLocal();
82732                 var keysIndex = factory.createLoopVariable();
82733                 var initializer = node.initializer;
82734                 hoistVariableDeclaration(keysIndex);
82735                 emitAssignment(keysArray, factory.createArrayLiteralExpression());
82736                 emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), undefined, [key]))));
82737                 emitAssignment(keysIndex, factory.createNumericLiteral(0));
82738                 var conditionLabel = defineLabel();
82739                 var incrementLabel = defineLabel();
82740                 var endLabel = beginLoopBlock(incrementLabel);
82741                 markLabel(conditionLabel);
82742                 emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length")));
82743                 var variable = void 0;
82744                 if (ts.isVariableDeclarationList(initializer)) {
82745                     for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
82746                         var variable_1 = _a[_i];
82747                         hoistVariableDeclaration(variable_1.name);
82748                     }
82749                     variable = factory.cloneNode(initializer.declarations[0].name);
82750                 }
82751                 else {
82752                     variable = ts.visitNode(initializer, visitor, ts.isExpression);
82753                     ts.Debug.assert(ts.isLeftHandSideExpression(variable));
82754                 }
82755                 emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex));
82756                 transformAndEmitEmbeddedStatement(node.statement);
82757                 markLabel(incrementLabel);
82758                 emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex)));
82759                 emitBreak(conditionLabel);
82760                 endLoopBlock();
82761             }
82762             else {
82763                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82764             }
82765         }
82766         function visitForInStatement(node) {
82767             if (inStatementContainingYield) {
82768                 beginScriptLoopBlock();
82769             }
82770             var initializer = node.initializer;
82771             if (ts.isVariableDeclarationList(initializer)) {
82772                 for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) {
82773                     var variable = _a[_i];
82774                     hoistVariableDeclaration(variable.name);
82775                 }
82776                 node = factory.updateForInStatement(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, factory.liftToBlock));
82777             }
82778             else {
82779                 node = ts.visitEachChild(node, visitor, context);
82780             }
82781             if (inStatementContainingYield) {
82782                 endLoopBlock();
82783             }
82784             return node;
82785         }
82786         function transformAndEmitContinueStatement(node) {
82787             var label = findContinueTarget(node.label ? ts.idText(node.label) : undefined);
82788             if (label > 0) {
82789                 emitBreak(label, node);
82790             }
82791             else {
82792                 emitStatement(node);
82793             }
82794         }
82795         function visitContinueStatement(node) {
82796             if (inStatementContainingYield) {
82797                 var label = findContinueTarget(node.label && ts.idText(node.label));
82798                 if (label > 0) {
82799                     return createInlineBreak(label, node);
82800                 }
82801             }
82802             return ts.visitEachChild(node, visitor, context);
82803         }
82804         function transformAndEmitBreakStatement(node) {
82805             var label = findBreakTarget(node.label ? ts.idText(node.label) : undefined);
82806             if (label > 0) {
82807                 emitBreak(label, node);
82808             }
82809             else {
82810                 emitStatement(node);
82811             }
82812         }
82813         function visitBreakStatement(node) {
82814             if (inStatementContainingYield) {
82815                 var label = findBreakTarget(node.label && ts.idText(node.label));
82816                 if (label > 0) {
82817                     return createInlineBreak(label, node);
82818                 }
82819             }
82820             return ts.visitEachChild(node, visitor, context);
82821         }
82822         function transformAndEmitReturnStatement(node) {
82823             emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node);
82824         }
82825         function visitReturnStatement(node) {
82826             return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node);
82827         }
82828         function transformAndEmitWithStatement(node) {
82829             if (containsYield(node)) {
82830                 beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)));
82831                 transformAndEmitEmbeddedStatement(node.statement);
82832                 endWithBlock();
82833             }
82834             else {
82835                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82836             }
82837         }
82838         function transformAndEmitSwitchStatement(node) {
82839             if (containsYield(node.caseBlock)) {
82840                 var caseBlock = node.caseBlock;
82841                 var numClauses = caseBlock.clauses.length;
82842                 var endLabel = beginSwitchBlock();
82843                 var expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression));
82844                 var clauseLabels = [];
82845                 var defaultClauseIndex = -1;
82846                 for (var i = 0; i < numClauses; i++) {
82847                     var clause = caseBlock.clauses[i];
82848                     clauseLabels.push(defineLabel());
82849                     if (clause.kind === 289 && defaultClauseIndex === -1) {
82850                         defaultClauseIndex = i;
82851                     }
82852                 }
82853                 var clausesWritten = 0;
82854                 var pendingClauses = [];
82855                 while (clausesWritten < numClauses) {
82856                     var defaultClausesSkipped = 0;
82857                     for (var i = clausesWritten; i < numClauses; i++) {
82858                         var clause = caseBlock.clauses[i];
82859                         if (clause.kind === 288) {
82860                             if (containsYield(clause.expression) && pendingClauses.length > 0) {
82861                                 break;
82862                             }
82863                             pendingClauses.push(factory.createCaseClause(ts.visitNode(clause.expression, visitor, ts.isExpression), [
82864                                 createInlineBreak(clauseLabels[i], clause.expression)
82865                             ]));
82866                         }
82867                         else {
82868                             defaultClausesSkipped++;
82869                         }
82870                     }
82871                     if (pendingClauses.length) {
82872                         emitStatement(factory.createSwitchStatement(expression, factory.createCaseBlock(pendingClauses)));
82873                         clausesWritten += pendingClauses.length;
82874                         pendingClauses = [];
82875                     }
82876                     if (defaultClausesSkipped > 0) {
82877                         clausesWritten += defaultClausesSkipped;
82878                         defaultClausesSkipped = 0;
82879                     }
82880                 }
82881                 if (defaultClauseIndex >= 0) {
82882                     emitBreak(clauseLabels[defaultClauseIndex]);
82883                 }
82884                 else {
82885                     emitBreak(endLabel);
82886                 }
82887                 for (var i = 0; i < numClauses; i++) {
82888                     markLabel(clauseLabels[i]);
82889                     transformAndEmitStatements(caseBlock.clauses[i].statements);
82890                 }
82891                 endSwitchBlock();
82892             }
82893             else {
82894                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82895             }
82896         }
82897         function visitSwitchStatement(node) {
82898             if (inStatementContainingYield) {
82899                 beginScriptSwitchBlock();
82900             }
82901             node = ts.visitEachChild(node, visitor, context);
82902             if (inStatementContainingYield) {
82903                 endSwitchBlock();
82904             }
82905             return node;
82906         }
82907         function transformAndEmitLabeledStatement(node) {
82908             if (containsYield(node)) {
82909                 beginLabeledBlock(ts.idText(node.label));
82910                 transformAndEmitEmbeddedStatement(node.statement);
82911                 endLabeledBlock();
82912             }
82913             else {
82914                 emitStatement(ts.visitNode(node, visitor, ts.isStatement));
82915             }
82916         }
82917         function visitLabeledStatement(node) {
82918             if (inStatementContainingYield) {
82919                 beginScriptLabeledBlock(ts.idText(node.label));
82920             }
82921             node = ts.visitEachChild(node, visitor, context);
82922             if (inStatementContainingYield) {
82923                 endLabeledBlock();
82924             }
82925             return node;
82926         }
82927         function transformAndEmitThrowStatement(node) {
82928             var _a;
82929             emitThrow(ts.visitNode((_a = node.expression) !== null && _a !== void 0 ? _a : factory.createVoidZero(), visitor, ts.isExpression), node);
82930         }
82931         function transformAndEmitTryStatement(node) {
82932             if (containsYield(node)) {
82933                 beginExceptionBlock();
82934                 transformAndEmitEmbeddedStatement(node.tryBlock);
82935                 if (node.catchClause) {
82936                     beginCatchBlock(node.catchClause.variableDeclaration);
82937                     transformAndEmitEmbeddedStatement(node.catchClause.block);
82938                 }
82939                 if (node.finallyBlock) {
82940                     beginFinallyBlock();
82941                     transformAndEmitEmbeddedStatement(node.finallyBlock);
82942                 }
82943                 endExceptionBlock();
82944             }
82945             else {
82946                 emitStatement(ts.visitEachChild(node, visitor, context));
82947             }
82948         }
82949         function containsYield(node) {
82950             return !!node && (node.transformFlags & 524288) !== 0;
82951         }
82952         function countInitialNodesWithoutYield(nodes) {
82953             var numNodes = nodes.length;
82954             for (var i = 0; i < numNodes; i++) {
82955                 if (containsYield(nodes[i])) {
82956                     return i;
82957                 }
82958             }
82959             return -1;
82960         }
82961         function onSubstituteNode(hint, node) {
82962             node = previousOnSubstituteNode(hint, node);
82963             if (hint === 1) {
82964                 return substituteExpression(node);
82965             }
82966             return node;
82967         }
82968         function substituteExpression(node) {
82969             if (ts.isIdentifier(node)) {
82970                 return substituteExpressionIdentifier(node);
82971             }
82972             return node;
82973         }
82974         function substituteExpressionIdentifier(node) {
82975             if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(ts.idText(node))) {
82976                 var original = ts.getOriginalNode(node);
82977                 if (ts.isIdentifier(original) && original.parent) {
82978                     var declaration = resolver.getReferencedValueDeclaration(original);
82979                     if (declaration) {
82980                         var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)];
82981                         if (name) {
82982                             var clone_6 = ts.setParent(ts.setTextRange(factory.cloneNode(name), name), name.parent);
82983                             ts.setSourceMapRange(clone_6, node);
82984                             ts.setCommentRange(clone_6, node);
82985                             return clone_6;
82986                         }
82987                     }
82988                 }
82989             }
82990             return node;
82991         }
82992         function cacheExpression(node) {
82993             if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096) {
82994                 return node;
82995             }
82996             var temp = factory.createTempVariable(hoistVariableDeclaration);
82997             emitAssignment(temp, node, node);
82998             return temp;
82999         }
83000         function declareLocal(name) {
83001             var temp = name
83002                 ? factory.createUniqueName(name)
83003                 : factory.createTempVariable(undefined);
83004             hoistVariableDeclaration(temp);
83005             return temp;
83006         }
83007         function defineLabel() {
83008             if (!labelOffsets) {
83009                 labelOffsets = [];
83010             }
83011             var label = nextLabelId;
83012             nextLabelId++;
83013             labelOffsets[label] = -1;
83014             return label;
83015         }
83016         function markLabel(label) {
83017             ts.Debug.assert(labelOffsets !== undefined, "No labels were defined.");
83018             labelOffsets[label] = operations ? operations.length : 0;
83019         }
83020         function beginBlock(block) {
83021             if (!blocks) {
83022                 blocks = [];
83023                 blockActions = [];
83024                 blockOffsets = [];
83025                 blockStack = [];
83026             }
83027             var index = blockActions.length;
83028             blockActions[index] = 0;
83029             blockOffsets[index] = operations ? operations.length : 0;
83030             blocks[index] = block;
83031             blockStack.push(block);
83032             return index;
83033         }
83034         function endBlock() {
83035             var block = peekBlock();
83036             if (block === undefined)
83037                 return ts.Debug.fail("beginBlock was never called.");
83038             var index = blockActions.length;
83039             blockActions[index] = 1;
83040             blockOffsets[index] = operations ? operations.length : 0;
83041             blocks[index] = block;
83042             blockStack.pop();
83043             return block;
83044         }
83045         function peekBlock() {
83046             return ts.lastOrUndefined(blockStack);
83047         }
83048         function peekBlockKind() {
83049             var block = peekBlock();
83050             return block && block.kind;
83051         }
83052         function beginWithBlock(expression) {
83053             var startLabel = defineLabel();
83054             var endLabel = defineLabel();
83055             markLabel(startLabel);
83056             beginBlock({
83057                 kind: 1,
83058                 expression: expression,
83059                 startLabel: startLabel,
83060                 endLabel: endLabel
83061             });
83062         }
83063         function endWithBlock() {
83064             ts.Debug.assert(peekBlockKind() === 1);
83065             var block = endBlock();
83066             markLabel(block.endLabel);
83067         }
83068         function beginExceptionBlock() {
83069             var startLabel = defineLabel();
83070             var endLabel = defineLabel();
83071             markLabel(startLabel);
83072             beginBlock({
83073                 kind: 0,
83074                 state: 0,
83075                 startLabel: startLabel,
83076                 endLabel: endLabel
83077             });
83078             emitNop();
83079             return endLabel;
83080         }
83081         function beginCatchBlock(variable) {
83082             ts.Debug.assert(peekBlockKind() === 0);
83083             var name;
83084             if (ts.isGeneratedIdentifier(variable.name)) {
83085                 name = variable.name;
83086                 hoistVariableDeclaration(variable.name);
83087             }
83088             else {
83089                 var text = ts.idText(variable.name);
83090                 name = declareLocal(text);
83091                 if (!renamedCatchVariables) {
83092                     renamedCatchVariables = new ts.Map();
83093                     renamedCatchVariableDeclarations = [];
83094                     context.enableSubstitution(79);
83095                 }
83096                 renamedCatchVariables.set(text, true);
83097                 renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
83098             }
83099             var exception = peekBlock();
83100             ts.Debug.assert(exception.state < 1);
83101             var endLabel = exception.endLabel;
83102             emitBreak(endLabel);
83103             var catchLabel = defineLabel();
83104             markLabel(catchLabel);
83105             exception.state = 1;
83106             exception.catchVariable = name;
83107             exception.catchLabel = catchLabel;
83108             emitAssignment(name, factory.createCallExpression(factory.createPropertyAccessExpression(state, "sent"), undefined, []));
83109             emitNop();
83110         }
83111         function beginFinallyBlock() {
83112             ts.Debug.assert(peekBlockKind() === 0);
83113             var exception = peekBlock();
83114             ts.Debug.assert(exception.state < 2);
83115             var endLabel = exception.endLabel;
83116             emitBreak(endLabel);
83117             var finallyLabel = defineLabel();
83118             markLabel(finallyLabel);
83119             exception.state = 2;
83120             exception.finallyLabel = finallyLabel;
83121         }
83122         function endExceptionBlock() {
83123             ts.Debug.assert(peekBlockKind() === 0);
83124             var exception = endBlock();
83125             var state = exception.state;
83126             if (state < 2) {
83127                 emitBreak(exception.endLabel);
83128             }
83129             else {
83130                 emitEndfinally();
83131             }
83132             markLabel(exception.endLabel);
83133             emitNop();
83134             exception.state = 3;
83135         }
83136         function beginScriptLoopBlock() {
83137             beginBlock({
83138                 kind: 3,
83139                 isScript: true,
83140                 breakLabel: -1,
83141                 continueLabel: -1
83142             });
83143         }
83144         function beginLoopBlock(continueLabel) {
83145             var breakLabel = defineLabel();
83146             beginBlock({
83147                 kind: 3,
83148                 isScript: false,
83149                 breakLabel: breakLabel,
83150                 continueLabel: continueLabel,
83151             });
83152             return breakLabel;
83153         }
83154         function endLoopBlock() {
83155             ts.Debug.assert(peekBlockKind() === 3);
83156             var block = endBlock();
83157             var breakLabel = block.breakLabel;
83158             if (!block.isScript) {
83159                 markLabel(breakLabel);
83160             }
83161         }
83162         function beginScriptSwitchBlock() {
83163             beginBlock({
83164                 kind: 2,
83165                 isScript: true,
83166                 breakLabel: -1
83167             });
83168         }
83169         function beginSwitchBlock() {
83170             var breakLabel = defineLabel();
83171             beginBlock({
83172                 kind: 2,
83173                 isScript: false,
83174                 breakLabel: breakLabel,
83175             });
83176             return breakLabel;
83177         }
83178         function endSwitchBlock() {
83179             ts.Debug.assert(peekBlockKind() === 2);
83180             var block = endBlock();
83181             var breakLabel = block.breakLabel;
83182             if (!block.isScript) {
83183                 markLabel(breakLabel);
83184             }
83185         }
83186         function beginScriptLabeledBlock(labelText) {
83187             beginBlock({
83188                 kind: 4,
83189                 isScript: true,
83190                 labelText: labelText,
83191                 breakLabel: -1
83192             });
83193         }
83194         function beginLabeledBlock(labelText) {
83195             var breakLabel = defineLabel();
83196             beginBlock({
83197                 kind: 4,
83198                 isScript: false,
83199                 labelText: labelText,
83200                 breakLabel: breakLabel
83201             });
83202         }
83203         function endLabeledBlock() {
83204             ts.Debug.assert(peekBlockKind() === 4);
83205             var block = endBlock();
83206             if (!block.isScript) {
83207                 markLabel(block.breakLabel);
83208             }
83209         }
83210         function supportsUnlabeledBreak(block) {
83211             return block.kind === 2
83212                 || block.kind === 3;
83213         }
83214         function supportsLabeledBreakOrContinue(block) {
83215             return block.kind === 4;
83216         }
83217         function supportsUnlabeledContinue(block) {
83218             return block.kind === 3;
83219         }
83220         function hasImmediateContainingLabeledBlock(labelText, start) {
83221             for (var j = start; j >= 0; j--) {
83222                 var containingBlock = blockStack[j];
83223                 if (supportsLabeledBreakOrContinue(containingBlock)) {
83224                     if (containingBlock.labelText === labelText) {
83225                         return true;
83226                     }
83227                 }
83228                 else {
83229                     break;
83230                 }
83231             }
83232             return false;
83233         }
83234         function findBreakTarget(labelText) {
83235             if (blockStack) {
83236                 if (labelText) {
83237                     for (var i = blockStack.length - 1; i >= 0; i--) {
83238                         var block = blockStack[i];
83239                         if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) {
83240                             return block.breakLabel;
83241                         }
83242                         else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {
83243                             return block.breakLabel;
83244                         }
83245                     }
83246                 }
83247                 else {
83248                     for (var i = blockStack.length - 1; i >= 0; i--) {
83249                         var block = blockStack[i];
83250                         if (supportsUnlabeledBreak(block)) {
83251                             return block.breakLabel;
83252                         }
83253                     }
83254                 }
83255             }
83256             return 0;
83257         }
83258         function findContinueTarget(labelText) {
83259             if (blockStack) {
83260                 if (labelText) {
83261                     for (var i = blockStack.length - 1; i >= 0; i--) {
83262                         var block = blockStack[i];
83263                         if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) {
83264                             return block.continueLabel;
83265                         }
83266                     }
83267                 }
83268                 else {
83269                     for (var i = blockStack.length - 1; i >= 0; i--) {
83270                         var block = blockStack[i];
83271                         if (supportsUnlabeledContinue(block)) {
83272                             return block.continueLabel;
83273                         }
83274                     }
83275                 }
83276             }
83277             return 0;
83278         }
83279         function createLabel(label) {
83280             if (label !== undefined && label > 0) {
83281                 if (labelExpressions === undefined) {
83282                     labelExpressions = [];
83283                 }
83284                 var expression = factory.createNumericLiteral(-1);
83285                 if (labelExpressions[label] === undefined) {
83286                     labelExpressions[label] = [expression];
83287                 }
83288                 else {
83289                     labelExpressions[label].push(expression);
83290                 }
83291                 return expression;
83292             }
83293             return factory.createOmittedExpression();
83294         }
83295         function createInstruction(instruction) {
83296             var literal = factory.createNumericLiteral(instruction);
83297             ts.addSyntheticTrailingComment(literal, 3, getInstructionName(instruction));
83298             return literal;
83299         }
83300         function createInlineBreak(label, location) {
83301             ts.Debug.assertLessThan(0, label, "Invalid label");
83302             return ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([
83303                 createInstruction(3),
83304                 createLabel(label)
83305             ])), location);
83306         }
83307         function createInlineReturn(expression, location) {
83308             return ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression
83309                 ? [createInstruction(2), expression]
83310                 : [createInstruction(2)])), location);
83311         }
83312         function createGeneratorResume(location) {
83313             return ts.setTextRange(factory.createCallExpression(factory.createPropertyAccessExpression(state, "sent"), undefined, []), location);
83314         }
83315         function emitNop() {
83316             emitWorker(0);
83317         }
83318         function emitStatement(node) {
83319             if (node) {
83320                 emitWorker(1, [node]);
83321             }
83322             else {
83323                 emitNop();
83324             }
83325         }
83326         function emitAssignment(left, right, location) {
83327             emitWorker(2, [left, right], location);
83328         }
83329         function emitBreak(label, location) {
83330             emitWorker(3, [label], location);
83331         }
83332         function emitBreakWhenTrue(label, condition, location) {
83333             emitWorker(4, [label, condition], location);
83334         }
83335         function emitBreakWhenFalse(label, condition, location) {
83336             emitWorker(5, [label, condition], location);
83337         }
83338         function emitYieldStar(expression, location) {
83339             emitWorker(7, [expression], location);
83340         }
83341         function emitYield(expression, location) {
83342             emitWorker(6, [expression], location);
83343         }
83344         function emitReturn(expression, location) {
83345             emitWorker(8, [expression], location);
83346         }
83347         function emitThrow(expression, location) {
83348             emitWorker(9, [expression], location);
83349         }
83350         function emitEndfinally() {
83351             emitWorker(10);
83352         }
83353         function emitWorker(code, args, location) {
83354             if (operations === undefined) {
83355                 operations = [];
83356                 operationArguments = [];
83357                 operationLocations = [];
83358             }
83359             if (labelOffsets === undefined) {
83360                 markLabel(defineLabel());
83361             }
83362             var operationIndex = operations.length;
83363             operations[operationIndex] = code;
83364             operationArguments[operationIndex] = args;
83365             operationLocations[operationIndex] = location;
83366         }
83367         function build() {
83368             blockIndex = 0;
83369             labelNumber = 0;
83370             labelNumbers = undefined;
83371             lastOperationWasAbrupt = false;
83372             lastOperationWasCompletion = false;
83373             clauses = undefined;
83374             statements = undefined;
83375             exceptionBlockStack = undefined;
83376             currentExceptionBlock = undefined;
83377             withBlockStack = undefined;
83378             var buildResult = buildStatements();
83379             return emitHelpers().createGeneratorHelper(ts.setEmitFlags(factory.createFunctionExpression(undefined, undefined, undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, state)], undefined, factory.createBlock(buildResult, buildResult.length > 0)), 524288));
83380         }
83381         function buildStatements() {
83382             if (operations) {
83383                 for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) {
83384                     writeOperation(operationIndex);
83385                 }
83386                 flushFinalLabel(operations.length);
83387             }
83388             else {
83389                 flushFinalLabel(0);
83390             }
83391             if (clauses) {
83392                 var labelExpression = factory.createPropertyAccessExpression(state, "label");
83393                 var switchStatement = factory.createSwitchStatement(labelExpression, factory.createCaseBlock(clauses));
83394                 return [ts.startOnNewLine(switchStatement)];
83395             }
83396             if (statements) {
83397                 return statements;
83398             }
83399             return [];
83400         }
83401         function flushLabel() {
83402             if (!statements) {
83403                 return;
83404             }
83405             appendLabel(!lastOperationWasAbrupt);
83406             lastOperationWasAbrupt = false;
83407             lastOperationWasCompletion = false;
83408             labelNumber++;
83409         }
83410         function flushFinalLabel(operationIndex) {
83411             if (isFinalLabelReachable(operationIndex)) {
83412                 tryEnterLabel(operationIndex);
83413                 withBlockStack = undefined;
83414                 writeReturn(undefined, undefined);
83415             }
83416             if (statements && clauses) {
83417                 appendLabel(false);
83418             }
83419             updateLabelExpressions();
83420         }
83421         function isFinalLabelReachable(operationIndex) {
83422             if (!lastOperationWasCompletion) {
83423                 return true;
83424             }
83425             if (!labelOffsets || !labelExpressions) {
83426                 return false;
83427             }
83428             for (var label = 0; label < labelOffsets.length; label++) {
83429                 if (labelOffsets[label] === operationIndex && labelExpressions[label]) {
83430                     return true;
83431                 }
83432             }
83433             return false;
83434         }
83435         function appendLabel(markLabelEnd) {
83436             if (!clauses) {
83437                 clauses = [];
83438             }
83439             if (statements) {
83440                 if (withBlockStack) {
83441                     for (var i = withBlockStack.length - 1; i >= 0; i--) {
83442                         var withBlock = withBlockStack[i];
83443                         statements = [factory.createWithStatement(withBlock.expression, factory.createBlock(statements))];
83444                     }
83445                 }
83446                 if (currentExceptionBlock) {
83447                     var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel;
83448                     statements.unshift(factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(state, "trys"), "push"), undefined, [
83449                         factory.createArrayLiteralExpression([
83450                             createLabel(startLabel),
83451                             createLabel(catchLabel),
83452                             createLabel(finallyLabel),
83453                             createLabel(endLabel)
83454                         ])
83455                     ])));
83456                     currentExceptionBlock = undefined;
83457                 }
83458                 if (markLabelEnd) {
83459                     statements.push(factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(state, "label"), factory.createNumericLiteral(labelNumber + 1))));
83460                 }
83461             }
83462             clauses.push(factory.createCaseClause(factory.createNumericLiteral(labelNumber), statements || []));
83463             statements = undefined;
83464         }
83465         function tryEnterLabel(operationIndex) {
83466             if (!labelOffsets) {
83467                 return;
83468             }
83469             for (var label = 0; label < labelOffsets.length; label++) {
83470                 if (labelOffsets[label] === operationIndex) {
83471                     flushLabel();
83472                     if (labelNumbers === undefined) {
83473                         labelNumbers = [];
83474                     }
83475                     if (labelNumbers[labelNumber] === undefined) {
83476                         labelNumbers[labelNumber] = [label];
83477                     }
83478                     else {
83479                         labelNumbers[labelNumber].push(label);
83480                     }
83481                 }
83482             }
83483         }
83484         function updateLabelExpressions() {
83485             if (labelExpressions !== undefined && labelNumbers !== undefined) {
83486                 for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) {
83487                     var labels = labelNumbers[labelNumber_1];
83488                     if (labels !== undefined) {
83489                         for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {
83490                             var label = labels_1[_i];
83491                             var expressions = labelExpressions[label];
83492                             if (expressions !== undefined) {
83493                                 for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) {
83494                                     var expression = expressions_1[_a];
83495                                     expression.text = String(labelNumber_1);
83496                                 }
83497                             }
83498                         }
83499                     }
83500                 }
83501             }
83502         }
83503         function tryEnterOrLeaveBlock(operationIndex) {
83504             if (blocks) {
83505                 for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) {
83506                     var block = blocks[blockIndex];
83507                     var blockAction = blockActions[blockIndex];
83508                     switch (block.kind) {
83509                         case 0:
83510                             if (blockAction === 0) {
83511                                 if (!exceptionBlockStack) {
83512                                     exceptionBlockStack = [];
83513                                 }
83514                                 if (!statements) {
83515                                     statements = [];
83516                                 }
83517                                 exceptionBlockStack.push(currentExceptionBlock);
83518                                 currentExceptionBlock = block;
83519                             }
83520                             else if (blockAction === 1) {
83521                                 currentExceptionBlock = exceptionBlockStack.pop();
83522                             }
83523                             break;
83524                         case 1:
83525                             if (blockAction === 0) {
83526                                 if (!withBlockStack) {
83527                                     withBlockStack = [];
83528                                 }
83529                                 withBlockStack.push(block);
83530                             }
83531                             else if (blockAction === 1) {
83532                                 withBlockStack.pop();
83533                             }
83534                             break;
83535                     }
83536                 }
83537             }
83538         }
83539         function writeOperation(operationIndex) {
83540             tryEnterLabel(operationIndex);
83541             tryEnterOrLeaveBlock(operationIndex);
83542             if (lastOperationWasAbrupt) {
83543                 return;
83544             }
83545             lastOperationWasAbrupt = false;
83546             lastOperationWasCompletion = false;
83547             var opcode = operations[operationIndex];
83548             if (opcode === 0) {
83549                 return;
83550             }
83551             else if (opcode === 10) {
83552                 return writeEndfinally();
83553             }
83554             var args = operationArguments[operationIndex];
83555             if (opcode === 1) {
83556                 return writeStatement(args[0]);
83557             }
83558             var location = operationLocations[operationIndex];
83559             switch (opcode) {
83560                 case 2:
83561                     return writeAssign(args[0], args[1], location);
83562                 case 3:
83563                     return writeBreak(args[0], location);
83564                 case 4:
83565                     return writeBreakWhenTrue(args[0], args[1], location);
83566                 case 5:
83567                     return writeBreakWhenFalse(args[0], args[1], location);
83568                 case 6:
83569                     return writeYield(args[0], location);
83570                 case 7:
83571                     return writeYieldStar(args[0], location);
83572                 case 8:
83573                     return writeReturn(args[0], location);
83574                 case 9:
83575                     return writeThrow(args[0], location);
83576             }
83577         }
83578         function writeStatement(statement) {
83579             if (statement) {
83580                 if (!statements) {
83581                     statements = [statement];
83582                 }
83583                 else {
83584                     statements.push(statement);
83585                 }
83586             }
83587         }
83588         function writeAssign(left, right, operationLocation) {
83589             writeStatement(ts.setTextRange(factory.createExpressionStatement(factory.createAssignment(left, right)), operationLocation));
83590         }
83591         function writeThrow(expression, operationLocation) {
83592             lastOperationWasAbrupt = true;
83593             lastOperationWasCompletion = true;
83594             writeStatement(ts.setTextRange(factory.createThrowStatement(expression), operationLocation));
83595         }
83596         function writeReturn(expression, operationLocation) {
83597             lastOperationWasAbrupt = true;
83598             lastOperationWasCompletion = true;
83599             writeStatement(ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression
83600                 ? [createInstruction(2), expression]
83601                 : [createInstruction(2)])), operationLocation), 384));
83602         }
83603         function writeBreak(label, operationLocation) {
83604             lastOperationWasAbrupt = true;
83605             writeStatement(ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([
83606                 createInstruction(3),
83607                 createLabel(label)
83608             ])), operationLocation), 384));
83609         }
83610         function writeBreakWhenTrue(label, condition, operationLocation) {
83611             writeStatement(ts.setEmitFlags(factory.createIfStatement(condition, ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([
83612                 createInstruction(3),
83613                 createLabel(label)
83614             ])), operationLocation), 384)), 1));
83615         }
83616         function writeBreakWhenFalse(label, condition, operationLocation) {
83617             writeStatement(ts.setEmitFlags(factory.createIfStatement(factory.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([
83618                 createInstruction(3),
83619                 createLabel(label)
83620             ])), operationLocation), 384)), 1));
83621         }
83622         function writeYield(expression, operationLocation) {
83623             lastOperationWasAbrupt = true;
83624             writeStatement(ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression(expression
83625                 ? [createInstruction(4), expression]
83626                 : [createInstruction(4)])), operationLocation), 384));
83627         }
83628         function writeYieldStar(expression, operationLocation) {
83629             lastOperationWasAbrupt = true;
83630             writeStatement(ts.setEmitFlags(ts.setTextRange(factory.createReturnStatement(factory.createArrayLiteralExpression([
83631                 createInstruction(5),
83632                 expression
83633             ])), operationLocation), 384));
83634         }
83635         function writeEndfinally() {
83636             lastOperationWasAbrupt = true;
83637             writeStatement(factory.createReturnStatement(factory.createArrayLiteralExpression([
83638                 createInstruction(7)
83639             ])));
83640         }
83641     }
83642     ts.transformGenerators = transformGenerators;
83643 })(ts || (ts = {}));
83644 var ts;
83645 (function (ts) {
83646     function transformModule(context) {
83647         function getTransformModuleDelegate(moduleKind) {
83648             switch (moduleKind) {
83649                 case ts.ModuleKind.AMD: return transformAMDModule;
83650                 case ts.ModuleKind.UMD: return transformUMDModule;
83651                 default: return transformCommonJSModule;
83652             }
83653         }
83654         var factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
83655         var compilerOptions = context.getCompilerOptions();
83656         var resolver = context.getEmitResolver();
83657         var host = context.getEmitHost();
83658         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
83659         var moduleKind = ts.getEmitModuleKind(compilerOptions);
83660         var previousOnSubstituteNode = context.onSubstituteNode;
83661         var previousOnEmitNode = context.onEmitNode;
83662         context.onSubstituteNode = onSubstituteNode;
83663         context.onEmitNode = onEmitNode;
83664         context.enableSubstitution(207);
83665         context.enableSubstitution(209);
83666         context.enableSubstitution(79);
83667         context.enableSubstitution(220);
83668         context.enableSubstitution(295);
83669         context.enableEmitNotification(303);
83670         var moduleInfoMap = [];
83671         var deferredExports = [];
83672         var currentSourceFile;
83673         var currentModuleInfo;
83674         var noSubstitution = [];
83675         var needUMDDynamicImportHelper;
83676         return ts.chainBundle(context, transformSourceFile);
83677         function transformSourceFile(node) {
83678             if (node.isDeclarationFile ||
83679                 !(ts.isEffectiveExternalModule(node, compilerOptions) ||
83680                     node.transformFlags & 4194304 ||
83681                     (ts.isJsonSourceFile(node) && ts.hasJsonModuleEmitEnabled(compilerOptions) && ts.outFile(compilerOptions)))) {
83682                 return node;
83683             }
83684             currentSourceFile = node;
83685             currentModuleInfo = ts.collectExternalModuleInfo(context, node, resolver, compilerOptions);
83686             moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo;
83687             var transformModule = getTransformModuleDelegate(moduleKind);
83688             var updated = transformModule(node);
83689             currentSourceFile = undefined;
83690             currentModuleInfo = undefined;
83691             needUMDDynamicImportHelper = false;
83692             return updated;
83693         }
83694         function shouldEmitUnderscoreUnderscoreESModule() {
83695             if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) {
83696                 return true;
83697             }
83698             return false;
83699         }
83700         function transformCommonJSModule(node) {
83701             startLexicalEnvironment();
83702             var statements = [];
83703             var ensureUseStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile));
83704             var statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict && !ts.isJsonSourceFile(node), topLevelVisitor);
83705             if (shouldEmitUnderscoreUnderscoreESModule()) {
83706                 ts.append(statements, createUnderscoreUnderscoreESModule());
83707             }
83708             if (ts.length(currentModuleInfo.exportedNames)) {
83709                 var chunkSize = 50;
83710                 for (var i = 0; i < currentModuleInfo.exportedNames.length; i += chunkSize) {
83711                     ts.append(statements, factory.createExpressionStatement(ts.reduceLeft(currentModuleInfo.exportedNames.slice(i, i + chunkSize), function (prev, nextId) { return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts.idText(nextId))), prev); }, factory.createVoidZero())));
83712                 }
83713             }
83714             ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts.isStatement));
83715             ts.addRange(statements, ts.visitNodes(node.statements, topLevelVisitor, ts.isStatement, statementOffset));
83716             addExportEqualsIfNeeded(statements, false);
83717             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
83718             var updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray(statements), node.statements));
83719             ts.addEmitHelpers(updated, context.readEmitHelpers());
83720             return updated;
83721         }
83722         function transformAMDModule(node) {
83723             var define = factory.createIdentifier("define");
83724             var moduleName = ts.tryGetModuleNameFromFile(factory, node, host, compilerOptions);
83725             var jsonSourceFile = ts.isJsonSourceFile(node) && node;
83726             var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
83727             var updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray([
83728                 factory.createExpressionStatement(factory.createCallExpression(define, undefined, __spreadArray(__spreadArray([], (moduleName ? [moduleName] : []), true), [
83729                     factory.createArrayLiteralExpression(jsonSourceFile ? ts.emptyArray : __spreadArray(__spreadArray([
83730                         factory.createStringLiteral("require"),
83731                         factory.createStringLiteral("exports")
83732                     ], aliasedModuleNames, true), unaliasedModuleNames, true)),
83733                     jsonSourceFile ?
83734                         jsonSourceFile.statements.length ? jsonSourceFile.statements[0].expression : factory.createObjectLiteralExpression() :
83735                         factory.createFunctionExpression(undefined, undefined, undefined, undefined, __spreadArray([
83736                             factory.createParameterDeclaration(undefined, undefined, undefined, "require"),
83737                             factory.createParameterDeclaration(undefined, undefined, undefined, "exports")
83738                         ], importAliasNames, true), undefined, transformAsynchronousModuleBody(node))
83739                 ], false)))
83740             ]), node.statements));
83741             ts.addEmitHelpers(updated, context.readEmitHelpers());
83742             return updated;
83743         }
83744         function transformUMDModule(node) {
83745             var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames;
83746             var moduleName = ts.tryGetModuleNameFromFile(factory, node, host, compilerOptions);
83747             var umdHeader = factory.createFunctionExpression(undefined, undefined, undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, "factory")], undefined, ts.setTextRange(factory.createBlock([
83748                 factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("module"), "object"), factory.createTypeCheck(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), "object")), factory.createBlock([
83749                     factory.createVariableStatement(undefined, [
83750                         factory.createVariableDeclaration("v", undefined, undefined, factory.createCallExpression(factory.createIdentifier("factory"), undefined, [
83751                             factory.createIdentifier("require"),
83752                             factory.createIdentifier("exports")
83753                         ]))
83754                     ]),
83755                     ts.setEmitFlags(factory.createIfStatement(factory.createStrictInequality(factory.createIdentifier("v"), factory.createIdentifier("undefined")), factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), factory.createIdentifier("v")))), 1)
83756                 ]), factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("define"), "function"), factory.createPropertyAccessExpression(factory.createIdentifier("define"), "amd")), factory.createBlock([
83757                     factory.createExpressionStatement(factory.createCallExpression(factory.createIdentifier("define"), undefined, __spreadArray(__spreadArray([], (moduleName ? [moduleName] : []), true), [
83758                         factory.createArrayLiteralExpression(__spreadArray(__spreadArray([
83759                             factory.createStringLiteral("require"),
83760                             factory.createStringLiteral("exports")
83761                         ], aliasedModuleNames, true), unaliasedModuleNames, true)),
83762                         factory.createIdentifier("factory")
83763                     ], false)))
83764                 ])))
83765             ], true), undefined));
83766             var updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray([
83767                 factory.createExpressionStatement(factory.createCallExpression(umdHeader, undefined, [
83768                     factory.createFunctionExpression(undefined, undefined, undefined, undefined, __spreadArray([
83769                         factory.createParameterDeclaration(undefined, undefined, undefined, "require"),
83770                         factory.createParameterDeclaration(undefined, undefined, undefined, "exports")
83771                     ], importAliasNames, true), undefined, transformAsynchronousModuleBody(node))
83772                 ]))
83773             ]), node.statements));
83774             ts.addEmitHelpers(updated, context.readEmitHelpers());
83775             return updated;
83776         }
83777         function collectAsynchronousDependencies(node, includeNonAmdDependencies) {
83778             var aliasedModuleNames = [];
83779             var unaliasedModuleNames = [];
83780             var importAliasNames = [];
83781             for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) {
83782                 var amdDependency = _a[_i];
83783                 if (amdDependency.name) {
83784                     aliasedModuleNames.push(factory.createStringLiteral(amdDependency.path));
83785                     importAliasNames.push(factory.createParameterDeclaration(undefined, undefined, undefined, amdDependency.name));
83786                 }
83787                 else {
83788                     unaliasedModuleNames.push(factory.createStringLiteral(amdDependency.path));
83789                 }
83790             }
83791             for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) {
83792                 var importNode = _c[_b];
83793                 var externalModuleName = ts.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions);
83794                 var importAliasName = ts.getLocalNameForExternalImport(factory, importNode, currentSourceFile);
83795                 if (externalModuleName) {
83796                     if (includeNonAmdDependencies && importAliasName) {
83797                         ts.setEmitFlags(importAliasName, 4);
83798                         aliasedModuleNames.push(externalModuleName);
83799                         importAliasNames.push(factory.createParameterDeclaration(undefined, undefined, undefined, importAliasName));
83800                     }
83801                     else {
83802                         unaliasedModuleNames.push(externalModuleName);
83803                     }
83804                 }
83805             }
83806             return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames };
83807         }
83808         function getAMDImportExpressionForImport(node) {
83809             if (ts.isImportEqualsDeclaration(node) || ts.isExportDeclaration(node) || !ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions)) {
83810                 return undefined;
83811             }
83812             var name = ts.getLocalNameForExternalImport(factory, node, currentSourceFile);
83813             var expr = getHelperExpressionForImport(node, name);
83814             if (expr === name) {
83815                 return undefined;
83816             }
83817             return factory.createExpressionStatement(factory.createAssignment(name, expr));
83818         }
83819         function transformAsynchronousModuleBody(node) {
83820             startLexicalEnvironment();
83821             var statements = [];
83822             var statementOffset = factory.copyPrologue(node.statements, statements, !compilerOptions.noImplicitUseStrict, topLevelVisitor);
83823             if (shouldEmitUnderscoreUnderscoreESModule()) {
83824                 ts.append(statements, createUnderscoreUnderscoreESModule());
83825             }
83826             if (ts.length(currentModuleInfo.exportedNames)) {
83827                 ts.append(statements, factory.createExpressionStatement(ts.reduceLeft(currentModuleInfo.exportedNames, function (prev, nextId) { return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts.idText(nextId))), prev); }, factory.createVoidZero())));
83828             }
83829             ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts.isStatement));
83830             if (moduleKind === ts.ModuleKind.AMD) {
83831                 ts.addRange(statements, ts.mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport));
83832             }
83833             ts.addRange(statements, ts.visitNodes(node.statements, topLevelVisitor, ts.isStatement, statementOffset));
83834             addExportEqualsIfNeeded(statements, true);
83835             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
83836             var body = factory.createBlock(statements, true);
83837             if (needUMDDynamicImportHelper) {
83838                 ts.addEmitHelper(body, dynamicImportUMDHelper);
83839             }
83840             return body;
83841         }
83842         function addExportEqualsIfNeeded(statements, emitAsReturn) {
83843             if (currentModuleInfo.exportEquals) {
83844                 var expressionResult = ts.visitNode(currentModuleInfo.exportEquals.expression, visitor);
83845                 if (expressionResult) {
83846                     if (emitAsReturn) {
83847                         var statement = factory.createReturnStatement(expressionResult);
83848                         ts.setTextRange(statement, currentModuleInfo.exportEquals);
83849                         ts.setEmitFlags(statement, 384 | 1536);
83850                         statements.push(statement);
83851                     }
83852                     else {
83853                         var statement = factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), expressionResult));
83854                         ts.setTextRange(statement, currentModuleInfo.exportEquals);
83855                         ts.setEmitFlags(statement, 1536);
83856                         statements.push(statement);
83857                     }
83858                 }
83859             }
83860         }
83861         function topLevelVisitor(node) {
83862             switch (node.kind) {
83863                 case 265:
83864                     return visitImportDeclaration(node);
83865                 case 264:
83866                     return visitImportEqualsDeclaration(node);
83867                 case 271:
83868                     return visitExportDeclaration(node);
83869                 case 270:
83870                     return visitExportAssignment(node);
83871                 case 236:
83872                     return visitVariableStatement(node);
83873                 case 255:
83874                     return visitFunctionDeclaration(node);
83875                 case 256:
83876                     return visitClassDeclaration(node);
83877                 case 350:
83878                     return visitMergeDeclarationMarker(node);
83879                 case 351:
83880                     return visitEndOfDeclarationMarker(node);
83881                 default:
83882                     return visitor(node);
83883             }
83884         }
83885         function visitorWorker(node, valueIsDiscarded) {
83886             if (!(node.transformFlags & (4194304 | 2048 | 67108864))) {
83887                 return node;
83888             }
83889             switch (node.kind) {
83890                 case 241:
83891                     return visitForStatement(node);
83892                 case 237:
83893                     return visitExpressionStatement(node);
83894                 case 211:
83895                     return visitParenthesizedExpression(node, valueIsDiscarded);
83896                 case 348:
83897                     return visitPartiallyEmittedExpression(node, valueIsDiscarded);
83898                 case 207:
83899                     if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) {
83900                         return visitImportCallExpression(node);
83901                     }
83902                     break;
83903                 case 220:
83904                     if (ts.isDestructuringAssignment(node)) {
83905                         return visitDestructuringAssignment(node, valueIsDiscarded);
83906                     }
83907                     break;
83908                 case 218:
83909                 case 219:
83910                     return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded);
83911             }
83912             return ts.visitEachChild(node, visitor, context);
83913         }
83914         function visitor(node) {
83915             return visitorWorker(node, false);
83916         }
83917         function discardedValueVisitor(node) {
83918             return visitorWorker(node, true);
83919         }
83920         function destructuringNeedsFlattening(node) {
83921             if (ts.isObjectLiteralExpression(node)) {
83922                 for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
83923                     var elem = _a[_i];
83924                     switch (elem.kind) {
83925                         case 294:
83926                             if (destructuringNeedsFlattening(elem.initializer)) {
83927                                 return true;
83928                             }
83929                             break;
83930                         case 295:
83931                             if (destructuringNeedsFlattening(elem.name)) {
83932                                 return true;
83933                             }
83934                             break;
83935                         case 296:
83936                             if (destructuringNeedsFlattening(elem.expression)) {
83937                                 return true;
83938                             }
83939                             break;
83940                         case 168:
83941                         case 171:
83942                         case 172:
83943                             return false;
83944                         default: ts.Debug.assertNever(elem, "Unhandled object member kind");
83945                     }
83946                 }
83947             }
83948             else if (ts.isArrayLiteralExpression(node)) {
83949                 for (var _b = 0, _c = node.elements; _b < _c.length; _b++) {
83950                     var elem = _c[_b];
83951                     if (ts.isSpreadElement(elem)) {
83952                         if (destructuringNeedsFlattening(elem.expression)) {
83953                             return true;
83954                         }
83955                     }
83956                     else if (destructuringNeedsFlattening(elem)) {
83957                         return true;
83958                     }
83959                 }
83960             }
83961             else if (ts.isIdentifier(node)) {
83962                 return ts.length(getExports(node)) > (ts.isExportName(node) ? 1 : 0);
83963             }
83964             return false;
83965         }
83966         function visitDestructuringAssignment(node, valueIsDiscarded) {
83967             if (destructuringNeedsFlattening(node.left)) {
83968                 return ts.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded, createAllExportExpressions);
83969             }
83970             return ts.visitEachChild(node, visitor, context);
83971         }
83972         function visitForStatement(node) {
83973             return factory.updateForStatement(node, ts.visitNode(node.initializer, discardedValueVisitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, discardedValueVisitor, ts.isExpression), ts.visitIterationBody(node.statement, visitor, context));
83974         }
83975         function visitExpressionStatement(node) {
83976             return factory.updateExpressionStatement(node, ts.visitNode(node.expression, discardedValueVisitor, ts.isExpression));
83977         }
83978         function visitParenthesizedExpression(node, valueIsDiscarded) {
83979             return factory.updateParenthesizedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression));
83980         }
83981         function visitPartiallyEmittedExpression(node, valueIsDiscarded) {
83982             return factory.updatePartiallyEmittedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression));
83983         }
83984         function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) {
83985             if ((node.operator === 45 || node.operator === 46)
83986                 && ts.isIdentifier(node.operand)
83987                 && !ts.isGeneratedIdentifier(node.operand)
83988                 && !ts.isLocalName(node.operand)
83989                 && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
83990                 var exportedNames = getExports(node.operand);
83991                 if (exportedNames) {
83992                     var temp = void 0;
83993                     var expression = ts.visitNode(node.operand, visitor, ts.isExpression);
83994                     if (ts.isPrefixUnaryExpression(node)) {
83995                         expression = factory.updatePrefixUnaryExpression(node, expression);
83996                     }
83997                     else {
83998                         expression = factory.updatePostfixUnaryExpression(node, expression);
83999                         if (!valueIsDiscarded) {
84000                             temp = factory.createTempVariable(hoistVariableDeclaration);
84001                             expression = factory.createAssignment(temp, expression);
84002                             ts.setTextRange(expression, node);
84003                         }
84004                         expression = factory.createComma(expression, factory.cloneNode(node.operand));
84005                         ts.setTextRange(expression, node);
84006                     }
84007                     for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) {
84008                         var exportName = exportedNames_1[_i];
84009                         noSubstitution[ts.getNodeId(expression)] = true;
84010                         expression = createExportExpression(exportName, expression);
84011                         ts.setTextRange(expression, node);
84012                     }
84013                     if (temp) {
84014                         noSubstitution[ts.getNodeId(expression)] = true;
84015                         expression = factory.createComma(expression, temp);
84016                         ts.setTextRange(expression, node);
84017                     }
84018                     return expression;
84019                 }
84020             }
84021             return ts.visitEachChild(node, visitor, context);
84022         }
84023         function visitImportCallExpression(node) {
84024             var externalModuleName = ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
84025             var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor);
84026             var argument = externalModuleName && (!firstArgument || !ts.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
84027             var containsLexicalThis = !!(node.transformFlags & 8192);
84028             switch (compilerOptions.module) {
84029                 case ts.ModuleKind.AMD:
84030                     return createImportCallExpressionAMD(argument, containsLexicalThis);
84031                 case ts.ModuleKind.UMD:
84032                     return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
84033                 case ts.ModuleKind.CommonJS:
84034                 default:
84035                     return createImportCallExpressionCommonJS(argument, containsLexicalThis);
84036             }
84037         }
84038         function createImportCallExpressionUMD(arg, containsLexicalThis) {
84039             needUMDDynamicImportHelper = true;
84040             if (ts.isSimpleCopiableExpression(arg)) {
84041                 var argClone = ts.isGeneratedIdentifier(arg) ? arg : ts.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts.setEmitFlags(ts.setTextRange(factory.cloneNode(arg), arg), 1536);
84042                 return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(arg, containsLexicalThis), undefined, createImportCallExpressionAMD(argClone, containsLexicalThis));
84043             }
84044             else {
84045                 var temp = factory.createTempVariable(hoistVariableDeclaration);
84046                 return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(temp, containsLexicalThis), undefined, createImportCallExpressionAMD(temp, containsLexicalThis)));
84047             }
84048         }
84049         function createImportCallExpressionAMD(arg, containsLexicalThis) {
84050             var resolve = factory.createUniqueName("resolve");
84051             var reject = factory.createUniqueName("reject");
84052             var parameters = [
84053                 factory.createParameterDeclaration(undefined, undefined, undefined, resolve),
84054                 factory.createParameterDeclaration(undefined, undefined, undefined, reject)
84055             ];
84056             var body = factory.createBlock([
84057                 factory.createExpressionStatement(factory.createCallExpression(factory.createIdentifier("require"), undefined, [factory.createArrayLiteralExpression([arg || factory.createOmittedExpression()]), resolve, reject]))
84058             ]);
84059             var func;
84060             if (languageVersion >= 2) {
84061                 func = factory.createArrowFunction(undefined, undefined, parameters, undefined, undefined, body);
84062             }
84063             else {
84064                 func = factory.createFunctionExpression(undefined, undefined, undefined, undefined, parameters, undefined, body);
84065                 if (containsLexicalThis) {
84066                     ts.setEmitFlags(func, 8);
84067                 }
84068             }
84069             var promise = factory.createNewExpression(factory.createIdentifier("Promise"), undefined, [func]);
84070             if (ts.getESModuleInterop(compilerOptions)) {
84071                 return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), undefined, [emitHelpers().createImportStarCallbackHelper()]);
84072             }
84073             return promise;
84074         }
84075         function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
84076             var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), undefined, []);
84077             var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, arg ? [arg] : []);
84078             if (ts.getESModuleInterop(compilerOptions)) {
84079                 requireCall = emitHelpers().createImportStarHelper(requireCall);
84080             }
84081             var func;
84082             if (languageVersion >= 2) {
84083                 func = factory.createArrowFunction(undefined, undefined, [], undefined, undefined, requireCall);
84084             }
84085             else {
84086                 func = factory.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
84087                 if (containsLexicalThis) {
84088                     ts.setEmitFlags(func, 8);
84089                 }
84090             }
84091             return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]);
84092         }
84093         function getHelperExpressionForExport(node, innerExpr) {
84094             if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) {
84095                 return innerExpr;
84096             }
84097             if (ts.getExportNeedsImportStarHelper(node)) {
84098                 return emitHelpers().createImportStarHelper(innerExpr);
84099             }
84100             return innerExpr;
84101         }
84102         function getHelperExpressionForImport(node, innerExpr) {
84103             if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) {
84104                 return innerExpr;
84105             }
84106             if (ts.getImportNeedsImportStarHelper(node)) {
84107                 return emitHelpers().createImportStarHelper(innerExpr);
84108             }
84109             if (ts.getImportNeedsImportDefaultHelper(node)) {
84110                 return emitHelpers().createImportDefaultHelper(innerExpr);
84111             }
84112             return innerExpr;
84113         }
84114         function visitImportDeclaration(node) {
84115             var statements;
84116             var namespaceDeclaration = ts.getNamespaceDeclarationNode(node);
84117             if (moduleKind !== ts.ModuleKind.AMD) {
84118                 if (!node.importClause) {
84119                     return ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createRequireCall(node)), node), node);
84120                 }
84121                 else {
84122                     var variables = [];
84123                     if (namespaceDeclaration && !ts.isDefaultImport(node)) {
84124                         variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), undefined, undefined, getHelperExpressionForImport(node, createRequireCall(node))));
84125                     }
84126                     else {
84127                         variables.push(factory.createVariableDeclaration(factory.getGeneratedNameForNode(node), undefined, undefined, getHelperExpressionForImport(node, createRequireCall(node))));
84128                         if (namespaceDeclaration && ts.isDefaultImport(node)) {
84129                             variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), undefined, undefined, factory.getGeneratedNameForNode(node)));
84130                         }
84131                     }
84132                     statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node), node));
84133                 }
84134             }
84135             else if (namespaceDeclaration && ts.isDefaultImport(node)) {
84136                 statements = ts.append(statements, factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84137                     ts.setOriginalNode(ts.setTextRange(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), undefined, undefined, factory.getGeneratedNameForNode(node)), node), node)
84138                 ], languageVersion >= 2 ? 2 : 0)));
84139             }
84140             if (hasAssociatedEndOfDeclarationMarker(node)) {
84141                 var id = ts.getOriginalNodeId(node);
84142                 deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
84143             }
84144             else {
84145                 statements = appendExportsOfImportDeclaration(statements, node);
84146             }
84147             return ts.singleOrMany(statements);
84148         }
84149         function createRequireCall(importNode) {
84150             var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions);
84151             var args = [];
84152             if (moduleName) {
84153                 args.push(moduleName);
84154             }
84155             return factory.createCallExpression(factory.createIdentifier("require"), undefined, args);
84156         }
84157         function visitImportEqualsDeclaration(node) {
84158             ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
84159             var statements;
84160             if (moduleKind !== ts.ModuleKind.AMD) {
84161                 if (ts.hasSyntacticModifier(node, 1)) {
84162                     statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(node.name, createRequireCall(node))), node), node));
84163                 }
84164                 else {
84165                     statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84166                         factory.createVariableDeclaration(factory.cloneNode(node.name), undefined, undefined, createRequireCall(node))
84167                     ], languageVersion >= 2 ? 2 : 0)), node), node));
84168                 }
84169             }
84170             else {
84171                 if (ts.hasSyntacticModifier(node, 1)) {
84172                     statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(node), factory.getLocalName(node))), node), node));
84173                 }
84174             }
84175             if (hasAssociatedEndOfDeclarationMarker(node)) {
84176                 var id = ts.getOriginalNodeId(node);
84177                 deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
84178             }
84179             else {
84180                 statements = appendExportsOfImportEqualsDeclaration(statements, node);
84181             }
84182             return ts.singleOrMany(statements);
84183         }
84184         function visitExportDeclaration(node) {
84185             if (!node.moduleSpecifier) {
84186                 return undefined;
84187             }
84188             var generatedName = factory.getGeneratedNameForNode(node);
84189             if (node.exportClause && ts.isNamedExports(node.exportClause)) {
84190                 var statements = [];
84191                 if (moduleKind !== ts.ModuleKind.AMD) {
84192                     statements.push(ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84193                         factory.createVariableDeclaration(generatedName, undefined, undefined, createRequireCall(node))
84194                     ])), node), node));
84195                 }
84196                 for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) {
84197                     var specifier = _a[_i];
84198                     if (languageVersion === 0) {
84199                         statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : undefined)), specifier), specifier));
84200                     }
84201                     else {
84202                         var exportNeedsImportDefault = !!ts.getESModuleInterop(compilerOptions) &&
84203                             !(ts.getEmitFlags(node) & 67108864) &&
84204                             ts.idText(specifier.propertyName || specifier.name) === "default";
84205                         var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name);
84206                         statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(specifier), exportedValue, undefined, true)), specifier), specifier));
84207                     }
84208                 }
84209                 return ts.singleOrMany(statements);
84210             }
84211             else if (node.exportClause) {
84212                 var statements = [];
84213                 statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.cloneNode(node.exportClause.name), getHelperExpressionForExport(node, moduleKind !== ts.ModuleKind.AMD ?
84214                     createRequireCall(node) :
84215                     ts.isExportNamespaceAsDefaultDeclaration(node) ? generatedName :
84216                         factory.createIdentifier(ts.idText(node.exportClause.name))))), node), node));
84217                 return ts.singleOrMany(statements);
84218             }
84219             else {
84220                 return ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createExportStarHelper(moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : generatedName)), node), node);
84221             }
84222         }
84223         function visitExportAssignment(node) {
84224             if (node.isExportEquals) {
84225                 return undefined;
84226             }
84227             var statements;
84228             var original = node.original;
84229             if (original && hasAssociatedEndOfDeclarationMarker(original)) {
84230                 var id = ts.getOriginalNodeId(node);
84231                 deferredExports[id] = appendExportStatement(deferredExports[id], factory.createIdentifier("default"), ts.visitNode(node.expression, visitor), node, true);
84232             }
84233             else {
84234                 statements = appendExportStatement(statements, factory.createIdentifier("default"), ts.visitNode(node.expression, visitor), node, true);
84235             }
84236             return ts.singleOrMany(statements);
84237         }
84238         function visitFunctionDeclaration(node) {
84239             var statements;
84240             if (ts.hasSyntacticModifier(node, 1)) {
84241                 statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, factory.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, visitor), undefined, ts.visitEachChild(node.body, visitor, context)), node), node));
84242             }
84243             else {
84244                 statements = ts.append(statements, ts.visitEachChild(node, visitor, context));
84245             }
84246             if (hasAssociatedEndOfDeclarationMarker(node)) {
84247                 var id = ts.getOriginalNodeId(node);
84248                 deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
84249             }
84250             else {
84251                 statements = appendExportsOfHoistedDeclaration(statements, node);
84252             }
84253             return ts.singleOrMany(statements);
84254         }
84255         function visitClassDeclaration(node) {
84256             var statements;
84257             if (ts.hasSyntacticModifier(node, 1)) {
84258                 statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.heritageClauses, visitor), ts.visitNodes(node.members, visitor)), node), node));
84259             }
84260             else {
84261                 statements = ts.append(statements, ts.visitEachChild(node, visitor, context));
84262             }
84263             if (hasAssociatedEndOfDeclarationMarker(node)) {
84264                 var id = ts.getOriginalNodeId(node);
84265                 deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
84266             }
84267             else {
84268                 statements = appendExportsOfHoistedDeclaration(statements, node);
84269             }
84270             return ts.singleOrMany(statements);
84271         }
84272         function visitVariableStatement(node) {
84273             var statements;
84274             var variables;
84275             var expressions;
84276             if (ts.hasSyntacticModifier(node, 1)) {
84277                 var modifiers = void 0;
84278                 var removeCommentsOnExpressions = false;
84279                 for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
84280                     var variable = _a[_i];
84281                     if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) {
84282                         if (!modifiers) {
84283                             modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
84284                         }
84285                         variables = ts.append(variables, variable);
84286                     }
84287                     else if (variable.initializer) {
84288                         if (!ts.isBindingPattern(variable.name) && (ts.isArrowFunction(variable.initializer) || ts.isFunctionExpression(variable.initializer) || ts.isClassExpression(variable.initializer))) {
84289                             var expression = factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), variable.name), factory.createIdentifier(ts.getTextOfIdentifierOrLiteral(variable.name)));
84290                             var updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts.visitNode(variable.initializer, visitor));
84291                             variables = ts.append(variables, updatedVariable);
84292                             expressions = ts.append(expressions, expression);
84293                             removeCommentsOnExpressions = true;
84294                         }
84295                         else {
84296                             expressions = ts.append(expressions, transformInitializedVariable(variable));
84297                         }
84298                     }
84299                 }
84300                 if (variables) {
84301                     statements = ts.append(statements, factory.updateVariableStatement(node, modifiers, factory.updateVariableDeclarationList(node.declarationList, variables)));
84302                 }
84303                 if (expressions) {
84304                     var statement = ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node), node);
84305                     if (removeCommentsOnExpressions) {
84306                         ts.removeAllComments(statement);
84307                     }
84308                     statements = ts.append(statements, statement);
84309                 }
84310             }
84311             else {
84312                 statements = ts.append(statements, ts.visitEachChild(node, visitor, context));
84313             }
84314             if (hasAssociatedEndOfDeclarationMarker(node)) {
84315                 var id = ts.getOriginalNodeId(node);
84316                 deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);
84317             }
84318             else {
84319                 statements = appendExportsOfVariableStatement(statements, node);
84320             }
84321             return ts.singleOrMany(statements);
84322         }
84323         function createAllExportExpressions(name, value, location) {
84324             var exportedNames = getExports(name);
84325             if (exportedNames) {
84326                 var expression = ts.isExportName(name) ? value : factory.createAssignment(name, value);
84327                 for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) {
84328                     var exportName = exportedNames_2[_i];
84329                     ts.setEmitFlags(expression, 4);
84330                     expression = createExportExpression(exportName, expression, location);
84331                 }
84332                 return expression;
84333             }
84334             return factory.createAssignment(name, value);
84335         }
84336         function transformInitializedVariable(node) {
84337             if (ts.isBindingPattern(node.name)) {
84338                 return ts.flattenDestructuringAssignment(ts.visitNode(node, visitor), undefined, context, 0, false, createAllExportExpressions);
84339             }
84340             else {
84341                 return factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), node.name), node.name), node.initializer ? ts.visitNode(node.initializer, visitor) : factory.createVoidZero());
84342             }
84343         }
84344         function visitMergeDeclarationMarker(node) {
84345             if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 236) {
84346                 var id = ts.getOriginalNodeId(node);
84347                 deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
84348             }
84349             return node;
84350         }
84351         function hasAssociatedEndOfDeclarationMarker(node) {
84352             return (ts.getEmitFlags(node) & 4194304) !== 0;
84353         }
84354         function visitEndOfDeclarationMarker(node) {
84355             var id = ts.getOriginalNodeId(node);
84356             var statements = deferredExports[id];
84357             if (statements) {
84358                 delete deferredExports[id];
84359                 return ts.append(statements, node);
84360             }
84361             return node;
84362         }
84363         function appendExportsOfImportDeclaration(statements, decl) {
84364             if (currentModuleInfo.exportEquals) {
84365                 return statements;
84366             }
84367             var importClause = decl.importClause;
84368             if (!importClause) {
84369                 return statements;
84370             }
84371             if (importClause.name) {
84372                 statements = appendExportsOfDeclaration(statements, importClause);
84373             }
84374             var namedBindings = importClause.namedBindings;
84375             if (namedBindings) {
84376                 switch (namedBindings.kind) {
84377                     case 267:
84378                         statements = appendExportsOfDeclaration(statements, namedBindings);
84379                         break;
84380                     case 268:
84381                         for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
84382                             var importBinding = _a[_i];
84383                             statements = appendExportsOfDeclaration(statements, importBinding, true);
84384                         }
84385                         break;
84386                 }
84387             }
84388             return statements;
84389         }
84390         function appendExportsOfImportEqualsDeclaration(statements, decl) {
84391             if (currentModuleInfo.exportEquals) {
84392                 return statements;
84393             }
84394             return appendExportsOfDeclaration(statements, decl);
84395         }
84396         function appendExportsOfVariableStatement(statements, node) {
84397             if (currentModuleInfo.exportEquals) {
84398                 return statements;
84399             }
84400             for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
84401                 var decl = _a[_i];
84402                 statements = appendExportsOfBindingElement(statements, decl);
84403             }
84404             return statements;
84405         }
84406         function appendExportsOfBindingElement(statements, decl) {
84407             if (currentModuleInfo.exportEquals) {
84408                 return statements;
84409             }
84410             if (ts.isBindingPattern(decl.name)) {
84411                 for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
84412                     var element = _a[_i];
84413                     if (!ts.isOmittedExpression(element)) {
84414                         statements = appendExportsOfBindingElement(statements, element);
84415                     }
84416                 }
84417             }
84418             else if (!ts.isGeneratedIdentifier(decl.name)) {
84419                 statements = appendExportsOfDeclaration(statements, decl);
84420             }
84421             return statements;
84422         }
84423         function appendExportsOfHoistedDeclaration(statements, decl) {
84424             if (currentModuleInfo.exportEquals) {
84425                 return statements;
84426             }
84427             if (ts.hasSyntacticModifier(decl, 1)) {
84428                 var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createIdentifier("default") : factory.getDeclarationName(decl);
84429                 statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), decl);
84430             }
84431             if (decl.name) {
84432                 statements = appendExportsOfDeclaration(statements, decl);
84433             }
84434             return statements;
84435         }
84436         function appendExportsOfDeclaration(statements, decl, liveBinding) {
84437             var name = factory.getDeclarationName(decl);
84438             var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts.idText(name));
84439             if (exportSpecifiers) {
84440                 for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) {
84441                     var exportSpecifier = exportSpecifiers_1[_i];
84442                     statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name, undefined, liveBinding);
84443                 }
84444             }
84445             return statements;
84446         }
84447         function appendExportStatement(statements, exportName, expression, location, allowComments, liveBinding) {
84448             statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
84449             return statements;
84450         }
84451         function createUnderscoreUnderscoreESModule() {
84452             var statement;
84453             if (languageVersion === 0) {
84454                 statement = factory.createExpressionStatement(createExportExpression(factory.createIdentifier("__esModule"), factory.createTrue()));
84455             }
84456             else {
84457                 statement = factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), undefined, [
84458                     factory.createIdentifier("exports"),
84459                     factory.createStringLiteral("__esModule"),
84460                     factory.createObjectLiteralExpression([
84461                         factory.createPropertyAssignment("value", factory.createTrue())
84462                     ])
84463                 ]));
84464             }
84465             ts.setEmitFlags(statement, 1048576);
84466             return statement;
84467         }
84468         function createExportStatement(name, value, location, allowComments, liveBinding) {
84469             var statement = ts.setTextRange(factory.createExpressionStatement(createExportExpression(name, value, undefined, liveBinding)), location);
84470             ts.startOnNewLine(statement);
84471             if (!allowComments) {
84472                 ts.setEmitFlags(statement, 1536);
84473             }
84474             return statement;
84475         }
84476         function createExportExpression(name, value, location, liveBinding) {
84477             return ts.setTextRange(liveBinding && languageVersion !== 0 ? factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), undefined, [
84478                 factory.createIdentifier("exports"),
84479                 factory.createStringLiteralFromNode(name),
84480                 factory.createObjectLiteralExpression([
84481                     factory.createPropertyAssignment("enumerable", factory.createTrue()),
84482                     factory.createPropertyAssignment("get", factory.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, factory.createBlock([factory.createReturnStatement(value)])))
84483                 ])
84484             ]) : factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(name)), value), location);
84485         }
84486         function modifierVisitor(node) {
84487             switch (node.kind) {
84488                 case 93:
84489                 case 88:
84490                     return undefined;
84491             }
84492             return node;
84493         }
84494         function onEmitNode(hint, node, emitCallback) {
84495             if (node.kind === 303) {
84496                 currentSourceFile = node;
84497                 currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
84498                 previousOnEmitNode(hint, node, emitCallback);
84499                 currentSourceFile = undefined;
84500                 currentModuleInfo = undefined;
84501             }
84502             else {
84503                 previousOnEmitNode(hint, node, emitCallback);
84504             }
84505         }
84506         function onSubstituteNode(hint, node) {
84507             node = previousOnSubstituteNode(hint, node);
84508             if (node.id && noSubstitution[node.id]) {
84509                 return node;
84510             }
84511             if (hint === 1) {
84512                 return substituteExpression(node);
84513             }
84514             else if (ts.isShorthandPropertyAssignment(node)) {
84515                 return substituteShorthandPropertyAssignment(node);
84516             }
84517             return node;
84518         }
84519         function substituteShorthandPropertyAssignment(node) {
84520             var name = node.name;
84521             var exportedOrImportedName = substituteExpressionIdentifier(name);
84522             if (exportedOrImportedName !== name) {
84523                 if (node.objectAssignmentInitializer) {
84524                     var initializer = factory.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer);
84525                     return ts.setTextRange(factory.createPropertyAssignment(name, initializer), node);
84526                 }
84527                 return ts.setTextRange(factory.createPropertyAssignment(name, exportedOrImportedName), node);
84528             }
84529             return node;
84530         }
84531         function substituteExpression(node) {
84532             switch (node.kind) {
84533                 case 79:
84534                     return substituteExpressionIdentifier(node);
84535                 case 207:
84536                     return substituteCallExpression(node);
84537                 case 209:
84538                     return substituteTaggedTemplateExpression(node);
84539                 case 220:
84540                     return substituteBinaryExpression(node);
84541             }
84542             return node;
84543         }
84544         function substituteCallExpression(node) {
84545             if (ts.isIdentifier(node.expression)) {
84546                 var expression = substituteExpressionIdentifier(node.expression);
84547                 noSubstitution[ts.getNodeId(expression)] = true;
84548                 if (!ts.isIdentifier(expression)) {
84549                     return ts.addEmitFlags(factory.updateCallExpression(node, expression, undefined, node.arguments), 536870912);
84550                 }
84551             }
84552             return node;
84553         }
84554         function substituteTaggedTemplateExpression(node) {
84555             if (ts.isIdentifier(node.tag)) {
84556                 var tag = substituteExpressionIdentifier(node.tag);
84557                 noSubstitution[ts.getNodeId(tag)] = true;
84558                 if (!ts.isIdentifier(tag)) {
84559                     return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag, undefined, node.template), 536870912);
84560                 }
84561             }
84562             return node;
84563         }
84564         function substituteExpressionIdentifier(node) {
84565             var _a, _b;
84566             if (ts.getEmitFlags(node) & 4096) {
84567                 var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
84568                 if (externalHelpersModuleName) {
84569                     return factory.createPropertyAccessExpression(externalHelpersModuleName, node);
84570                 }
84571                 return node;
84572             }
84573             else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64)) && !ts.isLocalName(node)) {
84574                 var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
84575                 if (exportContainer && exportContainer.kind === 303) {
84576                     return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), node);
84577                 }
84578                 var importDeclaration = resolver.getReferencedImportDeclaration(node);
84579                 if (importDeclaration) {
84580                     if (ts.isImportClause(importDeclaration)) {
84581                         return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), node);
84582                     }
84583                     else if (ts.isImportSpecifier(importDeclaration)) {
84584                         var name = importDeclaration.propertyName || importDeclaration.name;
84585                         return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(name)), node);
84586                     }
84587                 }
84588             }
84589             return node;
84590         }
84591         function substituteBinaryExpression(node) {
84592             if (ts.isAssignmentOperator(node.operatorToken.kind)
84593                 && ts.isIdentifier(node.left)
84594                 && !ts.isGeneratedIdentifier(node.left)
84595                 && !ts.isLocalName(node.left)
84596                 && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {
84597                 var exportedNames = getExports(node.left);
84598                 if (exportedNames) {
84599                     var expression = node;
84600                     for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
84601                         var exportName = exportedNames_3[_i];
84602                         noSubstitution[ts.getNodeId(expression)] = true;
84603                         expression = createExportExpression(exportName, expression, node);
84604                     }
84605                     return expression;
84606                 }
84607             }
84608             return node;
84609         }
84610         function getExports(name) {
84611             if (!ts.isGeneratedIdentifier(name)) {
84612                 var valueDeclaration = resolver.getReferencedImportDeclaration(name)
84613                     || resolver.getReferencedValueDeclaration(name);
84614                 if (valueDeclaration) {
84615                     return currentModuleInfo
84616                         && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)];
84617                 }
84618             }
84619         }
84620     }
84621     ts.transformModule = transformModule;
84622     var dynamicImportUMDHelper = {
84623         name: "typescript:dynamicimport-sync-require",
84624         scoped: true,
84625         text: "\n            var __syncRequire = typeof module === \"object\" && typeof module.exports === \"object\";"
84626     };
84627 })(ts || (ts = {}));
84628 var ts;
84629 (function (ts) {
84630     function transformSystemModule(context) {
84631         var factory = context.factory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
84632         var compilerOptions = context.getCompilerOptions();
84633         var resolver = context.getEmitResolver();
84634         var host = context.getEmitHost();
84635         var previousOnSubstituteNode = context.onSubstituteNode;
84636         var previousOnEmitNode = context.onEmitNode;
84637         context.onSubstituteNode = onSubstituteNode;
84638         context.onEmitNode = onEmitNode;
84639         context.enableSubstitution(79);
84640         context.enableSubstitution(295);
84641         context.enableSubstitution(220);
84642         context.enableSubstitution(230);
84643         context.enableEmitNotification(303);
84644         var moduleInfoMap = [];
84645         var deferredExports = [];
84646         var exportFunctionsMap = [];
84647         var noSubstitutionMap = [];
84648         var contextObjectMap = [];
84649         var currentSourceFile;
84650         var moduleInfo;
84651         var exportFunction;
84652         var contextObject;
84653         var hoistedStatements;
84654         var enclosingBlockScopedContainer;
84655         var noSubstitution;
84656         return ts.chainBundle(context, transformSourceFile);
84657         function transformSourceFile(node) {
84658             if (node.isDeclarationFile || !(ts.isEffectiveExternalModule(node, compilerOptions) || node.transformFlags & 4194304)) {
84659                 return node;
84660             }
84661             var id = ts.getOriginalNodeId(node);
84662             currentSourceFile = node;
84663             enclosingBlockScopedContainer = node;
84664             moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(context, node, resolver, compilerOptions);
84665             exportFunction = factory.createUniqueName("exports");
84666             exportFunctionsMap[id] = exportFunction;
84667             contextObject = contextObjectMap[id] = factory.createUniqueName("context");
84668             var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports);
84669             var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups);
84670             var moduleBodyFunction = factory.createFunctionExpression(undefined, undefined, undefined, undefined, [
84671                 factory.createParameterDeclaration(undefined, undefined, undefined, exportFunction),
84672                 factory.createParameterDeclaration(undefined, undefined, undefined, contextObject)
84673             ], undefined, moduleBodyBlock);
84674             var moduleName = ts.tryGetModuleNameFromFile(factory, node, host, compilerOptions);
84675             var dependencies = factory.createArrayLiteralExpression(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
84676             var updated = ts.setEmitFlags(factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray([
84677                 factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("System"), "register"), undefined, moduleName
84678                     ? [moduleName, dependencies, moduleBodyFunction]
84679                     : [dependencies, moduleBodyFunction]))
84680             ]), node.statements)), 1024);
84681             if (!ts.outFile(compilerOptions)) {
84682                 ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
84683             }
84684             if (noSubstitution) {
84685                 noSubstitutionMap[id] = noSubstitution;
84686                 noSubstitution = undefined;
84687             }
84688             currentSourceFile = undefined;
84689             moduleInfo = undefined;
84690             exportFunction = undefined;
84691             contextObject = undefined;
84692             hoistedStatements = undefined;
84693             enclosingBlockScopedContainer = undefined;
84694             return updated;
84695         }
84696         function collectDependencyGroups(externalImports) {
84697             var groupIndices = new ts.Map();
84698             var dependencyGroups = [];
84699             for (var _i = 0, externalImports_1 = externalImports; _i < externalImports_1.length; _i++) {
84700                 var externalImport = externalImports_1[_i];
84701                 var externalModuleName = ts.getExternalModuleNameLiteral(factory, externalImport, currentSourceFile, host, resolver, compilerOptions);
84702                 if (externalModuleName) {
84703                     var text = externalModuleName.text;
84704                     var groupIndex = groupIndices.get(text);
84705                     if (groupIndex !== undefined) {
84706                         dependencyGroups[groupIndex].externalImports.push(externalImport);
84707                     }
84708                     else {
84709                         groupIndices.set(text, dependencyGroups.length);
84710                         dependencyGroups.push({
84711                             name: externalModuleName,
84712                             externalImports: [externalImport]
84713                         });
84714                     }
84715                 }
84716             }
84717             return dependencyGroups;
84718         }
84719         function createSystemModuleBody(node, dependencyGroups) {
84720             var statements = [];
84721             startLexicalEnvironment();
84722             var ensureUseStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile));
84723             var statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict, topLevelVisitor);
84724             statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84725                 factory.createVariableDeclaration("__moduleName", undefined, undefined, factory.createLogicalAnd(contextObject, factory.createPropertyAccessExpression(contextObject, "id")))
84726             ])));
84727             ts.visitNode(moduleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts.isStatement);
84728             var executeStatements = ts.visitNodes(node.statements, topLevelVisitor, ts.isStatement, statementOffset);
84729             ts.addRange(statements, hoistedStatements);
84730             ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
84731             var exportStarFunction = addExportStarIfNeeded(statements);
84732             var modifiers = node.transformFlags & 1048576 ?
84733                 factory.createModifiersFromModifierFlags(256) :
84734                 undefined;
84735             var moduleObject = factory.createObjectLiteralExpression([
84736                 factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
84737                 factory.createPropertyAssignment("execute", factory.createFunctionExpression(modifiers, undefined, undefined, undefined, [], undefined, factory.createBlock(executeStatements, true)))
84738             ], true);
84739             statements.push(factory.createReturnStatement(moduleObject));
84740             return factory.createBlock(statements, true);
84741         }
84742         function addExportStarIfNeeded(statements) {
84743             if (!moduleInfo.hasExportStarsToExportValues) {
84744                 return;
84745             }
84746             if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) {
84747                 var hasExportDeclarationWithExportClause = false;
84748                 for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
84749                     var externalImport = _a[_i];
84750                     if (externalImport.kind === 271 && externalImport.exportClause) {
84751                         hasExportDeclarationWithExportClause = true;
84752                         break;
84753                     }
84754                 }
84755                 if (!hasExportDeclarationWithExportClause) {
84756                     var exportStarFunction_1 = createExportStarFunction(undefined);
84757                     statements.push(exportStarFunction_1);
84758                     return exportStarFunction_1.name;
84759                 }
84760             }
84761             var exportedNames = [];
84762             if (moduleInfo.exportedNames) {
84763                 for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) {
84764                     var exportedLocalName = _c[_b];
84765                     if (exportedLocalName.escapedText === "default") {
84766                         continue;
84767                     }
84768                     exportedNames.push(factory.createPropertyAssignment(factory.createStringLiteralFromNode(exportedLocalName), factory.createTrue()));
84769                 }
84770             }
84771             var exportedNamesStorageRef = factory.createUniqueName("exportedNames");
84772             statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84773                 factory.createVariableDeclaration(exportedNamesStorageRef, undefined, undefined, factory.createObjectLiteralExpression(exportedNames, true))
84774             ])));
84775             var exportStarFunction = createExportStarFunction(exportedNamesStorageRef);
84776             statements.push(exportStarFunction);
84777             return exportStarFunction.name;
84778         }
84779         function createExportStarFunction(localNames) {
84780             var exportStarFunction = factory.createUniqueName("exportStar");
84781             var m = factory.createIdentifier("m");
84782             var n = factory.createIdentifier("n");
84783             var exports = factory.createIdentifier("exports");
84784             var condition = factory.createStrictInequality(n, factory.createStringLiteral("default"));
84785             if (localNames) {
84786                 condition = factory.createLogicalAnd(condition, factory.createLogicalNot(factory.createCallExpression(factory.createPropertyAccessExpression(localNames, "hasOwnProperty"), undefined, [n])));
84787             }
84788             return factory.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, m)], undefined, factory.createBlock([
84789                 factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
84790                     factory.createVariableDeclaration(exports, undefined, undefined, factory.createObjectLiteralExpression([]))
84791                 ])),
84792                 factory.createForInStatement(factory.createVariableDeclarationList([
84793                     factory.createVariableDeclaration(n)
84794                 ]), m, factory.createBlock([
84795                     ts.setEmitFlags(factory.createIfStatement(condition, factory.createExpressionStatement(factory.createAssignment(factory.createElementAccessExpression(exports, n), factory.createElementAccessExpression(m, n)))), 1)
84796                 ])),
84797                 factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [exports]))
84798             ], true));
84799         }
84800         function createSettersArray(exportStarFunction, dependencyGroups) {
84801             var setters = [];
84802             for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) {
84803                 var group_2 = dependencyGroups_1[_i];
84804                 var localName = ts.forEach(group_2.externalImports, function (i) { return ts.getLocalNameForExternalImport(factory, i, currentSourceFile); });
84805                 var parameterName = localName ? factory.getGeneratedNameForNode(localName) : factory.createUniqueName("");
84806                 var statements = [];
84807                 for (var _a = 0, _b = group_2.externalImports; _a < _b.length; _a++) {
84808                     var entry = _b[_a];
84809                     var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile);
84810                     switch (entry.kind) {
84811                         case 265:
84812                             if (!entry.importClause) {
84813                                 break;
84814                             }
84815                         case 264:
84816                             ts.Debug.assert(importVariableName !== undefined);
84817                             statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
84818                             break;
84819                         case 271:
84820                             ts.Debug.assert(importVariableName !== undefined);
84821                             if (entry.exportClause) {
84822                                 if (ts.isNamedExports(entry.exportClause)) {
84823                                     var properties = [];
84824                                     for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) {
84825                                         var e = _d[_c];
84826                                         properties.push(factory.createPropertyAssignment(factory.createStringLiteral(ts.idText(e.name)), factory.createElementAccessExpression(parameterName, factory.createStringLiteral(ts.idText(e.propertyName || e.name)))));
84827                                     }
84828                                     statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [factory.createObjectLiteralExpression(properties, true)])));
84829                                 }
84830                                 else {
84831                                     statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [
84832                                         factory.createStringLiteral(ts.idText(entry.exportClause.name)),
84833                                         parameterName
84834                                     ])));
84835                                 }
84836                             }
84837                             else {
84838                                 statements.push(factory.createExpressionStatement(factory.createCallExpression(exportStarFunction, undefined, [parameterName])));
84839                             }
84840                             break;
84841                     }
84842                 }
84843                 setters.push(factory.createFunctionExpression(undefined, undefined, undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, parameterName)], undefined, factory.createBlock(statements, true)));
84844             }
84845             return factory.createArrayLiteralExpression(setters, true);
84846         }
84847         function topLevelVisitor(node) {
84848             switch (node.kind) {
84849                 case 265:
84850                     return visitImportDeclaration(node);
84851                 case 264:
84852                     return visitImportEqualsDeclaration(node);
84853                 case 271:
84854                     return visitExportDeclaration(node);
84855                 case 270:
84856                     return visitExportAssignment(node);
84857                 default:
84858                     return topLevelNestedVisitor(node);
84859             }
84860         }
84861         function visitImportDeclaration(node) {
84862             var statements;
84863             if (node.importClause) {
84864                 hoistVariableDeclaration(ts.getLocalNameForExternalImport(factory, node, currentSourceFile));
84865             }
84866             if (hasAssociatedEndOfDeclarationMarker(node)) {
84867                 var id = ts.getOriginalNodeId(node);
84868                 deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
84869             }
84870             else {
84871                 statements = appendExportsOfImportDeclaration(statements, node);
84872             }
84873             return ts.singleOrMany(statements);
84874         }
84875         function visitExportDeclaration(node) {
84876             ts.Debug.assertIsDefined(node);
84877             return undefined;
84878         }
84879         function visitImportEqualsDeclaration(node) {
84880             ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
84881             var statements;
84882             hoistVariableDeclaration(ts.getLocalNameForExternalImport(factory, node, currentSourceFile));
84883             if (hasAssociatedEndOfDeclarationMarker(node)) {
84884                 var id = ts.getOriginalNodeId(node);
84885                 deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
84886             }
84887             else {
84888                 statements = appendExportsOfImportEqualsDeclaration(statements, node);
84889             }
84890             return ts.singleOrMany(statements);
84891         }
84892         function visitExportAssignment(node) {
84893             if (node.isExportEquals) {
84894                 return undefined;
84895             }
84896             var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
84897             var original = node.original;
84898             if (original && hasAssociatedEndOfDeclarationMarker(original)) {
84899                 var id = ts.getOriginalNodeId(node);
84900                 deferredExports[id] = appendExportStatement(deferredExports[id], factory.createIdentifier("default"), expression, true);
84901             }
84902             else {
84903                 return createExportStatement(factory.createIdentifier("default"), expression, true);
84904             }
84905         }
84906         function visitFunctionDeclaration(node) {
84907             if (ts.hasSyntacticModifier(node, 1)) {
84908                 hoistedStatements = ts.append(hoistedStatements, factory.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, factory.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, visitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, visitor, ts.isBlock)));
84909             }
84910             else {
84911                 hoistedStatements = ts.append(hoistedStatements, ts.visitEachChild(node, visitor, context));
84912             }
84913             if (hasAssociatedEndOfDeclarationMarker(node)) {
84914                 var id = ts.getOriginalNodeId(node);
84915                 deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
84916             }
84917             else {
84918                 hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);
84919             }
84920             return undefined;
84921         }
84922         function visitClassDeclaration(node) {
84923             var statements;
84924             var name = factory.getLocalName(node);
84925             hoistVariableDeclaration(name);
84926             statements = ts.append(statements, ts.setTextRange(factory.createExpressionStatement(factory.createAssignment(name, ts.setTextRange(factory.createClassExpression(ts.visitNodes(node.decorators, visitor, ts.isDecorator), undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), ts.visitNodes(node.members, visitor, ts.isClassElement)), node))), node));
84927             if (hasAssociatedEndOfDeclarationMarker(node)) {
84928                 var id = ts.getOriginalNodeId(node);
84929                 deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
84930             }
84931             else {
84932                 statements = appendExportsOfHoistedDeclaration(statements, node);
84933             }
84934             return ts.singleOrMany(statements);
84935         }
84936         function visitVariableStatement(node) {
84937             if (!shouldHoistVariableDeclarationList(node.declarationList)) {
84938                 return ts.visitNode(node, visitor, ts.isStatement);
84939             }
84940             var expressions;
84941             var isExportedDeclaration = ts.hasSyntacticModifier(node, 1);
84942             var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);
84943             for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
84944                 var variable = _a[_i];
84945                 if (variable.initializer) {
84946                     expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));
84947                 }
84948                 else {
84949                     hoistBindingElement(variable);
84950                 }
84951             }
84952             var statements;
84953             if (expressions) {
84954                 statements = ts.append(statements, ts.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node));
84955             }
84956             if (isMarkedDeclaration) {
84957                 var id = ts.getOriginalNodeId(node);
84958                 deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);
84959             }
84960             else {
84961                 statements = appendExportsOfVariableStatement(statements, node, false);
84962             }
84963             return ts.singleOrMany(statements);
84964         }
84965         function hoistBindingElement(node) {
84966             if (ts.isBindingPattern(node.name)) {
84967                 for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) {
84968                     var element = _a[_i];
84969                     if (!ts.isOmittedExpression(element)) {
84970                         hoistBindingElement(element);
84971                     }
84972                 }
84973             }
84974             else {
84975                 hoistVariableDeclaration(factory.cloneNode(node.name));
84976             }
84977         }
84978         function shouldHoistVariableDeclarationList(node) {
84979             return (ts.getEmitFlags(node) & 2097152) === 0
84980                 && (enclosingBlockScopedContainer.kind === 303
84981                     || (ts.getOriginalNode(node).flags & 3) === 0);
84982         }
84983         function transformInitializedVariable(node, isExportedDeclaration) {
84984             var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment;
84985             return ts.isBindingPattern(node.name)
84986                 ? ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createAssignment)
84987                 : node.initializer ? createAssignment(node.name, ts.visitNode(node.initializer, visitor, ts.isExpression)) : node.name;
84988         }
84989         function createExportedVariableAssignment(name, value, location) {
84990             return createVariableAssignment(name, value, location, true);
84991         }
84992         function createNonExportedVariableAssignment(name, value, location) {
84993             return createVariableAssignment(name, value, location, false);
84994         }
84995         function createVariableAssignment(name, value, location, isExportedDeclaration) {
84996             hoistVariableDeclaration(factory.cloneNode(name));
84997             return isExportedDeclaration
84998                 ? createExportExpression(name, preventSubstitution(ts.setTextRange(factory.createAssignment(name, value), location)))
84999                 : preventSubstitution(ts.setTextRange(factory.createAssignment(name, value), location));
85000         }
85001         function visitMergeDeclarationMarker(node) {
85002             if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 236) {
85003                 var id = ts.getOriginalNodeId(node);
85004                 var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1);
85005                 deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
85006             }
85007             return node;
85008         }
85009         function hasAssociatedEndOfDeclarationMarker(node) {
85010             return (ts.getEmitFlags(node) & 4194304) !== 0;
85011         }
85012         function visitEndOfDeclarationMarker(node) {
85013             var id = ts.getOriginalNodeId(node);
85014             var statements = deferredExports[id];
85015             if (statements) {
85016                 delete deferredExports[id];
85017                 return ts.append(statements, node);
85018             }
85019             else {
85020                 var original = ts.getOriginalNode(node);
85021                 if (ts.isModuleOrEnumDeclaration(original)) {
85022                     return ts.append(appendExportsOfDeclaration(statements, original), node);
85023                 }
85024             }
85025             return node;
85026         }
85027         function appendExportsOfImportDeclaration(statements, decl) {
85028             if (moduleInfo.exportEquals) {
85029                 return statements;
85030             }
85031             var importClause = decl.importClause;
85032             if (!importClause) {
85033                 return statements;
85034             }
85035             if (importClause.name) {
85036                 statements = appendExportsOfDeclaration(statements, importClause);
85037             }
85038             var namedBindings = importClause.namedBindings;
85039             if (namedBindings) {
85040                 switch (namedBindings.kind) {
85041                     case 267:
85042                         statements = appendExportsOfDeclaration(statements, namedBindings);
85043                         break;
85044                     case 268:
85045                         for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
85046                             var importBinding = _a[_i];
85047                             statements = appendExportsOfDeclaration(statements, importBinding);
85048                         }
85049                         break;
85050                 }
85051             }
85052             return statements;
85053         }
85054         function appendExportsOfImportEqualsDeclaration(statements, decl) {
85055             if (moduleInfo.exportEquals) {
85056                 return statements;
85057             }
85058             return appendExportsOfDeclaration(statements, decl);
85059         }
85060         function appendExportsOfVariableStatement(statements, node, exportSelf) {
85061             if (moduleInfo.exportEquals) {
85062                 return statements;
85063             }
85064             for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
85065                 var decl = _a[_i];
85066                 if (decl.initializer || exportSelf) {
85067                     statements = appendExportsOfBindingElement(statements, decl, exportSelf);
85068                 }
85069             }
85070             return statements;
85071         }
85072         function appendExportsOfBindingElement(statements, decl, exportSelf) {
85073             if (moduleInfo.exportEquals) {
85074                 return statements;
85075             }
85076             if (ts.isBindingPattern(decl.name)) {
85077                 for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) {
85078                     var element = _a[_i];
85079                     if (!ts.isOmittedExpression(element)) {
85080                         statements = appendExportsOfBindingElement(statements, element, exportSelf);
85081                     }
85082                 }
85083             }
85084             else if (!ts.isGeneratedIdentifier(decl.name)) {
85085                 var excludeName = void 0;
85086                 if (exportSelf) {
85087                     statements = appendExportStatement(statements, decl.name, factory.getLocalName(decl));
85088                     excludeName = ts.idText(decl.name);
85089                 }
85090                 statements = appendExportsOfDeclaration(statements, decl, excludeName);
85091             }
85092             return statements;
85093         }
85094         function appendExportsOfHoistedDeclaration(statements, decl) {
85095             if (moduleInfo.exportEquals) {
85096                 return statements;
85097             }
85098             var excludeName;
85099             if (ts.hasSyntacticModifier(decl, 1)) {
85100                 var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createStringLiteral("default") : decl.name;
85101                 statements = appendExportStatement(statements, exportName, factory.getLocalName(decl));
85102                 excludeName = ts.getTextOfIdentifierOrLiteral(exportName);
85103             }
85104             if (decl.name) {
85105                 statements = appendExportsOfDeclaration(statements, decl, excludeName);
85106             }
85107             return statements;
85108         }
85109         function appendExportsOfDeclaration(statements, decl, excludeName) {
85110             if (moduleInfo.exportEquals) {
85111                 return statements;
85112             }
85113             var name = factory.getDeclarationName(decl);
85114             var exportSpecifiers = moduleInfo.exportSpecifiers.get(ts.idText(name));
85115             if (exportSpecifiers) {
85116                 for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) {
85117                     var exportSpecifier = exportSpecifiers_2[_i];
85118                     if (exportSpecifier.name.escapedText !== excludeName) {
85119                         statements = appendExportStatement(statements, exportSpecifier.name, name);
85120                     }
85121                 }
85122             }
85123             return statements;
85124         }
85125         function appendExportStatement(statements, exportName, expression, allowComments) {
85126             statements = ts.append(statements, createExportStatement(exportName, expression, allowComments));
85127             return statements;
85128         }
85129         function createExportStatement(name, value, allowComments) {
85130             var statement = factory.createExpressionStatement(createExportExpression(name, value));
85131             ts.startOnNewLine(statement);
85132             if (!allowComments) {
85133                 ts.setEmitFlags(statement, 1536);
85134             }
85135             return statement;
85136         }
85137         function createExportExpression(name, value) {
85138             var exportName = ts.isIdentifier(name) ? factory.createStringLiteralFromNode(name) : name;
85139             ts.setEmitFlags(value, ts.getEmitFlags(value) | 1536);
85140             return ts.setCommentRange(factory.createCallExpression(exportFunction, undefined, [exportName, value]), value);
85141         }
85142         function topLevelNestedVisitor(node) {
85143             switch (node.kind) {
85144                 case 236:
85145                     return visitVariableStatement(node);
85146                 case 255:
85147                     return visitFunctionDeclaration(node);
85148                 case 256:
85149                     return visitClassDeclaration(node);
85150                 case 241:
85151                     return visitForStatement(node, true);
85152                 case 242:
85153                     return visitForInStatement(node);
85154                 case 243:
85155                     return visitForOfStatement(node);
85156                 case 239:
85157                     return visitDoStatement(node);
85158                 case 240:
85159                     return visitWhileStatement(node);
85160                 case 249:
85161                     return visitLabeledStatement(node);
85162                 case 247:
85163                     return visitWithStatement(node);
85164                 case 248:
85165                     return visitSwitchStatement(node);
85166                 case 262:
85167                     return visitCaseBlock(node);
85168                 case 288:
85169                     return visitCaseClause(node);
85170                 case 289:
85171                     return visitDefaultClause(node);
85172                 case 251:
85173                     return visitTryStatement(node);
85174                 case 291:
85175                     return visitCatchClause(node);
85176                 case 234:
85177                     return visitBlock(node);
85178                 case 350:
85179                     return visitMergeDeclarationMarker(node);
85180                 case 351:
85181                     return visitEndOfDeclarationMarker(node);
85182                 default:
85183                     return visitor(node);
85184             }
85185         }
85186         function visitForStatement(node, isTopLevel) {
85187             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85188             enclosingBlockScopedContainer = node;
85189             node = factory.updateForStatement(node, ts.visitNode(node.initializer, isTopLevel ? visitForInitializer : discardedValueVisitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, discardedValueVisitor, ts.isExpression), ts.visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context));
85190             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85191             return node;
85192         }
85193         function visitForInStatement(node) {
85194             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85195             enclosingBlockScopedContainer = node;
85196             node = factory.updateForInStatement(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, topLevelNestedVisitor, context));
85197             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85198             return node;
85199         }
85200         function visitForOfStatement(node) {
85201             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85202             enclosingBlockScopedContainer = node;
85203             node = factory.updateForOfStatement(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, topLevelNestedVisitor, context));
85204             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85205             return node;
85206         }
85207         function shouldHoistForInitializer(node) {
85208             return ts.isVariableDeclarationList(node)
85209                 && shouldHoistVariableDeclarationList(node);
85210         }
85211         function visitForInitializer(node) {
85212             if (shouldHoistForInitializer(node)) {
85213                 var expressions = void 0;
85214                 for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) {
85215                     var variable = _a[_i];
85216                     expressions = ts.append(expressions, transformInitializedVariable(variable, false));
85217                     if (!variable.initializer) {
85218                         hoistBindingElement(variable);
85219                     }
85220                 }
85221                 return expressions ? factory.inlineExpressions(expressions) : factory.createOmittedExpression();
85222             }
85223             else {
85224                 return ts.visitNode(node, discardedValueVisitor, ts.isExpression);
85225             }
85226         }
85227         function visitDoStatement(node) {
85228             return factory.updateDoStatement(node, ts.visitIterationBody(node.statement, topLevelNestedVisitor, context), ts.visitNode(node.expression, visitor, ts.isExpression));
85229         }
85230         function visitWhileStatement(node) {
85231             return factory.updateWhileStatement(node, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitIterationBody(node.statement, topLevelNestedVisitor, context));
85232         }
85233         function visitLabeledStatement(node) {
85234             return factory.updateLabeledStatement(node, node.label, ts.visitNode(node.statement, topLevelNestedVisitor, ts.isStatement, factory.liftToBlock));
85235         }
85236         function visitWithStatement(node) {
85237             return factory.updateWithStatement(node, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, topLevelNestedVisitor, ts.isStatement, factory.liftToBlock));
85238         }
85239         function visitSwitchStatement(node) {
85240             return factory.updateSwitchStatement(node, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.caseBlock, topLevelNestedVisitor, ts.isCaseBlock));
85241         }
85242         function visitCaseBlock(node) {
85243             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85244             enclosingBlockScopedContainer = node;
85245             node = factory.updateCaseBlock(node, ts.visitNodes(node.clauses, topLevelNestedVisitor, ts.isCaseOrDefaultClause));
85246             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85247             return node;
85248         }
85249         function visitCaseClause(node) {
85250             return factory.updateCaseClause(node, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNodes(node.statements, topLevelNestedVisitor, ts.isStatement));
85251         }
85252         function visitDefaultClause(node) {
85253             return ts.visitEachChild(node, topLevelNestedVisitor, context);
85254         }
85255         function visitTryStatement(node) {
85256             return ts.visitEachChild(node, topLevelNestedVisitor, context);
85257         }
85258         function visitCatchClause(node) {
85259             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85260             enclosingBlockScopedContainer = node;
85261             node = factory.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, topLevelNestedVisitor, ts.isBlock));
85262             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85263             return node;
85264         }
85265         function visitBlock(node) {
85266             var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer;
85267             enclosingBlockScopedContainer = node;
85268             node = ts.visitEachChild(node, topLevelNestedVisitor, context);
85269             enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer;
85270             return node;
85271         }
85272         function visitorWorker(node, valueIsDiscarded) {
85273             if (!(node.transformFlags & (2048 | 4194304 | 67108864))) {
85274                 return node;
85275             }
85276             switch (node.kind) {
85277                 case 241:
85278                     return visitForStatement(node, false);
85279                 case 237:
85280                     return visitExpressionStatement(node);
85281                 case 211:
85282                     return visitParenthesizedExpression(node, valueIsDiscarded);
85283                 case 348:
85284                     return visitPartiallyEmittedExpression(node, valueIsDiscarded);
85285                 case 220:
85286                     if (ts.isDestructuringAssignment(node)) {
85287                         return visitDestructuringAssignment(node, valueIsDiscarded);
85288                     }
85289                     break;
85290                 case 207:
85291                     if (ts.isImportCall(node)) {
85292                         return visitImportCallExpression(node);
85293                     }
85294                     break;
85295                 case 218:
85296                 case 219:
85297                     return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded);
85298             }
85299             return ts.visitEachChild(node, visitor, context);
85300         }
85301         function visitor(node) {
85302             return visitorWorker(node, false);
85303         }
85304         function discardedValueVisitor(node) {
85305             return visitorWorker(node, true);
85306         }
85307         function visitExpressionStatement(node) {
85308             return factory.updateExpressionStatement(node, ts.visitNode(node.expression, discardedValueVisitor, ts.isExpression));
85309         }
85310         function visitParenthesizedExpression(node, valueIsDiscarded) {
85311             return factory.updateParenthesizedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression));
85312         }
85313         function visitPartiallyEmittedExpression(node, valueIsDiscarded) {
85314             return factory.updatePartiallyEmittedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression));
85315         }
85316         function visitImportCallExpression(node) {
85317             var externalModuleName = ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
85318             var firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor);
85319             var argument = externalModuleName && (!firstArgument || !ts.isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
85320             return factory.createCallExpression(factory.createPropertyAccessExpression(contextObject, factory.createIdentifier("import")), undefined, argument ? [argument] : []);
85321         }
85322         function visitDestructuringAssignment(node, valueIsDiscarded) {
85323             if (hasExportedReferenceInDestructuringTarget(node.left)) {
85324                 return ts.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded);
85325             }
85326             return ts.visitEachChild(node, visitor, context);
85327         }
85328         function hasExportedReferenceInDestructuringTarget(node) {
85329             if (ts.isAssignmentExpression(node, true)) {
85330                 return hasExportedReferenceInDestructuringTarget(node.left);
85331             }
85332             else if (ts.isSpreadElement(node)) {
85333                 return hasExportedReferenceInDestructuringTarget(node.expression);
85334             }
85335             else if (ts.isObjectLiteralExpression(node)) {
85336                 return ts.some(node.properties, hasExportedReferenceInDestructuringTarget);
85337             }
85338             else if (ts.isArrayLiteralExpression(node)) {
85339                 return ts.some(node.elements, hasExportedReferenceInDestructuringTarget);
85340             }
85341             else if (ts.isShorthandPropertyAssignment(node)) {
85342                 return hasExportedReferenceInDestructuringTarget(node.name);
85343             }
85344             else if (ts.isPropertyAssignment(node)) {
85345                 return hasExportedReferenceInDestructuringTarget(node.initializer);
85346             }
85347             else if (ts.isIdentifier(node)) {
85348                 var container = resolver.getReferencedExportContainer(node);
85349                 return container !== undefined && container.kind === 303;
85350             }
85351             else {
85352                 return false;
85353             }
85354         }
85355         function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) {
85356             if ((node.operator === 45 || node.operator === 46)
85357                 && ts.isIdentifier(node.operand)
85358                 && !ts.isGeneratedIdentifier(node.operand)
85359                 && !ts.isLocalName(node.operand)
85360                 && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
85361                 var exportedNames = getExports(node.operand);
85362                 if (exportedNames) {
85363                     var temp = void 0;
85364                     var expression = ts.visitNode(node.operand, visitor, ts.isExpression);
85365                     if (ts.isPrefixUnaryExpression(node)) {
85366                         expression = factory.updatePrefixUnaryExpression(node, expression);
85367                     }
85368                     else {
85369                         expression = factory.updatePostfixUnaryExpression(node, expression);
85370                         if (!valueIsDiscarded) {
85371                             temp = factory.createTempVariable(hoistVariableDeclaration);
85372                             expression = factory.createAssignment(temp, expression);
85373                             ts.setTextRange(expression, node);
85374                         }
85375                         expression = factory.createComma(expression, factory.cloneNode(node.operand));
85376                         ts.setTextRange(expression, node);
85377                     }
85378                     for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) {
85379                         var exportName = exportedNames_4[_i];
85380                         expression = createExportExpression(exportName, preventSubstitution(expression));
85381                     }
85382                     if (temp) {
85383                         expression = factory.createComma(expression, temp);
85384                         ts.setTextRange(expression, node);
85385                     }
85386                     return expression;
85387                 }
85388             }
85389             return ts.visitEachChild(node, visitor, context);
85390         }
85391         function modifierVisitor(node) {
85392             switch (node.kind) {
85393                 case 93:
85394                 case 88:
85395                     return undefined;
85396             }
85397             return node;
85398         }
85399         function onEmitNode(hint, node, emitCallback) {
85400             if (node.kind === 303) {
85401                 var id = ts.getOriginalNodeId(node);
85402                 currentSourceFile = node;
85403                 moduleInfo = moduleInfoMap[id];
85404                 exportFunction = exportFunctionsMap[id];
85405                 noSubstitution = noSubstitutionMap[id];
85406                 contextObject = contextObjectMap[id];
85407                 if (noSubstitution) {
85408                     delete noSubstitutionMap[id];
85409                 }
85410                 previousOnEmitNode(hint, node, emitCallback);
85411                 currentSourceFile = undefined;
85412                 moduleInfo = undefined;
85413                 exportFunction = undefined;
85414                 contextObject = undefined;
85415                 noSubstitution = undefined;
85416             }
85417             else {
85418                 previousOnEmitNode(hint, node, emitCallback);
85419             }
85420         }
85421         function onSubstituteNode(hint, node) {
85422             node = previousOnSubstituteNode(hint, node);
85423             if (isSubstitutionPrevented(node)) {
85424                 return node;
85425             }
85426             if (hint === 1) {
85427                 return substituteExpression(node);
85428             }
85429             else if (hint === 4) {
85430                 return substituteUnspecified(node);
85431             }
85432             return node;
85433         }
85434         function substituteUnspecified(node) {
85435             switch (node.kind) {
85436                 case 295:
85437                     return substituteShorthandPropertyAssignment(node);
85438             }
85439             return node;
85440         }
85441         function substituteShorthandPropertyAssignment(node) {
85442             var _a, _b;
85443             var name = node.name;
85444             if (!ts.isGeneratedIdentifier(name) && !ts.isLocalName(name)) {
85445                 var importDeclaration = resolver.getReferencedImportDeclaration(name);
85446                 if (importDeclaration) {
85447                     if (ts.isImportClause(importDeclaration)) {
85448                         return ts.setTextRange(factory.createPropertyAssignment(factory.cloneNode(name), factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default"))), node);
85449                     }
85450                     else if (ts.isImportSpecifier(importDeclaration)) {
85451                         return ts.setTextRange(factory.createPropertyAssignment(factory.cloneNode(name), factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(importDeclaration.propertyName || importDeclaration.name))), node);
85452                     }
85453                 }
85454             }
85455             return node;
85456         }
85457         function substituteExpression(node) {
85458             switch (node.kind) {
85459                 case 79:
85460                     return substituteExpressionIdentifier(node);
85461                 case 220:
85462                     return substituteBinaryExpression(node);
85463                 case 230:
85464                     return substituteMetaProperty(node);
85465             }
85466             return node;
85467         }
85468         function substituteExpressionIdentifier(node) {
85469             var _a, _b;
85470             if (ts.getEmitFlags(node) & 4096) {
85471                 var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile);
85472                 if (externalHelpersModuleName) {
85473                     return factory.createPropertyAccessExpression(externalHelpersModuleName, node);
85474                 }
85475                 return node;
85476             }
85477             if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
85478                 var importDeclaration = resolver.getReferencedImportDeclaration(node);
85479                 if (importDeclaration) {
85480                     if (ts.isImportClause(importDeclaration)) {
85481                         return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), node);
85482                     }
85483                     else if (ts.isImportSpecifier(importDeclaration)) {
85484                         return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(importDeclaration.propertyName || importDeclaration.name)), node);
85485                     }
85486                 }
85487             }
85488             return node;
85489         }
85490         function substituteBinaryExpression(node) {
85491             if (ts.isAssignmentOperator(node.operatorToken.kind)
85492                 && ts.isIdentifier(node.left)
85493                 && !ts.isGeneratedIdentifier(node.left)
85494                 && !ts.isLocalName(node.left)
85495                 && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) {
85496                 var exportedNames = getExports(node.left);
85497                 if (exportedNames) {
85498                     var expression = node;
85499                     for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
85500                         var exportName = exportedNames_5[_i];
85501                         expression = createExportExpression(exportName, preventSubstitution(expression));
85502                     }
85503                     return expression;
85504                 }
85505             }
85506             return node;
85507         }
85508         function substituteMetaProperty(node) {
85509             if (ts.isImportMeta(node)) {
85510                 return factory.createPropertyAccessExpression(contextObject, factory.createIdentifier("meta"));
85511             }
85512             return node;
85513         }
85514         function getExports(name) {
85515             var exportedNames;
85516             if (!ts.isGeneratedIdentifier(name)) {
85517                 var valueDeclaration = resolver.getReferencedImportDeclaration(name)
85518                     || resolver.getReferencedValueDeclaration(name);
85519                 if (valueDeclaration) {
85520                     var exportContainer = resolver.getReferencedExportContainer(name, false);
85521                     if (exportContainer && exportContainer.kind === 303) {
85522                         exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration));
85523                     }
85524                     exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
85525                 }
85526             }
85527             return exportedNames;
85528         }
85529         function preventSubstitution(node) {
85530             if (noSubstitution === undefined)
85531                 noSubstitution = [];
85532             noSubstitution[ts.getNodeId(node)] = true;
85533             return node;
85534         }
85535         function isSubstitutionPrevented(node) {
85536             return noSubstitution && node.id && noSubstitution[node.id];
85537         }
85538     }
85539     ts.transformSystemModule = transformSystemModule;
85540 })(ts || (ts = {}));
85541 var ts;
85542 (function (ts) {
85543     function transformECMAScriptModule(context) {
85544         var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
85545         var host = context.getEmitHost();
85546         var resolver = context.getEmitResolver();
85547         var compilerOptions = context.getCompilerOptions();
85548         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
85549         var previousOnEmitNode = context.onEmitNode;
85550         var previousOnSubstituteNode = context.onSubstituteNode;
85551         context.onEmitNode = onEmitNode;
85552         context.onSubstituteNode = onSubstituteNode;
85553         context.enableEmitNotification(303);
85554         context.enableSubstitution(79);
85555         var helperNameSubstitutions;
85556         var currentSourceFile;
85557         var importRequireStatements;
85558         return ts.chainBundle(context, transformSourceFile);
85559         function transformSourceFile(node) {
85560             if (node.isDeclarationFile) {
85561                 return node;
85562             }
85563             if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
85564                 currentSourceFile = node;
85565                 importRequireStatements = undefined;
85566                 var result = updateExternalModule(node);
85567                 currentSourceFile = undefined;
85568                 if (importRequireStatements) {
85569                     result = factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(ts.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements));
85570                 }
85571                 if (!ts.isExternalModule(node) || ts.some(result.statements, ts.isExternalModuleIndicator)) {
85572                     return result;
85573                 }
85574                 return factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], result.statements, true), [ts.createEmptyExports(factory)], false)), result.statements));
85575             }
85576             return node;
85577         }
85578         function updateExternalModule(node) {
85579             var externalHelpersImportDeclaration = ts.createExternalHelpersImportDeclarationIfNeeded(factory, emitHelpers(), node, compilerOptions);
85580             if (externalHelpersImportDeclaration) {
85581                 var statements = [];
85582                 var statementOffset = factory.copyPrologue(node.statements, statements);
85583                 ts.append(statements, externalHelpersImportDeclaration);
85584                 ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset));
85585                 return factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray(statements), node.statements));
85586             }
85587             else {
85588                 return ts.visitEachChild(node, visitor, context);
85589             }
85590         }
85591         function visitor(node) {
85592             switch (node.kind) {
85593                 case 264:
85594                     return ts.getEmitScriptTarget(compilerOptions) >= ts.ModuleKind.ES2020 ? visitImportEqualsDeclaration(node) : undefined;
85595                 case 270:
85596                     return visitExportAssignment(node);
85597                 case 271:
85598                     var exportDecl = node;
85599                     return visitExportDeclaration(exportDecl);
85600             }
85601             return node;
85602         }
85603         function createRequireCall(importNode) {
85604             var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, ts.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
85605             var args = [];
85606             if (moduleName) {
85607                 args.push(moduleName);
85608             }
85609             if (!importRequireStatements) {
85610                 var createRequireName = factory.createUniqueName("_createRequire", 16 | 32);
85611                 var importStatement = factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
85612                     factory.createImportSpecifier(false, factory.createIdentifier("createRequire"), createRequireName)
85613                 ])), factory.createStringLiteral("module"));
85614                 var requireHelperName = factory.createUniqueName("__require", 16 | 32);
85615                 var requireStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
85616                     factory.createVariableDeclaration(requireHelperName, undefined, undefined, factory.createCallExpression(factory.cloneNode(createRequireName), undefined, [
85617                         factory.createPropertyAccessExpression(factory.createMetaProperty(100, factory.createIdentifier("meta")), factory.createIdentifier("url"))
85618                     ]))
85619                 ], languageVersion >= 2 ? 2 : 0));
85620                 importRequireStatements = [importStatement, requireStatement];
85621             }
85622             var name = importRequireStatements[1].declarationList.declarations[0].name;
85623             ts.Debug.assertNode(name, ts.isIdentifier);
85624             return factory.createCallExpression(factory.cloneNode(name), undefined, args);
85625         }
85626         function visitImportEqualsDeclaration(node) {
85627             ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
85628             var statements;
85629             statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
85630                 factory.createVariableDeclaration(factory.cloneNode(node.name), undefined, undefined, createRequireCall(node))
85631             ], languageVersion >= 2 ? 2 : 0)), node), node));
85632             statements = appendExportsOfImportEqualsDeclaration(statements, node);
85633             return ts.singleOrMany(statements);
85634         }
85635         function appendExportsOfImportEqualsDeclaration(statements, node) {
85636             if (ts.hasSyntacticModifier(node, 1)) {
85637                 statements = ts.append(statements, factory.createExportDeclaration(undefined, undefined, node.isTypeOnly, factory.createNamedExports([factory.createExportSpecifier(false, undefined, ts.idText(node.name))])));
85638             }
85639             return statements;
85640         }
85641         function visitExportAssignment(node) {
85642             return node.isExportEquals ? undefined : node;
85643         }
85644         function visitExportDeclaration(node) {
85645             if (compilerOptions.module !== undefined && compilerOptions.module > ts.ModuleKind.ES2015) {
85646                 return node;
85647             }
85648             if (!node.exportClause || !ts.isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
85649                 return node;
85650             }
85651             var oldIdentifier = node.exportClause.name;
85652             var synthName = factory.getGeneratedNameForNode(oldIdentifier);
85653             var importDecl = factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(synthName)), node.moduleSpecifier, node.assertClause);
85654             ts.setOriginalNode(importDecl, node.exportClause);
85655             var exportDecl = ts.isExportNamespaceAsDefaultDeclaration(node) ? factory.createExportDefault(synthName) : factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports([factory.createExportSpecifier(false, synthName, oldIdentifier)]));
85656             ts.setOriginalNode(exportDecl, node);
85657             return [importDecl, exportDecl];
85658         }
85659         function onEmitNode(hint, node, emitCallback) {
85660             if (ts.isSourceFile(node)) {
85661                 if ((ts.isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
85662                     helperNameSubstitutions = new ts.Map();
85663                 }
85664                 previousOnEmitNode(hint, node, emitCallback);
85665                 helperNameSubstitutions = undefined;
85666             }
85667             else {
85668                 previousOnEmitNode(hint, node, emitCallback);
85669             }
85670         }
85671         function onSubstituteNode(hint, node) {
85672             node = previousOnSubstituteNode(hint, node);
85673             if (helperNameSubstitutions && ts.isIdentifier(node) && ts.getEmitFlags(node) & 4096) {
85674                 return substituteHelperName(node);
85675             }
85676             return node;
85677         }
85678         function substituteHelperName(node) {
85679             var name = ts.idText(node);
85680             var substitution = helperNameSubstitutions.get(name);
85681             if (!substitution) {
85682                 helperNameSubstitutions.set(name, substitution = factory.createUniqueName(name, 16 | 32));
85683             }
85684             return substitution;
85685         }
85686     }
85687     ts.transformECMAScriptModule = transformECMAScriptModule;
85688 })(ts || (ts = {}));
85689 var ts;
85690 (function (ts) {
85691     function transformNodeModule(context) {
85692         var previousOnSubstituteNode = context.onSubstituteNode;
85693         var previousOnEmitNode = context.onEmitNode;
85694         var esmTransform = ts.transformECMAScriptModule(context);
85695         var esmOnSubstituteNode = context.onSubstituteNode;
85696         var esmOnEmitNode = context.onEmitNode;
85697         context.onSubstituteNode = previousOnSubstituteNode;
85698         context.onEmitNode = previousOnEmitNode;
85699         var cjsTransform = ts.transformModule(context);
85700         var cjsOnSubstituteNode = context.onSubstituteNode;
85701         var cjsOnEmitNode = context.onEmitNode;
85702         context.onSubstituteNode = onSubstituteNode;
85703         context.onEmitNode = onEmitNode;
85704         context.enableSubstitution(303);
85705         context.enableEmitNotification(303);
85706         var currentSourceFile;
85707         return transformSourceFileOrBundle;
85708         function onSubstituteNode(hint, node) {
85709             if (ts.isSourceFile(node)) {
85710                 currentSourceFile = node;
85711                 return previousOnSubstituteNode(hint, node);
85712             }
85713             else {
85714                 if (!currentSourceFile) {
85715                     return previousOnSubstituteNode(hint, node);
85716                 }
85717                 if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
85718                     return esmOnSubstituteNode(hint, node);
85719                 }
85720                 return cjsOnSubstituteNode(hint, node);
85721             }
85722         }
85723         function onEmitNode(hint, node, emitCallback) {
85724             if (ts.isSourceFile(node)) {
85725                 currentSourceFile = node;
85726             }
85727             if (!currentSourceFile) {
85728                 return previousOnEmitNode(hint, node, emitCallback);
85729             }
85730             if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
85731                 return esmOnEmitNode(hint, node, emitCallback);
85732             }
85733             return cjsOnEmitNode(hint, node, emitCallback);
85734         }
85735         function getModuleTransformForFile(file) {
85736             return file.impliedNodeFormat === ts.ModuleKind.ESNext ? esmTransform : cjsTransform;
85737         }
85738         function transformSourceFile(node) {
85739             if (node.isDeclarationFile) {
85740                 return node;
85741             }
85742             currentSourceFile = node;
85743             var result = getModuleTransformForFile(node)(node);
85744             currentSourceFile = undefined;
85745             ts.Debug.assert(ts.isSourceFile(result));
85746             return result;
85747         }
85748         function transformSourceFileOrBundle(node) {
85749             return node.kind === 303 ? transformSourceFile(node) : transformBundle(node);
85750         }
85751         function transformBundle(node) {
85752             return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
85753         }
85754     }
85755     ts.transformNodeModule = transformNodeModule;
85756 })(ts || (ts = {}));
85757 var ts;
85758 (function (ts) {
85759     function canProduceDiagnostics(node) {
85760         return ts.isVariableDeclaration(node) ||
85761             ts.isPropertyDeclaration(node) ||
85762             ts.isPropertySignature(node) ||
85763             ts.isBindingElement(node) ||
85764             ts.isSetAccessor(node) ||
85765             ts.isGetAccessor(node) ||
85766             ts.isConstructSignatureDeclaration(node) ||
85767             ts.isCallSignatureDeclaration(node) ||
85768             ts.isMethodDeclaration(node) ||
85769             ts.isMethodSignature(node) ||
85770             ts.isFunctionDeclaration(node) ||
85771             ts.isParameter(node) ||
85772             ts.isTypeParameterDeclaration(node) ||
85773             ts.isExpressionWithTypeArguments(node) ||
85774             ts.isImportEqualsDeclaration(node) ||
85775             ts.isTypeAliasDeclaration(node) ||
85776             ts.isConstructorDeclaration(node) ||
85777             ts.isIndexSignatureDeclaration(node) ||
85778             ts.isPropertyAccessExpression(node) ||
85779             ts.isJSDocTypeAlias(node);
85780     }
85781     ts.canProduceDiagnostics = canProduceDiagnostics;
85782     function createGetSymbolAccessibilityDiagnosticForNodeName(node) {
85783         if (ts.isSetAccessor(node) || ts.isGetAccessor(node)) {
85784             return getAccessorNameVisibilityError;
85785         }
85786         else if (ts.isMethodSignature(node) || ts.isMethodDeclaration(node)) {
85787             return getMethodNameVisibilityError;
85788         }
85789         else {
85790             return createGetSymbolAccessibilityDiagnosticForNode(node);
85791         }
85792         function getAccessorNameVisibilityError(symbolAccessibilityResult) {
85793             var diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
85794             return diagnosticMessage !== undefined ? {
85795                 diagnosticMessage: diagnosticMessage,
85796                 errorNode: node,
85797                 typeName: node.name
85798             } : undefined;
85799         }
85800         function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult) {
85801             if (ts.isStatic(node)) {
85802                 return symbolAccessibilityResult.errorModuleName ?
85803                     symbolAccessibilityResult.accessibility === 2 ?
85804                         ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85805                         ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85806                     ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
85807             }
85808             else if (node.parent.kind === 256) {
85809                 return symbolAccessibilityResult.errorModuleName ?
85810                     symbolAccessibilityResult.accessibility === 2 ?
85811                         ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85812                         ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85813                     ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
85814             }
85815             else {
85816                 return symbolAccessibilityResult.errorModuleName ?
85817                     ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
85818                     ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
85819             }
85820         }
85821         function getMethodNameVisibilityError(symbolAccessibilityResult) {
85822             var diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
85823             return diagnosticMessage !== undefined ? {
85824                 diagnosticMessage: diagnosticMessage,
85825                 errorNode: node,
85826                 typeName: node.name
85827             } : undefined;
85828         }
85829         function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult) {
85830             if (ts.isStatic(node)) {
85831                 return symbolAccessibilityResult.errorModuleName ?
85832                     symbolAccessibilityResult.accessibility === 2 ?
85833                         ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85834                         ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85835                     ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
85836             }
85837             else if (node.parent.kind === 256) {
85838                 return symbolAccessibilityResult.errorModuleName ?
85839                     symbolAccessibilityResult.accessibility === 2 ?
85840                         ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85841                         ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85842                     ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1;
85843             }
85844             else {
85845                 return symbolAccessibilityResult.errorModuleName ?
85846                     ts.Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
85847                     ts.Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1;
85848             }
85849         }
85850     }
85851     ts.createGetSymbolAccessibilityDiagnosticForNodeName = createGetSymbolAccessibilityDiagnosticForNodeName;
85852     function createGetSymbolAccessibilityDiagnosticForNode(node) {
85853         if (ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isPropertyAccessExpression(node) || ts.isBindingElement(node) || ts.isConstructorDeclaration(node)) {
85854             return getVariableDeclarationTypeVisibilityError;
85855         }
85856         else if (ts.isSetAccessor(node) || ts.isGetAccessor(node)) {
85857             return getAccessorDeclarationTypeVisibilityError;
85858         }
85859         else if (ts.isConstructSignatureDeclaration(node) || ts.isCallSignatureDeclaration(node) || ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isFunctionDeclaration(node) || ts.isIndexSignatureDeclaration(node)) {
85860             return getReturnTypeVisibilityError;
85861         }
85862         else if (ts.isParameter(node)) {
85863             if (ts.isParameterPropertyDeclaration(node, node.parent) && ts.hasSyntacticModifier(node.parent, 8)) {
85864                 return getVariableDeclarationTypeVisibilityError;
85865             }
85866             return getParameterDeclarationTypeVisibilityError;
85867         }
85868         else if (ts.isTypeParameterDeclaration(node)) {
85869             return getTypeParameterConstraintVisibilityError;
85870         }
85871         else if (ts.isExpressionWithTypeArguments(node)) {
85872             return getHeritageClauseVisibilityError;
85873         }
85874         else if (ts.isImportEqualsDeclaration(node)) {
85875             return getImportEntityNameVisibilityError;
85876         }
85877         else if (ts.isTypeAliasDeclaration(node) || ts.isJSDocTypeAlias(node)) {
85878             return getTypeAliasDeclarationVisibilityError;
85879         }
85880         else {
85881             return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.SyntaxKind[node.kind]));
85882         }
85883         function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
85884             if (node.kind === 253 || node.kind === 202) {
85885                 return symbolAccessibilityResult.errorModuleName ?
85886                     symbolAccessibilityResult.accessibility === 2 ?
85887                         ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85888                         ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
85889                     ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
85890             }
85891             else if (node.kind === 166 || node.kind === 205 || node.kind === 165 ||
85892                 (node.kind === 163 && ts.hasSyntacticModifier(node.parent, 8))) {
85893                 if (ts.isStatic(node)) {
85894                     return symbolAccessibilityResult.errorModuleName ?
85895                         symbolAccessibilityResult.accessibility === 2 ?
85896                             ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85897                             ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85898                         ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
85899                 }
85900                 else if (node.parent.kind === 256 || node.kind === 163) {
85901                     return symbolAccessibilityResult.errorModuleName ?
85902                         symbolAccessibilityResult.accessibility === 2 ?
85903                             ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85904                             ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
85905                         ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
85906                 }
85907                 else {
85908                     return symbolAccessibilityResult.errorModuleName ?
85909                         ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
85910                         ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
85911                 }
85912             }
85913         }
85914         function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) {
85915             var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
85916             return diagnosticMessage !== undefined ? {
85917                 diagnosticMessage: diagnosticMessage,
85918                 errorNode: node,
85919                 typeName: node.name
85920             } : undefined;
85921         }
85922         function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
85923             var diagnosticMessage;
85924             if (node.kind === 172) {
85925                 if (ts.isStatic(node)) {
85926                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85927                         ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
85928                         ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1;
85929                 }
85930                 else {
85931                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85932                         ts.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
85933                         ts.Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1;
85934                 }
85935             }
85936             else {
85937                 if (ts.isStatic(node)) {
85938                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85939                         symbolAccessibilityResult.accessibility === 2 ?
85940                             ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85941                             ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
85942                         ts.Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1;
85943                 }
85944                 else {
85945                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85946                         symbolAccessibilityResult.accessibility === 2 ?
85947                             ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
85948                             ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
85949                         ts.Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1;
85950                 }
85951             }
85952             return {
85953                 diagnosticMessage: diagnosticMessage,
85954                 errorNode: node.name,
85955                 typeName: node.name
85956             };
85957         }
85958         function getReturnTypeVisibilityError(symbolAccessibilityResult) {
85959             var diagnosticMessage;
85960             switch (node.kind) {
85961                 case 174:
85962                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85963                         ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
85964                         ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
85965                     break;
85966                 case 173:
85967                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85968                         ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
85969                         ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
85970                     break;
85971                 case 175:
85972                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85973                         ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
85974                         ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
85975                     break;
85976                 case 168:
85977                 case 167:
85978                     if (ts.isStatic(node)) {
85979                         diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85980                             symbolAccessibilityResult.accessibility === 2 ?
85981                                 ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
85982                                 ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
85983                             ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
85984                     }
85985                     else if (node.parent.kind === 256) {
85986                         diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85987                             symbolAccessibilityResult.accessibility === 2 ?
85988                                 ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
85989                                 ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
85990                             ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
85991                     }
85992                     else {
85993                         diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
85994                             ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
85995                             ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
85996                     }
85997                     break;
85998                 case 255:
85999                     diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
86000                         symbolAccessibilityResult.accessibility === 2 ?
86001                             ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
86002                             ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
86003                         ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
86004                     break;
86005                 default:
86006                     return ts.Debug.fail("This is unknown kind for signature: " + node.kind);
86007             }
86008             return {
86009                 diagnosticMessage: diagnosticMessage,
86010                 errorNode: node.name || node
86011             };
86012         }
86013         function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) {
86014             var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
86015             return diagnosticMessage !== undefined ? {
86016                 diagnosticMessage: diagnosticMessage,
86017                 errorNode: node,
86018                 typeName: node.name
86019             } : undefined;
86020         }
86021         function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
86022             switch (node.parent.kind) {
86023                 case 170:
86024                     return symbolAccessibilityResult.errorModuleName ?
86025                         symbolAccessibilityResult.accessibility === 2 ?
86026                             ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
86027                             ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
86028                         ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
86029                 case 174:
86030                 case 179:
86031                     return symbolAccessibilityResult.errorModuleName ?
86032                         ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
86033                         ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
86034                 case 173:
86035                     return symbolAccessibilityResult.errorModuleName ?
86036                         ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
86037                         ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
86038                 case 175:
86039                     return symbolAccessibilityResult.errorModuleName ?
86040                         ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
86041                         ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
86042                 case 168:
86043                 case 167:
86044                     if (ts.isStatic(node.parent)) {
86045                         return symbolAccessibilityResult.errorModuleName ?
86046                             symbolAccessibilityResult.accessibility === 2 ?
86047                                 ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
86048                                 ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
86049                             ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
86050                     }
86051                     else if (node.parent.parent.kind === 256) {
86052                         return symbolAccessibilityResult.errorModuleName ?
86053                             symbolAccessibilityResult.accessibility === 2 ?
86054                                 ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
86055                                 ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
86056                             ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
86057                     }
86058                     else {
86059                         return symbolAccessibilityResult.errorModuleName ?
86060                             ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
86061                             ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
86062                     }
86063                 case 255:
86064                 case 178:
86065                     return symbolAccessibilityResult.errorModuleName ?
86066                         symbolAccessibilityResult.accessibility === 2 ?
86067                             ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
86068                             ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
86069                         ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
86070                 case 172:
86071                 case 171:
86072                     return symbolAccessibilityResult.errorModuleName ?
86073                         symbolAccessibilityResult.accessibility === 2 ?
86074                             ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
86075                             ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
86076                         ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
86077                 default:
86078                     return ts.Debug.fail("Unknown parent for parameter: ".concat(ts.SyntaxKind[node.parent.kind]));
86079             }
86080         }
86081         function getTypeParameterConstraintVisibilityError() {
86082             var diagnosticMessage;
86083             switch (node.parent.kind) {
86084                 case 256:
86085                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
86086                     break;
86087                 case 257:
86088                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
86089                     break;
86090                 case 194:
86091                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
86092                     break;
86093                 case 179:
86094                 case 174:
86095                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
86096                     break;
86097                 case 173:
86098                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
86099                     break;
86100                 case 168:
86101                 case 167:
86102                     if (ts.isStatic(node.parent)) {
86103                         diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
86104                     }
86105                     else if (node.parent.parent.kind === 256) {
86106                         diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
86107                     }
86108                     else {
86109                         diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
86110                     }
86111                     break;
86112                 case 178:
86113                 case 255:
86114                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
86115                     break;
86116                 case 258:
86117                     diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
86118                     break;
86119                 default:
86120                     return ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
86121             }
86122             return {
86123                 diagnosticMessage: diagnosticMessage,
86124                 errorNode: node,
86125                 typeName: node.name
86126             };
86127         }
86128         function getHeritageClauseVisibilityError() {
86129             var diagnosticMessage;
86130             if (ts.isClassDeclaration(node.parent.parent)) {
86131                 diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 117 ?
86132                     ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
86133                     node.parent.parent.name ? ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 :
86134                         ts.Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0;
86135             }
86136             else {
86137                 diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
86138             }
86139             return {
86140                 diagnosticMessage: diagnosticMessage,
86141                 errorNode: node,
86142                 typeName: ts.getNameOfDeclaration(node.parent.parent)
86143             };
86144         }
86145         function getImportEntityNameVisibilityError() {
86146             return {
86147                 diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1,
86148                 errorNode: node,
86149                 typeName: node.name
86150             };
86151         }
86152         function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) {
86153             return {
86154                 diagnosticMessage: symbolAccessibilityResult.errorModuleName
86155                     ? ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2
86156                     : ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
86157                 errorNode: ts.isJSDocTypeAlias(node) ? ts.Debug.checkDefined(node.typeExpression) : node.type,
86158                 typeName: ts.isJSDocTypeAlias(node) ? ts.getNameOfDeclaration(node) : node.name,
86159             };
86160         }
86161     }
86162     ts.createGetSymbolAccessibilityDiagnosticForNode = createGetSymbolAccessibilityDiagnosticForNode;
86163 })(ts || (ts = {}));
86164 var ts;
86165 (function (ts) {
86166     function getDeclarationDiagnostics(host, resolver, file) {
86167         var compilerOptions = host.getCompilerOptions();
86168         var result = ts.transformNodes(resolver, host, ts.factory, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJson), [transformDeclarations], false);
86169         return result.diagnostics;
86170     }
86171     ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
86172     function hasInternalAnnotation(range, currentSourceFile) {
86173         var comment = currentSourceFile.text.substring(range.pos, range.end);
86174         return ts.stringContains(comment, "@internal");
86175     }
86176     function isInternalDeclaration(node, currentSourceFile) {
86177         var parseTreeNode = ts.getParseTreeNode(node);
86178         if (parseTreeNode && parseTreeNode.kind === 163) {
86179             var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
86180             var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
86181             var text = currentSourceFile.text;
86182             var commentRanges = previousSibling
86183                 ? ts.concatenate(ts.getTrailingCommentRanges(text, ts.skipTrivia(text, previousSibling.end + 1, false, true)), ts.getLeadingCommentRanges(text, node.pos))
86184                 : ts.getTrailingCommentRanges(text, ts.skipTrivia(text, node.pos, false, true));
86185             return commentRanges && commentRanges.length && hasInternalAnnotation(ts.last(commentRanges), currentSourceFile);
86186         }
86187         var leadingCommentRanges = parseTreeNode && ts.getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
86188         return !!ts.forEach(leadingCommentRanges, function (range) {
86189             return hasInternalAnnotation(range, currentSourceFile);
86190         });
86191     }
86192     ts.isInternalDeclaration = isInternalDeclaration;
86193     var declarationEmitNodeBuilderFlags = 1024 |
86194         2048 |
86195         4096 |
86196         8 |
86197         524288 |
86198         4 |
86199         1;
86200     function transformDeclarations(context) {
86201         var throwDiagnostic = function () { return ts.Debug.fail("Diagnostic emitted without context"); };
86202         var getSymbolAccessibilityDiagnostic = throwDiagnostic;
86203         var needsDeclare = true;
86204         var isBundledEmit = false;
86205         var resultHasExternalModuleIndicator = false;
86206         var needsScopeFixMarker = false;
86207         var resultHasScopeMarker = false;
86208         var enclosingDeclaration;
86209         var necessaryTypeReferences;
86210         var lateMarkedStatements;
86211         var lateStatementReplacementMap;
86212         var suppressNewDiagnosticContexts;
86213         var exportedModulesFromDeclarationEmit;
86214         var factory = context.factory;
86215         var host = context.getEmitHost();
86216         var symbolTracker = {
86217             trackSymbol: trackSymbol,
86218             reportInaccessibleThisError: reportInaccessibleThisError,
86219             reportInaccessibleUniqueSymbolError: reportInaccessibleUniqueSymbolError,
86220             reportCyclicStructureError: reportCyclicStructureError,
86221             reportPrivateInBaseOfClassExpression: reportPrivateInBaseOfClassExpression,
86222             reportLikelyUnsafeImportRequiredError: reportLikelyUnsafeImportRequiredError,
86223             reportTruncationError: reportTruncationError,
86224             moduleResolverHost: host,
86225             trackReferencedAmbientModule: trackReferencedAmbientModule,
86226             trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
86227             reportNonlocalAugmentation: reportNonlocalAugmentation,
86228             reportNonSerializableProperty: reportNonSerializableProperty
86229         };
86230         var errorNameNode;
86231         var errorFallbackNode;
86232         var currentSourceFile;
86233         var refs;
86234         var libs;
86235         var emittedImports;
86236         var resolver = context.getEmitResolver();
86237         var options = context.getCompilerOptions();
86238         var noResolve = options.noResolve, stripInternal = options.stripInternal;
86239         return transformRoot;
86240         function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
86241             if (!typeReferenceDirectives) {
86242                 return;
86243             }
86244             necessaryTypeReferences = necessaryTypeReferences || new ts.Set();
86245             for (var _i = 0, typeReferenceDirectives_2 = typeReferenceDirectives; _i < typeReferenceDirectives_2.length; _i++) {
86246                 var ref = typeReferenceDirectives_2[_i];
86247                 necessaryTypeReferences.add(ref);
86248             }
86249         }
86250         function trackReferencedAmbientModule(node, symbol) {
86251             var directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, 67108863);
86252             if (ts.length(directives)) {
86253                 return recordTypeReferenceDirectivesIfNecessary(directives);
86254             }
86255             var container = ts.getSourceFileOfNode(node);
86256             refs.set(ts.getOriginalNodeId(container), container);
86257         }
86258         function handleSymbolAccessibilityError(symbolAccessibilityResult) {
86259             if (symbolAccessibilityResult.accessibility === 0) {
86260                 if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
86261                     if (!lateMarkedStatements) {
86262                         lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible;
86263                     }
86264                     else {
86265                         for (var _i = 0, _a = symbolAccessibilityResult.aliasesToMakeVisible; _i < _a.length; _i++) {
86266                             var ref = _a[_i];
86267                             ts.pushIfUnique(lateMarkedStatements, ref);
86268                         }
86269                     }
86270                 }
86271             }
86272             else {
86273                 var errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
86274                 if (errorInfo) {
86275                     if (errorInfo.typeName) {
86276                         context.addDiagnostic(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
86277                     }
86278                     else {
86279                         context.addDiagnostic(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
86280                     }
86281                     return true;
86282                 }
86283             }
86284             return false;
86285         }
86286         function trackExternalModuleSymbolOfImportTypeNode(symbol) {
86287             if (!isBundledEmit) {
86288                 (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
86289             }
86290         }
86291         function trackSymbol(symbol, enclosingDeclaration, meaning) {
86292             if (symbol.flags & 262144)
86293                 return false;
86294             var issuedDiagnostic = handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));
86295             recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
86296             return issuedDiagnostic;
86297         }
86298         function reportPrivateInBaseOfClassExpression(propertyName) {
86299             if (errorNameNode || errorFallbackNode) {
86300                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName));
86301             }
86302         }
86303         function errorDeclarationNameWithFallback() {
86304             return errorNameNode ? ts.declarationNameToString(errorNameNode) :
86305                 errorFallbackNode && ts.getNameOfDeclaration(errorFallbackNode) ? ts.declarationNameToString(ts.getNameOfDeclaration(errorFallbackNode)) :
86306                     errorFallbackNode && ts.isExportAssignment(errorFallbackNode) ? errorFallbackNode.isExportEquals ? "export=" : "default" :
86307                         "(Missing)";
86308         }
86309         function reportInaccessibleUniqueSymbolError() {
86310             if (errorNameNode || errorFallbackNode) {
86311                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol"));
86312             }
86313         }
86314         function reportCyclicStructureError() {
86315             if (errorNameNode || errorFallbackNode) {
86316                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback()));
86317             }
86318         }
86319         function reportInaccessibleThisError() {
86320             if (errorNameNode || errorFallbackNode) {
86321                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
86322             }
86323         }
86324         function reportLikelyUnsafeImportRequiredError(specifier) {
86325             if (errorNameNode || errorFallbackNode) {
86326                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier));
86327             }
86328         }
86329         function reportTruncationError() {
86330             if (errorNameNode || errorFallbackNode) {
86331                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed));
86332             }
86333         }
86334         function reportNonlocalAugmentation(containingFile, parentSymbol, symbol) {
86335             var _a;
86336             var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
86337             var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
86338             if (augmentingDeclarations) {
86339                 for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
86340                     var augmentations = augmentingDeclarations_1[_i];
86341                     context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)));
86342                 }
86343             }
86344         }
86345         function reportNonSerializableProperty(propertyName) {
86346             if (errorNameNode || errorFallbackNode) {
86347                 context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
86348             }
86349         }
86350         function transformDeclarationsForJS(sourceFile, bundled) {
86351             var oldDiag = getSymbolAccessibilityDiagnostic;
86352             getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
86353                 diagnosticMessage: s.errorModuleName
86354                     ? ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit
86355                     : ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
86356                 errorNode: s.errorNode || sourceFile
86357             })); };
86358             var result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker, bundled);
86359             getSymbolAccessibilityDiagnostic = oldDiag;
86360             return result;
86361         }
86362         function transformRoot(node) {
86363             if (node.kind === 303 && node.isDeclarationFile) {
86364                 return node;
86365             }
86366             if (node.kind === 304) {
86367                 isBundledEmit = true;
86368                 refs = new ts.Map();
86369                 libs = new ts.Map();
86370                 var hasNoDefaultLib_1 = false;
86371                 var bundle = factory.createBundle(ts.map(node.sourceFiles, function (sourceFile) {
86372                     if (sourceFile.isDeclarationFile)
86373                         return undefined;
86374                     hasNoDefaultLib_1 = hasNoDefaultLib_1 || sourceFile.hasNoDefaultLib;
86375                     currentSourceFile = sourceFile;
86376                     enclosingDeclaration = sourceFile;
86377                     lateMarkedStatements = undefined;
86378                     suppressNewDiagnosticContexts = false;
86379                     lateStatementReplacementMap = new ts.Map();
86380                     getSymbolAccessibilityDiagnostic = throwDiagnostic;
86381                     needsScopeFixMarker = false;
86382                     resultHasScopeMarker = false;
86383                     collectReferences(sourceFile, refs);
86384                     collectLibs(sourceFile, libs);
86385                     if (ts.isExternalOrCommonJsModule(sourceFile) || ts.isJsonSourceFile(sourceFile)) {
86386                         resultHasExternalModuleIndicator = false;
86387                         needsDeclare = false;
86388                         var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
86389                         var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([], [factory.createModifier(135)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], true, [], [], false, []);
86390                         return newFile;
86391                     }
86392                     needsDeclare = true;
86393                     var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
86394                     return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), true, [], [], false, []);
86395                 }), ts.mapDefined(node.prepends, function (prepend) {
86396                     if (prepend.kind === 306) {
86397                         var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
86398                         hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
86399                         collectReferences(sourceFile, refs);
86400                         recordTypeReferenceDirectivesIfNecessary(sourceFile.typeReferenceDirectives);
86401                         collectLibs(sourceFile, libs);
86402                         return sourceFile;
86403                     }
86404                     return prepend;
86405                 }));
86406                 bundle.syntheticFileReferences = [];
86407                 bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
86408                 bundle.syntheticLibReferences = getLibReferences();
86409                 bundle.hasNoDefaultLib = hasNoDefaultLib_1;
86410                 var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, true).declarationFilePath));
86411                 var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1);
86412                 refs.forEach(referenceVisitor_1);
86413                 return bundle;
86414             }
86415             needsDeclare = true;
86416             needsScopeFixMarker = false;
86417             resultHasScopeMarker = false;
86418             enclosingDeclaration = node;
86419             currentSourceFile = node;
86420             getSymbolAccessibilityDiagnostic = throwDiagnostic;
86421             isBundledEmit = false;
86422             resultHasExternalModuleIndicator = false;
86423             suppressNewDiagnosticContexts = false;
86424             lateMarkedStatements = undefined;
86425             lateStatementReplacementMap = new ts.Map();
86426             necessaryTypeReferences = undefined;
86427             refs = collectReferences(currentSourceFile, new ts.Map());
86428             libs = collectLibs(currentSourceFile, new ts.Map());
86429             var references = [];
86430             var outputFilePath = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, true).declarationFilePath));
86431             var referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
86432             var combinedStatements;
86433             if (ts.isSourceFileJS(currentSourceFile)) {
86434                 combinedStatements = factory.createNodeArray(transformDeclarationsForJS(node));
86435                 refs.forEach(referenceVisitor);
86436                 emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
86437             }
86438             else {
86439                 var statements = ts.visitNodes(node.statements, visitDeclarationStatements);
86440                 combinedStatements = ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
86441                 refs.forEach(referenceVisitor);
86442                 emittedImports = ts.filter(combinedStatements, ts.isAnyImportSyntax);
86443                 if (ts.isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
86444                     combinedStatements = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], combinedStatements, true), [ts.createEmptyExports(factory)], false)), combinedStatements);
86445                 }
86446             }
86447             var updated = factory.updateSourceFile(node, combinedStatements, true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib, getLibReferences());
86448             updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit;
86449             return updated;
86450             function getLibReferences() {
86451                 return ts.map(ts.arrayFrom(libs.keys()), function (lib) { return ({ fileName: lib, pos: -1, end: -1 }); });
86452             }
86453             function getFileReferencesForUsedTypeReferences() {
86454                 return necessaryTypeReferences ? ts.mapDefined(ts.arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForTypeName) : [];
86455             }
86456             function getFileReferenceForTypeName(typeName) {
86457                 if (emittedImports) {
86458                     for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) {
86459                         var importStatement = emittedImports_1[_i];
86460                         if (ts.isImportEqualsDeclaration(importStatement) && ts.isExternalModuleReference(importStatement.moduleReference)) {
86461                             var expr = importStatement.moduleReference.expression;
86462                             if (ts.isStringLiteralLike(expr) && expr.text === typeName) {
86463                                 return undefined;
86464                             }
86465                         }
86466                         else if (ts.isImportDeclaration(importStatement) && ts.isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
86467                             return undefined;
86468                         }
86469                     }
86470                 }
86471                 return { fileName: typeName, pos: -1, end: -1 };
86472             }
86473             function mapReferencesIntoArray(references, outputFilePath) {
86474                 return function (file) {
86475                     var declFileName;
86476                     if (file.isDeclarationFile) {
86477                         declFileName = file.fileName;
86478                     }
86479                     else {
86480                         if (isBundledEmit && ts.contains(node.sourceFiles, file))
86481                             return;
86482                         var paths = ts.getOutputPathsFor(file, host, true);
86483                         declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
86484                     }
86485                     if (declFileName) {
86486                         var specifier = ts.moduleSpecifiers.getModuleSpecifier(options, currentSourceFile, ts.toPath(outputFilePath, host.getCurrentDirectory(), host.getCanonicalFileName), ts.toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName), host);
86487                         if (!ts.pathIsRelative(specifier)) {
86488                             recordTypeReferenceDirectivesIfNecessary([specifier]);
86489                             return;
86490                         }
86491                         var fileName = ts.getRelativePathToDirectoryOrUrl(outputFilePath, declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false);
86492                         if (ts.startsWith(fileName, "./") && ts.hasExtension(fileName)) {
86493                             fileName = fileName.substring(2);
86494                         }
86495                         if (ts.startsWith(fileName, "node_modules/") || ts.pathContainsNodeModules(fileName)) {
86496                             return;
86497                         }
86498                         references.push({ pos: -1, end: -1, fileName: fileName });
86499                     }
86500                 };
86501             }
86502         }
86503         function collectReferences(sourceFile, ret) {
86504             if (noResolve || (!ts.isUnparsedSource(sourceFile) && ts.isSourceFileJS(sourceFile)))
86505                 return ret;
86506             ts.forEach(sourceFile.referencedFiles, function (f) {
86507                 var elem = host.getSourceFileFromReference(sourceFile, f);
86508                 if (elem) {
86509                     ret.set(ts.getOriginalNodeId(elem), elem);
86510                 }
86511             });
86512             return ret;
86513         }
86514         function collectLibs(sourceFile, ret) {
86515             ts.forEach(sourceFile.libReferenceDirectives, function (ref) {
86516                 var lib = host.getLibFileFromReference(ref);
86517                 if (lib) {
86518                     ret.set(ts.toFileNameLowerCase(ref.fileName), true);
86519                 }
86520             });
86521             return ret;
86522         }
86523         function filterBindingPatternInitializers(name) {
86524             if (name.kind === 79) {
86525                 return name;
86526             }
86527             else {
86528                 if (name.kind === 201) {
86529                     return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
86530                 }
86531                 else {
86532                     return factory.updateObjectBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
86533                 }
86534             }
86535             function visitBindingElement(elem) {
86536                 if (elem.kind === 226) {
86537                     return elem;
86538                 }
86539                 return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
86540             }
86541         }
86542         function ensureParameter(p, modifierMask, type) {
86543             var oldDiag;
86544             if (!suppressNewDiagnosticContexts) {
86545                 oldDiag = getSymbolAccessibilityDiagnostic;
86546                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
86547             }
86548             var newParam = factory.updateParameterDeclaration(p, undefined, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57)) : undefined, ensureType(p, type || p.type, true), ensureNoInitializer(p));
86549             if (!suppressNewDiagnosticContexts) {
86550                 getSymbolAccessibilityDiagnostic = oldDiag;
86551             }
86552             return newParam;
86553         }
86554         function shouldPrintWithInitializer(node) {
86555             return canHaveLiteralInitializer(node) && resolver.isLiteralConstDeclaration(ts.getParseTreeNode(node));
86556         }
86557         function ensureNoInitializer(node) {
86558             if (shouldPrintWithInitializer(node)) {
86559                 return resolver.createLiteralConstValue(ts.getParseTreeNode(node), symbolTracker);
86560             }
86561             return undefined;
86562         }
86563         function ensureType(node, type, ignorePrivate) {
86564             if (!ignorePrivate && ts.hasEffectiveModifier(node, 8)) {
86565                 return;
86566             }
86567             if (shouldPrintWithInitializer(node)) {
86568                 return;
86569             }
86570             var shouldUseResolverType = node.kind === 163 &&
86571                 (resolver.isRequiredInitializedParameter(node) ||
86572                     resolver.isOptionalUninitializedParameterProperty(node));
86573             if (type && !shouldUseResolverType) {
86574                 return ts.visitNode(type, visitDeclarationSubtree);
86575             }
86576             if (!ts.getParseTreeNode(node)) {
86577                 return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130);
86578             }
86579             if (node.kind === 172) {
86580                 return factory.createKeywordTypeNode(130);
86581             }
86582             errorNameNode = node.name;
86583             var oldDiag;
86584             if (!suppressNewDiagnosticContexts) {
86585                 oldDiag = getSymbolAccessibilityDiagnostic;
86586                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
86587             }
86588             if (node.kind === 253 || node.kind === 202) {
86589                 return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
86590             }
86591             if (node.kind === 163
86592                 || node.kind === 166
86593                 || node.kind === 165) {
86594                 if (!node.initializer)
86595                     return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
86596                 return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
86597             }
86598             return cleanup(resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
86599             function cleanup(returnValue) {
86600                 errorNameNode = undefined;
86601                 if (!suppressNewDiagnosticContexts) {
86602                     getSymbolAccessibilityDiagnostic = oldDiag;
86603                 }
86604                 return returnValue || factory.createKeywordTypeNode(130);
86605             }
86606         }
86607         function isDeclarationAndNotVisible(node) {
86608             node = ts.getParseTreeNode(node);
86609             switch (node.kind) {
86610                 case 255:
86611                 case 260:
86612                 case 257:
86613                 case 256:
86614                 case 258:
86615                 case 259:
86616                     return !resolver.isDeclarationVisible(node);
86617                 case 253:
86618                     return !getBindingNameVisible(node);
86619                 case 264:
86620                 case 265:
86621                 case 271:
86622                 case 270:
86623                     return false;
86624                 case 169:
86625                     return true;
86626             }
86627             return false;
86628         }
86629         function shouldEmitFunctionProperties(input) {
86630             var _a;
86631             if (input.body) {
86632                 return true;
86633             }
86634             var overloadSignatures = (_a = input.symbol.declarations) === null || _a === void 0 ? void 0 : _a.filter(function (decl) { return ts.isFunctionDeclaration(decl) && !decl.body; });
86635             return !overloadSignatures || overloadSignatures.indexOf(input) === overloadSignatures.length - 1;
86636         }
86637         function getBindingNameVisible(elem) {
86638             if (ts.isOmittedExpression(elem)) {
86639                 return false;
86640             }
86641             if (ts.isBindingPattern(elem.name)) {
86642                 return ts.some(elem.name.elements, getBindingNameVisible);
86643             }
86644             else {
86645                 return resolver.isDeclarationVisible(elem);
86646             }
86647         }
86648         function updateParamsList(node, params, modifierMask) {
86649             if (ts.hasEffectiveModifier(node, 8)) {
86650                 return undefined;
86651             }
86652             var newParams = ts.map(params, function (p) { return ensureParameter(p, modifierMask); });
86653             if (!newParams) {
86654                 return undefined;
86655             }
86656             return factory.createNodeArray(newParams, params.hasTrailingComma);
86657         }
86658         function updateAccessorParamsList(input, isPrivate) {
86659             var newParams;
86660             if (!isPrivate) {
86661                 var thisParameter = ts.getThisParameter(input);
86662                 if (thisParameter) {
86663                     newParams = [ensureParameter(thisParameter)];
86664                 }
86665             }
86666             if (ts.isSetAccessorDeclaration(input)) {
86667                 var newValueParameter = void 0;
86668                 if (!isPrivate) {
86669                     var valueParameter = ts.getSetAccessorValueParameter(input);
86670                     if (valueParameter) {
86671                         var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
86672                         newValueParameter = ensureParameter(valueParameter, undefined, accessorType);
86673                     }
86674                 }
86675                 if (!newValueParameter) {
86676                     newValueParameter = factory.createParameterDeclaration(undefined, undefined, undefined, "value");
86677                 }
86678                 newParams = ts.append(newParams, newValueParameter);
86679             }
86680             return factory.createNodeArray(newParams || ts.emptyArray);
86681         }
86682         function ensureTypeParams(node, params) {
86683             return ts.hasEffectiveModifier(node, 8) ? undefined : ts.visitNodes(params, visitDeclarationSubtree);
86684         }
86685         function isEnclosingDeclaration(node) {
86686             return ts.isSourceFile(node)
86687                 || ts.isTypeAliasDeclaration(node)
86688                 || ts.isModuleDeclaration(node)
86689                 || ts.isClassDeclaration(node)
86690                 || ts.isInterfaceDeclaration(node)
86691                 || ts.isFunctionLike(node)
86692                 || ts.isIndexSignatureDeclaration(node)
86693                 || ts.isMappedTypeNode(node);
86694         }
86695         function checkEntityNameVisibility(entityName, enclosingDeclaration) {
86696             var visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration);
86697             handleSymbolAccessibilityError(visibilityResult);
86698             recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
86699         }
86700         function preserveJsDoc(updated, original) {
86701             if (ts.hasJSDocNodes(updated) && ts.hasJSDocNodes(original)) {
86702                 updated.jsDoc = original.jsDoc;
86703             }
86704             return ts.setCommentRange(updated, ts.getCommentRange(original));
86705         }
86706         function rewriteModuleSpecifier(parent, input) {
86707             if (!input)
86708                 return undefined;
86709             resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 260 && parent.kind !== 199);
86710             if (ts.isStringLiteralLike(input)) {
86711                 if (isBundledEmit) {
86712                     var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
86713                     if (newName) {
86714                         return factory.createStringLiteral(newName);
86715                     }
86716                 }
86717                 else {
86718                     var symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
86719                     if (symbol) {
86720                         (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
86721                     }
86722                 }
86723             }
86724             return input;
86725         }
86726         function transformImportEqualsDeclaration(decl) {
86727             if (!resolver.isDeclarationVisible(decl))
86728                 return;
86729             if (decl.moduleReference.kind === 276) {
86730                 var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
86731                 return factory.updateImportEqualsDeclaration(decl, undefined, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier)));
86732             }
86733             else {
86734                 var oldDiag = getSymbolAccessibilityDiagnostic;
86735                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(decl);
86736                 checkEntityNameVisibility(decl.moduleReference, enclosingDeclaration);
86737                 getSymbolAccessibilityDiagnostic = oldDiag;
86738                 return decl;
86739             }
86740         }
86741         function transformImportDeclaration(decl) {
86742             if (!decl.importClause) {
86743                 return factory.updateImportDeclaration(decl, undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), undefined);
86744             }
86745             var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
86746             if (!decl.importClause.namedBindings) {
86747                 return visibleDefaultBinding && factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), undefined);
86748             }
86749             if (decl.importClause.namedBindings.kind === 267) {
86750                 var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined;
86751                 return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), undefined) : undefined;
86752             }
86753             var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
86754             if ((bindingList && bindingList.length) || visibleDefaultBinding) {
86755                 return factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), undefined);
86756             }
86757             if (resolver.isImportRequiredByAugmentation(decl)) {
86758                 return factory.updateImportDeclaration(decl, undefined, decl.modifiers, undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), undefined);
86759             }
86760         }
86761         function transformAndReplaceLatePaintedStatements(statements) {
86762             while (ts.length(lateMarkedStatements)) {
86763                 var i = lateMarkedStatements.shift();
86764                 if (!ts.isLateVisibilityPaintedStatement(i)) {
86765                     return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: ".concat(ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
86766                 }
86767                 var priorNeedsDeclare = needsDeclare;
86768                 needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
86769                 var result = transformTopLevelDeclaration(i);
86770                 needsDeclare = priorNeedsDeclare;
86771                 lateStatementReplacementMap.set(ts.getOriginalNodeId(i), result);
86772             }
86773             return ts.visitNodes(statements, visitLateVisibilityMarkedStatements);
86774             function visitLateVisibilityMarkedStatements(statement) {
86775                 if (ts.isLateVisibilityPaintedStatement(statement)) {
86776                     var key = ts.getOriginalNodeId(statement);
86777                     if (lateStatementReplacementMap.has(key)) {
86778                         var result = lateStatementReplacementMap.get(key);
86779                         lateStatementReplacementMap.delete(key);
86780                         if (result) {
86781                             if (ts.isArray(result) ? ts.some(result, ts.needsScopeMarker) : ts.needsScopeMarker(result)) {
86782                                 needsScopeFixMarker = true;
86783                             }
86784                             if (ts.isSourceFile(statement.parent) && (ts.isArray(result) ? ts.some(result, ts.isExternalModuleIndicator) : ts.isExternalModuleIndicator(result))) {
86785                                 resultHasExternalModuleIndicator = true;
86786                             }
86787                         }
86788                         return result;
86789                     }
86790                 }
86791                 return statement;
86792             }
86793         }
86794         function visitDeclarationSubtree(input) {
86795             if (shouldStripInternal(input))
86796                 return;
86797             if (ts.isDeclaration(input)) {
86798                 if (isDeclarationAndNotVisible(input))
86799                     return;
86800                 if (ts.hasDynamicName(input) && !resolver.isLateBound(ts.getParseTreeNode(input))) {
86801                     return;
86802                 }
86803             }
86804             if (ts.isFunctionLike(input) && resolver.isImplementationOfOverload(input))
86805                 return;
86806             if (ts.isSemicolonClassElement(input))
86807                 return;
86808             var previousEnclosingDeclaration;
86809             if (isEnclosingDeclaration(input)) {
86810                 previousEnclosingDeclaration = enclosingDeclaration;
86811                 enclosingDeclaration = input;
86812             }
86813             var oldDiag = getSymbolAccessibilityDiagnostic;
86814             var canProduceDiagnostic = ts.canProduceDiagnostics(input);
86815             var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
86816             var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 181 || input.kind === 194) && input.parent.kind !== 258);
86817             if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
86818                 if (ts.hasEffectiveModifier(input, 8)) {
86819                     if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input)
86820                         return;
86821                     return cleanup(factory.createPropertyDeclaration(undefined, ensureModifiers(input), input.name, undefined, undefined, undefined));
86822                 }
86823             }
86824             if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
86825                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
86826             }
86827             if (ts.isTypeQueryNode(input)) {
86828                 checkEntityNameVisibility(input.exprName, enclosingDeclaration);
86829             }
86830             if (shouldEnterSuppressNewDiagnosticsContextContext) {
86831                 suppressNewDiagnosticContexts = true;
86832             }
86833             if (isProcessedComponent(input)) {
86834                 switch (input.kind) {
86835                     case 227: {
86836                         if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
86837                             checkEntityNameVisibility(input.expression, enclosingDeclaration);
86838                         }
86839                         var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
86840                         return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments));
86841                     }
86842                     case 177: {
86843                         checkEntityNameVisibility(input.typeName, enclosingDeclaration);
86844                         var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
86845                         return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments));
86846                     }
86847                     case 174:
86848                         return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
86849                     case 170: {
86850                         var ctor = factory.createConstructorDeclaration(undefined, ensureModifiers(input), updateParamsList(input, input.parameters, 0), undefined);
86851                         return cleanup(ctor);
86852                     }
86853                     case 168: {
86854                         if (ts.isPrivateIdentifier(input.name)) {
86855                             return cleanup(undefined);
86856                         }
86857                         var sig = factory.createMethodDeclaration(undefined, ensureModifiers(input), undefined, input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined);
86858                         return cleanup(sig);
86859                     }
86860                     case 171: {
86861                         if (ts.isPrivateIdentifier(input.name)) {
86862                             return cleanup(undefined);
86863                         }
86864                         var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
86865                         return cleanup(factory.updateGetAccessorDeclaration(input, undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), ensureType(input, accessorType), undefined));
86866                     }
86867                     case 172: {
86868                         if (ts.isPrivateIdentifier(input.name)) {
86869                             return cleanup(undefined);
86870                         }
86871                         return cleanup(factory.updateSetAccessorDeclaration(input, undefined, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), undefined));
86872                     }
86873                     case 166:
86874                         if (ts.isPrivateIdentifier(input.name)) {
86875                             return cleanup(undefined);
86876                         }
86877                         return cleanup(factory.updatePropertyDeclaration(input, undefined, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input)));
86878                     case 165:
86879                         if (ts.isPrivateIdentifier(input.name)) {
86880                             return cleanup(undefined);
86881                         }
86882                         return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type)));
86883                     case 167: {
86884                         if (ts.isPrivateIdentifier(input.name)) {
86885                             return cleanup(undefined);
86886                         }
86887                         return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
86888                     }
86889                     case 173: {
86890                         return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
86891                     }
86892                     case 175: {
86893                         return cleanup(factory.updateIndexSignature(input, undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130)));
86894                     }
86895                     case 253: {
86896                         if (ts.isBindingPattern(input.name)) {
86897                             return recreateBindingPattern(input.name);
86898                         }
86899                         shouldEnterSuppressNewDiagnosticsContextContext = true;
86900                         suppressNewDiagnosticContexts = true;
86901                         return cleanup(factory.updateVariableDeclaration(input, input.name, undefined, ensureType(input, input.type), ensureNoInitializer(input)));
86902                     }
86903                     case 162: {
86904                         if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
86905                             return cleanup(factory.updateTypeParameterDeclaration(input, input.name, undefined, undefined));
86906                         }
86907                         return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
86908                     }
86909                     case 188: {
86910                         var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
86911                         var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree);
86912                         var oldEnclosingDecl = enclosingDeclaration;
86913                         enclosingDeclaration = input.trueType;
86914                         var trueType = ts.visitNode(input.trueType, visitDeclarationSubtree);
86915                         enclosingDeclaration = oldEnclosingDecl;
86916                         var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
86917                         return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
86918                     }
86919                     case 178: {
86920                         return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
86921                     }
86922                     case 179: {
86923                         return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
86924                     }
86925                     case 199: {
86926                         if (!ts.isLiteralImportTypeNode(input))
86927                             return cleanup(input);
86928                         return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
86929                     }
86930                     default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: ".concat(ts.SyntaxKind[input.kind]));
86931                 }
86932             }
86933             if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
86934                 ts.setEmitFlags(input, 1);
86935             }
86936             return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
86937             function cleanup(returnValue) {
86938                 if (returnValue && canProduceDiagnostic && ts.hasDynamicName(input)) {
86939                     checkName(input);
86940                 }
86941                 if (isEnclosingDeclaration(input)) {
86942                     enclosingDeclaration = previousEnclosingDeclaration;
86943                 }
86944                 if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
86945                     getSymbolAccessibilityDiagnostic = oldDiag;
86946                 }
86947                 if (shouldEnterSuppressNewDiagnosticsContextContext) {
86948                     suppressNewDiagnosticContexts = oldWithinObjectLiteralType;
86949                 }
86950                 if (returnValue === input) {
86951                     return returnValue;
86952                 }
86953                 return returnValue && ts.setOriginalNode(preserveJsDoc(returnValue, input), input);
86954             }
86955         }
86956         function isPrivateMethodTypeParameter(node) {
86957             return node.parent.kind === 168 && ts.hasEffectiveModifier(node.parent, 8);
86958         }
86959         function visitDeclarationStatements(input) {
86960             if (!isPreservedDeclarationStatement(input)) {
86961                 return;
86962             }
86963             if (shouldStripInternal(input))
86964                 return;
86965             switch (input.kind) {
86966                 case 271: {
86967                     if (ts.isSourceFile(input.parent)) {
86968                         resultHasExternalModuleIndicator = true;
86969                     }
86970                     resultHasScopeMarker = true;
86971                     return factory.updateExportDeclaration(input, undefined, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), undefined);
86972                 }
86973                 case 270: {
86974                     if (ts.isSourceFile(input.parent)) {
86975                         resultHasExternalModuleIndicator = true;
86976                     }
86977                     resultHasScopeMarker = true;
86978                     if (input.expression.kind === 79) {
86979                         return input;
86980                     }
86981                     else {
86982                         var newId = factory.createUniqueName("_default", 16);
86983                         getSymbolAccessibilityDiagnostic = function () { return ({
86984                             diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
86985                             errorNode: input
86986                         }); };
86987                         errorFallbackNode = input;
86988                         var varDecl = factory.createVariableDeclaration(newId, undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined);
86989                         errorFallbackNode = undefined;
86990                         var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2));
86991                         return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
86992                     }
86993                 }
86994             }
86995             var result = transformTopLevelDeclaration(input);
86996             lateStatementReplacementMap.set(ts.getOriginalNodeId(input), result);
86997             return input;
86998         }
86999         function stripExportModifiers(statement) {
87000             if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512) || !ts.canHaveModifiers(statement)) {
87001                 return statement;
87002             }
87003             var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (27647 ^ 1));
87004             return factory.updateModifiers(statement, modifiers);
87005         }
87006         function transformTopLevelDeclaration(input) {
87007             if (shouldStripInternal(input))
87008                 return;
87009             switch (input.kind) {
87010                 case 264: {
87011                     return transformImportEqualsDeclaration(input);
87012                 }
87013                 case 265: {
87014                     return transformImportDeclaration(input);
87015                 }
87016             }
87017             if (ts.isDeclaration(input) && isDeclarationAndNotVisible(input))
87018                 return;
87019             if (ts.isFunctionLike(input) && resolver.isImplementationOfOverload(input))
87020                 return;
87021             var previousEnclosingDeclaration;
87022             if (isEnclosingDeclaration(input)) {
87023                 previousEnclosingDeclaration = enclosingDeclaration;
87024                 enclosingDeclaration = input;
87025             }
87026             var canProdiceDiagnostic = ts.canProduceDiagnostics(input);
87027             var oldDiag = getSymbolAccessibilityDiagnostic;
87028             if (canProdiceDiagnostic) {
87029                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
87030             }
87031             var previousNeedsDeclare = needsDeclare;
87032             switch (input.kind) {
87033                 case 258:
87034                     return cleanup(factory.updateTypeAliasDeclaration(input, undefined, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
87035                 case 257: {
87036                     return cleanup(factory.updateInterfaceDeclaration(input, undefined, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
87037                 }
87038                 case 255: {
87039                     var clean = cleanup(factory.updateFunctionDeclaration(input, undefined, ensureModifiers(input), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined));
87040                     if (clean && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) {
87041                         var props = resolver.getPropertiesOfContainerFunction(input);
87042                         var fakespace_1 = ts.parseNodeFactory.createModuleDeclaration(undefined, undefined, clean.name || factory.createIdentifier("_default"), factory.createModuleBlock([]), 16);
87043                         ts.setParent(fakespace_1, enclosingDeclaration);
87044                         fakespace_1.locals = ts.createSymbolTable(props);
87045                         fakespace_1.symbol = props[0].parent;
87046                         var exportMappings_1 = [];
87047                         var declarations = ts.mapDefined(props, function (p) {
87048                             if (!p.valueDeclaration || !ts.isPropertyAccessExpression(p.valueDeclaration)) {
87049                                 return undefined;
87050                             }
87051                             getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
87052                             var type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace_1, declarationEmitNodeBuilderFlags, symbolTracker);
87053                             getSymbolAccessibilityDiagnostic = oldDiag;
87054                             var nameStr = ts.unescapeLeadingUnderscores(p.escapedName);
87055                             var isNonContextualKeywordName = ts.isStringANonContextualKeyword(nameStr);
87056                             var name = isNonContextualKeywordName ? factory.getGeneratedNameForNode(p.valueDeclaration) : factory.createIdentifier(nameStr);
87057                             if (isNonContextualKeywordName) {
87058                                 exportMappings_1.push([name, nameStr]);
87059                             }
87060                             var varDecl = factory.createVariableDeclaration(name, undefined, type, undefined);
87061                             return factory.createVariableStatement(isNonContextualKeywordName ? undefined : [factory.createToken(93)], factory.createVariableDeclarationList([varDecl]));
87062                         });
87063                         if (!exportMappings_1.length) {
87064                             declarations = ts.mapDefined(declarations, function (declaration) { return factory.updateModifiers(declaration, 0); });
87065                         }
87066                         else {
87067                             declarations.push(factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports(ts.map(exportMappings_1, function (_a) {
87068                                 var gen = _a[0], exp = _a[1];
87069                                 return factory.createExportSpecifier(false, gen, exp);
87070                             }))));
87071                         }
87072                         var namespaceDecl = factory.createModuleDeclaration(undefined, ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16);
87073                         if (!ts.hasEffectiveModifier(clean, 512)) {
87074                             return [clean, namespaceDecl];
87075                         }
87076                         var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513) | 2);
87077                         var cleanDeclaration = factory.updateFunctionDeclaration(clean, undefined, modifiers, undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, undefined);
87078                         var namespaceDeclaration = factory.updateModuleDeclaration(namespaceDecl, undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
87079                         var exportDefaultDeclaration = factory.createExportAssignment(undefined, undefined, false, namespaceDecl.name);
87080                         if (ts.isSourceFile(input.parent)) {
87081                             resultHasExternalModuleIndicator = true;
87082                         }
87083                         resultHasScopeMarker = true;
87084                         return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
87085                     }
87086                     else {
87087                         return clean;
87088                     }
87089                 }
87090                 case 260: {
87091                     needsDeclare = false;
87092                     var inner = input.body;
87093                     if (inner && inner.kind === 261) {
87094                         var oldNeedsScopeFix = needsScopeFixMarker;
87095                         var oldHasScopeFix = resultHasScopeMarker;
87096                         resultHasScopeMarker = false;
87097                         needsScopeFixMarker = false;
87098                         var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
87099                         var lateStatements = transformAndReplaceLatePaintedStatements(statements);
87100                         if (input.flags & 8388608) {
87101                             needsScopeFixMarker = false;
87102                         }
87103                         if (!ts.isGlobalScopeAugmentation(input) && !hasScopeMarker(lateStatements) && !resultHasScopeMarker) {
87104                             if (needsScopeFixMarker) {
87105                                 lateStatements = factory.createNodeArray(__spreadArray(__spreadArray([], lateStatements, true), [ts.createEmptyExports(factory)], false));
87106                             }
87107                             else {
87108                                 lateStatements = ts.visitNodes(lateStatements, stripExportModifiers);
87109                             }
87110                         }
87111                         var body = factory.updateModuleBlock(inner, lateStatements);
87112                         needsDeclare = previousNeedsDeclare;
87113                         needsScopeFixMarker = oldNeedsScopeFix;
87114                         resultHasScopeMarker = oldHasScopeFix;
87115                         var mods = ensureModifiers(input);
87116                         return cleanup(factory.updateModuleDeclaration(input, undefined, mods, ts.isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name, body));
87117                     }
87118                     else {
87119                         needsDeclare = previousNeedsDeclare;
87120                         var mods = ensureModifiers(input);
87121                         needsDeclare = false;
87122                         ts.visitNode(inner, visitDeclarationStatements);
87123                         var id = ts.getOriginalNodeId(inner);
87124                         var body = lateStatementReplacementMap.get(id);
87125                         lateStatementReplacementMap.delete(id);
87126                         return cleanup(factory.updateModuleDeclaration(input, undefined, mods, input.name, body));
87127                     }
87128                 }
87129                 case 256: {
87130                     errorNameNode = input.name;
87131                     errorFallbackNode = input;
87132                     var modifiers = factory.createNodeArray(ensureModifiers(input));
87133                     var typeParameters = ensureTypeParams(input, input.typeParameters);
87134                     var ctor = ts.getFirstConstructorWithBody(input);
87135                     var parameterProperties = void 0;
87136                     if (ctor) {
87137                         var oldDiag_1 = getSymbolAccessibilityDiagnostic;
87138                         parameterProperties = ts.compact(ts.flatMap(ctor.parameters, function (param) {
87139                             if (!ts.hasSyntacticModifier(param, 16476) || shouldStripInternal(param))
87140                                 return;
87141                             getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
87142                             if (param.name.kind === 79) {
87143                                 return preserveJsDoc(factory.createPropertyDeclaration(undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
87144                             }
87145                             else {
87146                                 return walkBindingPattern(param.name);
87147                             }
87148                             function walkBindingPattern(pattern) {
87149                                 var elems;
87150                                 for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
87151                                     var elem = _a[_i];
87152                                     if (ts.isOmittedExpression(elem))
87153                                         continue;
87154                                     if (ts.isBindingPattern(elem.name)) {
87155                                         elems = ts.concatenate(elems, walkBindingPattern(elem.name));
87156                                     }
87157                                     elems = elems || [];
87158                                     elems.push(factory.createPropertyDeclaration(undefined, ensureModifiers(param), elem.name, undefined, ensureType(elem, undefined), undefined));
87159                                 }
87160                                 return elems;
87161                             }
87162                         }));
87163                         getSymbolAccessibilityDiagnostic = oldDiag_1;
87164                     }
87165                     var hasPrivateIdentifier = ts.some(input.members, function (member) { return !!member.name && ts.isPrivateIdentifier(member.name); });
87166                     var privateIdentifier = hasPrivateIdentifier ? [
87167                         factory.createPropertyDeclaration(undefined, undefined, factory.createPrivateIdentifier("#private"), undefined, undefined, undefined)
87168                     ] : undefined;
87169                     var memberNodes = ts.concatenate(ts.concatenate(privateIdentifier, parameterProperties), ts.visitNodes(input.members, visitDeclarationSubtree));
87170                     var members = factory.createNodeArray(memberNodes);
87171                     var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
87172                     if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 104) {
87173                         var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
87174                         var newId_1 = factory.createUniqueName("".concat(oldId, "_base"), 16);
87175                         getSymbolAccessibilityDiagnostic = function () { return ({
87176                             diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1,
87177                             errorNode: extendsClause_1,
87178                             typeName: input.name
87179                         }); };
87180                         var varDecl = factory.createVariableDeclaration(newId_1, undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined);
87181                         var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2));
87182                         var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) {
87183                             if (clause.token === 94) {
87184                                 var oldDiag_2 = getSymbolAccessibilityDiagnostic;
87185                                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
87186                                 var newClause = factory.updateHeritageClause(clause, ts.map(clause.types, function (t) { return factory.updateExpressionWithTypeArguments(t, newId_1, ts.visitNodes(t.typeArguments, visitDeclarationSubtree)); }));
87187                                 getSymbolAccessibilityDiagnostic = oldDiag_2;
87188                                 return newClause;
87189                             }
87190                             return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 104; })), visitDeclarationSubtree));
87191                         }));
87192                         return [statement, cleanup(factory.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members))];
87193                     }
87194                     else {
87195                         var heritageClauses = transformHeritageClauses(input.heritageClauses);
87196                         return cleanup(factory.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members));
87197                     }
87198                 }
87199                 case 236: {
87200                     return cleanup(transformVariableStatement(input));
87201                 }
87202                 case 259: {
87203                     return cleanup(factory.updateEnumDeclaration(input, undefined, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) {
87204                         if (shouldStripInternal(m))
87205                             return;
87206                         var constValue = resolver.getConstantValue(m);
87207                         return preserveJsDoc(factory.updateEnumMember(m, m.name, constValue !== undefined ? typeof constValue === "string" ? factory.createStringLiteral(constValue) : factory.createNumericLiteral(constValue) : undefined), m);
87208                     }))));
87209                 }
87210             }
87211             return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: ".concat(ts.SyntaxKind[input.kind]));
87212             function cleanup(node) {
87213                 if (isEnclosingDeclaration(input)) {
87214                     enclosingDeclaration = previousEnclosingDeclaration;
87215                 }
87216                 if (canProdiceDiagnostic) {
87217                     getSymbolAccessibilityDiagnostic = oldDiag;
87218                 }
87219                 if (input.kind === 260) {
87220                     needsDeclare = previousNeedsDeclare;
87221                 }
87222                 if (node === input) {
87223                     return node;
87224                 }
87225                 errorFallbackNode = undefined;
87226                 errorNameNode = undefined;
87227                 return node && ts.setOriginalNode(preserveJsDoc(node, input), input);
87228             }
87229         }
87230         function transformVariableStatement(input) {
87231             if (!ts.forEach(input.declarationList.declarations, getBindingNameVisible))
87232                 return;
87233             var nodes = ts.visitNodes(input.declarationList.declarations, visitDeclarationSubtree);
87234             if (!ts.length(nodes))
87235                 return;
87236             return factory.updateVariableStatement(input, factory.createNodeArray(ensureModifiers(input)), factory.updateVariableDeclarationList(input.declarationList, nodes));
87237         }
87238         function recreateBindingPattern(d) {
87239             return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
87240         }
87241         function recreateBindingElement(e) {
87242             if (e.kind === 226) {
87243                 return;
87244             }
87245             if (e.name) {
87246                 if (!getBindingNameVisible(e))
87247                     return;
87248                 if (ts.isBindingPattern(e.name)) {
87249                     return recreateBindingPattern(e.name);
87250                 }
87251                 else {
87252                     return factory.createVariableDeclaration(e.name, undefined, ensureType(e, undefined), undefined);
87253                 }
87254             }
87255         }
87256         function checkName(node) {
87257             var oldDiag;
87258             if (!suppressNewDiagnosticContexts) {
87259                 oldDiag = getSymbolAccessibilityDiagnostic;
87260                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNodeName(node);
87261             }
87262             errorNameNode = node.name;
87263             ts.Debug.assert(resolver.isLateBound(ts.getParseTreeNode(node)));
87264             var decl = node;
87265             var entityName = decl.name.expression;
87266             checkEntityNameVisibility(entityName, enclosingDeclaration);
87267             if (!suppressNewDiagnosticContexts) {
87268                 getSymbolAccessibilityDiagnostic = oldDiag;
87269             }
87270             errorNameNode = undefined;
87271         }
87272         function shouldStripInternal(node) {
87273             return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile);
87274         }
87275         function isScopeMarker(node) {
87276             return ts.isExportAssignment(node) || ts.isExportDeclaration(node);
87277         }
87278         function hasScopeMarker(statements) {
87279             return ts.some(statements, isScopeMarker);
87280         }
87281         function ensureModifiers(node) {
87282             var currentFlags = ts.getEffectiveModifierFlags(node);
87283             var newFlags = ensureModifierFlags(node);
87284             if (currentFlags === newFlags) {
87285                 return node.modifiers;
87286             }
87287             return factory.createModifiersFromModifierFlags(newFlags);
87288         }
87289         function ensureModifierFlags(node) {
87290             var mask = 27647 ^ (4 | 256 | 16384);
87291             var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0;
87292             var parentIsFile = node.parent.kind === 303;
87293             if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
87294                 mask ^= 2;
87295                 additions = 0;
87296             }
87297             return maskModifierFlags(node, mask, additions);
87298         }
87299         function getTypeAnnotationFromAllAccessorDeclarations(node, accessors) {
87300             var accessorType = getTypeAnnotationFromAccessor(node);
87301             if (!accessorType && node !== accessors.firstAccessor) {
87302                 accessorType = getTypeAnnotationFromAccessor(accessors.firstAccessor);
87303                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.firstAccessor);
87304             }
87305             if (!accessorType && accessors.secondAccessor && node !== accessors.secondAccessor) {
87306                 accessorType = getTypeAnnotationFromAccessor(accessors.secondAccessor);
87307                 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(accessors.secondAccessor);
87308             }
87309             return accessorType;
87310         }
87311         function transformHeritageClauses(nodes) {
87312             return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) {
87313                 return ts.isEntityNameExpression(t.expression) || (clause.token === 94 && t.expression.kind === 104);
87314             })), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
87315         }
87316     }
87317     ts.transformDeclarations = transformDeclarations;
87318     function isAlwaysType(node) {
87319         if (node.kind === 257) {
87320             return true;
87321         }
87322         return false;
87323     }
87324     function maskModifiers(node, modifierMask, modifierAdditions) {
87325         return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
87326     }
87327     function maskModifierFlags(node, modifierMask, modifierAdditions) {
87328         if (modifierMask === void 0) { modifierMask = 27647 ^ 4; }
87329         if (modifierAdditions === void 0) { modifierAdditions = 0; }
87330         var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions;
87331         if (flags & 512 && !(flags & 1)) {
87332             flags ^= 1;
87333         }
87334         if (flags & 512 && flags & 2) {
87335             flags ^= 2;
87336         }
87337         return flags;
87338     }
87339     function getTypeAnnotationFromAccessor(accessor) {
87340         if (accessor) {
87341             return accessor.kind === 171
87342                 ? accessor.type
87343                 : accessor.parameters.length > 0
87344                     ? accessor.parameters[0].type
87345                     : undefined;
87346         }
87347     }
87348     function canHaveLiteralInitializer(node) {
87349         switch (node.kind) {
87350             case 166:
87351             case 165:
87352                 return !ts.hasEffectiveModifier(node, 8);
87353             case 163:
87354             case 253:
87355                 return true;
87356         }
87357         return false;
87358     }
87359     function isPreservedDeclarationStatement(node) {
87360         switch (node.kind) {
87361             case 255:
87362             case 260:
87363             case 264:
87364             case 257:
87365             case 256:
87366             case 258:
87367             case 259:
87368             case 236:
87369             case 265:
87370             case 271:
87371             case 270:
87372                 return true;
87373         }
87374         return false;
87375     }
87376     function isProcessedComponent(node) {
87377         switch (node.kind) {
87378             case 174:
87379             case 170:
87380             case 168:
87381             case 171:
87382             case 172:
87383             case 166:
87384             case 165:
87385             case 167:
87386             case 173:
87387             case 175:
87388             case 253:
87389             case 162:
87390             case 227:
87391             case 177:
87392             case 188:
87393             case 178:
87394             case 179:
87395             case 199:
87396                 return true;
87397         }
87398         return false;
87399     }
87400 })(ts || (ts = {}));
87401 var ts;
87402 (function (ts) {
87403     function getModuleTransformer(moduleKind) {
87404         switch (moduleKind) {
87405             case ts.ModuleKind.ESNext:
87406             case ts.ModuleKind.ES2022:
87407             case ts.ModuleKind.ES2020:
87408             case ts.ModuleKind.ES2015:
87409                 return ts.transformECMAScriptModule;
87410             case ts.ModuleKind.System:
87411                 return ts.transformSystemModule;
87412             case ts.ModuleKind.Node12:
87413             case ts.ModuleKind.NodeNext:
87414                 return ts.transformNodeModule;
87415             default:
87416                 return ts.transformModule;
87417         }
87418     }
87419     ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
87420     function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
87421         return {
87422             scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
87423             declarationTransformers: getDeclarationTransformers(customTransformers),
87424         };
87425     }
87426     ts.getTransformers = getTransformers;
87427     function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
87428         if (emitOnlyDtsFiles)
87429             return ts.emptyArray;
87430         var languageVersion = ts.getEmitScriptTarget(compilerOptions);
87431         var moduleKind = ts.getEmitModuleKind(compilerOptions);
87432         var transformers = [];
87433         ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
87434         transformers.push(ts.transformTypeScript);
87435         transformers.push(ts.transformClassFields);
87436         if (ts.getJSXTransformEnabled(compilerOptions)) {
87437             transformers.push(ts.transformJsx);
87438         }
87439         if (languageVersion < 99) {
87440             transformers.push(ts.transformESNext);
87441         }
87442         if (languageVersion < 8) {
87443             transformers.push(ts.transformES2021);
87444         }
87445         if (languageVersion < 7) {
87446             transformers.push(ts.transformES2020);
87447         }
87448         if (languageVersion < 6) {
87449             transformers.push(ts.transformES2019);
87450         }
87451         if (languageVersion < 5) {
87452             transformers.push(ts.transformES2018);
87453         }
87454         if (languageVersion < 4) {
87455             transformers.push(ts.transformES2017);
87456         }
87457         if (languageVersion < 3) {
87458             transformers.push(ts.transformES2016);
87459         }
87460         if (languageVersion < 2) {
87461             transformers.push(ts.transformES2015);
87462             transformers.push(ts.transformGenerators);
87463         }
87464         transformers.push(getModuleTransformer(moduleKind));
87465         if (languageVersion < 1) {
87466             transformers.push(ts.transformES5);
87467         }
87468         ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
87469         return transformers;
87470     }
87471     function getDeclarationTransformers(customTransformers) {
87472         var transformers = [];
87473         transformers.push(ts.transformDeclarations);
87474         ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
87475         return transformers;
87476     }
87477     function wrapCustomTransformer(transformer) {
87478         return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
87479     }
87480     function wrapCustomTransformerFactory(transformer, handleDefault) {
87481         return function (context) {
87482             var customTransformer = transformer(context);
87483             return typeof customTransformer === "function"
87484                 ? handleDefault(context, customTransformer)
87485                 : wrapCustomTransformer(customTransformer);
87486         };
87487     }
87488     function wrapScriptTransformerFactory(transformer) {
87489         return wrapCustomTransformerFactory(transformer, ts.chainBundle);
87490     }
87491     function wrapDeclarationTransformerFactory(transformer) {
87492         return wrapCustomTransformerFactory(transformer, function (_, node) { return node; });
87493     }
87494     function noEmitSubstitution(_hint, node) {
87495         return node;
87496     }
87497     ts.noEmitSubstitution = noEmitSubstitution;
87498     function noEmitNotification(hint, node, callback) {
87499         callback(hint, node);
87500     }
87501     ts.noEmitNotification = noEmitNotification;
87502     function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) {
87503         var enabledSyntaxKindFeatures = new Array(353);
87504         var lexicalEnvironmentVariableDeclarations;
87505         var lexicalEnvironmentFunctionDeclarations;
87506         var lexicalEnvironmentStatements;
87507         var lexicalEnvironmentFlags = 0;
87508         var lexicalEnvironmentVariableDeclarationsStack = [];
87509         var lexicalEnvironmentFunctionDeclarationsStack = [];
87510         var lexicalEnvironmentStatementsStack = [];
87511         var lexicalEnvironmentFlagsStack = [];
87512         var lexicalEnvironmentStackOffset = 0;
87513         var lexicalEnvironmentSuspended = false;
87514         var blockScopedVariableDeclarationsStack = [];
87515         var blockScopeStackOffset = 0;
87516         var blockScopedVariableDeclarations;
87517         var emitHelpers;
87518         var onSubstituteNode = noEmitSubstitution;
87519         var onEmitNode = noEmitNotification;
87520         var state = 0;
87521         var diagnostics = [];
87522         var context = {
87523             factory: factory,
87524             getCompilerOptions: function () { return options; },
87525             getEmitResolver: function () { return resolver; },
87526             getEmitHost: function () { return host; },
87527             getEmitHelperFactory: ts.memoize(function () { return ts.createEmitHelperFactory(context); }),
87528             startLexicalEnvironment: startLexicalEnvironment,
87529             suspendLexicalEnvironment: suspendLexicalEnvironment,
87530             resumeLexicalEnvironment: resumeLexicalEnvironment,
87531             endLexicalEnvironment: endLexicalEnvironment,
87532             setLexicalEnvironmentFlags: setLexicalEnvironmentFlags,
87533             getLexicalEnvironmentFlags: getLexicalEnvironmentFlags,
87534             hoistVariableDeclaration: hoistVariableDeclaration,
87535             hoistFunctionDeclaration: hoistFunctionDeclaration,
87536             addInitializationStatement: addInitializationStatement,
87537             startBlockScope: startBlockScope,
87538             endBlockScope: endBlockScope,
87539             addBlockScopedVariable: addBlockScopedVariable,
87540             requestEmitHelper: requestEmitHelper,
87541             readEmitHelpers: readEmitHelpers,
87542             enableSubstitution: enableSubstitution,
87543             enableEmitNotification: enableEmitNotification,
87544             isSubstitutionEnabled: isSubstitutionEnabled,
87545             isEmitNotificationEnabled: isEmitNotificationEnabled,
87546             get onSubstituteNode() { return onSubstituteNode; },
87547             set onSubstituteNode(value) {
87548                 ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed.");
87549                 ts.Debug.assert(value !== undefined, "Value must not be 'undefined'");
87550                 onSubstituteNode = value;
87551             },
87552             get onEmitNode() { return onEmitNode; },
87553             set onEmitNode(value) {
87554                 ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed.");
87555                 ts.Debug.assert(value !== undefined, "Value must not be 'undefined'");
87556                 onEmitNode = value;
87557             },
87558             addDiagnostic: function (diag) {
87559                 diagnostics.push(diag);
87560             }
87561         };
87562         for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
87563             var node = nodes_2[_i];
87564             ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node)));
87565         }
87566         ts.performance.mark("beforeTransform");
87567         var transformersWithContext = transformers.map(function (t) { return t(context); });
87568         var transformation = function (node) {
87569             for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
87570                 var transform = transformersWithContext_1[_i];
87571                 node = transform(node);
87572             }
87573             return node;
87574         };
87575         state = 1;
87576         var transformed = [];
87577         for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) {
87578             var node = nodes_3[_a];
87579             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "transformNodes", node.kind === 303 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end });
87580             transformed.push((allowDtsFiles ? transformation : transformRoot)(node));
87581             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
87582         }
87583         state = 2;
87584         ts.performance.mark("afterTransform");
87585         ts.performance.measure("transformTime", "beforeTransform", "afterTransform");
87586         return {
87587             transformed: transformed,
87588             substituteNode: substituteNode,
87589             emitNodeWithNotification: emitNodeWithNotification,
87590             isEmitNotificationEnabled: isEmitNotificationEnabled,
87591             dispose: dispose,
87592             diagnostics: diagnostics
87593         };
87594         function transformRoot(node) {
87595             return node && (!ts.isSourceFile(node) || !node.isDeclarationFile) ? transformation(node) : node;
87596         }
87597         function enableSubstitution(kind) {
87598             ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed.");
87599             enabledSyntaxKindFeatures[kind] |= 1;
87600         }
87601         function isSubstitutionEnabled(node) {
87602             return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0
87603                 && (ts.getEmitFlags(node) & 4) === 0;
87604         }
87605         function substituteNode(hint, node) {
87606             ts.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed.");
87607             return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node;
87608         }
87609         function enableEmitNotification(kind) {
87610             ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed.");
87611             enabledSyntaxKindFeatures[kind] |= 2;
87612         }
87613         function isEmitNotificationEnabled(node) {
87614             return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0
87615                 || (ts.getEmitFlags(node) & 2) !== 0;
87616         }
87617         function emitNodeWithNotification(hint, node, emitCallback) {
87618             ts.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed.");
87619             if (node) {
87620                 if (isEmitNotificationEnabled(node)) {
87621                     onEmitNode(hint, node, emitCallback);
87622                 }
87623                 else {
87624                     emitCallback(hint, node);
87625                 }
87626             }
87627         }
87628         function hoistVariableDeclaration(name) {
87629             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87630             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87631             var decl = ts.setEmitFlags(factory.createVariableDeclaration(name), 64);
87632             if (!lexicalEnvironmentVariableDeclarations) {
87633                 lexicalEnvironmentVariableDeclarations = [decl];
87634             }
87635             else {
87636                 lexicalEnvironmentVariableDeclarations.push(decl);
87637             }
87638             if (lexicalEnvironmentFlags & 1) {
87639                 lexicalEnvironmentFlags |= 2;
87640             }
87641         }
87642         function hoistFunctionDeclaration(func) {
87643             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87644             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87645             ts.setEmitFlags(func, 1048576);
87646             if (!lexicalEnvironmentFunctionDeclarations) {
87647                 lexicalEnvironmentFunctionDeclarations = [func];
87648             }
87649             else {
87650                 lexicalEnvironmentFunctionDeclarations.push(func);
87651             }
87652         }
87653         function addInitializationStatement(node) {
87654             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87655             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87656             ts.setEmitFlags(node, 1048576);
87657             if (!lexicalEnvironmentStatements) {
87658                 lexicalEnvironmentStatements = [node];
87659             }
87660             else {
87661                 lexicalEnvironmentStatements.push(node);
87662             }
87663         }
87664         function startLexicalEnvironment() {
87665             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87666             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87667             ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
87668             lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations;
87669             lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations;
87670             lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentStatements;
87671             lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFlags;
87672             lexicalEnvironmentStackOffset++;
87673             lexicalEnvironmentVariableDeclarations = undefined;
87674             lexicalEnvironmentFunctionDeclarations = undefined;
87675             lexicalEnvironmentStatements = undefined;
87676             lexicalEnvironmentFlags = 0;
87677         }
87678         function suspendLexicalEnvironment() {
87679             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87680             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87681             ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended.");
87682             lexicalEnvironmentSuspended = true;
87683         }
87684         function resumeLexicalEnvironment() {
87685             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87686             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87687             ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended.");
87688             lexicalEnvironmentSuspended = false;
87689         }
87690         function endLexicalEnvironment() {
87691             ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization.");
87692             ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed.");
87693             ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended.");
87694             var statements;
87695             if (lexicalEnvironmentVariableDeclarations ||
87696                 lexicalEnvironmentFunctionDeclarations ||
87697                 lexicalEnvironmentStatements) {
87698                 if (lexicalEnvironmentFunctionDeclarations) {
87699                     statements = __spreadArray([], lexicalEnvironmentFunctionDeclarations, true);
87700                 }
87701                 if (lexicalEnvironmentVariableDeclarations) {
87702                     var statement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
87703                     ts.setEmitFlags(statement, 1048576);
87704                     if (!statements) {
87705                         statements = [statement];
87706                     }
87707                     else {
87708                         statements.push(statement);
87709                     }
87710                 }
87711                 if (lexicalEnvironmentStatements) {
87712                     if (!statements) {
87713                         statements = __spreadArray([], lexicalEnvironmentStatements, true);
87714                     }
87715                     else {
87716                         statements = __spreadArray(__spreadArray([], statements, true), lexicalEnvironmentStatements, true);
87717                     }
87718                 }
87719             }
87720             lexicalEnvironmentStackOffset--;
87721             lexicalEnvironmentVariableDeclarations = lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset];
87722             lexicalEnvironmentFunctionDeclarations = lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset];
87723             lexicalEnvironmentStatements = lexicalEnvironmentStatementsStack[lexicalEnvironmentStackOffset];
87724             lexicalEnvironmentFlags = lexicalEnvironmentFlagsStack[lexicalEnvironmentStackOffset];
87725             if (lexicalEnvironmentStackOffset === 0) {
87726                 lexicalEnvironmentVariableDeclarationsStack = [];
87727                 lexicalEnvironmentFunctionDeclarationsStack = [];
87728                 lexicalEnvironmentStatementsStack = [];
87729                 lexicalEnvironmentFlagsStack = [];
87730             }
87731             return statements;
87732         }
87733         function setLexicalEnvironmentFlags(flags, value) {
87734             lexicalEnvironmentFlags = value ?
87735                 lexicalEnvironmentFlags | flags :
87736                 lexicalEnvironmentFlags & ~flags;
87737         }
87738         function getLexicalEnvironmentFlags() {
87739             return lexicalEnvironmentFlags;
87740         }
87741         function startBlockScope() {
87742             ts.Debug.assert(state > 0, "Cannot start a block scope during initialization.");
87743             ts.Debug.assert(state < 2, "Cannot start a block scope after transformation has completed.");
87744             blockScopedVariableDeclarationsStack[blockScopeStackOffset] = blockScopedVariableDeclarations;
87745             blockScopeStackOffset++;
87746             blockScopedVariableDeclarations = undefined;
87747         }
87748         function endBlockScope() {
87749             ts.Debug.assert(state > 0, "Cannot end a block scope during initialization.");
87750             ts.Debug.assert(state < 2, "Cannot end a block scope after transformation has completed.");
87751             var statements = ts.some(blockScopedVariableDeclarations) ?
87752                 [
87753                     factory.createVariableStatement(undefined, factory.createVariableDeclarationList(blockScopedVariableDeclarations.map(function (identifier) { return factory.createVariableDeclaration(identifier); }), 1))
87754                 ] : undefined;
87755             blockScopeStackOffset--;
87756             blockScopedVariableDeclarations = blockScopedVariableDeclarationsStack[blockScopeStackOffset];
87757             if (blockScopeStackOffset === 0) {
87758                 blockScopedVariableDeclarationsStack = [];
87759             }
87760             return statements;
87761         }
87762         function addBlockScopedVariable(name) {
87763             ts.Debug.assert(blockScopeStackOffset > 0, "Cannot add a block scoped variable outside of an iteration body.");
87764             (blockScopedVariableDeclarations || (blockScopedVariableDeclarations = [])).push(name);
87765         }
87766         function requestEmitHelper(helper) {
87767             ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization.");
87768             ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed.");
87769             ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper.");
87770             if (helper.dependencies) {
87771                 for (var _i = 0, _a = helper.dependencies; _i < _a.length; _i++) {
87772                     var h = _a[_i];
87773                     requestEmitHelper(h);
87774                 }
87775             }
87776             emitHelpers = ts.append(emitHelpers, helper);
87777         }
87778         function readEmitHelpers() {
87779             ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization.");
87780             ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed.");
87781             var helpers = emitHelpers;
87782             emitHelpers = undefined;
87783             return helpers;
87784         }
87785         function dispose() {
87786             if (state < 3) {
87787                 for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) {
87788                     var node = nodes_4[_i];
87789                     ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node)));
87790                 }
87791                 lexicalEnvironmentVariableDeclarations = undefined;
87792                 lexicalEnvironmentVariableDeclarationsStack = undefined;
87793                 lexicalEnvironmentFunctionDeclarations = undefined;
87794                 lexicalEnvironmentFunctionDeclarationsStack = undefined;
87795                 onSubstituteNode = undefined;
87796                 onEmitNode = undefined;
87797                 emitHelpers = undefined;
87798                 state = 3;
87799             }
87800         }
87801     }
87802     ts.transformNodes = transformNodes;
87803     ts.nullTransformationContext = {
87804         factory: ts.factory,
87805         getCompilerOptions: function () { return ({}); },
87806         getEmitResolver: ts.notImplemented,
87807         getEmitHost: ts.notImplemented,
87808         getEmitHelperFactory: ts.notImplemented,
87809         startLexicalEnvironment: ts.noop,
87810         resumeLexicalEnvironment: ts.noop,
87811         suspendLexicalEnvironment: ts.noop,
87812         endLexicalEnvironment: ts.returnUndefined,
87813         setLexicalEnvironmentFlags: ts.noop,
87814         getLexicalEnvironmentFlags: function () { return 0; },
87815         hoistVariableDeclaration: ts.noop,
87816         hoistFunctionDeclaration: ts.noop,
87817         addInitializationStatement: ts.noop,
87818         startBlockScope: ts.noop,
87819         endBlockScope: ts.returnUndefined,
87820         addBlockScopedVariable: ts.noop,
87821         requestEmitHelper: ts.noop,
87822         readEmitHelpers: ts.notImplemented,
87823         enableSubstitution: ts.noop,
87824         enableEmitNotification: ts.noop,
87825         isSubstitutionEnabled: ts.notImplemented,
87826         isEmitNotificationEnabled: ts.notImplemented,
87827         onSubstituteNode: noEmitSubstitution,
87828         onEmitNode: noEmitNotification,
87829         addDiagnostic: ts.noop,
87830     };
87831 })(ts || (ts = {}));
87832 var ts;
87833 (function (ts) {
87834     var brackets = createBracketsMap();
87835     function isBuildInfoFile(file) {
87836         return ts.fileExtensionIs(file, ".tsbuildinfo");
87837     }
87838     ts.isBuildInfoFile = isBuildInfoFile;
87839     function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) {
87840         if (forceDtsEmit === void 0) { forceDtsEmit = false; }
87841         var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
87842         var options = host.getCompilerOptions();
87843         if (ts.outFile(options)) {
87844             var prepends = host.getPrependNodes();
87845             if (sourceFiles.length || prepends.length) {
87846                 var bundle = ts.factory.createBundle(sourceFiles, prepends);
87847                 var result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
87848                 if (result) {
87849                     return result;
87850                 }
87851             }
87852         }
87853         else {
87854             if (!onlyBuildInfo) {
87855                 for (var _a = 0, sourceFiles_1 = sourceFiles; _a < sourceFiles_1.length; _a++) {
87856                     var sourceFile = sourceFiles_1[_a];
87857                     var result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
87858                     if (result) {
87859                         return result;
87860                     }
87861                 }
87862             }
87863             if (includeBuildInfo) {
87864                 var buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
87865                 if (buildInfoPath)
87866                     return action({ buildInfoPath: buildInfoPath }, undefined);
87867             }
87868         }
87869     }
87870     ts.forEachEmittedFile = forEachEmittedFile;
87871     function getTsBuildInfoEmitOutputFilePath(options) {
87872         var configFile = options.configFilePath;
87873         if (!ts.isIncrementalCompilation(options))
87874             return undefined;
87875         if (options.tsBuildInfoFile)
87876             return options.tsBuildInfoFile;
87877         var outPath = ts.outFile(options);
87878         var buildInfoExtensionLess;
87879         if (outPath) {
87880             buildInfoExtensionLess = ts.removeFileExtension(outPath);
87881         }
87882         else {
87883             if (!configFile)
87884                 return undefined;
87885             var configFileExtensionLess = ts.removeFileExtension(configFile);
87886             buildInfoExtensionLess = options.outDir ?
87887                 options.rootDir ?
87888                     ts.resolvePath(options.outDir, ts.getRelativePathFromDirectory(options.rootDir, configFileExtensionLess, true)) :
87889                     ts.combinePaths(options.outDir, ts.getBaseFileName(configFileExtensionLess)) :
87890                 configFileExtensionLess;
87891         }
87892         return buildInfoExtensionLess + ".tsbuildinfo";
87893     }
87894     ts.getTsBuildInfoEmitOutputFilePath = getTsBuildInfoEmitOutputFilePath;
87895     function getOutputPathsForBundle(options, forceDtsPaths) {
87896         var outPath = ts.outFile(options);
87897         var jsFilePath = options.emitDeclarationOnly ? undefined : outPath;
87898         var sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
87899         var declarationFilePath = (forceDtsPaths || ts.getEmitDeclarations(options)) ? ts.removeFileExtension(outPath) + ".d.ts" : undefined;
87900         var declarationMapPath = declarationFilePath && ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
87901         var buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
87902         return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, buildInfoPath: buildInfoPath };
87903     }
87904     ts.getOutputPathsForBundle = getOutputPathsForBundle;
87905     function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
87906         var options = host.getCompilerOptions();
87907         if (sourceFile.kind === 304) {
87908             return getOutputPathsForBundle(options, forceDtsPaths);
87909         }
87910         else {
87911             var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options));
87912             var isJsonFile = ts.isJsonSourceFile(sourceFile);
87913             var isJsonEmittedToSameLocation = isJsonFile &&
87914                 ts.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0;
87915             var jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? undefined : ownOutputFilePath;
87916             var sourceMapFilePath = !jsFilePath || ts.isJsonSourceFile(sourceFile) ? undefined : getSourceMapFilePath(jsFilePath, options);
87917             var declarationFilePath = (forceDtsPaths || (ts.getEmitDeclarations(options) && !isJsonFile)) ? ts.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : undefined;
87918             var declarationMapPath = declarationFilePath && ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
87919             return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, buildInfoPath: undefined };
87920         }
87921     }
87922     ts.getOutputPathsFor = getOutputPathsFor;
87923     function getSourceMapFilePath(jsFilePath, options) {
87924         return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
87925     }
87926     function getOutputExtension(fileName, options) {
87927         return ts.fileExtensionIs(fileName, ".json") ? ".json" :
87928             options.jsx === 1 && ts.fileExtensionIsOneOf(fileName, [".jsx", ".tsx"]) ? ".jsx" :
87929                 ts.fileExtensionIsOneOf(fileName, [".mts", ".mjs"]) ? ".mjs" :
87930                     ts.fileExtensionIsOneOf(fileName, [".cts", ".cjs"]) ? ".cjs" :
87931                         ".js";
87932     }
87933     ts.getOutputExtension = getOutputExtension;
87934     function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory) {
87935         return outputDir ?
87936             ts.resolvePath(outputDir, ts.getRelativePathFromDirectory(getCommonSourceDirectory ? getCommonSourceDirectory() : getCommonSourceDirectoryOfConfig(configFile, ignoreCase), inputFileName, ignoreCase)) :
87937             inputFileName;
87938     }
87939     function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
87940         return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ts.getDeclarationEmitExtensionForPath(inputFileName));
87941     }
87942     ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
87943     function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
87944         if (configFile.options.emitDeclarationOnly)
87945             return undefined;
87946         var isJsonFile = ts.fileExtensionIs(inputFileName, ".json");
87947         var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), getOutputExtension(inputFileName, configFile.options));
87948         return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 ?
87949             outputFileName :
87950             undefined;
87951     }
87952     function createAddOutput() {
87953         var outputs;
87954         return { addOutput: addOutput, getOutputs: getOutputs };
87955         function addOutput(path) {
87956             if (path) {
87957                 (outputs || (outputs = [])).push(path);
87958             }
87959         }
87960         function getOutputs() {
87961             return outputs || ts.emptyArray;
87962         }
87963     }
87964     function getSingleOutputFileNames(configFile, addOutput) {
87965         var _a = getOutputPathsForBundle(configFile.options, false), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
87966         addOutput(jsFilePath);
87967         addOutput(sourceMapFilePath);
87968         addOutput(declarationFilePath);
87969         addOutput(declarationMapPath);
87970         addOutput(buildInfoPath);
87971     }
87972     function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
87973         if (ts.fileExtensionIs(inputFileName, ".d.ts"))
87974             return;
87975         var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
87976         addOutput(js);
87977         if (ts.fileExtensionIs(inputFileName, ".json"))
87978             return;
87979         if (js && configFile.options.sourceMap) {
87980             addOutput("".concat(js, ".map"));
87981         }
87982         if (ts.getEmitDeclarations(configFile.options)) {
87983             var dts = getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
87984             addOutput(dts);
87985             if (configFile.options.declarationMap) {
87986                 addOutput("".concat(dts, ".map"));
87987             }
87988         }
87989     }
87990     function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCanonicalFileName, checkSourceFilesBelongToPath) {
87991         var commonSourceDirectory;
87992         if (options.rootDir) {
87993             commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);
87994             checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(options.rootDir);
87995         }
87996         else if (options.composite && options.configFilePath) {
87997             commonSourceDirectory = ts.getDirectoryPath(ts.normalizeSlashes(options.configFilePath));
87998             checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory);
87999         }
88000         else {
88001             commonSourceDirectory = ts.computeCommonSourceDirectoryOfFilenames(emittedFiles(), currentDirectory, getCanonicalFileName);
88002         }
88003         if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) {
88004             commonSourceDirectory += ts.directorySeparator;
88005         }
88006         return commonSourceDirectory;
88007     }
88008     ts.getCommonSourceDirectory = getCommonSourceDirectory;
88009     function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
88010         var options = _a.options, fileNames = _a.fileNames;
88011         return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.fileExtensionIs(file, ".d.ts"); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
88012     }
88013     ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
88014     function getAllProjectOutputs(configFile, ignoreCase) {
88015         var _a = createAddOutput(), addOutput = _a.addOutput, getOutputs = _a.getOutputs;
88016         if (ts.outFile(configFile.options)) {
88017             getSingleOutputFileNames(configFile, addOutput);
88018         }
88019         else {
88020             var getCommonSourceDirectory_1 = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
88021             for (var _b = 0, _c = configFile.fileNames; _b < _c.length; _b++) {
88022                 var inputFileName = _c[_b];
88023                 getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory_1);
88024             }
88025             addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
88026         }
88027         return getOutputs();
88028     }
88029     ts.getAllProjectOutputs = getAllProjectOutputs;
88030     function getOutputFileNames(commandLine, inputFileName, ignoreCase) {
88031         inputFileName = ts.normalizePath(inputFileName);
88032         ts.Debug.assert(ts.contains(commandLine.fileNames, inputFileName), "Expected fileName to be present in command line");
88033         var _a = createAddOutput(), addOutput = _a.addOutput, getOutputs = _a.getOutputs;
88034         if (ts.outFile(commandLine.options)) {
88035             getSingleOutputFileNames(commandLine, addOutput);
88036         }
88037         else {
88038             getOwnOutputFileNames(commandLine, inputFileName, ignoreCase, addOutput);
88039         }
88040         return getOutputs();
88041     }
88042     ts.getOutputFileNames = getOutputFileNames;
88043     function getFirstProjectOutput(configFile, ignoreCase) {
88044         if (ts.outFile(configFile.options)) {
88045             var jsFilePath = getOutputPathsForBundle(configFile.options, false).jsFilePath;
88046             return ts.Debug.checkDefined(jsFilePath, "project ".concat(configFile.options.configFilePath, " expected to have at least one output"));
88047         }
88048         var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
88049         for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
88050             var inputFileName = _b[_a];
88051             if (ts.fileExtensionIs(inputFileName, ".d.ts"))
88052                 continue;
88053             var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
88054             if (jsFilePath)
88055                 return jsFilePath;
88056             if (ts.fileExtensionIs(inputFileName, ".json"))
88057                 continue;
88058             if (ts.getEmitDeclarations(configFile.options)) {
88059                 return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
88060             }
88061         }
88062         var buildInfoPath = getTsBuildInfoEmitOutputFilePath(configFile.options);
88063         if (buildInfoPath)
88064             return buildInfoPath;
88065         return ts.Debug.fail("project ".concat(configFile.options.configFilePath, " expected to have at least one output"));
88066     }
88067     ts.getFirstProjectOutput = getFirstProjectOutput;
88068     function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo, forceDtsEmit) {
88069         var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
88070         var compilerOptions = host.getCompilerOptions();
88071         var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
88072         var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
88073         var emitterDiagnostics = ts.createDiagnosticCollection();
88074         var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
88075         var writer = ts.createTextWriter(newLine);
88076         var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
88077         var bundleBuildInfo;
88078         var emitSkipped = false;
88079         var exportedModulesFromDeclarationEmit;
88080         enter();
88081         forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
88082         exit();
88083         return {
88084             emitSkipped: emitSkipped,
88085             diagnostics: emitterDiagnostics.getDiagnostics(),
88086             emittedFiles: emittedFilesList,
88087             sourceMaps: sourceMapDataList,
88088             exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
88089         };
88090         function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
88091             var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
88092             var buildInfoDirectory;
88093             if (buildInfoPath && sourceFileOrBundle && ts.isBundle(sourceFileOrBundle)) {
88094                 buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
88095                 bundleBuildInfo = {
88096                     commonSourceDirectory: relativeToBuildInfo(host.getCommonSourceDirectory()),
88097                     sourceFiles: sourceFileOrBundle.sourceFiles.map(function (file) { return relativeToBuildInfo(ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory())); })
88098                 };
88099             }
88100             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitJsFileOrBundle", { jsFilePath: jsFilePath });
88101             emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo);
88102             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
88103             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitDeclarationFileOrBundle", { declarationFilePath: declarationFilePath });
88104             emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo);
88105             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
88106             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitBuildInfo", { buildInfoPath: buildInfoPath });
88107             emitBuildInfo(bundleBuildInfo, buildInfoPath);
88108             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
88109             if (!emitSkipped && emittedFilesList) {
88110                 if (!emitOnlyDtsFiles) {
88111                     if (jsFilePath) {
88112                         emittedFilesList.push(jsFilePath);
88113                     }
88114                     if (sourceMapFilePath) {
88115                         emittedFilesList.push(sourceMapFilePath);
88116                     }
88117                     if (buildInfoPath) {
88118                         emittedFilesList.push(buildInfoPath);
88119                     }
88120                 }
88121                 if (declarationFilePath) {
88122                     emittedFilesList.push(declarationFilePath);
88123                 }
88124                 if (declarationMapPath) {
88125                     emittedFilesList.push(declarationMapPath);
88126                 }
88127             }
88128             function relativeToBuildInfo(path) {
88129                 return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
88130             }
88131         }
88132         function emitBuildInfo(bundle, buildInfoPath) {
88133             if (!buildInfoPath || targetSourceFile || emitSkipped)
88134                 return;
88135             var program = host.getProgramBuildInfo();
88136             if (host.isEmitBlocked(buildInfoPath)) {
88137                 emitSkipped = true;
88138                 return;
88139             }
88140             var version = ts.version;
88141             ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), false);
88142         }
88143         function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
88144             if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
88145                 return;
88146             }
88147             if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
88148                 emitSkipped = true;
88149                 return;
88150             }
88151             var transform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, [sourceFileOrBundle], scriptTransformers, false);
88152             var printerOptions = {
88153                 removeComments: compilerOptions.removeComments,
88154                 newLine: compilerOptions.newLine,
88155                 noEmitHelpers: compilerOptions.noEmitHelpers,
88156                 module: compilerOptions.module,
88157                 target: compilerOptions.target,
88158                 sourceMap: compilerOptions.sourceMap,
88159                 inlineSourceMap: compilerOptions.inlineSourceMap,
88160                 inlineSources: compilerOptions.inlineSources,
88161                 extendedDiagnostics: compilerOptions.extendedDiagnostics,
88162                 writeBundleFileInfo: !!bundleBuildInfo,
88163                 relativeToBuildInfo: relativeToBuildInfo
88164             };
88165             var printer = createPrinter(printerOptions, {
88166                 hasGlobalName: resolver.hasGlobalName,
88167                 onEmitNode: transform.emitNodeWithNotification,
88168                 isEmitNotificationEnabled: transform.isEmitNotificationEnabled,
88169                 substituteNode: transform.substituteNode,
88170             });
88171             ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
88172             printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
88173             transform.dispose();
88174             if (bundleBuildInfo)
88175                 bundleBuildInfo.js = printer.bundleFileInfo;
88176         }
88177         function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
88178             if (!sourceFileOrBundle)
88179                 return;
88180             if (!declarationFilePath) {
88181                 if (emitOnlyDtsFiles || compilerOptions.emitDeclarationOnly)
88182                     emitSkipped = true;
88183                 return;
88184             }
88185             var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
88186             var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
88187             var inputListOrBundle = ts.outFile(compilerOptions) ? [ts.factory.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
88188             if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
88189                 filesForEmit.forEach(collectLinkedAliases);
88190             }
88191             var declarationTransform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, false);
88192             if (ts.length(declarationTransform.diagnostics)) {
88193                 for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
88194                     var diagnostic = _b[_a];
88195                     emitterDiagnostics.add(diagnostic);
88196                 }
88197             }
88198             var printerOptions = {
88199                 removeComments: compilerOptions.removeComments,
88200                 newLine: compilerOptions.newLine,
88201                 noEmitHelpers: true,
88202                 module: compilerOptions.module,
88203                 target: compilerOptions.target,
88204                 sourceMap: compilerOptions.sourceMap,
88205                 inlineSourceMap: compilerOptions.inlineSourceMap,
88206                 extendedDiagnostics: compilerOptions.extendedDiagnostics,
88207                 onlyPrintJsDocStyle: true,
88208                 writeBundleFileInfo: !!bundleBuildInfo,
88209                 recordInternalSection: !!bundleBuildInfo,
88210                 relativeToBuildInfo: relativeToBuildInfo
88211             };
88212             var declarationPrinter = createPrinter(printerOptions, {
88213                 hasGlobalName: resolver.hasGlobalName,
88214                 onEmitNode: declarationTransform.emitNodeWithNotification,
88215                 isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
88216                 substituteNode: declarationTransform.substituteNode,
88217             });
88218             var declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
88219             emitSkipped = emitSkipped || declBlocked;
88220             if (!declBlocked || forceDtsEmit) {
88221                 ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
88222                 printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
88223                     sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
88224                     sourceRoot: compilerOptions.sourceRoot,
88225                     mapRoot: compilerOptions.mapRoot,
88226                     extendedDiagnostics: compilerOptions.extendedDiagnostics,
88227                 });
88228                 if (forceDtsEmit && declarationTransform.transformed[0].kind === 303) {
88229                     var sourceFile = declarationTransform.transformed[0];
88230                     exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
88231                 }
88232             }
88233             declarationTransform.dispose();
88234             if (bundleBuildInfo)
88235                 bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
88236         }
88237         function collectLinkedAliases(node) {
88238             if (ts.isExportAssignment(node)) {
88239                 if (node.expression.kind === 79) {
88240                     resolver.collectLinkedAliases(node.expression, true);
88241                 }
88242                 return;
88243             }
88244             else if (ts.isExportSpecifier(node)) {
88245                 resolver.collectLinkedAliases(node.propertyName || node.name, true);
88246                 return;
88247             }
88248             ts.forEachChild(node, collectLinkedAliases);
88249         }
88250         function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
88251             var bundle = sourceFileOrBundle.kind === 304 ? sourceFileOrBundle : undefined;
88252             var sourceFile = sourceFileOrBundle.kind === 303 ? sourceFileOrBundle : undefined;
88253             var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
88254             var sourceMapGenerator;
88255             if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
88256                 sourceMapGenerator = ts.createSourceMapGenerator(host, ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)), getSourceRoot(mapOptions), getSourceMapDirectory(mapOptions, jsFilePath, sourceFile), mapOptions);
88257             }
88258             if (bundle) {
88259                 printer.writeBundle(bundle, writer, sourceMapGenerator);
88260             }
88261             else {
88262                 printer.writeFile(sourceFile, writer, sourceMapGenerator);
88263             }
88264             if (sourceMapGenerator) {
88265                 if (sourceMapDataList) {
88266                     sourceMapDataList.push({
88267                         inputSourceFileNames: sourceMapGenerator.getSources(),
88268                         sourceMap: sourceMapGenerator.toJSON()
88269                     });
88270                 }
88271                 var sourceMappingURL = getSourceMappingURL(mapOptions, sourceMapGenerator, jsFilePath, sourceMapFilePath, sourceFile);
88272                 if (sourceMappingURL) {
88273                     if (!writer.isAtStartOfLine())
88274                         writer.rawWrite(newLine);
88275                     writer.writeComment("//# ".concat("sourceMappingURL", "=").concat(sourceMappingURL));
88276                 }
88277                 if (sourceMapFilePath) {
88278                     var sourceMap = sourceMapGenerator.toString();
88279                     ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
88280                 }
88281             }
88282             else {
88283                 writer.writeLine();
88284             }
88285             ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
88286             writer.clear();
88287         }
88288         function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
88289             return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
88290                 && (sourceFileOrBundle.kind !== 303 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json"));
88291         }
88292         function getSourceRoot(mapOptions) {
88293             var sourceRoot = ts.normalizeSlashes(mapOptions.sourceRoot || "");
88294             return sourceRoot ? ts.ensureTrailingDirectorySeparator(sourceRoot) : sourceRoot;
88295         }
88296         function getSourceMapDirectory(mapOptions, filePath, sourceFile) {
88297             if (mapOptions.sourceRoot)
88298                 return host.getCommonSourceDirectory();
88299             if (mapOptions.mapRoot) {
88300                 var sourceMapDir = ts.normalizeSlashes(mapOptions.mapRoot);
88301                 if (sourceFile) {
88302                     sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFile.fileName, host, sourceMapDir));
88303                 }
88304                 if (ts.getRootLength(sourceMapDir) === 0) {
88305                     sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
88306                 }
88307                 return sourceMapDir;
88308             }
88309             return ts.getDirectoryPath(ts.normalizePath(filePath));
88310         }
88311         function getSourceMappingURL(mapOptions, sourceMapGenerator, filePath, sourceMapFilePath, sourceFile) {
88312             if (mapOptions.inlineSourceMap) {
88313                 var sourceMapText = sourceMapGenerator.toString();
88314                 var base64SourceMapText = ts.base64encode(ts.sys, sourceMapText);
88315                 return "data:application/json;base64,".concat(base64SourceMapText);
88316             }
88317             var sourceMapFile = ts.getBaseFileName(ts.normalizeSlashes(ts.Debug.checkDefined(sourceMapFilePath)));
88318             if (mapOptions.mapRoot) {
88319                 var sourceMapDir = ts.normalizeSlashes(mapOptions.mapRoot);
88320                 if (sourceFile) {
88321                     sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFile.fileName, host, sourceMapDir));
88322                 }
88323                 if (ts.getRootLength(sourceMapDir) === 0) {
88324                     sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
88325                     return encodeURI(ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), ts.combinePaths(sourceMapDir, sourceMapFile), host.getCurrentDirectory(), host.getCanonicalFileName, true));
88326                 }
88327                 else {
88328                     return encodeURI(ts.combinePaths(sourceMapDir, sourceMapFile));
88329                 }
88330             }
88331             return encodeURI(sourceMapFile);
88332         }
88333     }
88334     ts.emitFiles = emitFiles;
88335     function getBuildInfoText(buildInfo) {
88336         return JSON.stringify(buildInfo);
88337     }
88338     ts.getBuildInfoText = getBuildInfoText;
88339     function getBuildInfo(buildInfoText) {
88340         return JSON.parse(buildInfoText);
88341     }
88342     ts.getBuildInfo = getBuildInfo;
88343     ts.notImplementedResolver = {
88344         hasGlobalName: ts.notImplemented,
88345         getReferencedExportContainer: ts.notImplemented,
88346         getReferencedImportDeclaration: ts.notImplemented,
88347         getReferencedDeclarationWithCollidingName: ts.notImplemented,
88348         isDeclarationWithCollidingName: ts.notImplemented,
88349         isValueAliasDeclaration: ts.notImplemented,
88350         isReferencedAliasDeclaration: ts.notImplemented,
88351         isTopLevelValueImportEqualsWithEntityName: ts.notImplemented,
88352         getNodeCheckFlags: ts.notImplemented,
88353         isDeclarationVisible: ts.notImplemented,
88354         isLateBound: function (_node) { return false; },
88355         collectLinkedAliases: ts.notImplemented,
88356         isImplementationOfOverload: ts.notImplemented,
88357         isRequiredInitializedParameter: ts.notImplemented,
88358         isOptionalUninitializedParameterProperty: ts.notImplemented,
88359         isExpandoFunctionDeclaration: ts.notImplemented,
88360         getPropertiesOfContainerFunction: ts.notImplemented,
88361         createTypeOfDeclaration: ts.notImplemented,
88362         createReturnTypeOfSignatureDeclaration: ts.notImplemented,
88363         createTypeOfExpression: ts.notImplemented,
88364         createLiteralConstValue: ts.notImplemented,
88365         isSymbolAccessible: ts.notImplemented,
88366         isEntityNameVisible: ts.notImplemented,
88367         getConstantValue: ts.notImplemented,
88368         getReferencedValueDeclaration: ts.notImplemented,
88369         getTypeReferenceSerializationKind: ts.notImplemented,
88370         isOptionalParameter: ts.notImplemented,
88371         moduleExportsSomeValue: ts.notImplemented,
88372         isArgumentsLocalBinding: ts.notImplemented,
88373         getExternalModuleFileFromDeclaration: ts.notImplemented,
88374         getTypeReferenceDirectivesForEntityName: ts.notImplemented,
88375         getTypeReferenceDirectivesForSymbol: ts.notImplemented,
88376         isLiteralConstDeclaration: ts.notImplemented,
88377         getJsxFactoryEntity: ts.notImplemented,
88378         getJsxFragmentFactoryEntity: ts.notImplemented,
88379         getAllAccessorDeclarations: ts.notImplemented,
88380         getSymbolOfExternalModuleSpecifier: ts.notImplemented,
88381         isBindingCapturedByNode: ts.notImplemented,
88382         getDeclarationStatementsForSourceFile: ts.notImplemented,
88383         isImportRequiredByAugmentation: ts.notImplemented,
88384     };
88385     function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host) {
88386         var _a;
88387         var jsBundle = ts.Debug.checkDefined(bundle.js);
88388         var prologueMap = ((_a = jsBundle.sources) === null || _a === void 0 ? void 0 : _a.prologues) && ts.arrayToMap(jsBundle.sources.prologues, function (prologueInfo) { return prologueInfo.file; });
88389         return bundle.sourceFiles.map(function (fileName, index) {
88390             var _a, _b;
88391             var prologueInfo = prologueMap === null || prologueMap === void 0 ? void 0 : prologueMap.get(index);
88392             var statements = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.directives.map(function (directive) {
88393                 var literal = ts.setTextRange(ts.factory.createStringLiteral(directive.expression.text), directive.expression);
88394                 var statement = ts.setTextRange(ts.factory.createExpressionStatement(literal), directive);
88395                 ts.setParent(literal, statement);
88396                 return statement;
88397             });
88398             var eofToken = ts.factory.createToken(1);
88399             var sourceFile = ts.factory.createSourceFile(statements !== null && statements !== void 0 ? statements : [], eofToken, 0);
88400             sourceFile.fileName = ts.getRelativePathFromDirectory(host.getCurrentDirectory(), ts.getNormalizedAbsolutePath(fileName, buildInfoDirectory), !host.useCaseSensitiveFileNames());
88401             sourceFile.text = (_a = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text) !== null && _a !== void 0 ? _a : "";
88402             ts.setTextRangePosWidth(sourceFile, 0, (_b = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text.length) !== null && _b !== void 0 ? _b : 0);
88403             ts.setEachParent(sourceFile.statements, sourceFile);
88404             ts.setTextRangePosWidth(eofToken, sourceFile.end, 0);
88405             ts.setParent(eofToken, sourceFile);
88406             return sourceFile;
88407         });
88408     }
88409     function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
88410         var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
88411         var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
88412         if (!buildInfoText)
88413             return buildInfoPath;
88414         var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
88415         if (!jsFileText)
88416             return jsFilePath;
88417         var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
88418         if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
88419             return sourceMapFilePath || "inline sourcemap decoding";
88420         var declarationText = declarationFilePath && host.readFile(declarationFilePath);
88421         if (declarationFilePath && !declarationText)
88422             return declarationFilePath;
88423         var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
88424         if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
88425             return declarationMapPath || "inline sourcemap decoding";
88426         var buildInfo = getBuildInfo(buildInfoText);
88427         if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
88428             return buildInfoPath;
88429         var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
88430         var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
88431         var outputFiles = [];
88432         var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
88433         var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
88434         var emitHost = {
88435             getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
88436             getCanonicalFileName: host.getCanonicalFileName,
88437             getCommonSourceDirectory: function () { return ts.getNormalizedAbsolutePath(buildInfo.bundle.commonSourceDirectory, buildInfoDirectory); },
88438             getCompilerOptions: function () { return config.options; },
88439             getCurrentDirectory: function () { return host.getCurrentDirectory(); },
88440             getNewLine: function () { return host.getNewLine(); },
88441             getSourceFile: ts.returnUndefined,
88442             getSourceFileByPath: ts.returnUndefined,
88443             getSourceFiles: function () { return sourceFilesForJsEmit; },
88444             getLibFileFromReference: ts.notImplemented,
88445             isSourceFileFromExternalLibrary: ts.returnFalse,
88446             getResolvedProjectReferenceToRedirect: ts.returnUndefined,
88447             getProjectReferenceRedirect: ts.returnUndefined,
88448             isSourceOfProjectReferenceRedirect: ts.returnFalse,
88449             writeFile: function (name, text, writeByteOrderMark) {
88450                 switch (name) {
88451                     case jsFilePath:
88452                         if (jsFileText === text)
88453                             return;
88454                         break;
88455                     case sourceMapFilePath:
88456                         if (sourceMapText === text)
88457                             return;
88458                         break;
88459                     case buildInfoPath:
88460                         var newBuildInfo = getBuildInfo(text);
88461                         newBuildInfo.program = buildInfo.program;
88462                         var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
88463                         newBuildInfo.bundle.js.sources = js.sources;
88464                         if (dts) {
88465                             newBuildInfo.bundle.dts.sources = dts.sources;
88466                         }
88467                         newBuildInfo.bundle.sourceFiles = sourceFiles;
88468                         outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
88469                         return;
88470                     case declarationFilePath:
88471                         if (declarationText === text)
88472                             return;
88473                         break;
88474                     case declarationMapPath:
88475                         if (declarationMapText === text)
88476                             return;
88477                         break;
88478                     default:
88479                         ts.Debug.fail("Unexpected path: ".concat(name));
88480                 }
88481                 outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark });
88482             },
88483             isEmitBlocked: ts.returnFalse,
88484             readFile: function (f) { return host.readFile(f); },
88485             fileExists: function (f) { return host.fileExists(f); },
88486             useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
88487             getProgramBuildInfo: ts.returnUndefined,
88488             getSourceFileFromReference: ts.returnUndefined,
88489             redirectTargetsMap: ts.createMultiMap(),
88490             getFileIncludeReasons: ts.notImplemented,
88491         };
88492         emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
88493         return outputFiles;
88494     }
88495     ts.emitUsingBuildInfo = emitUsingBuildInfo;
88496     function createPrinter(printerOptions, handlers) {
88497         if (printerOptions === void 0) { printerOptions = {}; }
88498         if (handlers === void 0) { handlers = {}; }
88499         var hasGlobalName = handlers.hasGlobalName, _a = handlers.onEmitNode, onEmitNode = _a === void 0 ? ts.noEmitNotification : _a, isEmitNotificationEnabled = handlers.isEmitNotificationEnabled, _b = handlers.substituteNode, substituteNode = _b === void 0 ? ts.noEmitSubstitution : _b, onBeforeEmitNode = handlers.onBeforeEmitNode, onAfterEmitNode = handlers.onAfterEmitNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken;
88500         var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
88501         var newLine = ts.getNewLineCharacter(printerOptions);
88502         var moduleKind = ts.getEmitModuleKind(printerOptions);
88503         var bundledHelpers = new ts.Map();
88504         var currentSourceFile;
88505         var nodeIdToGeneratedName;
88506         var autoGeneratedIdToGeneratedName;
88507         var generatedNames;
88508         var tempFlagsStack;
88509         var tempFlags;
88510         var reservedNamesStack;
88511         var reservedNames;
88512         var preserveSourceNewlines = printerOptions.preserveSourceNewlines;
88513         var nextListElementPos;
88514         var writer;
88515         var ownWriter;
88516         var write = writeBase;
88517         var isOwnFileEmit;
88518         var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : undefined;
88519         var relativeToBuildInfo = bundleFileInfo ? ts.Debug.checkDefined(printerOptions.relativeToBuildInfo) : undefined;
88520         var recordInternalSection = printerOptions.recordInternalSection;
88521         var sourceFileTextPos = 0;
88522         var sourceFileTextKind = "text";
88523         var sourceMapsDisabled = true;
88524         var sourceMapGenerator;
88525         var sourceMapSource;
88526         var sourceMapSourceIndex = -1;
88527         var mostRecentlyAddedSourceMapSource;
88528         var mostRecentlyAddedSourceMapSourceIndex = -1;
88529         var containerPos = -1;
88530         var containerEnd = -1;
88531         var declarationListContainerEnd = -1;
88532         var currentLineMap;
88533         var detachedCommentsInfo;
88534         var hasWrittenComment = false;
88535         var commentsDisabled = !!printerOptions.removeComments;
88536         var lastSubstitution;
88537         var currentParenthesizerRule;
88538         var _c = ts.performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"), enterComment = _c.enter, exitComment = _c.exit;
88539         var parenthesizer = ts.factory.parenthesizer;
88540         var emitBinaryExpression = createEmitBinaryExpression();
88541         reset();
88542         return {
88543             printNode: printNode,
88544             printList: printList,
88545             printFile: printFile,
88546             printBundle: printBundle,
88547             writeNode: writeNode,
88548             writeList: writeList,
88549             writeFile: writeFile,
88550             writeBundle: writeBundle,
88551             bundleFileInfo: bundleFileInfo
88552         };
88553         function printNode(hint, node, sourceFile) {
88554             switch (hint) {
88555                 case 0:
88556                     ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node.");
88557                     break;
88558                 case 2:
88559                     ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node.");
88560                     break;
88561                 case 1:
88562                     ts.Debug.assert(ts.isExpression(node), "Expected an Expression node.");
88563                     break;
88564             }
88565             switch (node.kind) {
88566                 case 303: return printFile(node);
88567                 case 304: return printBundle(node);
88568                 case 305: return printUnparsedSource(node);
88569             }
88570             writeNode(hint, node, sourceFile, beginPrint());
88571             return endPrint();
88572         }
88573         function printList(format, nodes, sourceFile) {
88574             writeList(format, nodes, sourceFile, beginPrint());
88575             return endPrint();
88576         }
88577         function printBundle(bundle) {
88578             writeBundle(bundle, beginPrint(), undefined);
88579             return endPrint();
88580         }
88581         function printFile(sourceFile) {
88582             writeFile(sourceFile, beginPrint(), undefined);
88583             return endPrint();
88584         }
88585         function printUnparsedSource(unparsed) {
88586             writeUnparsedSource(unparsed, beginPrint());
88587             return endPrint();
88588         }
88589         function writeNode(hint, node, sourceFile, output) {
88590             var previousWriter = writer;
88591             setWriter(output, undefined);
88592             print(hint, node, sourceFile);
88593             reset();
88594             writer = previousWriter;
88595         }
88596         function writeList(format, nodes, sourceFile, output) {
88597             var previousWriter = writer;
88598             setWriter(output, undefined);
88599             if (sourceFile) {
88600                 setSourceFile(sourceFile);
88601             }
88602             emitList(undefined, nodes, format);
88603             reset();
88604             writer = previousWriter;
88605         }
88606         function getTextPosWithWriteLine() {
88607             return writer.getTextPosWithWriteLine ? writer.getTextPosWithWriteLine() : writer.getTextPos();
88608         }
88609         function updateOrPushBundleFileTextLike(pos, end, kind) {
88610             var last = ts.lastOrUndefined(bundleFileInfo.sections);
88611             if (last && last.kind === kind) {
88612                 last.end = end;
88613             }
88614             else {
88615                 bundleFileInfo.sections.push({ pos: pos, end: end, kind: kind });
88616             }
88617         }
88618         function recordBundleFileInternalSectionStart(node) {
88619             if (recordInternalSection &&
88620                 bundleFileInfo &&
88621                 currentSourceFile &&
88622                 (ts.isDeclaration(node) || ts.isVariableStatement(node)) &&
88623                 ts.isInternalDeclaration(node, currentSourceFile) &&
88624                 sourceFileTextKind !== "internal") {
88625                 var prevSourceFileTextKind = sourceFileTextKind;
88626                 recordBundleFileTextLikeSection(writer.getTextPos());
88627                 sourceFileTextPos = getTextPosWithWriteLine();
88628                 sourceFileTextKind = "internal";
88629                 return prevSourceFileTextKind;
88630             }
88631             return undefined;
88632         }
88633         function recordBundleFileInternalSectionEnd(prevSourceFileTextKind) {
88634             if (prevSourceFileTextKind) {
88635                 recordBundleFileTextLikeSection(writer.getTextPos());
88636                 sourceFileTextPos = getTextPosWithWriteLine();
88637                 sourceFileTextKind = prevSourceFileTextKind;
88638             }
88639         }
88640         function recordBundleFileTextLikeSection(end) {
88641             if (sourceFileTextPos < end) {
88642                 updateOrPushBundleFileTextLike(sourceFileTextPos, end, sourceFileTextKind);
88643                 return true;
88644             }
88645             return false;
88646         }
88647         function writeBundle(bundle, output, sourceMapGenerator) {
88648             var _a;
88649             isOwnFileEmit = false;
88650             var previousWriter = writer;
88651             setWriter(output, sourceMapGenerator);
88652             emitShebangIfNeeded(bundle);
88653             emitPrologueDirectivesIfNeeded(bundle);
88654             emitHelpers(bundle);
88655             emitSyntheticTripleSlashReferencesIfNeeded(bundle);
88656             for (var _b = 0, _c = bundle.prepends; _b < _c.length; _b++) {
88657                 var prepend = _c[_b];
88658                 writeLine();
88659                 var pos = writer.getTextPos();
88660                 var savedSections = bundleFileInfo && bundleFileInfo.sections;
88661                 if (savedSections)
88662                     bundleFileInfo.sections = [];
88663                 print(4, prepend, undefined);
88664                 if (bundleFileInfo) {
88665                     var newSections = bundleFileInfo.sections;
88666                     bundleFileInfo.sections = savedSections;
88667                     if (prepend.oldFileOfCurrentEmit)
88668                         (_a = bundleFileInfo.sections).push.apply(_a, newSections);
88669                     else {
88670                         newSections.forEach(function (section) { return ts.Debug.assert(ts.isBundleFileTextLike(section)); });
88671                         bundleFileInfo.sections.push({
88672                             pos: pos,
88673                             end: writer.getTextPos(),
88674                             kind: "prepend",
88675                             data: relativeToBuildInfo(prepend.fileName),
88676                             texts: newSections
88677                         });
88678                     }
88679                 }
88680             }
88681             sourceFileTextPos = getTextPosWithWriteLine();
88682             for (var _d = 0, _e = bundle.sourceFiles; _d < _e.length; _d++) {
88683                 var sourceFile = _e[_d];
88684                 print(0, sourceFile, sourceFile);
88685             }
88686             if (bundleFileInfo && bundle.sourceFiles.length) {
88687                 var end = writer.getTextPos();
88688                 if (recordBundleFileTextLikeSection(end)) {
88689                     var prologues = getPrologueDirectivesFromBundledSourceFiles(bundle);
88690                     if (prologues) {
88691                         if (!bundleFileInfo.sources)
88692                             bundleFileInfo.sources = {};
88693                         bundleFileInfo.sources.prologues = prologues;
88694                     }
88695                     var helpers = getHelpersFromBundledSourceFiles(bundle);
88696                     if (helpers) {
88697                         if (!bundleFileInfo.sources)
88698                             bundleFileInfo.sources = {};
88699                         bundleFileInfo.sources.helpers = helpers;
88700                     }
88701                 }
88702             }
88703             reset();
88704             writer = previousWriter;
88705         }
88706         function writeUnparsedSource(unparsed, output) {
88707             var previousWriter = writer;
88708             setWriter(output, undefined);
88709             print(4, unparsed, undefined);
88710             reset();
88711             writer = previousWriter;
88712         }
88713         function writeFile(sourceFile, output, sourceMapGenerator) {
88714             isOwnFileEmit = true;
88715             var previousWriter = writer;
88716             setWriter(output, sourceMapGenerator);
88717             emitShebangIfNeeded(sourceFile);
88718             emitPrologueDirectivesIfNeeded(sourceFile);
88719             print(0, sourceFile, sourceFile);
88720             reset();
88721             writer = previousWriter;
88722         }
88723         function beginPrint() {
88724             return ownWriter || (ownWriter = ts.createTextWriter(newLine));
88725         }
88726         function endPrint() {
88727             var text = ownWriter.getText();
88728             ownWriter.clear();
88729             return text;
88730         }
88731         function print(hint, node, sourceFile) {
88732             if (sourceFile) {
88733                 setSourceFile(sourceFile);
88734             }
88735             pipelineEmit(hint, node, undefined);
88736         }
88737         function setSourceFile(sourceFile) {
88738             currentSourceFile = sourceFile;
88739             currentLineMap = undefined;
88740             detachedCommentsInfo = undefined;
88741             if (sourceFile) {
88742                 setSourceMapSource(sourceFile);
88743             }
88744         }
88745         function setWriter(_writer, _sourceMapGenerator) {
88746             if (_writer && printerOptions.omitTrailingSemicolon) {
88747                 _writer = ts.getTrailingSemicolonDeferringWriter(_writer);
88748             }
88749             writer = _writer;
88750             sourceMapGenerator = _sourceMapGenerator;
88751             sourceMapsDisabled = !writer || !sourceMapGenerator;
88752         }
88753         function reset() {
88754             nodeIdToGeneratedName = [];
88755             autoGeneratedIdToGeneratedName = [];
88756             generatedNames = new ts.Set();
88757             tempFlagsStack = [];
88758             tempFlags = 0;
88759             reservedNamesStack = [];
88760             currentSourceFile = undefined;
88761             currentLineMap = undefined;
88762             detachedCommentsInfo = undefined;
88763             setWriter(undefined, undefined);
88764         }
88765         function getCurrentLineMap() {
88766             return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
88767         }
88768         function emit(node, parenthesizerRule) {
88769             if (node === undefined)
88770                 return;
88771             var prevSourceFileTextKind = recordBundleFileInternalSectionStart(node);
88772             pipelineEmit(4, node, parenthesizerRule);
88773             recordBundleFileInternalSectionEnd(prevSourceFileTextKind);
88774         }
88775         function emitIdentifierName(node) {
88776             if (node === undefined)
88777                 return;
88778             pipelineEmit(2, node, undefined);
88779         }
88780         function emitExpression(node, parenthesizerRule) {
88781             if (node === undefined)
88782                 return;
88783             pipelineEmit(1, node, parenthesizerRule);
88784         }
88785         function emitJsxAttributeValue(node) {
88786             pipelineEmit(ts.isStringLiteral(node) ? 6 : 4, node);
88787         }
88788         function beforeEmitNode(node) {
88789             if (preserveSourceNewlines && (ts.getEmitFlags(node) & 134217728)) {
88790                 preserveSourceNewlines = false;
88791             }
88792         }
88793         function afterEmitNode(savedPreserveSourceNewlines) {
88794             preserveSourceNewlines = savedPreserveSourceNewlines;
88795         }
88796         function pipelineEmit(emitHint, node, parenthesizerRule) {
88797             currentParenthesizerRule = parenthesizerRule;
88798             var pipelinePhase = getPipelinePhase(0, emitHint, node);
88799             pipelinePhase(emitHint, node);
88800             currentParenthesizerRule = undefined;
88801         }
88802         function shouldEmitComments(node) {
88803             return !commentsDisabled && !ts.isSourceFile(node);
88804         }
88805         function shouldEmitSourceMaps(node) {
88806             return !sourceMapsDisabled &&
88807                 !ts.isSourceFile(node) &&
88808                 !ts.isInJsonFile(node) &&
88809                 !ts.isUnparsedSource(node) &&
88810                 !ts.isUnparsedPrepend(node);
88811         }
88812         function getPipelinePhase(phase, emitHint, node) {
88813             switch (phase) {
88814                 case 0:
88815                     if (onEmitNode !== ts.noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
88816                         return pipelineEmitWithNotification;
88817                     }
88818                 case 1:
88819                     if (substituteNode !== ts.noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
88820                         if (currentParenthesizerRule) {
88821                             lastSubstitution = currentParenthesizerRule(lastSubstitution);
88822                         }
88823                         return pipelineEmitWithSubstitution;
88824                     }
88825                 case 2:
88826                     if (shouldEmitComments(node)) {
88827                         return pipelineEmitWithComments;
88828                     }
88829                 case 3:
88830                     if (shouldEmitSourceMaps(node)) {
88831                         return pipelineEmitWithSourceMaps;
88832                     }
88833                 case 4:
88834                     return pipelineEmitWithHint;
88835                 default:
88836                     return ts.Debug.assertNever(phase);
88837             }
88838         }
88839         function getNextPipelinePhase(currentPhase, emitHint, node) {
88840             return getPipelinePhase(currentPhase + 1, emitHint, node);
88841         }
88842         function pipelineEmitWithNotification(hint, node) {
88843             var pipelinePhase = getNextPipelinePhase(0, hint, node);
88844             onEmitNode(hint, node, pipelinePhase);
88845         }
88846         function pipelineEmitWithHint(hint, node) {
88847             onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(node);
88848             if (preserveSourceNewlines) {
88849                 var savedPreserveSourceNewlines = preserveSourceNewlines;
88850                 beforeEmitNode(node);
88851                 pipelineEmitWithHintWorker(hint, node);
88852                 afterEmitNode(savedPreserveSourceNewlines);
88853             }
88854             else {
88855                 pipelineEmitWithHintWorker(hint, node);
88856             }
88857             onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(node);
88858             currentParenthesizerRule = undefined;
88859         }
88860         function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
88861             if (allowSnippets === void 0) { allowSnippets = true; }
88862             if (allowSnippets) {
88863                 var snippet = ts.getSnippetElement(node);
88864                 if (snippet) {
88865                     return emitSnippetNode(hint, node, snippet);
88866                 }
88867             }
88868             if (hint === 0)
88869                 return emitSourceFile(ts.cast(node, ts.isSourceFile));
88870             if (hint === 2)
88871                 return emitIdentifier(ts.cast(node, ts.isIdentifier));
88872             if (hint === 6)
88873                 return emitLiteral(ts.cast(node, ts.isStringLiteral), true);
88874             if (hint === 3)
88875                 return emitMappedTypeParameter(ts.cast(node, ts.isTypeParameterDeclaration));
88876             if (hint === 5) {
88877                 ts.Debug.assertNode(node, ts.isEmptyStatement);
88878                 return emitEmptyStatement(true);
88879             }
88880             if (hint === 4) {
88881                 switch (node.kind) {
88882                     case 15:
88883                     case 16:
88884                     case 17:
88885                         return emitLiteral(node, false);
88886                     case 79:
88887                         return emitIdentifier(node);
88888                     case 80:
88889                         return emitPrivateIdentifier(node);
88890                     case 160:
88891                         return emitQualifiedName(node);
88892                     case 161:
88893                         return emitComputedPropertyName(node);
88894                     case 162:
88895                         return emitTypeParameter(node);
88896                     case 163:
88897                         return emitParameter(node);
88898                     case 164:
88899                         return emitDecorator(node);
88900                     case 165:
88901                         return emitPropertySignature(node);
88902                     case 166:
88903                         return emitPropertyDeclaration(node);
88904                     case 167:
88905                         return emitMethodSignature(node);
88906                     case 168:
88907                         return emitMethodDeclaration(node);
88908                     case 169:
88909                         return emitClassStaticBlockDeclaration(node);
88910                     case 170:
88911                         return emitConstructor(node);
88912                     case 171:
88913                     case 172:
88914                         return emitAccessorDeclaration(node);
88915                     case 173:
88916                         return emitCallSignature(node);
88917                     case 174:
88918                         return emitConstructSignature(node);
88919                     case 175:
88920                         return emitIndexSignature(node);
88921                     case 176:
88922                         return emitTypePredicate(node);
88923                     case 177:
88924                         return emitTypeReference(node);
88925                     case 178:
88926                         return emitFunctionType(node);
88927                     case 179:
88928                         return emitConstructorType(node);
88929                     case 180:
88930                         return emitTypeQuery(node);
88931                     case 181:
88932                         return emitTypeLiteral(node);
88933                     case 182:
88934                         return emitArrayType(node);
88935                     case 183:
88936                         return emitTupleType(node);
88937                     case 184:
88938                         return emitOptionalType(node);
88939                     case 186:
88940                         return emitUnionType(node);
88941                     case 187:
88942                         return emitIntersectionType(node);
88943                     case 188:
88944                         return emitConditionalType(node);
88945                     case 189:
88946                         return emitInferType(node);
88947                     case 190:
88948                         return emitParenthesizedType(node);
88949                     case 227:
88950                         return emitExpressionWithTypeArguments(node);
88951                     case 191:
88952                         return emitThisType();
88953                     case 192:
88954                         return emitTypeOperator(node);
88955                     case 193:
88956                         return emitIndexedAccessType(node);
88957                     case 194:
88958                         return emitMappedType(node);
88959                     case 195:
88960                         return emitLiteralType(node);
88961                     case 196:
88962                         return emitNamedTupleMember(node);
88963                     case 197:
88964                         return emitTemplateType(node);
88965                     case 198:
88966                         return emitTemplateTypeSpan(node);
88967                     case 199:
88968                         return emitImportTypeNode(node);
88969                     case 200:
88970                         return emitObjectBindingPattern(node);
88971                     case 201:
88972                         return emitArrayBindingPattern(node);
88973                     case 202:
88974                         return emitBindingElement(node);
88975                     case 232:
88976                         return emitTemplateSpan(node);
88977                     case 233:
88978                         return emitSemicolonClassElement();
88979                     case 234:
88980                         return emitBlock(node);
88981                     case 236:
88982                         return emitVariableStatement(node);
88983                     case 235:
88984                         return emitEmptyStatement(false);
88985                     case 237:
88986                         return emitExpressionStatement(node);
88987                     case 238:
88988                         return emitIfStatement(node);
88989                     case 239:
88990                         return emitDoStatement(node);
88991                     case 240:
88992                         return emitWhileStatement(node);
88993                     case 241:
88994                         return emitForStatement(node);
88995                     case 242:
88996                         return emitForInStatement(node);
88997                     case 243:
88998                         return emitForOfStatement(node);
88999                     case 244:
89000                         return emitContinueStatement(node);
89001                     case 245:
89002                         return emitBreakStatement(node);
89003                     case 246:
89004                         return emitReturnStatement(node);
89005                     case 247:
89006                         return emitWithStatement(node);
89007                     case 248:
89008                         return emitSwitchStatement(node);
89009                     case 249:
89010                         return emitLabeledStatement(node);
89011                     case 250:
89012                         return emitThrowStatement(node);
89013                     case 251:
89014                         return emitTryStatement(node);
89015                     case 252:
89016                         return emitDebuggerStatement(node);
89017                     case 253:
89018                         return emitVariableDeclaration(node);
89019                     case 254:
89020                         return emitVariableDeclarationList(node);
89021                     case 255:
89022                         return emitFunctionDeclaration(node);
89023                     case 256:
89024                         return emitClassDeclaration(node);
89025                     case 257:
89026                         return emitInterfaceDeclaration(node);
89027                     case 258:
89028                         return emitTypeAliasDeclaration(node);
89029                     case 259:
89030                         return emitEnumDeclaration(node);
89031                     case 260:
89032                         return emitModuleDeclaration(node);
89033                     case 261:
89034                         return emitModuleBlock(node);
89035                     case 262:
89036                         return emitCaseBlock(node);
89037                     case 263:
89038                         return emitNamespaceExportDeclaration(node);
89039                     case 264:
89040                         return emitImportEqualsDeclaration(node);
89041                     case 265:
89042                         return emitImportDeclaration(node);
89043                     case 266:
89044                         return emitImportClause(node);
89045                     case 267:
89046                         return emitNamespaceImport(node);
89047                     case 273:
89048                         return emitNamespaceExport(node);
89049                     case 268:
89050                         return emitNamedImports(node);
89051                     case 269:
89052                         return emitImportSpecifier(node);
89053                     case 270:
89054                         return emitExportAssignment(node);
89055                     case 271:
89056                         return emitExportDeclaration(node);
89057                     case 272:
89058                         return emitNamedExports(node);
89059                     case 274:
89060                         return emitExportSpecifier(node);
89061                     case 292:
89062                         return emitAssertClause(node);
89063                     case 293:
89064                         return emitAssertEntry(node);
89065                     case 275:
89066                         return;
89067                     case 276:
89068                         return emitExternalModuleReference(node);
89069                     case 11:
89070                         return emitJsxText(node);
89071                     case 279:
89072                     case 282:
89073                         return emitJsxOpeningElementOrFragment(node);
89074                     case 280:
89075                     case 283:
89076                         return emitJsxClosingElementOrFragment(node);
89077                     case 284:
89078                         return emitJsxAttribute(node);
89079                     case 285:
89080                         return emitJsxAttributes(node);
89081                     case 286:
89082                         return emitJsxSpreadAttribute(node);
89083                     case 287:
89084                         return emitJsxExpression(node);
89085                     case 288:
89086                         return emitCaseClause(node);
89087                     case 289:
89088                         return emitDefaultClause(node);
89089                     case 290:
89090                         return emitHeritageClause(node);
89091                     case 291:
89092                         return emitCatchClause(node);
89093                     case 294:
89094                         return emitPropertyAssignment(node);
89095                     case 295:
89096                         return emitShorthandPropertyAssignment(node);
89097                     case 296:
89098                         return emitSpreadAssignment(node);
89099                     case 297:
89100                         return emitEnumMember(node);
89101                     case 298:
89102                         return writeUnparsedNode(node);
89103                     case 305:
89104                     case 299:
89105                         return emitUnparsedSourceOrPrepend(node);
89106                     case 300:
89107                     case 301:
89108                         return emitUnparsedTextLike(node);
89109                     case 302:
89110                         return emitUnparsedSyntheticReference(node);
89111                     case 303:
89112                         return emitSourceFile(node);
89113                     case 304:
89114                         return ts.Debug.fail("Bundles should be printed using printBundle");
89115                     case 306:
89116                         return ts.Debug.fail("InputFiles should not be printed");
89117                     case 307:
89118                         return emitJSDocTypeExpression(node);
89119                     case 308:
89120                         return emitJSDocNameReference(node);
89121                     case 310:
89122                         return writePunctuation("*");
89123                     case 311:
89124                         return writePunctuation("?");
89125                     case 312:
89126                         return emitJSDocNullableType(node);
89127                     case 313:
89128                         return emitJSDocNonNullableType(node);
89129                     case 314:
89130                         return emitJSDocOptionalType(node);
89131                     case 315:
89132                         return emitJSDocFunctionType(node);
89133                     case 185:
89134                     case 316:
89135                         return emitRestOrJSDocVariadicType(node);
89136                     case 317:
89137                         return;
89138                     case 318:
89139                         return emitJSDoc(node);
89140                     case 320:
89141                         return emitJSDocTypeLiteral(node);
89142                     case 321:
89143                         return emitJSDocSignature(node);
89144                     case 325:
89145                     case 330:
89146                         return emitJSDocSimpleTag(node);
89147                     case 326:
89148                     case 327:
89149                         return emitJSDocHeritageTag(node);
89150                     case 328:
89151                     case 329:
89152                         return;
89153                     case 331:
89154                     case 332:
89155                     case 333:
89156                     case 334:
89157                     case 335:
89158                         return;
89159                     case 336:
89160                         return emitJSDocCallbackTag(node);
89161                     case 338:
89162                     case 345:
89163                         return emitJSDocPropertyLikeTag(node);
89164                     case 337:
89165                     case 339:
89166                     case 340:
89167                     case 341:
89168                         return emitJSDocSimpleTypedTag(node);
89169                     case 342:
89170                         return emitJSDocTemplateTag(node);
89171                     case 343:
89172                         return emitJSDocTypedefTag(node);
89173                     case 344:
89174                         return emitJSDocSeeTag(node);
89175                     case 347:
89176                     case 351:
89177                     case 350:
89178                         return;
89179                 }
89180                 if (ts.isExpression(node)) {
89181                     hint = 1;
89182                     if (substituteNode !== ts.noEmitSubstitution) {
89183                         var substitute = substituteNode(hint, node) || node;
89184                         if (substitute !== node) {
89185                             node = substitute;
89186                             if (currentParenthesizerRule) {
89187                                 node = currentParenthesizerRule(node);
89188                             }
89189                         }
89190                     }
89191                 }
89192             }
89193             if (hint === 1) {
89194                 switch (node.kind) {
89195                     case 8:
89196                     case 9:
89197                         return emitNumericOrBigIntLiteral(node);
89198                     case 10:
89199                     case 13:
89200                     case 14:
89201                         return emitLiteral(node, false);
89202                     case 79:
89203                         return emitIdentifier(node);
89204                     case 80:
89205                         return emitPrivateIdentifier(node);
89206                     case 203:
89207                         return emitArrayLiteralExpression(node);
89208                     case 204:
89209                         return emitObjectLiteralExpression(node);
89210                     case 205:
89211                         return emitPropertyAccessExpression(node);
89212                     case 206:
89213                         return emitElementAccessExpression(node);
89214                     case 207:
89215                         return emitCallExpression(node);
89216                     case 208:
89217                         return emitNewExpression(node);
89218                     case 209:
89219                         return emitTaggedTemplateExpression(node);
89220                     case 210:
89221                         return emitTypeAssertionExpression(node);
89222                     case 211:
89223                         return emitParenthesizedExpression(node);
89224                     case 212:
89225                         return emitFunctionExpression(node);
89226                     case 213:
89227                         return emitArrowFunction(node);
89228                     case 214:
89229                         return emitDeleteExpression(node);
89230                     case 215:
89231                         return emitTypeOfExpression(node);
89232                     case 216:
89233                         return emitVoidExpression(node);
89234                     case 217:
89235                         return emitAwaitExpression(node);
89236                     case 218:
89237                         return emitPrefixUnaryExpression(node);
89238                     case 219:
89239                         return emitPostfixUnaryExpression(node);
89240                     case 220:
89241                         return emitBinaryExpression(node);
89242                     case 221:
89243                         return emitConditionalExpression(node);
89244                     case 222:
89245                         return emitTemplateExpression(node);
89246                     case 223:
89247                         return emitYieldExpression(node);
89248                     case 224:
89249                         return emitSpreadElement(node);
89250                     case 225:
89251                         return emitClassExpression(node);
89252                     case 226:
89253                         return;
89254                     case 228:
89255                         return emitAsExpression(node);
89256                     case 229:
89257                         return emitNonNullExpression(node);
89258                     case 230:
89259                         return emitMetaProperty(node);
89260                     case 231:
89261                         return ts.Debug.fail("SyntheticExpression should never be printed.");
89262                     case 277:
89263                         return emitJsxElement(node);
89264                     case 278:
89265                         return emitJsxSelfClosingElement(node);
89266                     case 281:
89267                         return emitJsxFragment(node);
89268                     case 346:
89269                         return ts.Debug.fail("SyntaxList should not be printed");
89270                     case 347:
89271                         return;
89272                     case 348:
89273                         return emitPartiallyEmittedExpression(node);
89274                     case 349:
89275                         return emitCommaList(node);
89276                     case 350:
89277                     case 351:
89278                         return;
89279                     case 352:
89280                         return ts.Debug.fail("SyntheticReferenceExpression should not be printed");
89281                 }
89282             }
89283             if (ts.isKeyword(node.kind))
89284                 return writeTokenNode(node, writeKeyword);
89285             if (ts.isTokenKind(node.kind))
89286                 return writeTokenNode(node, writePunctuation);
89287             ts.Debug.fail("Unhandled SyntaxKind: ".concat(ts.Debug.formatSyntaxKind(node.kind), "."));
89288         }
89289         function emitMappedTypeParameter(node) {
89290             emit(node.name);
89291             writeSpace();
89292             writeKeyword("in");
89293             writeSpace();
89294             emit(node.constraint);
89295         }
89296         function pipelineEmitWithSubstitution(hint, node) {
89297             var pipelinePhase = getNextPipelinePhase(1, hint, node);
89298             ts.Debug.assertIsDefined(lastSubstitution);
89299             node = lastSubstitution;
89300             lastSubstitution = undefined;
89301             pipelinePhase(hint, node);
89302         }
89303         function getHelpersFromBundledSourceFiles(bundle) {
89304             var result;
89305             if (moduleKind === ts.ModuleKind.None || printerOptions.noEmitHelpers) {
89306                 return undefined;
89307             }
89308             var bundledHelpers = new ts.Map();
89309             for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) {
89310                 var sourceFile = _b[_a];
89311                 var shouldSkip = ts.getExternalHelpersModuleName(sourceFile) !== undefined;
89312                 var helpers = getSortedEmitHelpers(sourceFile);
89313                 if (!helpers)
89314                     continue;
89315                 for (var _c = 0, helpers_5 = helpers; _c < helpers_5.length; _c++) {
89316                     var helper = helpers_5[_c];
89317                     if (!helper.scoped && !shouldSkip && !bundledHelpers.get(helper.name)) {
89318                         bundledHelpers.set(helper.name, true);
89319                         (result || (result = [])).push(helper.name);
89320                     }
89321                 }
89322             }
89323             return result;
89324         }
89325         function emitHelpers(node) {
89326             var helpersEmitted = false;
89327             var bundle = node.kind === 304 ? node : undefined;
89328             if (bundle && moduleKind === ts.ModuleKind.None) {
89329                 return;
89330             }
89331             var numPrepends = bundle ? bundle.prepends.length : 0;
89332             var numNodes = bundle ? bundle.sourceFiles.length + numPrepends : 1;
89333             for (var i = 0; i < numNodes; i++) {
89334                 var currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
89335                 var sourceFile = ts.isSourceFile(currentNode) ? currentNode : ts.isUnparsedSource(currentNode) ? undefined : currentSourceFile;
89336                 var shouldSkip = printerOptions.noEmitHelpers || (!!sourceFile && ts.hasRecordedExternalHelpers(sourceFile));
89337                 var shouldBundle = (ts.isSourceFile(currentNode) || ts.isUnparsedSource(currentNode)) && !isOwnFileEmit;
89338                 var helpers = ts.isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
89339                 if (helpers) {
89340                     for (var _a = 0, helpers_6 = helpers; _a < helpers_6.length; _a++) {
89341                         var helper = helpers_6[_a];
89342                         if (!helper.scoped) {
89343                             if (shouldSkip)
89344                                 continue;
89345                             if (shouldBundle) {
89346                                 if (bundledHelpers.get(helper.name)) {
89347                                     continue;
89348                                 }
89349                                 bundledHelpers.set(helper.name, true);
89350                             }
89351                         }
89352                         else if (bundle) {
89353                             continue;
89354                         }
89355                         var pos = getTextPosWithWriteLine();
89356                         if (typeof helper.text === "string") {
89357                             writeLines(helper.text);
89358                         }
89359                         else {
89360                             writeLines(helper.text(makeFileLevelOptimisticUniqueName));
89361                         }
89362                         if (bundleFileInfo)
89363                             bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "emitHelpers", data: helper.name });
89364                         helpersEmitted = true;
89365                     }
89366                 }
89367             }
89368             return helpersEmitted;
89369         }
89370         function getSortedEmitHelpers(node) {
89371             var helpers = ts.getEmitHelpers(node);
89372             return helpers && ts.stableSort(helpers, ts.compareEmitHelpers);
89373         }
89374         function emitNumericOrBigIntLiteral(node) {
89375             emitLiteral(node, false);
89376         }
89377         function emitLiteral(node, jsxAttributeEscape) {
89378             var text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape);
89379             if ((printerOptions.sourceMap || printerOptions.inlineSourceMap)
89380                 && (node.kind === 10 || ts.isTemplateLiteralKind(node.kind))) {
89381                 writeLiteral(text);
89382             }
89383             else {
89384                 writeStringLiteral(text);
89385             }
89386         }
89387         function emitUnparsedSourceOrPrepend(unparsed) {
89388             for (var _a = 0, _b = unparsed.texts; _a < _b.length; _a++) {
89389                 var text = _b[_a];
89390                 writeLine();
89391                 emit(text);
89392             }
89393         }
89394         function writeUnparsedNode(unparsed) {
89395             writer.rawWrite(unparsed.parent.text.substring(unparsed.pos, unparsed.end));
89396         }
89397         function emitUnparsedTextLike(unparsed) {
89398             var pos = getTextPosWithWriteLine();
89399             writeUnparsedNode(unparsed);
89400             if (bundleFileInfo) {
89401                 updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 300 ?
89402                     "text" :
89403                     "internal");
89404             }
89405         }
89406         function emitUnparsedSyntheticReference(unparsed) {
89407             var pos = getTextPosWithWriteLine();
89408             writeUnparsedNode(unparsed);
89409             if (bundleFileInfo) {
89410                 var section = ts.clone(unparsed.section);
89411                 section.pos = pos;
89412                 section.end = writer.getTextPos();
89413                 bundleFileInfo.sections.push(section);
89414             }
89415         }
89416         function emitSnippetNode(hint, node, snippet) {
89417             switch (snippet.kind) {
89418                 case 1:
89419                     emitPlaceholder(hint, node, snippet);
89420                     break;
89421                 case 0:
89422                     emitTabStop(snippet);
89423                     break;
89424             }
89425         }
89426         function emitPlaceholder(hint, node, snippet) {
89427             nonEscapingWrite("${".concat(snippet.order, ":"));
89428             pipelineEmitWithHintWorker(hint, node, false);
89429             nonEscapingWrite("}");
89430         }
89431         function emitTabStop(snippet) {
89432             nonEscapingWrite("$".concat(snippet.order));
89433         }
89434         function emitIdentifier(node) {
89435             var writeText = node.symbol ? writeSymbol : write;
89436             writeText(getTextOfNode(node, false), node.symbol);
89437             emitList(node, node.typeArguments, 53776);
89438         }
89439         function emitPrivateIdentifier(node) {
89440             var writeText = node.symbol ? writeSymbol : write;
89441             writeText(getTextOfNode(node, false), node.symbol);
89442         }
89443         function emitQualifiedName(node) {
89444             emitEntityName(node.left);
89445             writePunctuation(".");
89446             emit(node.right);
89447         }
89448         function emitEntityName(node) {
89449             if (node.kind === 79) {
89450                 emitExpression(node);
89451             }
89452             else {
89453                 emit(node);
89454             }
89455         }
89456         function emitComputedPropertyName(node) {
89457             writePunctuation("[");
89458             emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfComputedPropertyName);
89459             writePunctuation("]");
89460         }
89461         function emitTypeParameter(node) {
89462             emit(node.name);
89463             if (node.constraint) {
89464                 writeSpace();
89465                 writeKeyword("extends");
89466                 writeSpace();
89467                 emit(node.constraint);
89468             }
89469             if (node.default) {
89470                 writeSpace();
89471                 writeOperator("=");
89472                 writeSpace();
89473                 emit(node.default);
89474             }
89475         }
89476         function emitParameter(node) {
89477             emitDecorators(node, node.decorators);
89478             emitModifiers(node, node.modifiers);
89479             emit(node.dotDotDotToken);
89480             emitNodeWithWriter(node.name, writeParameter);
89481             emit(node.questionToken);
89482             if (node.parent && node.parent.kind === 315 && !node.name) {
89483                 emit(node.type);
89484             }
89485             else {
89486                 emitTypeAnnotation(node.type);
89487             }
89488             emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.decorators ? node.decorators.end : node.pos, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
89489         }
89490         function emitDecorator(decorator) {
89491             writePunctuation("@");
89492             emitExpression(decorator.expression, parenthesizer.parenthesizeLeftSideOfAccess);
89493         }
89494         function emitPropertySignature(node) {
89495             emitDecorators(node, node.decorators);
89496             emitModifiers(node, node.modifiers);
89497             emitNodeWithWriter(node.name, writeProperty);
89498             emit(node.questionToken);
89499             emitTypeAnnotation(node.type);
89500             writeTrailingSemicolon();
89501         }
89502         function emitPropertyDeclaration(node) {
89503             emitDecorators(node, node.decorators);
89504             emitModifiers(node, node.modifiers);
89505             emit(node.name);
89506             emit(node.questionToken);
89507             emit(node.exclamationToken);
89508             emitTypeAnnotation(node.type);
89509             emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node);
89510             writeTrailingSemicolon();
89511         }
89512         function emitMethodSignature(node) {
89513             pushNameGenerationScope(node);
89514             emitDecorators(node, node.decorators);
89515             emitModifiers(node, node.modifiers);
89516             emit(node.name);
89517             emit(node.questionToken);
89518             emitTypeParameters(node, node.typeParameters);
89519             emitParameters(node, node.parameters);
89520             emitTypeAnnotation(node.type);
89521             writeTrailingSemicolon();
89522             popNameGenerationScope(node);
89523         }
89524         function emitMethodDeclaration(node) {
89525             emitDecorators(node, node.decorators);
89526             emitModifiers(node, node.modifiers);
89527             emit(node.asteriskToken);
89528             emit(node.name);
89529             emit(node.questionToken);
89530             emitSignatureAndBody(node, emitSignatureHead);
89531         }
89532         function emitClassStaticBlockDeclaration(node) {
89533             emitDecorators(node, node.decorators);
89534             emitModifiers(node, node.modifiers);
89535             writeKeyword("static");
89536             emitBlockFunctionBody(node.body);
89537         }
89538         function emitConstructor(node) {
89539             emitModifiers(node, node.modifiers);
89540             writeKeyword("constructor");
89541             emitSignatureAndBody(node, emitSignatureHead);
89542         }
89543         function emitAccessorDeclaration(node) {
89544             emitDecorators(node, node.decorators);
89545             emitModifiers(node, node.modifiers);
89546             writeKeyword(node.kind === 171 ? "get" : "set");
89547             writeSpace();
89548             emit(node.name);
89549             emitSignatureAndBody(node, emitSignatureHead);
89550         }
89551         function emitCallSignature(node) {
89552             pushNameGenerationScope(node);
89553             emitDecorators(node, node.decorators);
89554             emitModifiers(node, node.modifiers);
89555             emitTypeParameters(node, node.typeParameters);
89556             emitParameters(node, node.parameters);
89557             emitTypeAnnotation(node.type);
89558             writeTrailingSemicolon();
89559             popNameGenerationScope(node);
89560         }
89561         function emitConstructSignature(node) {
89562             pushNameGenerationScope(node);
89563             emitDecorators(node, node.decorators);
89564             emitModifiers(node, node.modifiers);
89565             writeKeyword("new");
89566             writeSpace();
89567             emitTypeParameters(node, node.typeParameters);
89568             emitParameters(node, node.parameters);
89569             emitTypeAnnotation(node.type);
89570             writeTrailingSemicolon();
89571             popNameGenerationScope(node);
89572         }
89573         function emitIndexSignature(node) {
89574             emitDecorators(node, node.decorators);
89575             emitModifiers(node, node.modifiers);
89576             emitParametersForIndexSignature(node, node.parameters);
89577             emitTypeAnnotation(node.type);
89578             writeTrailingSemicolon();
89579         }
89580         function emitTemplateTypeSpan(node) {
89581             emit(node.type);
89582             emit(node.literal);
89583         }
89584         function emitSemicolonClassElement() {
89585             writeTrailingSemicolon();
89586         }
89587         function emitTypePredicate(node) {
89588             if (node.assertsModifier) {
89589                 emit(node.assertsModifier);
89590                 writeSpace();
89591             }
89592             emit(node.parameterName);
89593             if (node.type) {
89594                 writeSpace();
89595                 writeKeyword("is");
89596                 writeSpace();
89597                 emit(node.type);
89598             }
89599         }
89600         function emitTypeReference(node) {
89601             emit(node.typeName);
89602             emitTypeArguments(node, node.typeArguments);
89603         }
89604         function emitFunctionType(node) {
89605             pushNameGenerationScope(node);
89606             emitTypeParameters(node, node.typeParameters);
89607             emitParametersForArrow(node, node.parameters);
89608             writeSpace();
89609             writePunctuation("=>");
89610             writeSpace();
89611             emit(node.type);
89612             popNameGenerationScope(node);
89613         }
89614         function emitJSDocFunctionType(node) {
89615             writeKeyword("function");
89616             emitParameters(node, node.parameters);
89617             writePunctuation(":");
89618             emit(node.type);
89619         }
89620         function emitJSDocNullableType(node) {
89621             writePunctuation("?");
89622             emit(node.type);
89623         }
89624         function emitJSDocNonNullableType(node) {
89625             writePunctuation("!");
89626             emit(node.type);
89627         }
89628         function emitJSDocOptionalType(node) {
89629             emit(node.type);
89630             writePunctuation("=");
89631         }
89632         function emitConstructorType(node) {
89633             pushNameGenerationScope(node);
89634             emitModifiers(node, node.modifiers);
89635             writeKeyword("new");
89636             writeSpace();
89637             emitTypeParameters(node, node.typeParameters);
89638             emitParameters(node, node.parameters);
89639             writeSpace();
89640             writePunctuation("=>");
89641             writeSpace();
89642             emit(node.type);
89643             popNameGenerationScope(node);
89644         }
89645         function emitTypeQuery(node) {
89646             writeKeyword("typeof");
89647             writeSpace();
89648             emit(node.exprName);
89649         }
89650         function emitTypeLiteral(node) {
89651             writePunctuation("{");
89652             var flags = ts.getEmitFlags(node) & 1 ? 768 : 32897;
89653             emitList(node, node.members, flags | 524288);
89654             writePunctuation("}");
89655         }
89656         function emitArrayType(node) {
89657             emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType);
89658             writePunctuation("[");
89659             writePunctuation("]");
89660         }
89661         function emitRestOrJSDocVariadicType(node) {
89662             writePunctuation("...");
89663             emit(node.type);
89664         }
89665         function emitTupleType(node) {
89666             emitTokenWithComment(22, node.pos, writePunctuation, node);
89667             var flags = ts.getEmitFlags(node) & 1 ? 528 : 657;
89668             emitList(node, node.elements, flags | 524288);
89669             emitTokenWithComment(23, node.elements.end, writePunctuation, node);
89670         }
89671         function emitNamedTupleMember(node) {
89672             emit(node.dotDotDotToken);
89673             emit(node.name);
89674             emit(node.questionToken);
89675             emitTokenWithComment(58, node.name.end, writePunctuation, node);
89676             writeSpace();
89677             emit(node.type);
89678         }
89679         function emitOptionalType(node) {
89680             emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType);
89681             writePunctuation("?");
89682         }
89683         function emitUnionType(node) {
89684             emitList(node, node.types, 516, parenthesizer.parenthesizeMemberOfElementType);
89685         }
89686         function emitIntersectionType(node) {
89687             emitList(node, node.types, 520, parenthesizer.parenthesizeMemberOfElementType);
89688         }
89689         function emitConditionalType(node) {
89690             emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType);
89691             writeSpace();
89692             writeKeyword("extends");
89693             writeSpace();
89694             emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType);
89695             writeSpace();
89696             writePunctuation("?");
89697             writeSpace();
89698             emit(node.trueType);
89699             writeSpace();
89700             writePunctuation(":");
89701             writeSpace();
89702             emit(node.falseType);
89703         }
89704         function emitInferType(node) {
89705             writeKeyword("infer");
89706             writeSpace();
89707             emit(node.typeParameter);
89708         }
89709         function emitParenthesizedType(node) {
89710             writePunctuation("(");
89711             emit(node.type);
89712             writePunctuation(")");
89713         }
89714         function emitThisType() {
89715             writeKeyword("this");
89716         }
89717         function emitTypeOperator(node) {
89718             writeTokenText(node.operator, writeKeyword);
89719             writeSpace();
89720             emit(node.type, parenthesizer.parenthesizeMemberOfElementType);
89721         }
89722         function emitIndexedAccessType(node) {
89723             emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType);
89724             writePunctuation("[");
89725             emit(node.indexType);
89726             writePunctuation("]");
89727         }
89728         function emitMappedType(node) {
89729             var emitFlags = ts.getEmitFlags(node);
89730             writePunctuation("{");
89731             if (emitFlags & 1) {
89732                 writeSpace();
89733             }
89734             else {
89735                 writeLine();
89736                 increaseIndent();
89737             }
89738             if (node.readonlyToken) {
89739                 emit(node.readonlyToken);
89740                 if (node.readonlyToken.kind !== 144) {
89741                     writeKeyword("readonly");
89742                 }
89743                 writeSpace();
89744             }
89745             writePunctuation("[");
89746             pipelineEmit(3, node.typeParameter);
89747             if (node.nameType) {
89748                 writeSpace();
89749                 writeKeyword("as");
89750                 writeSpace();
89751                 emit(node.nameType);
89752             }
89753             writePunctuation("]");
89754             if (node.questionToken) {
89755                 emit(node.questionToken);
89756                 if (node.questionToken.kind !== 57) {
89757                     writePunctuation("?");
89758                 }
89759             }
89760             writePunctuation(":");
89761             writeSpace();
89762             emit(node.type);
89763             writeTrailingSemicolon();
89764             if (emitFlags & 1) {
89765                 writeSpace();
89766             }
89767             else {
89768                 writeLine();
89769                 decreaseIndent();
89770             }
89771             writePunctuation("}");
89772         }
89773         function emitLiteralType(node) {
89774             emitExpression(node.literal);
89775         }
89776         function emitTemplateType(node) {
89777             emit(node.head);
89778             emitList(node, node.templateSpans, 262144);
89779         }
89780         function emitImportTypeNode(node) {
89781             if (node.isTypeOf) {
89782                 writeKeyword("typeof");
89783                 writeSpace();
89784             }
89785             writeKeyword("import");
89786             writePunctuation("(");
89787             emit(node.argument);
89788             writePunctuation(")");
89789             if (node.qualifier) {
89790                 writePunctuation(".");
89791                 emit(node.qualifier);
89792             }
89793             emitTypeArguments(node, node.typeArguments);
89794         }
89795         function emitObjectBindingPattern(node) {
89796             writePunctuation("{");
89797             emitList(node, node.elements, 525136);
89798             writePunctuation("}");
89799         }
89800         function emitArrayBindingPattern(node) {
89801             writePunctuation("[");
89802             emitList(node, node.elements, 524880);
89803             writePunctuation("]");
89804         }
89805         function emitBindingElement(node) {
89806             emit(node.dotDotDotToken);
89807             if (node.propertyName) {
89808                 emit(node.propertyName);
89809                 writePunctuation(":");
89810                 writeSpace();
89811             }
89812             emit(node.name);
89813             emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
89814         }
89815         function emitArrayLiteralExpression(node) {
89816             var elements = node.elements;
89817             var preferNewLine = node.multiLine ? 65536 : 0;
89818             emitExpressionList(node, elements, 8914 | preferNewLine, parenthesizer.parenthesizeExpressionForDisallowedComma);
89819         }
89820         function emitObjectLiteralExpression(node) {
89821             ts.forEach(node.properties, generateMemberNames);
89822             var indentedFlag = ts.getEmitFlags(node) & 65536;
89823             if (indentedFlag) {
89824                 increaseIndent();
89825             }
89826             var preferNewLine = node.multiLine ? 65536 : 0;
89827             var allowTrailingComma = currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 64 : 0;
89828             emitList(node, node.properties, 526226 | allowTrailingComma | preferNewLine);
89829             if (indentedFlag) {
89830                 decreaseIndent();
89831             }
89832         }
89833         function emitPropertyAccessExpression(node) {
89834             emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
89835             var token = node.questionDotToken || ts.setTextRangePosEnd(ts.factory.createToken(24), node.expression.end, node.name.pos);
89836             var linesBeforeDot = getLinesBetweenNodes(node, node.expression, token);
89837             var linesAfterDot = getLinesBetweenNodes(node, token, node.name);
89838             writeLinesAndIndent(linesBeforeDot, false);
89839             var shouldEmitDotDot = token.kind !== 28 &&
89840                 mayNeedDotDotForPropertyAccess(node.expression) &&
89841                 !writer.hasTrailingComment() &&
89842                 !writer.hasTrailingWhitespace();
89843             if (shouldEmitDotDot) {
89844                 writePunctuation(".");
89845             }
89846             if (node.questionDotToken) {
89847                 emit(token);
89848             }
89849             else {
89850                 emitTokenWithComment(token.kind, node.expression.end, writePunctuation, node);
89851             }
89852             writeLinesAndIndent(linesAfterDot, false);
89853             emit(node.name);
89854             decreaseIndentIf(linesBeforeDot, linesAfterDot);
89855         }
89856         function mayNeedDotDotForPropertyAccess(expression) {
89857             expression = ts.skipPartiallyEmittedExpressions(expression);
89858             if (ts.isNumericLiteral(expression)) {
89859                 var text = getLiteralTextOfNode(expression, true, false);
89860                 return !expression.numericLiteralFlags && !ts.stringContains(text, ts.tokenToString(24));
89861             }
89862             else if (ts.isAccessExpression(expression)) {
89863                 var constantValue = ts.getConstantValue(expression);
89864                 return typeof constantValue === "number" && isFinite(constantValue)
89865                     && Math.floor(constantValue) === constantValue;
89866             }
89867         }
89868         function emitElementAccessExpression(node) {
89869             emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
89870             emit(node.questionDotToken);
89871             emitTokenWithComment(22, node.expression.end, writePunctuation, node);
89872             emitExpression(node.argumentExpression);
89873             emitTokenWithComment(23, node.argumentExpression.end, writePunctuation, node);
89874         }
89875         function emitCallExpression(node) {
89876             var indirectCall = ts.getEmitFlags(node) & 536870912;
89877             if (indirectCall) {
89878                 writePunctuation("(");
89879                 writeLiteral("0");
89880                 writePunctuation(",");
89881                 writeSpace();
89882             }
89883             emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
89884             if (indirectCall) {
89885                 writePunctuation(")");
89886             }
89887             emit(node.questionDotToken);
89888             emitTypeArguments(node, node.typeArguments);
89889             emitExpressionList(node, node.arguments, 2576, parenthesizer.parenthesizeExpressionForDisallowedComma);
89890         }
89891         function emitNewExpression(node) {
89892             emitTokenWithComment(103, node.pos, writeKeyword, node);
89893             writeSpace();
89894             emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfNew);
89895             emitTypeArguments(node, node.typeArguments);
89896             emitExpressionList(node, node.arguments, 18960, parenthesizer.parenthesizeExpressionForDisallowedComma);
89897         }
89898         function emitTaggedTemplateExpression(node) {
89899             var indirectCall = ts.getEmitFlags(node) & 536870912;
89900             if (indirectCall) {
89901                 writePunctuation("(");
89902                 writeLiteral("0");
89903                 writePunctuation(",");
89904                 writeSpace();
89905             }
89906             emitExpression(node.tag, parenthesizer.parenthesizeLeftSideOfAccess);
89907             if (indirectCall) {
89908                 writePunctuation(")");
89909             }
89910             emitTypeArguments(node, node.typeArguments);
89911             writeSpace();
89912             emitExpression(node.template);
89913         }
89914         function emitTypeAssertionExpression(node) {
89915             writePunctuation("<");
89916             emit(node.type);
89917             writePunctuation(">");
89918             emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
89919         }
89920         function emitParenthesizedExpression(node) {
89921             var openParenPos = emitTokenWithComment(20, node.pos, writePunctuation, node);
89922             var indented = writeLineSeparatorsAndIndentBefore(node.expression, node);
89923             emitExpression(node.expression, undefined);
89924             writeLineSeparatorsAfter(node.expression, node);
89925             decreaseIndentIf(indented);
89926             emitTokenWithComment(21, node.expression ? node.expression.end : openParenPos, writePunctuation, node);
89927         }
89928         function emitFunctionExpression(node) {
89929             generateNameIfNeeded(node.name);
89930             emitFunctionDeclarationOrExpression(node);
89931         }
89932         function emitArrowFunction(node) {
89933             emitDecorators(node, node.decorators);
89934             emitModifiers(node, node.modifiers);
89935             emitSignatureAndBody(node, emitArrowFunctionHead);
89936         }
89937         function emitArrowFunctionHead(node) {
89938             emitTypeParameters(node, node.typeParameters);
89939             emitParametersForArrow(node, node.parameters);
89940             emitTypeAnnotation(node.type);
89941             writeSpace();
89942             emit(node.equalsGreaterThanToken);
89943         }
89944         function emitDeleteExpression(node) {
89945             emitTokenWithComment(89, node.pos, writeKeyword, node);
89946             writeSpace();
89947             emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
89948         }
89949         function emitTypeOfExpression(node) {
89950             emitTokenWithComment(112, node.pos, writeKeyword, node);
89951             writeSpace();
89952             emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
89953         }
89954         function emitVoidExpression(node) {
89955             emitTokenWithComment(114, node.pos, writeKeyword, node);
89956             writeSpace();
89957             emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
89958         }
89959         function emitAwaitExpression(node) {
89960             emitTokenWithComment(132, node.pos, writeKeyword, node);
89961             writeSpace();
89962             emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
89963         }
89964         function emitPrefixUnaryExpression(node) {
89965             writeTokenText(node.operator, writeOperator);
89966             if (shouldEmitWhitespaceBeforeOperand(node)) {
89967                 writeSpace();
89968             }
89969             emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPrefixUnary);
89970         }
89971         function shouldEmitWhitespaceBeforeOperand(node) {
89972             var operand = node.operand;
89973             return operand.kind === 218
89974                 && ((node.operator === 39 && (operand.operator === 39 || operand.operator === 45))
89975                     || (node.operator === 40 && (operand.operator === 40 || operand.operator === 46)));
89976         }
89977         function emitPostfixUnaryExpression(node) {
89978             emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary);
89979             writeTokenText(node.operator, writeOperator);
89980         }
89981         function createEmitBinaryExpression() {
89982             return ts.createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, undefined);
89983             function onEnter(node, state) {
89984                 if (state) {
89985                     state.stackIndex++;
89986                     state.preserveSourceNewlinesStack[state.stackIndex] = preserveSourceNewlines;
89987                     state.containerPosStack[state.stackIndex] = containerPos;
89988                     state.containerEndStack[state.stackIndex] = containerEnd;
89989                     state.declarationListContainerEndStack[state.stackIndex] = declarationListContainerEnd;
89990                     var emitComments_1 = state.shouldEmitCommentsStack[state.stackIndex] = shouldEmitComments(node);
89991                     var emitSourceMaps = state.shouldEmitSourceMapsStack[state.stackIndex] = shouldEmitSourceMaps(node);
89992                     onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(node);
89993                     if (emitComments_1)
89994                         emitCommentsBeforeNode(node);
89995                     if (emitSourceMaps)
89996                         emitSourceMapsBeforeNode(node);
89997                     beforeEmitNode(node);
89998                 }
89999                 else {
90000                     state = {
90001                         stackIndex: 0,
90002                         preserveSourceNewlinesStack: [undefined],
90003                         containerPosStack: [-1],
90004                         containerEndStack: [-1],
90005                         declarationListContainerEndStack: [-1],
90006                         shouldEmitCommentsStack: [false],
90007                         shouldEmitSourceMapsStack: [false],
90008                     };
90009                 }
90010                 return state;
90011             }
90012             function onLeft(next, _workArea, parent) {
90013                 return maybeEmitExpression(next, parent, "left");
90014             }
90015             function onOperator(operatorToken, _state, node) {
90016                 var isCommaOperator = operatorToken.kind !== 27;
90017                 var linesBeforeOperator = getLinesBetweenNodes(node, node.left, operatorToken);
90018                 var linesAfterOperator = getLinesBetweenNodes(node, operatorToken, node.right);
90019                 writeLinesAndIndent(linesBeforeOperator, isCommaOperator);
90020                 emitLeadingCommentsOfPosition(operatorToken.pos);
90021                 writeTokenNode(operatorToken, operatorToken.kind === 101 ? writeKeyword : writeOperator);
90022                 emitTrailingCommentsOfPosition(operatorToken.end, true);
90023                 writeLinesAndIndent(linesAfterOperator, true);
90024             }
90025             function onRight(next, _workArea, parent) {
90026                 return maybeEmitExpression(next, parent, "right");
90027             }
90028             function onExit(node, state) {
90029                 var linesBeforeOperator = getLinesBetweenNodes(node, node.left, node.operatorToken);
90030                 var linesAfterOperator = getLinesBetweenNodes(node, node.operatorToken, node.right);
90031                 decreaseIndentIf(linesBeforeOperator, linesAfterOperator);
90032                 if (state.stackIndex > 0) {
90033                     var savedPreserveSourceNewlines = state.preserveSourceNewlinesStack[state.stackIndex];
90034                     var savedContainerPos = state.containerPosStack[state.stackIndex];
90035                     var savedContainerEnd = state.containerEndStack[state.stackIndex];
90036                     var savedDeclarationListContainerEnd = state.declarationListContainerEndStack[state.stackIndex];
90037                     var shouldEmitComments_1 = state.shouldEmitCommentsStack[state.stackIndex];
90038                     var shouldEmitSourceMaps_1 = state.shouldEmitSourceMapsStack[state.stackIndex];
90039                     afterEmitNode(savedPreserveSourceNewlines);
90040                     if (shouldEmitSourceMaps_1)
90041                         emitSourceMapsAfterNode(node);
90042                     if (shouldEmitComments_1)
90043                         emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
90044                     onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(node);
90045                     state.stackIndex--;
90046                 }
90047             }
90048             function maybeEmitExpression(next, parent, side) {
90049                 var parenthesizerRule = side === "left" ?
90050                     parenthesizer.getParenthesizeLeftSideOfBinaryForOperator(parent.operatorToken.kind) :
90051                     parenthesizer.getParenthesizeRightSideOfBinaryForOperator(parent.operatorToken.kind);
90052                 var pipelinePhase = getPipelinePhase(0, 1, next);
90053                 if (pipelinePhase === pipelineEmitWithSubstitution) {
90054                     ts.Debug.assertIsDefined(lastSubstitution);
90055                     next = parenthesizerRule(ts.cast(lastSubstitution, ts.isExpression));
90056                     pipelinePhase = getNextPipelinePhase(1, 1, next);
90057                     lastSubstitution = undefined;
90058                 }
90059                 if (pipelinePhase === pipelineEmitWithComments ||
90060                     pipelinePhase === pipelineEmitWithSourceMaps ||
90061                     pipelinePhase === pipelineEmitWithHint) {
90062                     if (ts.isBinaryExpression(next)) {
90063                         return next;
90064                     }
90065                 }
90066                 currentParenthesizerRule = parenthesizerRule;
90067                 pipelinePhase(1, next);
90068             }
90069         }
90070         function emitConditionalExpression(node) {
90071             var linesBeforeQuestion = getLinesBetweenNodes(node, node.condition, node.questionToken);
90072             var linesAfterQuestion = getLinesBetweenNodes(node, node.questionToken, node.whenTrue);
90073             var linesBeforeColon = getLinesBetweenNodes(node, node.whenTrue, node.colonToken);
90074             var linesAfterColon = getLinesBetweenNodes(node, node.colonToken, node.whenFalse);
90075             emitExpression(node.condition, parenthesizer.parenthesizeConditionOfConditionalExpression);
90076             writeLinesAndIndent(linesBeforeQuestion, true);
90077             emit(node.questionToken);
90078             writeLinesAndIndent(linesAfterQuestion, true);
90079             emitExpression(node.whenTrue, parenthesizer.parenthesizeBranchOfConditionalExpression);
90080             decreaseIndentIf(linesBeforeQuestion, linesAfterQuestion);
90081             writeLinesAndIndent(linesBeforeColon, true);
90082             emit(node.colonToken);
90083             writeLinesAndIndent(linesAfterColon, true);
90084             emitExpression(node.whenFalse, parenthesizer.parenthesizeBranchOfConditionalExpression);
90085             decreaseIndentIf(linesBeforeColon, linesAfterColon);
90086         }
90087         function emitTemplateExpression(node) {
90088             emit(node.head);
90089             emitList(node, node.templateSpans, 262144);
90090         }
90091         function emitYieldExpression(node) {
90092             emitTokenWithComment(125, node.pos, writeKeyword, node);
90093             emit(node.asteriskToken);
90094             emitExpressionWithLeadingSpace(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
90095         }
90096         function emitSpreadElement(node) {
90097             emitTokenWithComment(25, node.pos, writePunctuation, node);
90098             emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
90099         }
90100         function emitClassExpression(node) {
90101             generateNameIfNeeded(node.name);
90102             emitClassDeclarationOrExpression(node);
90103         }
90104         function emitExpressionWithTypeArguments(node) {
90105             emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
90106             emitTypeArguments(node, node.typeArguments);
90107         }
90108         function emitAsExpression(node) {
90109             emitExpression(node.expression, undefined);
90110             if (node.type) {
90111                 writeSpace();
90112                 writeKeyword("as");
90113                 writeSpace();
90114                 emit(node.type);
90115             }
90116         }
90117         function emitNonNullExpression(node) {
90118             emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
90119             writeOperator("!");
90120         }
90121         function emitMetaProperty(node) {
90122             writeToken(node.keywordToken, node.pos, writePunctuation);
90123             writePunctuation(".");
90124             emit(node.name);
90125         }
90126         function emitTemplateSpan(node) {
90127             emitExpression(node.expression);
90128             emit(node.literal);
90129         }
90130         function emitBlock(node) {
90131             emitBlockStatements(node, !node.multiLine && isEmptyBlock(node));
90132         }
90133         function emitBlockStatements(node, forceSingleLine) {
90134             emitTokenWithComment(18, node.pos, writePunctuation, node);
90135             var format = forceSingleLine || ts.getEmitFlags(node) & 1 ? 768 : 129;
90136             emitList(node, node.statements, format);
90137             emitTokenWithComment(19, node.statements.end, writePunctuation, node, !!(format & 1));
90138         }
90139         function emitVariableStatement(node) {
90140             emitModifiers(node, node.modifiers);
90141             emit(node.declarationList);
90142             writeTrailingSemicolon();
90143         }
90144         function emitEmptyStatement(isEmbeddedStatement) {
90145             if (isEmbeddedStatement) {
90146                 writePunctuation(";");
90147             }
90148             else {
90149                 writeTrailingSemicolon();
90150             }
90151         }
90152         function emitExpressionStatement(node) {
90153             emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
90154             if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
90155                 writeTrailingSemicolon();
90156             }
90157         }
90158         function emitIfStatement(node) {
90159             var openParenPos = emitTokenWithComment(99, node.pos, writeKeyword, node);
90160             writeSpace();
90161             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90162             emitExpression(node.expression);
90163             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90164             emitEmbeddedStatement(node, node.thenStatement);
90165             if (node.elseStatement) {
90166                 writeLineOrSpace(node, node.thenStatement, node.elseStatement);
90167                 emitTokenWithComment(91, node.thenStatement.end, writeKeyword, node);
90168                 if (node.elseStatement.kind === 238) {
90169                     writeSpace();
90170                     emit(node.elseStatement);
90171                 }
90172                 else {
90173                     emitEmbeddedStatement(node, node.elseStatement);
90174                 }
90175             }
90176         }
90177         function emitWhileClause(node, startPos) {
90178             var openParenPos = emitTokenWithComment(115, startPos, writeKeyword, node);
90179             writeSpace();
90180             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90181             emitExpression(node.expression);
90182             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90183         }
90184         function emitDoStatement(node) {
90185             emitTokenWithComment(90, node.pos, writeKeyword, node);
90186             emitEmbeddedStatement(node, node.statement);
90187             if (ts.isBlock(node.statement) && !preserveSourceNewlines) {
90188                 writeSpace();
90189             }
90190             else {
90191                 writeLineOrSpace(node, node.statement, node.expression);
90192             }
90193             emitWhileClause(node, node.statement.end);
90194             writeTrailingSemicolon();
90195         }
90196         function emitWhileStatement(node) {
90197             emitWhileClause(node, node.pos);
90198             emitEmbeddedStatement(node, node.statement);
90199         }
90200         function emitForStatement(node) {
90201             var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node);
90202             writeSpace();
90203             var pos = emitTokenWithComment(20, openParenPos, writePunctuation, node);
90204             emitForBinding(node.initializer);
90205             pos = emitTokenWithComment(26, node.initializer ? node.initializer.end : pos, writePunctuation, node);
90206             emitExpressionWithLeadingSpace(node.condition);
90207             pos = emitTokenWithComment(26, node.condition ? node.condition.end : pos, writePunctuation, node);
90208             emitExpressionWithLeadingSpace(node.incrementor);
90209             emitTokenWithComment(21, node.incrementor ? node.incrementor.end : pos, writePunctuation, node);
90210             emitEmbeddedStatement(node, node.statement);
90211         }
90212         function emitForInStatement(node) {
90213             var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node);
90214             writeSpace();
90215             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90216             emitForBinding(node.initializer);
90217             writeSpace();
90218             emitTokenWithComment(101, node.initializer.end, writeKeyword, node);
90219             writeSpace();
90220             emitExpression(node.expression);
90221             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90222             emitEmbeddedStatement(node, node.statement);
90223         }
90224         function emitForOfStatement(node) {
90225             var openParenPos = emitTokenWithComment(97, node.pos, writeKeyword, node);
90226             writeSpace();
90227             emitWithTrailingSpace(node.awaitModifier);
90228             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90229             emitForBinding(node.initializer);
90230             writeSpace();
90231             emitTokenWithComment(159, node.initializer.end, writeKeyword, node);
90232             writeSpace();
90233             emitExpression(node.expression);
90234             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90235             emitEmbeddedStatement(node, node.statement);
90236         }
90237         function emitForBinding(node) {
90238             if (node !== undefined) {
90239                 if (node.kind === 254) {
90240                     emit(node);
90241                 }
90242                 else {
90243                     emitExpression(node);
90244                 }
90245             }
90246         }
90247         function emitContinueStatement(node) {
90248             emitTokenWithComment(86, node.pos, writeKeyword, node);
90249             emitWithLeadingSpace(node.label);
90250             writeTrailingSemicolon();
90251         }
90252         function emitBreakStatement(node) {
90253             emitTokenWithComment(81, node.pos, writeKeyword, node);
90254             emitWithLeadingSpace(node.label);
90255             writeTrailingSemicolon();
90256         }
90257         function emitTokenWithComment(token, pos, writer, contextNode, indentLeading) {
90258             var node = ts.getParseTreeNode(contextNode);
90259             var isSimilarNode = node && node.kind === contextNode.kind;
90260             var startPos = pos;
90261             if (isSimilarNode && currentSourceFile) {
90262                 pos = ts.skipTrivia(currentSourceFile.text, pos);
90263             }
90264             if (isSimilarNode && contextNode.pos !== startPos) {
90265                 var needsIndent = indentLeading && currentSourceFile && !ts.positionsAreOnSameLine(startPos, pos, currentSourceFile);
90266                 if (needsIndent) {
90267                     increaseIndent();
90268                 }
90269                 emitLeadingCommentsOfPosition(startPos);
90270                 if (needsIndent) {
90271                     decreaseIndent();
90272                 }
90273             }
90274             pos = writeTokenText(token, writer, pos);
90275             if (isSimilarNode && contextNode.end !== pos) {
90276                 var isJsxExprContext = contextNode.kind === 287;
90277                 emitTrailingCommentsOfPosition(pos, !isJsxExprContext, isJsxExprContext);
90278             }
90279             return pos;
90280         }
90281         function emitReturnStatement(node) {
90282             emitTokenWithComment(105, node.pos, writeKeyword, node);
90283             emitExpressionWithLeadingSpace(node.expression);
90284             writeTrailingSemicolon();
90285         }
90286         function emitWithStatement(node) {
90287             var openParenPos = emitTokenWithComment(116, node.pos, writeKeyword, node);
90288             writeSpace();
90289             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90290             emitExpression(node.expression);
90291             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90292             emitEmbeddedStatement(node, node.statement);
90293         }
90294         function emitSwitchStatement(node) {
90295             var openParenPos = emitTokenWithComment(107, node.pos, writeKeyword, node);
90296             writeSpace();
90297             emitTokenWithComment(20, openParenPos, writePunctuation, node);
90298             emitExpression(node.expression);
90299             emitTokenWithComment(21, node.expression.end, writePunctuation, node);
90300             writeSpace();
90301             emit(node.caseBlock);
90302         }
90303         function emitLabeledStatement(node) {
90304             emit(node.label);
90305             emitTokenWithComment(58, node.label.end, writePunctuation, node);
90306             writeSpace();
90307             emit(node.statement);
90308         }
90309         function emitThrowStatement(node) {
90310             emitTokenWithComment(109, node.pos, writeKeyword, node);
90311             emitExpressionWithLeadingSpace(node.expression);
90312             writeTrailingSemicolon();
90313         }
90314         function emitTryStatement(node) {
90315             emitTokenWithComment(111, node.pos, writeKeyword, node);
90316             writeSpace();
90317             emit(node.tryBlock);
90318             if (node.catchClause) {
90319                 writeLineOrSpace(node, node.tryBlock, node.catchClause);
90320                 emit(node.catchClause);
90321             }
90322             if (node.finallyBlock) {
90323                 writeLineOrSpace(node, node.catchClause || node.tryBlock, node.finallyBlock);
90324                 emitTokenWithComment(96, (node.catchClause || node.tryBlock).end, writeKeyword, node);
90325                 writeSpace();
90326                 emit(node.finallyBlock);
90327             }
90328         }
90329         function emitDebuggerStatement(node) {
90330             writeToken(87, node.pos, writeKeyword);
90331             writeTrailingSemicolon();
90332         }
90333         function emitVariableDeclaration(node) {
90334             emit(node.name);
90335             emit(node.exclamationToken);
90336             emitTypeAnnotation(node.type);
90337             emitInitializer(node.initializer, node.type ? node.type.end : node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
90338         }
90339         function emitVariableDeclarationList(node) {
90340             writeKeyword(ts.isLet(node) ? "let" : ts.isVarConst(node) ? "const" : "var");
90341             writeSpace();
90342             emitList(node, node.declarations, 528);
90343         }
90344         function emitFunctionDeclaration(node) {
90345             emitFunctionDeclarationOrExpression(node);
90346         }
90347         function emitFunctionDeclarationOrExpression(node) {
90348             emitDecorators(node, node.decorators);
90349             emitModifiers(node, node.modifiers);
90350             writeKeyword("function");
90351             emit(node.asteriskToken);
90352             writeSpace();
90353             emitIdentifierName(node.name);
90354             emitSignatureAndBody(node, emitSignatureHead);
90355         }
90356         function emitSignatureAndBody(node, emitSignatureHead) {
90357             var body = node.body;
90358             if (body) {
90359                 if (ts.isBlock(body)) {
90360                     var indentedFlag = ts.getEmitFlags(node) & 65536;
90361                     if (indentedFlag) {
90362                         increaseIndent();
90363                     }
90364                     pushNameGenerationScope(node);
90365                     ts.forEach(node.parameters, generateNames);
90366                     generateNames(node.body);
90367                     emitSignatureHead(node);
90368                     emitBlockFunctionBody(body);
90369                     popNameGenerationScope(node);
90370                     if (indentedFlag) {
90371                         decreaseIndent();
90372                     }
90373                 }
90374                 else {
90375                     emitSignatureHead(node);
90376                     writeSpace();
90377                     emitExpression(body, parenthesizer.parenthesizeConciseBodyOfArrowFunction);
90378                 }
90379             }
90380             else {
90381                 emitSignatureHead(node);
90382                 writeTrailingSemicolon();
90383             }
90384         }
90385         function emitSignatureHead(node) {
90386             emitTypeParameters(node, node.typeParameters);
90387             emitParameters(node, node.parameters);
90388             emitTypeAnnotation(node.type);
90389         }
90390         function shouldEmitBlockFunctionBodyOnSingleLine(body) {
90391             if (ts.getEmitFlags(body) & 1) {
90392                 return true;
90393             }
90394             if (body.multiLine) {
90395                 return false;
90396             }
90397             if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
90398                 return false;
90399             }
90400             if (getLeadingLineTerminatorCount(body, body.statements, 2)
90401                 || getClosingLineTerminatorCount(body, body.statements, 2)) {
90402                 return false;
90403             }
90404             var previousStatement;
90405             for (var _a = 0, _b = body.statements; _a < _b.length; _a++) {
90406                 var statement = _b[_a];
90407                 if (getSeparatingLineTerminatorCount(previousStatement, statement, 2) > 0) {
90408                     return false;
90409                 }
90410                 previousStatement = statement;
90411             }
90412             return true;
90413         }
90414         function emitBlockFunctionBody(body) {
90415             onBeforeEmitNode === null || onBeforeEmitNode === void 0 ? void 0 : onBeforeEmitNode(body);
90416             writeSpace();
90417             writePunctuation("{");
90418             increaseIndent();
90419             var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
90420                 ? emitBlockFunctionBodyOnSingleLine
90421                 : emitBlockFunctionBodyWorker;
90422             if (emitBodyWithDetachedComments) {
90423                 emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
90424             }
90425             else {
90426                 emitBlockFunctionBody(body);
90427             }
90428             decreaseIndent();
90429             writeToken(19, body.statements.end, writePunctuation, body);
90430             onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
90431         }
90432         function emitBlockFunctionBodyOnSingleLine(body) {
90433             emitBlockFunctionBodyWorker(body, true);
90434         }
90435         function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) {
90436             var statementOffset = emitPrologueDirectives(body.statements);
90437             var pos = writer.getTextPos();
90438             emitHelpers(body);
90439             if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) {
90440                 decreaseIndent();
90441                 emitList(body, body.statements, 768);
90442                 increaseIndent();
90443             }
90444             else {
90445                 emitList(body, body.statements, 1, undefined, statementOffset);
90446             }
90447         }
90448         function emitClassDeclaration(node) {
90449             emitClassDeclarationOrExpression(node);
90450         }
90451         function emitClassDeclarationOrExpression(node) {
90452             ts.forEach(node.members, generateMemberNames);
90453             emitDecorators(node, node.decorators);
90454             emitModifiers(node, node.modifiers);
90455             writeKeyword("class");
90456             if (node.name) {
90457                 writeSpace();
90458                 emitIdentifierName(node.name);
90459             }
90460             var indentedFlag = ts.getEmitFlags(node) & 65536;
90461             if (indentedFlag) {
90462                 increaseIndent();
90463             }
90464             emitTypeParameters(node, node.typeParameters);
90465             emitList(node, node.heritageClauses, 0);
90466             writeSpace();
90467             writePunctuation("{");
90468             emitList(node, node.members, 129);
90469             writePunctuation("}");
90470             if (indentedFlag) {
90471                 decreaseIndent();
90472             }
90473         }
90474         function emitInterfaceDeclaration(node) {
90475             emitDecorators(node, node.decorators);
90476             emitModifiers(node, node.modifiers);
90477             writeKeyword("interface");
90478             writeSpace();
90479             emit(node.name);
90480             emitTypeParameters(node, node.typeParameters);
90481             emitList(node, node.heritageClauses, 512);
90482             writeSpace();
90483             writePunctuation("{");
90484             emitList(node, node.members, 129);
90485             writePunctuation("}");
90486         }
90487         function emitTypeAliasDeclaration(node) {
90488             emitDecorators(node, node.decorators);
90489             emitModifiers(node, node.modifiers);
90490             writeKeyword("type");
90491             writeSpace();
90492             emit(node.name);
90493             emitTypeParameters(node, node.typeParameters);
90494             writeSpace();
90495             writePunctuation("=");
90496             writeSpace();
90497             emit(node.type);
90498             writeTrailingSemicolon();
90499         }
90500         function emitEnumDeclaration(node) {
90501             emitModifiers(node, node.modifiers);
90502             writeKeyword("enum");
90503             writeSpace();
90504             emit(node.name);
90505             writeSpace();
90506             writePunctuation("{");
90507             emitList(node, node.members, 145);
90508             writePunctuation("}");
90509         }
90510         function emitModuleDeclaration(node) {
90511             emitModifiers(node, node.modifiers);
90512             if (~node.flags & 1024) {
90513                 writeKeyword(node.flags & 16 ? "namespace" : "module");
90514                 writeSpace();
90515             }
90516             emit(node.name);
90517             var body = node.body;
90518             if (!body)
90519                 return writeTrailingSemicolon();
90520             while (body && ts.isModuleDeclaration(body)) {
90521                 writePunctuation(".");
90522                 emit(body.name);
90523                 body = body.body;
90524             }
90525             writeSpace();
90526             emit(body);
90527         }
90528         function emitModuleBlock(node) {
90529             pushNameGenerationScope(node);
90530             ts.forEach(node.statements, generateNames);
90531             emitBlockStatements(node, isEmptyBlock(node));
90532             popNameGenerationScope(node);
90533         }
90534         function emitCaseBlock(node) {
90535             emitTokenWithComment(18, node.pos, writePunctuation, node);
90536             emitList(node, node.clauses, 129);
90537             emitTokenWithComment(19, node.clauses.end, writePunctuation, node, true);
90538         }
90539         function emitImportEqualsDeclaration(node) {
90540             emitModifiers(node, node.modifiers);
90541             emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
90542             writeSpace();
90543             if (node.isTypeOnly) {
90544                 emitTokenWithComment(151, node.pos, writeKeyword, node);
90545                 writeSpace();
90546             }
90547             emit(node.name);
90548             writeSpace();
90549             emitTokenWithComment(63, node.name.end, writePunctuation, node);
90550             writeSpace();
90551             emitModuleReference(node.moduleReference);
90552             writeTrailingSemicolon();
90553         }
90554         function emitModuleReference(node) {
90555             if (node.kind === 79) {
90556                 emitExpression(node);
90557             }
90558             else {
90559                 emit(node);
90560             }
90561         }
90562         function emitImportDeclaration(node) {
90563             emitModifiers(node, node.modifiers);
90564             emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
90565             writeSpace();
90566             if (node.importClause) {
90567                 emit(node.importClause);
90568                 writeSpace();
90569                 emitTokenWithComment(155, node.importClause.end, writeKeyword, node);
90570                 writeSpace();
90571             }
90572             emitExpression(node.moduleSpecifier);
90573             if (node.assertClause) {
90574                 emitWithLeadingSpace(node.assertClause);
90575             }
90576             writeTrailingSemicolon();
90577         }
90578         function emitImportClause(node) {
90579             if (node.isTypeOnly) {
90580                 emitTokenWithComment(151, node.pos, writeKeyword, node);
90581                 writeSpace();
90582             }
90583             emit(node.name);
90584             if (node.name && node.namedBindings) {
90585                 emitTokenWithComment(27, node.name.end, writePunctuation, node);
90586                 writeSpace();
90587             }
90588             emit(node.namedBindings);
90589         }
90590         function emitNamespaceImport(node) {
90591             var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node);
90592             writeSpace();
90593             emitTokenWithComment(127, asPos, writeKeyword, node);
90594             writeSpace();
90595             emit(node.name);
90596         }
90597         function emitNamedImports(node) {
90598             emitNamedImportsOrExports(node);
90599         }
90600         function emitImportSpecifier(node) {
90601             emitImportOrExportSpecifier(node);
90602         }
90603         function emitExportAssignment(node) {
90604             var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node);
90605             writeSpace();
90606             if (node.isExportEquals) {
90607                 emitTokenWithComment(63, nextPos, writeOperator, node);
90608             }
90609             else {
90610                 emitTokenWithComment(88, nextPos, writeKeyword, node);
90611             }
90612             writeSpace();
90613             emitExpression(node.expression, node.isExportEquals ?
90614                 parenthesizer.getParenthesizeRightSideOfBinaryForOperator(63) :
90615                 parenthesizer.parenthesizeExpressionOfExportDefault);
90616             writeTrailingSemicolon();
90617         }
90618         function emitExportDeclaration(node) {
90619             var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node);
90620             writeSpace();
90621             if (node.isTypeOnly) {
90622                 nextPos = emitTokenWithComment(151, nextPos, writeKeyword, node);
90623                 writeSpace();
90624             }
90625             if (node.exportClause) {
90626                 emit(node.exportClause);
90627             }
90628             else {
90629                 nextPos = emitTokenWithComment(41, nextPos, writePunctuation, node);
90630             }
90631             if (node.moduleSpecifier) {
90632                 writeSpace();
90633                 var fromPos = node.exportClause ? node.exportClause.end : nextPos;
90634                 emitTokenWithComment(155, fromPos, writeKeyword, node);
90635                 writeSpace();
90636                 emitExpression(node.moduleSpecifier);
90637             }
90638             if (node.assertClause) {
90639                 emitWithLeadingSpace(node.assertClause);
90640             }
90641             writeTrailingSemicolon();
90642         }
90643         function emitAssertClause(node) {
90644             emitTokenWithComment(129, node.pos, writeKeyword, node);
90645             writeSpace();
90646             var elements = node.elements;
90647             emitList(node, elements, 526226);
90648         }
90649         function emitAssertEntry(node) {
90650             emit(node.name);
90651             writePunctuation(":");
90652             writeSpace();
90653             var value = node.value;
90654             if ((ts.getEmitFlags(value) & 512) === 0) {
90655                 var commentRange = ts.getCommentRange(value);
90656                 emitTrailingCommentsOfPosition(commentRange.pos);
90657             }
90658             emit(value);
90659         }
90660         function emitNamespaceExportDeclaration(node) {
90661             var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node);
90662             writeSpace();
90663             nextPos = emitTokenWithComment(127, nextPos, writeKeyword, node);
90664             writeSpace();
90665             nextPos = emitTokenWithComment(142, nextPos, writeKeyword, node);
90666             writeSpace();
90667             emit(node.name);
90668             writeTrailingSemicolon();
90669         }
90670         function emitNamespaceExport(node) {
90671             var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node);
90672             writeSpace();
90673             emitTokenWithComment(127, asPos, writeKeyword, node);
90674             writeSpace();
90675             emit(node.name);
90676         }
90677         function emitNamedExports(node) {
90678             emitNamedImportsOrExports(node);
90679         }
90680         function emitExportSpecifier(node) {
90681             emitImportOrExportSpecifier(node);
90682         }
90683         function emitNamedImportsOrExports(node) {
90684             writePunctuation("{");
90685             emitList(node, node.elements, 525136);
90686             writePunctuation("}");
90687         }
90688         function emitImportOrExportSpecifier(node) {
90689             if (node.isTypeOnly) {
90690                 writeKeyword("type");
90691                 writeSpace();
90692             }
90693             if (node.propertyName) {
90694                 emit(node.propertyName);
90695                 writeSpace();
90696                 emitTokenWithComment(127, node.propertyName.end, writeKeyword, node);
90697                 writeSpace();
90698             }
90699             emit(node.name);
90700         }
90701         function emitExternalModuleReference(node) {
90702             writeKeyword("require");
90703             writePunctuation("(");
90704             emitExpression(node.expression);
90705             writePunctuation(")");
90706         }
90707         function emitJsxElement(node) {
90708             emit(node.openingElement);
90709             emitList(node, node.children, 262144);
90710             emit(node.closingElement);
90711         }
90712         function emitJsxSelfClosingElement(node) {
90713             writePunctuation("<");
90714             emitJsxTagName(node.tagName);
90715             emitTypeArguments(node, node.typeArguments);
90716             writeSpace();
90717             emit(node.attributes);
90718             writePunctuation("/>");
90719         }
90720         function emitJsxFragment(node) {
90721             emit(node.openingFragment);
90722             emitList(node, node.children, 262144);
90723             emit(node.closingFragment);
90724         }
90725         function emitJsxOpeningElementOrFragment(node) {
90726             writePunctuation("<");
90727             if (ts.isJsxOpeningElement(node)) {
90728                 var indented = writeLineSeparatorsAndIndentBefore(node.tagName, node);
90729                 emitJsxTagName(node.tagName);
90730                 emitTypeArguments(node, node.typeArguments);
90731                 if (node.attributes.properties && node.attributes.properties.length > 0) {
90732                     writeSpace();
90733                 }
90734                 emit(node.attributes);
90735                 writeLineSeparatorsAfter(node.attributes, node);
90736                 decreaseIndentIf(indented);
90737             }
90738             writePunctuation(">");
90739         }
90740         function emitJsxText(node) {
90741             writer.writeLiteral(node.text);
90742         }
90743         function emitJsxClosingElementOrFragment(node) {
90744             writePunctuation("</");
90745             if (ts.isJsxClosingElement(node)) {
90746                 emitJsxTagName(node.tagName);
90747             }
90748             writePunctuation(">");
90749         }
90750         function emitJsxAttributes(node) {
90751             emitList(node, node.properties, 262656);
90752         }
90753         function emitJsxAttribute(node) {
90754             emit(node.name);
90755             emitNodeWithPrefix("=", writePunctuation, node.initializer, emitJsxAttributeValue);
90756         }
90757         function emitJsxSpreadAttribute(node) {
90758             writePunctuation("{...");
90759             emitExpression(node.expression);
90760             writePunctuation("}");
90761         }
90762         function hasTrailingCommentsAtPosition(pos) {
90763             var result = false;
90764             ts.forEachTrailingCommentRange((currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.text) || "", pos + 1, function () { return result = true; });
90765             return result;
90766         }
90767         function hasLeadingCommentsAtPosition(pos) {
90768             var result = false;
90769             ts.forEachLeadingCommentRange((currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.text) || "", pos + 1, function () { return result = true; });
90770             return result;
90771         }
90772         function hasCommentsAtPosition(pos) {
90773             return hasTrailingCommentsAtPosition(pos) || hasLeadingCommentsAtPosition(pos);
90774         }
90775         function emitJsxExpression(node) {
90776             var _a;
90777             if (node.expression || (!commentsDisabled && !ts.nodeIsSynthesized(node) && hasCommentsAtPosition(node.pos))) {
90778                 var isMultiline = currentSourceFile && !ts.nodeIsSynthesized(node) && ts.getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== ts.getLineAndCharacterOfPosition(currentSourceFile, node.end).line;
90779                 if (isMultiline) {
90780                     writer.increaseIndent();
90781                 }
90782                 var end = emitTokenWithComment(18, node.pos, writePunctuation, node);
90783                 emit(node.dotDotDotToken);
90784                 emitExpression(node.expression);
90785                 emitTokenWithComment(19, ((_a = node.expression) === null || _a === void 0 ? void 0 : _a.end) || end, writePunctuation, node);
90786                 if (isMultiline) {
90787                     writer.decreaseIndent();
90788                 }
90789             }
90790         }
90791         function emitJsxTagName(node) {
90792             if (node.kind === 79) {
90793                 emitExpression(node);
90794             }
90795             else {
90796                 emit(node);
90797             }
90798         }
90799         function emitCaseClause(node) {
90800             emitTokenWithComment(82, node.pos, writeKeyword, node);
90801             writeSpace();
90802             emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
90803             emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
90804         }
90805         function emitDefaultClause(node) {
90806             var pos = emitTokenWithComment(88, node.pos, writeKeyword, node);
90807             emitCaseOrDefaultClauseRest(node, node.statements, pos);
90808         }
90809         function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
90810             var emitAsSingleStatement = statements.length === 1 &&
90811                 (ts.nodeIsSynthesized(parentNode) ||
90812                     ts.nodeIsSynthesized(statements[0]) ||
90813                     ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
90814             var format = 163969;
90815             if (emitAsSingleStatement) {
90816                 writeToken(58, colonPos, writePunctuation, parentNode);
90817                 writeSpace();
90818                 format &= ~(1 | 128);
90819             }
90820             else {
90821                 emitTokenWithComment(58, colonPos, writePunctuation, parentNode);
90822             }
90823             emitList(parentNode, statements, format);
90824         }
90825         function emitHeritageClause(node) {
90826             writeSpace();
90827             writeTokenText(node.token, writeKeyword);
90828             writeSpace();
90829             emitList(node, node.types, 528);
90830         }
90831         function emitCatchClause(node) {
90832             var openParenPos = emitTokenWithComment(83, node.pos, writeKeyword, node);
90833             writeSpace();
90834             if (node.variableDeclaration) {
90835                 emitTokenWithComment(20, openParenPos, writePunctuation, node);
90836                 emit(node.variableDeclaration);
90837                 emitTokenWithComment(21, node.variableDeclaration.end, writePunctuation, node);
90838                 writeSpace();
90839             }
90840             emit(node.block);
90841         }
90842         function emitPropertyAssignment(node) {
90843             emit(node.name);
90844             writePunctuation(":");
90845             writeSpace();
90846             var initializer = node.initializer;
90847             if ((ts.getEmitFlags(initializer) & 512) === 0) {
90848                 var commentRange = ts.getCommentRange(initializer);
90849                 emitTrailingCommentsOfPosition(commentRange.pos);
90850             }
90851             emitExpression(initializer, parenthesizer.parenthesizeExpressionForDisallowedComma);
90852         }
90853         function emitShorthandPropertyAssignment(node) {
90854             emit(node.name);
90855             if (node.objectAssignmentInitializer) {
90856                 writeSpace();
90857                 writePunctuation("=");
90858                 writeSpace();
90859                 emitExpression(node.objectAssignmentInitializer, parenthesizer.parenthesizeExpressionForDisallowedComma);
90860             }
90861         }
90862         function emitSpreadAssignment(node) {
90863             if (node.expression) {
90864                 emitTokenWithComment(25, node.pos, writePunctuation, node);
90865                 emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
90866             }
90867         }
90868         function emitEnumMember(node) {
90869             emit(node.name);
90870             emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
90871         }
90872         function emitJSDoc(node) {
90873             write("/**");
90874             if (node.comment) {
90875                 var text = ts.getTextOfJSDocComment(node.comment);
90876                 if (text) {
90877                     var lines = text.split(/\r\n?|\n/g);
90878                     for (var _a = 0, lines_2 = lines; _a < lines_2.length; _a++) {
90879                         var line = lines_2[_a];
90880                         writeLine();
90881                         writeSpace();
90882                         writePunctuation("*");
90883                         writeSpace();
90884                         write(line);
90885                     }
90886                 }
90887             }
90888             if (node.tags) {
90889                 if (node.tags.length === 1 && node.tags[0].kind === 341 && !node.comment) {
90890                     writeSpace();
90891                     emit(node.tags[0]);
90892                 }
90893                 else {
90894                     emitList(node, node.tags, 33);
90895                 }
90896             }
90897             writeSpace();
90898             write("*/");
90899         }
90900         function emitJSDocSimpleTypedTag(tag) {
90901             emitJSDocTagName(tag.tagName);
90902             emitJSDocTypeExpression(tag.typeExpression);
90903             emitJSDocComment(tag.comment);
90904         }
90905         function emitJSDocSeeTag(tag) {
90906             emitJSDocTagName(tag.tagName);
90907             emit(tag.name);
90908             emitJSDocComment(tag.comment);
90909         }
90910         function emitJSDocNameReference(node) {
90911             writeSpace();
90912             writePunctuation("{");
90913             emit(node.name);
90914             writePunctuation("}");
90915         }
90916         function emitJSDocHeritageTag(tag) {
90917             emitJSDocTagName(tag.tagName);
90918             writeSpace();
90919             writePunctuation("{");
90920             emit(tag.class);
90921             writePunctuation("}");
90922             emitJSDocComment(tag.comment);
90923         }
90924         function emitJSDocTemplateTag(tag) {
90925             emitJSDocTagName(tag.tagName);
90926             emitJSDocTypeExpression(tag.constraint);
90927             writeSpace();
90928             emitList(tag, tag.typeParameters, 528);
90929             emitJSDocComment(tag.comment);
90930         }
90931         function emitJSDocTypedefTag(tag) {
90932             emitJSDocTagName(tag.tagName);
90933             if (tag.typeExpression) {
90934                 if (tag.typeExpression.kind === 307) {
90935                     emitJSDocTypeExpression(tag.typeExpression);
90936                 }
90937                 else {
90938                     writeSpace();
90939                     writePunctuation("{");
90940                     write("Object");
90941                     if (tag.typeExpression.isArrayType) {
90942                         writePunctuation("[");
90943                         writePunctuation("]");
90944                     }
90945                     writePunctuation("}");
90946                 }
90947             }
90948             if (tag.fullName) {
90949                 writeSpace();
90950                 emit(tag.fullName);
90951             }
90952             emitJSDocComment(tag.comment);
90953             if (tag.typeExpression && tag.typeExpression.kind === 320) {
90954                 emitJSDocTypeLiteral(tag.typeExpression);
90955             }
90956         }
90957         function emitJSDocCallbackTag(tag) {
90958             emitJSDocTagName(tag.tagName);
90959             if (tag.name) {
90960                 writeSpace();
90961                 emit(tag.name);
90962             }
90963             emitJSDocComment(tag.comment);
90964             emitJSDocSignature(tag.typeExpression);
90965         }
90966         function emitJSDocSimpleTag(tag) {
90967             emitJSDocTagName(tag.tagName);
90968             emitJSDocComment(tag.comment);
90969         }
90970         function emitJSDocTypeLiteral(lit) {
90971             emitList(lit, ts.factory.createNodeArray(lit.jsDocPropertyTags), 33);
90972         }
90973         function emitJSDocSignature(sig) {
90974             if (sig.typeParameters) {
90975                 emitList(sig, ts.factory.createNodeArray(sig.typeParameters), 33);
90976             }
90977             if (sig.parameters) {
90978                 emitList(sig, ts.factory.createNodeArray(sig.parameters), 33);
90979             }
90980             if (sig.type) {
90981                 writeLine();
90982                 writeSpace();
90983                 writePunctuation("*");
90984                 writeSpace();
90985                 emit(sig.type);
90986             }
90987         }
90988         function emitJSDocPropertyLikeTag(param) {
90989             emitJSDocTagName(param.tagName);
90990             emitJSDocTypeExpression(param.typeExpression);
90991             writeSpace();
90992             if (param.isBracketed) {
90993                 writePunctuation("[");
90994             }
90995             emit(param.name);
90996             if (param.isBracketed) {
90997                 writePunctuation("]");
90998             }
90999             emitJSDocComment(param.comment);
91000         }
91001         function emitJSDocTagName(tagName) {
91002             writePunctuation("@");
91003             emit(tagName);
91004         }
91005         function emitJSDocComment(comment) {
91006             var text = ts.getTextOfJSDocComment(comment);
91007             if (text) {
91008                 writeSpace();
91009                 write(text);
91010             }
91011         }
91012         function emitJSDocTypeExpression(typeExpression) {
91013             if (typeExpression) {
91014                 writeSpace();
91015                 writePunctuation("{");
91016                 emit(typeExpression.type);
91017                 writePunctuation("}");
91018             }
91019         }
91020         function emitSourceFile(node) {
91021             writeLine();
91022             var statements = node.statements;
91023             if (emitBodyWithDetachedComments) {
91024                 var shouldEmitDetachedComment = statements.length === 0 ||
91025                     !ts.isPrologueDirective(statements[0]) ||
91026                     ts.nodeIsSynthesized(statements[0]);
91027                 if (shouldEmitDetachedComment) {
91028                     emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
91029                     return;
91030                 }
91031             }
91032             emitSourceFileWorker(node);
91033         }
91034         function emitSyntheticTripleSlashReferencesIfNeeded(node) {
91035             emitTripleSlashDirectives(!!node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []);
91036             for (var _a = 0, _b = node.prepends; _a < _b.length; _a++) {
91037                 var prepend = _b[_a];
91038                 if (ts.isUnparsedSource(prepend) && prepend.syntheticReferences) {
91039                     for (var _c = 0, _d = prepend.syntheticReferences; _c < _d.length; _c++) {
91040                         var ref = _d[_c];
91041                         emit(ref);
91042                         writeLine();
91043                     }
91044                 }
91045             }
91046         }
91047         function emitTripleSlashDirectivesIfNeeded(node) {
91048             if (node.isDeclarationFile)
91049                 emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives);
91050         }
91051         function emitTripleSlashDirectives(hasNoDefaultLib, files, types, libs) {
91052             if (hasNoDefaultLib) {
91053                 var pos = writer.getTextPos();
91054                 writeComment("/// <reference no-default-lib=\"true\"/>");
91055                 if (bundleFileInfo)
91056                     bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "no-default-lib" });
91057                 writeLine();
91058             }
91059             if (currentSourceFile && currentSourceFile.moduleName) {
91060                 writeComment("/// <amd-module name=\"".concat(currentSourceFile.moduleName, "\" />"));
91061                 writeLine();
91062             }
91063             if (currentSourceFile && currentSourceFile.amdDependencies) {
91064                 for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) {
91065                     var dep = _b[_a];
91066                     if (dep.name) {
91067                         writeComment("/// <amd-dependency name=\"".concat(dep.name, "\" path=\"").concat(dep.path, "\" />"));
91068                     }
91069                     else {
91070                         writeComment("/// <amd-dependency path=\"".concat(dep.path, "\" />"));
91071                     }
91072                     writeLine();
91073                 }
91074             }
91075             for (var _c = 0, files_2 = files; _c < files_2.length; _c++) {
91076                 var directive = files_2[_c];
91077                 var pos = writer.getTextPos();
91078                 writeComment("/// <reference path=\"".concat(directive.fileName, "\" />"));
91079                 if (bundleFileInfo)
91080                     bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference", data: directive.fileName });
91081                 writeLine();
91082             }
91083             for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
91084                 var directive = types_24[_d];
91085                 var pos = writer.getTextPos();
91086                 writeComment("/// <reference types=\"".concat(directive.fileName, "\" />"));
91087                 if (bundleFileInfo)
91088                     bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "type", data: directive.fileName });
91089                 writeLine();
91090             }
91091             for (var _e = 0, libs_1 = libs; _e < libs_1.length; _e++) {
91092                 var directive = libs_1[_e];
91093                 var pos = writer.getTextPos();
91094                 writeComment("/// <reference lib=\"".concat(directive.fileName, "\" />"));
91095                 if (bundleFileInfo)
91096                     bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "lib", data: directive.fileName });
91097                 writeLine();
91098             }
91099         }
91100         function emitSourceFileWorker(node) {
91101             var statements = node.statements;
91102             pushNameGenerationScope(node);
91103             ts.forEach(node.statements, generateNames);
91104             emitHelpers(node);
91105             var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); });
91106             emitTripleSlashDirectivesIfNeeded(node);
91107             emitList(node, statements, 1, undefined, index === -1 ? statements.length : index);
91108             popNameGenerationScope(node);
91109         }
91110         function emitPartiallyEmittedExpression(node) {
91111             emitExpression(node.expression);
91112         }
91113         function emitCommaList(node) {
91114             emitExpressionList(node, node.elements, 528, undefined);
91115         }
91116         function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
91117             var needsToSetSourceFile = !!sourceFile;
91118             for (var i = 0; i < statements.length; i++) {
91119                 var statement = statements[i];
91120                 if (ts.isPrologueDirective(statement)) {
91121                     var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true;
91122                     if (shouldEmitPrologueDirective) {
91123                         if (needsToSetSourceFile) {
91124                             needsToSetSourceFile = false;
91125                             setSourceFile(sourceFile);
91126                         }
91127                         writeLine();
91128                         var pos = writer.getTextPos();
91129                         emit(statement);
91130                         if (recordBundleFileSection && bundleFileInfo)
91131                             bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue", data: statement.expression.text });
91132                         if (seenPrologueDirectives) {
91133                             seenPrologueDirectives.add(statement.expression.text);
91134                         }
91135                     }
91136                 }
91137                 else {
91138                     return i;
91139                 }
91140             }
91141             return statements.length;
91142         }
91143         function emitUnparsedPrologues(prologues, seenPrologueDirectives) {
91144             for (var _a = 0, prologues_1 = prologues; _a < prologues_1.length; _a++) {
91145                 var prologue = prologues_1[_a];
91146                 if (!seenPrologueDirectives.has(prologue.data)) {
91147                     writeLine();
91148                     var pos = writer.getTextPos();
91149                     emit(prologue);
91150                     if (bundleFileInfo)
91151                         bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue", data: prologue.data });
91152                     if (seenPrologueDirectives) {
91153                         seenPrologueDirectives.add(prologue.data);
91154                     }
91155                 }
91156             }
91157         }
91158         function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) {
91159             if (ts.isSourceFile(sourceFileOrBundle)) {
91160                 emitPrologueDirectives(sourceFileOrBundle.statements, sourceFileOrBundle);
91161             }
91162             else {
91163                 var seenPrologueDirectives = new ts.Set();
91164                 for (var _a = 0, _b = sourceFileOrBundle.prepends; _a < _b.length; _a++) {
91165                     var prepend = _b[_a];
91166                     emitUnparsedPrologues(prepend.prologues, seenPrologueDirectives);
91167                 }
91168                 for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
91169                     var sourceFile = _d[_c];
91170                     emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, true);
91171                 }
91172                 setSourceFile(undefined);
91173             }
91174         }
91175         function getPrologueDirectivesFromBundledSourceFiles(bundle) {
91176             var seenPrologueDirectives = new ts.Set();
91177             var prologues;
91178             for (var index = 0; index < bundle.sourceFiles.length; index++) {
91179                 var sourceFile = bundle.sourceFiles[index];
91180                 var directives = void 0;
91181                 var end = 0;
91182                 for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) {
91183                     var statement = _b[_a];
91184                     if (!ts.isPrologueDirective(statement))
91185                         break;
91186                     if (seenPrologueDirectives.has(statement.expression.text))
91187                         continue;
91188                     seenPrologueDirectives.add(statement.expression.text);
91189                     (directives || (directives = [])).push({
91190                         pos: statement.pos,
91191                         end: statement.end,
91192                         expression: {
91193                             pos: statement.expression.pos,
91194                             end: statement.expression.end,
91195                             text: statement.expression.text
91196                         }
91197                     });
91198                     end = end < statement.end ? statement.end : end;
91199                 }
91200                 if (directives)
91201                     (prologues || (prologues = [])).push({ file: index, text: sourceFile.text.substring(0, end), directives: directives });
91202             }
91203             return prologues;
91204         }
91205         function emitShebangIfNeeded(sourceFileOrBundle) {
91206             if (ts.isSourceFile(sourceFileOrBundle) || ts.isUnparsedSource(sourceFileOrBundle)) {
91207                 var shebang = ts.getShebang(sourceFileOrBundle.text);
91208                 if (shebang) {
91209                     writeComment(shebang);
91210                     writeLine();
91211                     return true;
91212                 }
91213             }
91214             else {
91215                 for (var _a = 0, _b = sourceFileOrBundle.prepends; _a < _b.length; _a++) {
91216                     var prepend = _b[_a];
91217                     ts.Debug.assertNode(prepend, ts.isUnparsedSource);
91218                     if (emitShebangIfNeeded(prepend)) {
91219                         return true;
91220                     }
91221                 }
91222                 for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
91223                     var sourceFile = _d[_c];
91224                     if (emitShebangIfNeeded(sourceFile)) {
91225                         return true;
91226                     }
91227                 }
91228             }
91229         }
91230         function emitNodeWithWriter(node, writer) {
91231             if (!node)
91232                 return;
91233             var savedWrite = write;
91234             write = writer;
91235             emit(node);
91236             write = savedWrite;
91237         }
91238         function emitModifiers(node, modifiers) {
91239             if (modifiers && modifiers.length) {
91240                 emitList(node, modifiers, 262656);
91241                 writeSpace();
91242             }
91243         }
91244         function emitTypeAnnotation(node) {
91245             if (node) {
91246                 writePunctuation(":");
91247                 writeSpace();
91248                 emit(node);
91249             }
91250         }
91251         function emitInitializer(node, equalCommentStartPos, container, parenthesizerRule) {
91252             if (node) {
91253                 writeSpace();
91254                 emitTokenWithComment(63, equalCommentStartPos, writeOperator, container);
91255                 writeSpace();
91256                 emitExpression(node, parenthesizerRule);
91257             }
91258         }
91259         function emitNodeWithPrefix(prefix, prefixWriter, node, emit) {
91260             if (node) {
91261                 prefixWriter(prefix);
91262                 emit(node);
91263             }
91264         }
91265         function emitWithLeadingSpace(node) {
91266             if (node) {
91267                 writeSpace();
91268                 emit(node);
91269             }
91270         }
91271         function emitExpressionWithLeadingSpace(node, parenthesizerRule) {
91272             if (node) {
91273                 writeSpace();
91274                 emitExpression(node, parenthesizerRule);
91275             }
91276         }
91277         function emitWithTrailingSpace(node) {
91278             if (node) {
91279                 emit(node);
91280                 writeSpace();
91281             }
91282         }
91283         function emitEmbeddedStatement(parent, node) {
91284             if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) {
91285                 writeSpace();
91286                 emit(node);
91287             }
91288             else {
91289                 writeLine();
91290                 increaseIndent();
91291                 if (ts.isEmptyStatement(node)) {
91292                     pipelineEmit(5, node);
91293                 }
91294                 else {
91295                     emit(node);
91296                 }
91297                 decreaseIndent();
91298             }
91299         }
91300         function emitDecorators(parentNode, decorators) {
91301             emitList(parentNode, decorators, 2146305);
91302         }
91303         function emitTypeArguments(parentNode, typeArguments) {
91304             emitList(parentNode, typeArguments, 53776, parenthesizer.parenthesizeMemberOfElementType);
91305         }
91306         function emitTypeParameters(parentNode, typeParameters) {
91307             if (ts.isFunctionLike(parentNode) && parentNode.typeArguments) {
91308                 return emitTypeArguments(parentNode, parentNode.typeArguments);
91309             }
91310             emitList(parentNode, typeParameters, 53776);
91311         }
91312         function emitParameters(parentNode, parameters) {
91313             emitList(parentNode, parameters, 2576);
91314         }
91315         function canEmitSimpleArrowHead(parentNode, parameters) {
91316             var parameter = ts.singleOrUndefined(parameters);
91317             return parameter
91318                 && parameter.pos === parentNode.pos
91319                 && ts.isArrowFunction(parentNode)
91320                 && !parentNode.type
91321                 && !ts.some(parentNode.decorators)
91322                 && !ts.some(parentNode.modifiers)
91323                 && !ts.some(parentNode.typeParameters)
91324                 && !ts.some(parameter.decorators)
91325                 && !ts.some(parameter.modifiers)
91326                 && !parameter.dotDotDotToken
91327                 && !parameter.questionToken
91328                 && !parameter.type
91329                 && !parameter.initializer
91330                 && ts.isIdentifier(parameter.name);
91331         }
91332         function emitParametersForArrow(parentNode, parameters) {
91333             if (canEmitSimpleArrowHead(parentNode, parameters)) {
91334                 emitList(parentNode, parameters, 2576 & ~2048);
91335             }
91336             else {
91337                 emitParameters(parentNode, parameters);
91338             }
91339         }
91340         function emitParametersForIndexSignature(parentNode, parameters) {
91341             emitList(parentNode, parameters, 8848);
91342         }
91343         function writeDelimiter(format) {
91344             switch (format & 60) {
91345                 case 0:
91346                     break;
91347                 case 16:
91348                     writePunctuation(",");
91349                     break;
91350                 case 4:
91351                     writeSpace();
91352                     writePunctuation("|");
91353                     break;
91354                 case 32:
91355                     writeSpace();
91356                     writePunctuation("*");
91357                     writeSpace();
91358                     break;
91359                 case 8:
91360                     writeSpace();
91361                     writePunctuation("&");
91362                     break;
91363             }
91364         }
91365         function emitList(parentNode, children, format, parenthesizerRule, start, count) {
91366             emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count);
91367         }
91368         function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count) {
91369             emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count);
91370         }
91371         function emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count) {
91372             if (start === void 0) { start = 0; }
91373             if (count === void 0) { count = children ? children.length - start : 0; }
91374             var isUndefined = children === undefined;
91375             if (isUndefined && format & 16384) {
91376                 return;
91377             }
91378             var isEmpty = children === undefined || start >= children.length || count === 0;
91379             if (isEmpty && format & 32768) {
91380                 if (onBeforeEmitNodeArray) {
91381                     onBeforeEmitNodeArray(children);
91382                 }
91383                 if (onAfterEmitNodeArray) {
91384                     onAfterEmitNodeArray(children);
91385                 }
91386                 return;
91387             }
91388             if (format & 15360) {
91389                 writePunctuation(getOpeningBracket(format));
91390                 if (isEmpty && children) {
91391                     emitTrailingCommentsOfPosition(children.pos, true);
91392                 }
91393             }
91394             if (onBeforeEmitNodeArray) {
91395                 onBeforeEmitNodeArray(children);
91396             }
91397             if (isEmpty) {
91398                 if (format & 1 && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
91399                     writeLine();
91400                 }
91401                 else if (format & 256 && !(format & 524288)) {
91402                     writeSpace();
91403                 }
91404             }
91405             else {
91406                 ts.Debug.type(children);
91407                 var mayEmitInterveningComments = (format & 262144) === 0;
91408                 var shouldEmitInterveningComments = mayEmitInterveningComments;
91409                 var leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children, format);
91410                 if (leadingLineTerminatorCount) {
91411                     writeLine(leadingLineTerminatorCount);
91412                     shouldEmitInterveningComments = false;
91413                 }
91414                 else if (format & 256) {
91415                     writeSpace();
91416                 }
91417                 if (format & 128) {
91418                     increaseIndent();
91419                 }
91420                 var previousSibling = void 0;
91421                 var previousSourceFileTextKind = void 0;
91422                 var shouldDecreaseIndentAfterEmit = false;
91423                 for (var i = 0; i < count; i++) {
91424                     var child = children[start + i];
91425                     if (format & 32) {
91426                         writeLine();
91427                         writeDelimiter(format);
91428                     }
91429                     else if (previousSibling) {
91430                         if (format & 60 && previousSibling.end !== (parentNode ? parentNode.end : -1)) {
91431                             emitLeadingCommentsOfPosition(previousSibling.end);
91432                         }
91433                         writeDelimiter(format);
91434                         recordBundleFileInternalSectionEnd(previousSourceFileTextKind);
91435                         var separatingLineTerminatorCount = getSeparatingLineTerminatorCount(previousSibling, child, format);
91436                         if (separatingLineTerminatorCount > 0) {
91437                             if ((format & (3 | 128)) === 0) {
91438                                 increaseIndent();
91439                                 shouldDecreaseIndentAfterEmit = true;
91440                             }
91441                             writeLine(separatingLineTerminatorCount);
91442                             shouldEmitInterveningComments = false;
91443                         }
91444                         else if (previousSibling && format & 512) {
91445                             writeSpace();
91446                         }
91447                     }
91448                     previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
91449                     if (shouldEmitInterveningComments) {
91450                         if (emitTrailingCommentsOfPosition) {
91451                             var commentRange = ts.getCommentRange(child);
91452                             emitTrailingCommentsOfPosition(commentRange.pos);
91453                         }
91454                     }
91455                     else {
91456                         shouldEmitInterveningComments = mayEmitInterveningComments;
91457                     }
91458                     nextListElementPos = child.pos;
91459                     if (emit.length === 1) {
91460                         emit(child);
91461                     }
91462                     else {
91463                         emit(child, parenthesizerRule);
91464                     }
91465                     if (shouldDecreaseIndentAfterEmit) {
91466                         decreaseIndent();
91467                         shouldDecreaseIndentAfterEmit = false;
91468                     }
91469                     previousSibling = child;
91470                 }
91471                 var emitFlags = previousSibling ? ts.getEmitFlags(previousSibling) : 0;
91472                 var skipTrailingComments = commentsDisabled || !!(emitFlags & 1024);
91473                 var hasTrailingComma = (children === null || children === void 0 ? void 0 : children.hasTrailingComma) && (format & 64) && (format & 16);
91474                 if (hasTrailingComma) {
91475                     if (previousSibling && !skipTrailingComments) {
91476                         emitTokenWithComment(27, previousSibling.end, writePunctuation, previousSibling);
91477                     }
91478                     else {
91479                         writePunctuation(",");
91480                     }
91481                 }
91482                 if (previousSibling && (parentNode ? parentNode.end : -1) !== previousSibling.end && (format & 60) && !skipTrailingComments) {
91483                     emitLeadingCommentsOfPosition(hasTrailingComma && (children === null || children === void 0 ? void 0 : children.end) ? children.end : previousSibling.end);
91484                 }
91485                 if (format & 128) {
91486                     decreaseIndent();
91487                 }
91488                 recordBundleFileInternalSectionEnd(previousSourceFileTextKind);
91489                 var closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children, format);
91490                 if (closingLineTerminatorCount) {
91491                     writeLine(closingLineTerminatorCount);
91492                 }
91493                 else if (format & (2097152 | 256)) {
91494                     writeSpace();
91495                 }
91496             }
91497             if (onAfterEmitNodeArray) {
91498                 onAfterEmitNodeArray(children);
91499             }
91500             if (format & 15360) {
91501                 if (isEmpty && children) {
91502                     emitLeadingCommentsOfPosition(children.end);
91503                 }
91504                 writePunctuation(getClosingBracket(format));
91505             }
91506         }
91507         function writeLiteral(s) {
91508             writer.writeLiteral(s);
91509         }
91510         function writeStringLiteral(s) {
91511             writer.writeStringLiteral(s);
91512         }
91513         function writeBase(s) {
91514             writer.write(s);
91515         }
91516         function writeSymbol(s, sym) {
91517             writer.writeSymbol(s, sym);
91518         }
91519         function writePunctuation(s) {
91520             writer.writePunctuation(s);
91521         }
91522         function writeTrailingSemicolon() {
91523             writer.writeTrailingSemicolon(";");
91524         }
91525         function writeKeyword(s) {
91526             writer.writeKeyword(s);
91527         }
91528         function writeOperator(s) {
91529             writer.writeOperator(s);
91530         }
91531         function writeParameter(s) {
91532             writer.writeParameter(s);
91533         }
91534         function writeComment(s) {
91535             writer.writeComment(s);
91536         }
91537         function writeSpace() {
91538             writer.writeSpace(" ");
91539         }
91540         function writeProperty(s) {
91541             writer.writeProperty(s);
91542         }
91543         function nonEscapingWrite(s) {
91544             if (writer.nonEscapingWrite) {
91545                 writer.nonEscapingWrite(s);
91546             }
91547             else {
91548                 writer.write(s);
91549             }
91550         }
91551         function writeLine(count) {
91552             if (count === void 0) { count = 1; }
91553             for (var i = 0; i < count; i++) {
91554                 writer.writeLine(i > 0);
91555             }
91556         }
91557         function increaseIndent() {
91558             writer.increaseIndent();
91559         }
91560         function decreaseIndent() {
91561             writer.decreaseIndent();
91562         }
91563         function writeToken(token, pos, writer, contextNode) {
91564             return !sourceMapsDisabled
91565                 ? emitTokenWithSourceMap(contextNode, token, writer, pos, writeTokenText)
91566                 : writeTokenText(token, writer, pos);
91567         }
91568         function writeTokenNode(node, writer) {
91569             if (onBeforeEmitToken) {
91570                 onBeforeEmitToken(node);
91571             }
91572             writer(ts.tokenToString(node.kind));
91573             if (onAfterEmitToken) {
91574                 onAfterEmitToken(node);
91575             }
91576         }
91577         function writeTokenText(token, writer, pos) {
91578             var tokenString = ts.tokenToString(token);
91579             writer(tokenString);
91580             return pos < 0 ? pos : pos + tokenString.length;
91581         }
91582         function writeLineOrSpace(parentNode, prevChildNode, nextChildNode) {
91583             if (ts.getEmitFlags(parentNode) & 1) {
91584                 writeSpace();
91585             }
91586             else if (preserveSourceNewlines) {
91587                 var lines = getLinesBetweenNodes(parentNode, prevChildNode, nextChildNode);
91588                 if (lines) {
91589                     writeLine(lines);
91590                 }
91591                 else {
91592                     writeSpace();
91593                 }
91594             }
91595             else {
91596                 writeLine();
91597             }
91598         }
91599         function writeLines(text) {
91600             var lines = text.split(/\r\n?|\n/g);
91601             var indentation = ts.guessIndentation(lines);
91602             for (var _a = 0, lines_3 = lines; _a < lines_3.length; _a++) {
91603                 var lineText = lines_3[_a];
91604                 var line = indentation ? lineText.slice(indentation) : lineText;
91605                 if (line.length) {
91606                     writeLine();
91607                     write(line);
91608                 }
91609             }
91610         }
91611         function writeLinesAndIndent(lineCount, writeSpaceIfNotIndenting) {
91612             if (lineCount) {
91613                 increaseIndent();
91614                 writeLine(lineCount);
91615             }
91616             else if (writeSpaceIfNotIndenting) {
91617                 writeSpace();
91618             }
91619         }
91620         function decreaseIndentIf(value1, value2) {
91621             if (value1) {
91622                 decreaseIndent();
91623             }
91624             if (value2) {
91625                 decreaseIndent();
91626             }
91627         }
91628         function getLeadingLineTerminatorCount(parentNode, children, format) {
91629             if (format & 2 || preserveSourceNewlines) {
91630                 if (format & 65536) {
91631                     return 1;
91632                 }
91633                 var firstChild_1 = children[0];
91634                 if (firstChild_1 === undefined) {
91635                     return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
91636                 }
91637                 if (firstChild_1.pos === nextListElementPos) {
91638                     return 0;
91639                 }
91640                 if (firstChild_1.kind === 11) {
91641                     return 0;
91642                 }
91643                 if (parentNode &&
91644                     !ts.positionIsSynthesized(parentNode.pos) &&
91645                     !ts.nodeIsSynthesized(firstChild_1) &&
91646                     (!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
91647                     if (preserveSourceNewlines) {
91648                         return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(firstChild_1.pos, parentNode.pos, currentSourceFile, includeComments); });
91649                     }
91650                     return ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild_1, currentSourceFile) ? 0 : 1;
91651                 }
91652                 if (synthesizedNodeStartsOnNewLine(firstChild_1, format)) {
91653                     return 1;
91654                 }
91655             }
91656             return format & 1 ? 1 : 0;
91657         }
91658         function getSeparatingLineTerminatorCount(previousNode, nextNode, format) {
91659             if (format & 2 || preserveSourceNewlines) {
91660                 if (previousNode === undefined || nextNode === undefined) {
91661                     return 0;
91662                 }
91663                 if (nextNode.kind === 11) {
91664                     return 0;
91665                 }
91666                 else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
91667                     if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
91668                         return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
91669                     }
91670                     else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) {
91671                         return ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
91672                     }
91673                     return format & 65536 ? 1 : 0;
91674                 }
91675                 else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) {
91676                     return 1;
91677                 }
91678             }
91679             else if (ts.getStartsOnNewLine(nextNode)) {
91680                 return 1;
91681             }
91682             return format & 1 ? 1 : 0;
91683         }
91684         function getClosingLineTerminatorCount(parentNode, children, format) {
91685             if (format & 2 || preserveSourceNewlines) {
91686                 if (format & 65536) {
91687                     return 1;
91688                 }
91689                 var lastChild = ts.lastOrUndefined(children);
91690                 if (lastChild === undefined) {
91691                     return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
91692                 }
91693                 if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
91694                     if (preserveSourceNewlines) {
91695                         var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
91696                         return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
91697                     }
91698                     return ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile) ? 0 : 1;
91699                 }
91700                 if (synthesizedNodeStartsOnNewLine(lastChild, format)) {
91701                     return 1;
91702                 }
91703             }
91704             if (format & 1 && !(format & 131072)) {
91705                 return 1;
91706             }
91707             return 0;
91708         }
91709         function getEffectiveLines(getLineDifference) {
91710             ts.Debug.assert(!!preserveSourceNewlines);
91711             var lines = getLineDifference(true);
91712             if (lines === 0) {
91713                 return getLineDifference(false);
91714             }
91715             return lines;
91716         }
91717         function writeLineSeparatorsAndIndentBefore(node, parent) {
91718             var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0);
91719             if (leadingNewlines) {
91720                 writeLinesAndIndent(leadingNewlines, false);
91721             }
91722             return !!leadingNewlines;
91723         }
91724         function writeLineSeparatorsAfter(node, parent) {
91725             var trailingNewlines = preserveSourceNewlines && getClosingLineTerminatorCount(parent, [node], 0);
91726             if (trailingNewlines) {
91727                 writeLine(trailingNewlines);
91728             }
91729         }
91730         function synthesizedNodeStartsOnNewLine(node, format) {
91731             if (ts.nodeIsSynthesized(node)) {
91732                 var startsOnNewLine = ts.getStartsOnNewLine(node);
91733                 if (startsOnNewLine === undefined) {
91734                     return (format & 65536) !== 0;
91735                 }
91736                 return startsOnNewLine;
91737             }
91738             return (format & 65536) !== 0;
91739         }
91740         function getLinesBetweenNodes(parent, node1, node2) {
91741             if (ts.getEmitFlags(parent) & 131072) {
91742                 return 0;
91743             }
91744             parent = skipSynthesizedParentheses(parent);
91745             node1 = skipSynthesizedParentheses(node1);
91746             node2 = skipSynthesizedParentheses(node2);
91747             if (ts.getStartsOnNewLine(node2)) {
91748                 return 1;
91749             }
91750             if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
91751                 if (preserveSourceNewlines) {
91752                     return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
91753                 }
91754                 return ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile) ? 0 : 1;
91755             }
91756             return 0;
91757         }
91758         function isEmptyBlock(block) {
91759             return block.statements.length === 0
91760                 && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
91761         }
91762         function skipSynthesizedParentheses(node) {
91763             while (node.kind === 211 && ts.nodeIsSynthesized(node)) {
91764                 node = node.expression;
91765             }
91766             return node;
91767         }
91768         function getTextOfNode(node, includeTrivia) {
91769             if (ts.isGeneratedIdentifier(node)) {
91770                 return generateName(node);
91771             }
91772             else if ((ts.isIdentifier(node) || ts.isPrivateIdentifier(node)) && (ts.nodeIsSynthesized(node) || !node.parent || !currentSourceFile || (node.parent && currentSourceFile && ts.getSourceFileOfNode(node) !== ts.getOriginalNode(currentSourceFile)))) {
91773                 return ts.idText(node);
91774             }
91775             else if (node.kind === 10 && node.textSourceNode) {
91776                 return getTextOfNode(node.textSourceNode, includeTrivia);
91777             }
91778             else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {
91779                 return node.text;
91780             }
91781             return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
91782         }
91783         function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
91784             if (node.kind === 10 && node.textSourceNode) {
91785                 var textSourceNode = node.textSourceNode;
91786                 if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) {
91787                     var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode);
91788                     return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") :
91789                         neverAsciiEscape || (ts.getEmitFlags(node) & 16777216) ? "\"".concat(ts.escapeString(text), "\"") :
91790                             "\"".concat(ts.escapeNonAsciiString(text), "\"");
91791                 }
91792                 else {
91793                     return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
91794                 }
91795             }
91796             var flags = (neverAsciiEscape ? 1 : 0)
91797                 | (jsxAttributeEscape ? 2 : 0)
91798                 | (printerOptions.terminateUnterminatedLiterals ? 4 : 0)
91799                 | (printerOptions.target && printerOptions.target === 99 ? 8 : 0);
91800             return ts.getLiteralText(node, currentSourceFile, flags);
91801         }
91802         function pushNameGenerationScope(node) {
91803             if (node && ts.getEmitFlags(node) & 524288) {
91804                 return;
91805             }
91806             tempFlagsStack.push(tempFlags);
91807             tempFlags = 0;
91808             reservedNamesStack.push(reservedNames);
91809         }
91810         function popNameGenerationScope(node) {
91811             if (node && ts.getEmitFlags(node) & 524288) {
91812                 return;
91813             }
91814             tempFlags = tempFlagsStack.pop();
91815             reservedNames = reservedNamesStack.pop();
91816         }
91817         function reserveNameInNestedScopes(name) {
91818             if (!reservedNames || reservedNames === ts.lastOrUndefined(reservedNamesStack)) {
91819                 reservedNames = new ts.Set();
91820             }
91821             reservedNames.add(name);
91822         }
91823         function generateNames(node) {
91824             if (!node)
91825                 return;
91826             switch (node.kind) {
91827                 case 234:
91828                     ts.forEach(node.statements, generateNames);
91829                     break;
91830                 case 249:
91831                 case 247:
91832                 case 239:
91833                 case 240:
91834                     generateNames(node.statement);
91835                     break;
91836                 case 238:
91837                     generateNames(node.thenStatement);
91838                     generateNames(node.elseStatement);
91839                     break;
91840                 case 241:
91841                 case 243:
91842                 case 242:
91843                     generateNames(node.initializer);
91844                     generateNames(node.statement);
91845                     break;
91846                 case 248:
91847                     generateNames(node.caseBlock);
91848                     break;
91849                 case 262:
91850                     ts.forEach(node.clauses, generateNames);
91851                     break;
91852                 case 288:
91853                 case 289:
91854                     ts.forEach(node.statements, generateNames);
91855                     break;
91856                 case 251:
91857                     generateNames(node.tryBlock);
91858                     generateNames(node.catchClause);
91859                     generateNames(node.finallyBlock);
91860                     break;
91861                 case 291:
91862                     generateNames(node.variableDeclaration);
91863                     generateNames(node.block);
91864                     break;
91865                 case 236:
91866                     generateNames(node.declarationList);
91867                     break;
91868                 case 254:
91869                     ts.forEach(node.declarations, generateNames);
91870                     break;
91871                 case 253:
91872                 case 163:
91873                 case 202:
91874                 case 256:
91875                     generateNameIfNeeded(node.name);
91876                     break;
91877                 case 255:
91878                     generateNameIfNeeded(node.name);
91879                     if (ts.getEmitFlags(node) & 524288) {
91880                         ts.forEach(node.parameters, generateNames);
91881                         generateNames(node.body);
91882                     }
91883                     break;
91884                 case 200:
91885                 case 201:
91886                     ts.forEach(node.elements, generateNames);
91887                     break;
91888                 case 265:
91889                     generateNames(node.importClause);
91890                     break;
91891                 case 266:
91892                     generateNameIfNeeded(node.name);
91893                     generateNames(node.namedBindings);
91894                     break;
91895                 case 267:
91896                     generateNameIfNeeded(node.name);
91897                     break;
91898                 case 273:
91899                     generateNameIfNeeded(node.name);
91900                     break;
91901                 case 268:
91902                     ts.forEach(node.elements, generateNames);
91903                     break;
91904                 case 269:
91905                     generateNameIfNeeded(node.propertyName || node.name);
91906                     break;
91907             }
91908         }
91909         function generateMemberNames(node) {
91910             if (!node)
91911                 return;
91912             switch (node.kind) {
91913                 case 294:
91914                 case 295:
91915                 case 166:
91916                 case 168:
91917                 case 171:
91918                 case 172:
91919                     generateNameIfNeeded(node.name);
91920                     break;
91921             }
91922         }
91923         function generateNameIfNeeded(name) {
91924             if (name) {
91925                 if (ts.isGeneratedIdentifier(name)) {
91926                     generateName(name);
91927                 }
91928                 else if (ts.isBindingPattern(name)) {
91929                     generateNames(name);
91930                 }
91931             }
91932         }
91933         function generateName(name) {
91934             if ((name.autoGenerateFlags & 7) === 4) {
91935                 return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags);
91936             }
91937             else {
91938                 var autoGenerateId = name.autoGenerateId;
91939                 return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name));
91940             }
91941         }
91942         function generateNameCached(node, flags) {
91943             var nodeId = ts.getNodeId(node);
91944             return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags));
91945         }
91946         function isUniqueName(name) {
91947             return isFileLevelUniqueName(name)
91948                 && !generatedNames.has(name)
91949                 && !(reservedNames && reservedNames.has(name));
91950         }
91951         function isFileLevelUniqueName(name) {
91952             return currentSourceFile ? ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
91953         }
91954         function isUniqueLocalName(name, container) {
91955             for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) {
91956                 if (node.locals) {
91957                     var local = node.locals.get(ts.escapeLeadingUnderscores(name));
91958                     if (local && local.flags & (111551 | 1048576 | 2097152)) {
91959                         return false;
91960                     }
91961                 }
91962             }
91963             return true;
91964         }
91965         function makeTempVariableName(flags, reservedInNestedScopes) {
91966             if (flags && !(tempFlags & flags)) {
91967                 var name = flags === 268435456 ? "_i" : "_n";
91968                 if (isUniqueName(name)) {
91969                     tempFlags |= flags;
91970                     if (reservedInNestedScopes) {
91971                         reserveNameInNestedScopes(name);
91972                     }
91973                     return name;
91974                 }
91975             }
91976             while (true) {
91977                 var count = tempFlags & 268435455;
91978                 tempFlags++;
91979                 if (count !== 8 && count !== 13) {
91980                     var name = count < 26
91981                         ? "_" + String.fromCharCode(97 + count)
91982                         : "_" + (count - 26);
91983                     if (isUniqueName(name)) {
91984                         if (reservedInNestedScopes) {
91985                             reserveNameInNestedScopes(name);
91986                         }
91987                         return name;
91988                     }
91989                 }
91990             }
91991         }
91992         function makeUniqueName(baseName, checkFn, optimistic, scoped) {
91993             if (checkFn === void 0) { checkFn = isUniqueName; }
91994             if (optimistic) {
91995                 if (checkFn(baseName)) {
91996                     if (scoped) {
91997                         reserveNameInNestedScopes(baseName);
91998                     }
91999                     else {
92000                         generatedNames.add(baseName);
92001                     }
92002                     return baseName;
92003                 }
92004             }
92005             if (baseName.charCodeAt(baseName.length - 1) !== 95) {
92006                 baseName += "_";
92007             }
92008             var i = 1;
92009             while (true) {
92010                 var generatedName = baseName + i;
92011                 if (checkFn(generatedName)) {
92012                     if (scoped) {
92013                         reserveNameInNestedScopes(generatedName);
92014                     }
92015                     else {
92016                         generatedNames.add(generatedName);
92017                     }
92018                     return generatedName;
92019                 }
92020                 i++;
92021             }
92022         }
92023         function makeFileLevelOptimisticUniqueName(name) {
92024             return makeUniqueName(name, isFileLevelUniqueName, true);
92025         }
92026         function generateNameForModuleOrEnum(node) {
92027             var name = getTextOfNode(node.name);
92028             return isUniqueLocalName(name, node) ? name : makeUniqueName(name);
92029         }
92030         function generateNameForImportOrExportDeclaration(node) {
92031             var expr = ts.getExternalModuleName(node);
92032             var baseName = ts.isStringLiteral(expr) ?
92033                 ts.makeIdentifierFromModuleName(expr.text) : "module";
92034             return makeUniqueName(baseName);
92035         }
92036         function generateNameForExportDefault() {
92037             return makeUniqueName("default");
92038         }
92039         function generateNameForClassExpression() {
92040             return makeUniqueName("class");
92041         }
92042         function generateNameForMethodOrAccessor(node) {
92043             if (ts.isIdentifier(node.name)) {
92044                 return generateNameCached(node.name);
92045             }
92046             return makeTempVariableName(0);
92047         }
92048         function generateNameForNode(node, flags) {
92049             switch (node.kind) {
92050                 case 79:
92051                     return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8));
92052                 case 260:
92053                 case 259:
92054                     return generateNameForModuleOrEnum(node);
92055                 case 265:
92056                 case 271:
92057                     return generateNameForImportOrExportDeclaration(node);
92058                 case 255:
92059                 case 256:
92060                 case 270:
92061                     return generateNameForExportDefault();
92062                 case 225:
92063                     return generateNameForClassExpression();
92064                 case 168:
92065                 case 171:
92066                 case 172:
92067                     return generateNameForMethodOrAccessor(node);
92068                 case 161:
92069                     return makeTempVariableName(0, true);
92070                 default:
92071                     return makeTempVariableName(0);
92072             }
92073         }
92074         function makeName(name) {
92075             switch (name.autoGenerateFlags & 7) {
92076                 case 1:
92077                     return makeTempVariableName(0, !!(name.autoGenerateFlags & 8));
92078                 case 2:
92079                     return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 8));
92080                 case 3:
92081                     return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8));
92082             }
92083             return ts.Debug.fail("Unsupported GeneratedIdentifierKind.");
92084         }
92085         function getNodeForGeneratedName(name) {
92086             var autoGenerateId = name.autoGenerateId;
92087             var node = name;
92088             var original = node.original;
92089             while (original) {
92090                 node = original;
92091                 if (ts.isIdentifier(node)
92092                     && !!(node.autoGenerateFlags & 4)
92093                     && node.autoGenerateId !== autoGenerateId) {
92094                     break;
92095                 }
92096                 original = node.original;
92097             }
92098             return node;
92099         }
92100         function pipelineEmitWithComments(hint, node) {
92101             var pipelinePhase = getNextPipelinePhase(2, hint, node);
92102             var savedContainerPos = containerPos;
92103             var savedContainerEnd = containerEnd;
92104             var savedDeclarationListContainerEnd = declarationListContainerEnd;
92105             emitCommentsBeforeNode(node);
92106             pipelinePhase(hint, node);
92107             emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
92108         }
92109         function emitCommentsBeforeNode(node) {
92110             var emitFlags = ts.getEmitFlags(node);
92111             var commentRange = ts.getCommentRange(node);
92112             emitLeadingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end);
92113             if (emitFlags & 2048) {
92114                 commentsDisabled = true;
92115             }
92116         }
92117         function emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) {
92118             var emitFlags = ts.getEmitFlags(node);
92119             var commentRange = ts.getCommentRange(node);
92120             if (emitFlags & 2048) {
92121                 commentsDisabled = false;
92122             }
92123             emitTrailingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
92124         }
92125         function emitLeadingCommentsOfNode(node, emitFlags, pos, end) {
92126             enterComment();
92127             hasWrittenComment = false;
92128             var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 11;
92129             var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11;
92130             if ((pos > 0 || end > 0) && pos !== end) {
92131                 if (!skipLeadingComments) {
92132                     emitLeadingComments(pos, node.kind !== 347);
92133                 }
92134                 if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512) !== 0)) {
92135                     containerPos = pos;
92136                 }
92137                 if (!skipTrailingComments || (end >= 0 && (emitFlags & 1024) !== 0)) {
92138                     containerEnd = end;
92139                     if (node.kind === 254) {
92140                         declarationListContainerEnd = end;
92141                     }
92142                 }
92143             }
92144             ts.forEach(ts.getSyntheticLeadingComments(node), emitLeadingSynthesizedComment);
92145             exitComment();
92146         }
92147         function emitTrailingCommentsOfNode(node, emitFlags, pos, end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) {
92148             enterComment();
92149             var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11;
92150             ts.forEach(ts.getSyntheticTrailingComments(node), emitTrailingSynthesizedComment);
92151             if ((pos > 0 || end > 0) && pos !== end) {
92152                 containerPos = savedContainerPos;
92153                 containerEnd = savedContainerEnd;
92154                 declarationListContainerEnd = savedDeclarationListContainerEnd;
92155                 if (!skipTrailingComments && node.kind !== 347) {
92156                     emitTrailingComments(end);
92157                 }
92158             }
92159             exitComment();
92160         }
92161         function emitLeadingSynthesizedComment(comment) {
92162             if (comment.hasLeadingNewline || comment.kind === 2) {
92163                 writer.writeLine();
92164             }
92165             writeSynthesizedComment(comment);
92166             if (comment.hasTrailingNewLine || comment.kind === 2) {
92167                 writer.writeLine();
92168             }
92169             else {
92170                 writer.writeSpace(" ");
92171             }
92172         }
92173         function emitTrailingSynthesizedComment(comment) {
92174             if (!writer.isAtStartOfLine()) {
92175                 writer.writeSpace(" ");
92176             }
92177             writeSynthesizedComment(comment);
92178             if (comment.hasTrailingNewLine) {
92179                 writer.writeLine();
92180             }
92181         }
92182         function writeSynthesizedComment(comment) {
92183             var text = formatSynthesizedComment(comment);
92184             var lineMap = comment.kind === 3 ? ts.computeLineStarts(text) : undefined;
92185             ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine);
92186         }
92187         function formatSynthesizedComment(comment) {
92188             return comment.kind === 3
92189                 ? "/*".concat(comment.text, "*/")
92190                 : "//".concat(comment.text);
92191         }
92192         function emitBodyWithDetachedComments(node, detachedRange, emitCallback) {
92193             enterComment();
92194             var pos = detachedRange.pos, end = detachedRange.end;
92195             var emitFlags = ts.getEmitFlags(node);
92196             var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0;
92197             var skipTrailingComments = commentsDisabled || end < 0 || (emitFlags & 1024) !== 0;
92198             if (!skipLeadingComments) {
92199                 emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
92200             }
92201             exitComment();
92202             if (emitFlags & 2048 && !commentsDisabled) {
92203                 commentsDisabled = true;
92204                 emitCallback(node);
92205                 commentsDisabled = false;
92206             }
92207             else {
92208                 emitCallback(node);
92209             }
92210             enterComment();
92211             if (!skipTrailingComments) {
92212                 emitLeadingComments(detachedRange.end, true);
92213                 if (hasWrittenComment && !writer.isAtStartOfLine()) {
92214                     writer.writeLine();
92215                 }
92216             }
92217             exitComment();
92218         }
92219         function originalNodesHaveSameParent(nodeA, nodeB) {
92220             nodeA = ts.getOriginalNode(nodeA);
92221             return nodeA.parent && nodeA.parent === ts.getOriginalNode(nodeB).parent;
92222         }
92223         function siblingNodePositionsAreComparable(previousNode, nextNode) {
92224             if (nextNode.pos < previousNode.end) {
92225                 return false;
92226             }
92227             previousNode = ts.getOriginalNode(previousNode);
92228             nextNode = ts.getOriginalNode(nextNode);
92229             var parent = previousNode.parent;
92230             if (!parent || parent !== nextNode.parent) {
92231                 return false;
92232             }
92233             var parentNodeArray = ts.getContainingNodeArray(previousNode);
92234             var prevNodeIndex = parentNodeArray === null || parentNodeArray === void 0 ? void 0 : parentNodeArray.indexOf(previousNode);
92235             return prevNodeIndex !== undefined && prevNodeIndex > -1 && parentNodeArray.indexOf(nextNode) === prevNodeIndex + 1;
92236         }
92237         function emitLeadingComments(pos, isEmittedNode) {
92238             hasWrittenComment = false;
92239             if (isEmittedNode) {
92240                 if (pos === 0 && (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.isDeclarationFile)) {
92241                     forEachLeadingCommentToEmit(pos, emitNonTripleSlashLeadingComment);
92242                 }
92243                 else {
92244                     forEachLeadingCommentToEmit(pos, emitLeadingComment);
92245                 }
92246             }
92247             else if (pos === 0) {
92248                 forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);
92249             }
92250         }
92251         function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
92252             if (isTripleSlashComment(commentPos, commentEnd)) {
92253                 emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
92254             }
92255         }
92256         function emitNonTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
92257             if (!isTripleSlashComment(commentPos, commentEnd)) {
92258                 emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
92259             }
92260         }
92261         function shouldWriteComment(text, pos) {
92262             if (printerOptions.onlyPrintJsDocStyle) {
92263                 return (ts.isJSDocLikeText(text, pos) || ts.isPinnedComment(text, pos));
92264             }
92265             return true;
92266         }
92267         function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
92268             if (!shouldWriteComment(currentSourceFile.text, commentPos))
92269                 return;
92270             if (!hasWrittenComment) {
92271                 ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
92272                 hasWrittenComment = true;
92273             }
92274             emitPos(commentPos);
92275             ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
92276             emitPos(commentEnd);
92277             if (hasTrailingNewLine) {
92278                 writer.writeLine();
92279             }
92280             else if (kind === 3) {
92281                 writer.writeSpace(" ");
92282             }
92283         }
92284         function emitLeadingCommentsOfPosition(pos) {
92285             if (commentsDisabled || pos === -1) {
92286                 return;
92287             }
92288             emitLeadingComments(pos, true);
92289         }
92290         function emitTrailingComments(pos) {
92291             forEachTrailingCommentToEmit(pos, emitTrailingComment);
92292         }
92293         function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
92294             if (!shouldWriteComment(currentSourceFile.text, commentPos))
92295                 return;
92296             if (!writer.isAtStartOfLine()) {
92297                 writer.writeSpace(" ");
92298             }
92299             emitPos(commentPos);
92300             ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
92301             emitPos(commentEnd);
92302             if (hasTrailingNewLine) {
92303                 writer.writeLine();
92304             }
92305         }
92306         function emitTrailingCommentsOfPosition(pos, prefixSpace, forceNoNewline) {
92307             if (commentsDisabled) {
92308                 return;
92309             }
92310             enterComment();
92311             forEachTrailingCommentToEmit(pos, prefixSpace ? emitTrailingComment : forceNoNewline ? emitTrailingCommentOfPositionNoNewline : emitTrailingCommentOfPosition);
92312             exitComment();
92313         }
92314         function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
92315             emitPos(commentPos);
92316             ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
92317             emitPos(commentEnd);
92318             if (kind === 2) {
92319                 writer.writeLine();
92320             }
92321         }
92322         function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
92323             emitPos(commentPos);
92324             ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
92325             emitPos(commentEnd);
92326             if (hasTrailingNewLine) {
92327                 writer.writeLine();
92328             }
92329             else {
92330                 writer.writeSpace(" ");
92331             }
92332         }
92333         function forEachLeadingCommentToEmit(pos, cb) {
92334             if (currentSourceFile && (containerPos === -1 || pos !== containerPos)) {
92335                 if (hasDetachedComments(pos)) {
92336                     forEachLeadingCommentWithoutDetachedComments(cb);
92337                 }
92338                 else {
92339                     ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, pos);
92340                 }
92341             }
92342         }
92343         function forEachTrailingCommentToEmit(end, cb) {
92344             if (currentSourceFile && (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd))) {
92345                 ts.forEachTrailingCommentRange(currentSourceFile.text, end, cb);
92346             }
92347         }
92348         function hasDetachedComments(pos) {
92349             return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
92350         }
92351         function forEachLeadingCommentWithoutDetachedComments(cb) {
92352             var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
92353             if (detachedCommentsInfo.length - 1) {
92354                 detachedCommentsInfo.pop();
92355             }
92356             else {
92357                 detachedCommentsInfo = undefined;
92358             }
92359             ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, pos);
92360         }
92361         function emitDetachedCommentsAndUpdateCommentsInfo(range) {
92362             var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
92363             if (currentDetachedCommentInfo) {
92364                 if (detachedCommentsInfo) {
92365                     detachedCommentsInfo.push(currentDetachedCommentInfo);
92366                 }
92367                 else {
92368                     detachedCommentsInfo = [currentDetachedCommentInfo];
92369                 }
92370             }
92371         }
92372         function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
92373             if (!shouldWriteComment(currentSourceFile.text, commentPos))
92374                 return;
92375             emitPos(commentPos);
92376             ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
92377             emitPos(commentEnd);
92378         }
92379         function isTripleSlashComment(commentPos, commentEnd) {
92380             return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
92381         }
92382         function getParsedSourceMap(node) {
92383             if (node.parsedSourceMap === undefined && node.sourceMapText !== undefined) {
92384                 node.parsedSourceMap = ts.tryParseRawSourceMap(node.sourceMapText) || false;
92385             }
92386             return node.parsedSourceMap || undefined;
92387         }
92388         function pipelineEmitWithSourceMaps(hint, node) {
92389             var pipelinePhase = getNextPipelinePhase(3, hint, node);
92390             emitSourceMapsBeforeNode(node);
92391             pipelinePhase(hint, node);
92392             emitSourceMapsAfterNode(node);
92393         }
92394         function emitSourceMapsBeforeNode(node) {
92395             var emitFlags = ts.getEmitFlags(node);
92396             var sourceMapRange = ts.getSourceMapRange(node);
92397             if (ts.isUnparsedNode(node)) {
92398                 ts.Debug.assertIsDefined(node.parent, "UnparsedNodes must have parent pointers");
92399                 var parsed = getParsedSourceMap(node.parent);
92400                 if (parsed && sourceMapGenerator) {
92401                     sourceMapGenerator.appendSourceMap(writer.getLine(), writer.getColumn(), parsed, node.parent.sourceMapPath, node.parent.getLineAndCharacterOfPosition(node.pos), node.parent.getLineAndCharacterOfPosition(node.end));
92402                 }
92403             }
92404             else {
92405                 var source = sourceMapRange.source || sourceMapSource;
92406                 if (node.kind !== 347
92407                     && (emitFlags & 16) === 0
92408                     && sourceMapRange.pos >= 0) {
92409                     emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
92410                 }
92411                 if (emitFlags & 64) {
92412                     sourceMapsDisabled = true;
92413                 }
92414             }
92415         }
92416         function emitSourceMapsAfterNode(node) {
92417             var emitFlags = ts.getEmitFlags(node);
92418             var sourceMapRange = ts.getSourceMapRange(node);
92419             if (!ts.isUnparsedNode(node)) {
92420                 if (emitFlags & 64) {
92421                     sourceMapsDisabled = false;
92422                 }
92423                 if (node.kind !== 347
92424                     && (emitFlags & 32) === 0
92425                     && sourceMapRange.end >= 0) {
92426                     emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
92427                 }
92428             }
92429         }
92430         function skipSourceTrivia(source, pos) {
92431             return source.skipTrivia ? source.skipTrivia(pos) : ts.skipTrivia(source.text, pos);
92432         }
92433         function emitPos(pos) {
92434             if (sourceMapsDisabled || ts.positionIsSynthesized(pos) || isJsonSourceMapSource(sourceMapSource)) {
92435                 return;
92436             }
92437             var _a = ts.getLineAndCharacterOfPosition(sourceMapSource, pos), sourceLine = _a.line, sourceCharacter = _a.character;
92438             sourceMapGenerator.addMapping(writer.getLine(), writer.getColumn(), sourceMapSourceIndex, sourceLine, sourceCharacter, undefined);
92439         }
92440         function emitSourcePos(source, pos) {
92441             if (source !== sourceMapSource) {
92442                 var savedSourceMapSource = sourceMapSource;
92443                 var savedSourceMapSourceIndex = sourceMapSourceIndex;
92444                 setSourceMapSource(source);
92445                 emitPos(pos);
92446                 resetSourceMapSource(savedSourceMapSource, savedSourceMapSourceIndex);
92447             }
92448             else {
92449                 emitPos(pos);
92450             }
92451         }
92452         function emitTokenWithSourceMap(node, token, writer, tokenPos, emitCallback) {
92453             if (sourceMapsDisabled || node && ts.isInJsonFile(node)) {
92454                 return emitCallback(token, writer, tokenPos);
92455             }
92456             var emitNode = node && node.emitNode;
92457             var emitFlags = emitNode && emitNode.flags || 0;
92458             var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
92459             var source = range && range.source || sourceMapSource;
92460             tokenPos = skipSourceTrivia(source, range ? range.pos : tokenPos);
92461             if ((emitFlags & 128) === 0 && tokenPos >= 0) {
92462                 emitSourcePos(source, tokenPos);
92463             }
92464             tokenPos = emitCallback(token, writer, tokenPos);
92465             if (range)
92466                 tokenPos = range.end;
92467             if ((emitFlags & 256) === 0 && tokenPos >= 0) {
92468                 emitSourcePos(source, tokenPos);
92469             }
92470             return tokenPos;
92471         }
92472         function setSourceMapSource(source) {
92473             if (sourceMapsDisabled) {
92474                 return;
92475             }
92476             sourceMapSource = source;
92477             if (source === mostRecentlyAddedSourceMapSource) {
92478                 sourceMapSourceIndex = mostRecentlyAddedSourceMapSourceIndex;
92479                 return;
92480             }
92481             if (isJsonSourceMapSource(source)) {
92482                 return;
92483             }
92484             sourceMapSourceIndex = sourceMapGenerator.addSource(source.fileName);
92485             if (printerOptions.inlineSources) {
92486                 sourceMapGenerator.setSourceContent(sourceMapSourceIndex, source.text);
92487             }
92488             mostRecentlyAddedSourceMapSource = source;
92489             mostRecentlyAddedSourceMapSourceIndex = sourceMapSourceIndex;
92490         }
92491         function resetSourceMapSource(source, sourceIndex) {
92492             sourceMapSource = source;
92493             sourceMapSourceIndex = sourceIndex;
92494         }
92495         function isJsonSourceMapSource(sourceFile) {
92496             return ts.fileExtensionIs(sourceFile.fileName, ".json");
92497         }
92498     }
92499     ts.createPrinter = createPrinter;
92500     function createBracketsMap() {
92501         var brackets = [];
92502         brackets[1024] = ["{", "}"];
92503         brackets[2048] = ["(", ")"];
92504         brackets[4096] = ["<", ">"];
92505         brackets[8192] = ["[", "]"];
92506         return brackets;
92507     }
92508     function getOpeningBracket(format) {
92509         return brackets[format & 15360][0];
92510     }
92511     function getClosingBracket(format) {
92512         return brackets[format & 15360][1];
92513     }
92514 })(ts || (ts = {}));
92515 var ts;
92516 (function (ts) {
92517     function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames) {
92518         if (!host.getDirectories || !host.readDirectory) {
92519             return undefined;
92520         }
92521         var cachedReadDirectoryResult = new ts.Map();
92522         var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
92523         return {
92524             useCaseSensitiveFileNames: useCaseSensitiveFileNames,
92525             fileExists: fileExists,
92526             readFile: function (path, encoding) { return host.readFile(path, encoding); },
92527             directoryExists: host.directoryExists && directoryExists,
92528             getDirectories: getDirectories,
92529             readDirectory: readDirectory,
92530             createDirectory: host.createDirectory && createDirectory,
92531             writeFile: host.writeFile && writeFile,
92532             addOrDeleteFileOrDirectory: addOrDeleteFileOrDirectory,
92533             addOrDeleteFile: addOrDeleteFile,
92534             clearCache: clearCache,
92535             realpath: host.realpath && realpath
92536         };
92537         function toPath(fileName) {
92538             return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
92539         }
92540         function getCachedFileSystemEntries(rootDirPath) {
92541             return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
92542         }
92543         function getCachedFileSystemEntriesForBaseDir(path) {
92544             return getCachedFileSystemEntries(ts.getDirectoryPath(path));
92545         }
92546         function getBaseNameOfFileName(fileName) {
92547             return ts.getBaseFileName(ts.normalizePath(fileName));
92548         }
92549         function createCachedFileSystemEntries(rootDir, rootDirPath) {
92550             var _a;
92551             if (!host.realpath || ts.ensureTrailingDirectorySeparator(toPath(host.realpath(rootDir))) === rootDirPath) {
92552                 var resultFromHost = {
92553                     files: ts.map(host.readDirectory(rootDir, undefined, undefined, ["*.*"]), getBaseNameOfFileName) || [],
92554                     directories: host.getDirectories(rootDir) || []
92555                 };
92556                 cachedReadDirectoryResult.set(ts.ensureTrailingDirectorySeparator(rootDirPath), resultFromHost);
92557                 return resultFromHost;
92558             }
92559             if ((_a = host.directoryExists) === null || _a === void 0 ? void 0 : _a.call(host, rootDir)) {
92560                 cachedReadDirectoryResult.set(rootDirPath, false);
92561                 return false;
92562             }
92563             return undefined;
92564         }
92565         function tryReadDirectory(rootDir, rootDirPath) {
92566             rootDirPath = ts.ensureTrailingDirectorySeparator(rootDirPath);
92567             var cachedResult = getCachedFileSystemEntries(rootDirPath);
92568             if (cachedResult) {
92569                 return cachedResult;
92570             }
92571             try {
92572                 return createCachedFileSystemEntries(rootDir, rootDirPath);
92573             }
92574             catch (_e) {
92575                 ts.Debug.assert(!cachedReadDirectoryResult.has(ts.ensureTrailingDirectorySeparator(rootDirPath)));
92576                 return undefined;
92577             }
92578         }
92579         function fileNameEqual(name1, name2) {
92580             return getCanonicalFileName(name1) === getCanonicalFileName(name2);
92581         }
92582         function hasEntry(entries, name) {
92583             return ts.some(entries, function (file) { return fileNameEqual(file, name); });
92584         }
92585         function updateFileSystemEntry(entries, baseName, isValid) {
92586             if (hasEntry(entries, baseName)) {
92587                 if (!isValid) {
92588                     return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
92589                 }
92590             }
92591             else if (isValid) {
92592                 return entries.push(baseName);
92593             }
92594         }
92595         function writeFile(fileName, data, writeByteOrderMark) {
92596             var path = toPath(fileName);
92597             var result = getCachedFileSystemEntriesForBaseDir(path);
92598             if (result) {
92599                 updateFilesOfFileSystemEntry(result, getBaseNameOfFileName(fileName), true);
92600             }
92601             return host.writeFile(fileName, data, writeByteOrderMark);
92602         }
92603         function fileExists(fileName) {
92604             var path = toPath(fileName);
92605             var result = getCachedFileSystemEntriesForBaseDir(path);
92606             return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) ||
92607                 host.fileExists(fileName);
92608         }
92609         function directoryExists(dirPath) {
92610             var path = toPath(dirPath);
92611             return cachedReadDirectoryResult.has(ts.ensureTrailingDirectorySeparator(path)) || host.directoryExists(dirPath);
92612         }
92613         function createDirectory(dirPath) {
92614             var path = toPath(dirPath);
92615             var result = getCachedFileSystemEntriesForBaseDir(path);
92616             var baseFileName = getBaseNameOfFileName(dirPath);
92617             if (result) {
92618                 updateFileSystemEntry(result.directories, baseFileName, true);
92619             }
92620             host.createDirectory(dirPath);
92621         }
92622         function getDirectories(rootDir) {
92623             var rootDirPath = toPath(rootDir);
92624             var result = tryReadDirectory(rootDir, rootDirPath);
92625             if (result) {
92626                 return result.directories.slice();
92627             }
92628             return host.getDirectories(rootDir);
92629         }
92630         function readDirectory(rootDir, extensions, excludes, includes, depth) {
92631             var rootDirPath = toPath(rootDir);
92632             var rootResult = tryReadDirectory(rootDir, rootDirPath);
92633             var rootSymLinkResult;
92634             if (rootResult !== undefined) {
92635                 return ts.matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
92636             }
92637             return host.readDirectory(rootDir, extensions, excludes, includes, depth);
92638             function getFileSystemEntries(dir) {
92639                 var path = toPath(dir);
92640                 if (path === rootDirPath) {
92641                     return rootResult || getFileSystemEntriesFromHost(dir, path);
92642                 }
92643                 var result = tryReadDirectory(dir, path);
92644                 return result !== undefined ?
92645                     result || getFileSystemEntriesFromHost(dir, path) :
92646                     ts.emptyFileSystemEntries;
92647             }
92648             function getFileSystemEntriesFromHost(dir, path) {
92649                 if (rootSymLinkResult && path === rootDirPath)
92650                     return rootSymLinkResult;
92651                 var result = {
92652                     files: ts.map(host.readDirectory(dir, undefined, undefined, ["*.*"]), getBaseNameOfFileName) || ts.emptyArray,
92653                     directories: host.getDirectories(dir) || ts.emptyArray
92654                 };
92655                 if (path === rootDirPath)
92656                     rootSymLinkResult = result;
92657                 return result;
92658             }
92659         }
92660         function realpath(s) {
92661             return host.realpath ? host.realpath(s) : s;
92662         }
92663         function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
92664             var existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
92665             if (existingResult !== undefined) {
92666                 clearCache();
92667                 return undefined;
92668             }
92669             var parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
92670             if (!parentResult) {
92671                 return undefined;
92672             }
92673             if (!host.directoryExists) {
92674                 clearCache();
92675                 return undefined;
92676             }
92677             var baseName = getBaseNameOfFileName(fileOrDirectory);
92678             var fsQueryResult = {
92679                 fileExists: host.fileExists(fileOrDirectoryPath),
92680                 directoryExists: host.directoryExists(fileOrDirectoryPath)
92681             };
92682             if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) {
92683                 clearCache();
92684             }
92685             else {
92686                 updateFilesOfFileSystemEntry(parentResult, baseName, fsQueryResult.fileExists);
92687             }
92688             return fsQueryResult;
92689         }
92690         function addOrDeleteFile(fileName, filePath, eventKind) {
92691             if (eventKind === ts.FileWatcherEventKind.Changed) {
92692                 return;
92693             }
92694             var parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
92695             if (parentResult) {
92696                 updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === ts.FileWatcherEventKind.Created);
92697             }
92698         }
92699         function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
92700             updateFileSystemEntry(parentResult.files, baseName, fileExists);
92701         }
92702         function clearCache() {
92703             cachedReadDirectoryResult.clear();
92704         }
92705     }
92706     ts.createCachedDirectoryStructureHost = createCachedDirectoryStructureHost;
92707     var ConfigFileProgramReloadLevel;
92708     (function (ConfigFileProgramReloadLevel) {
92709         ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["None"] = 0] = "None";
92710         ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Partial"] = 1] = "Partial";
92711         ConfigFileProgramReloadLevel[ConfigFileProgramReloadLevel["Full"] = 2] = "Full";
92712     })(ConfigFileProgramReloadLevel = ts.ConfigFileProgramReloadLevel || (ts.ConfigFileProgramReloadLevel = {}));
92713     function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath) {
92714         var _a;
92715         var extendedConfigs = ts.arrayToMap(((_a = options === null || options === void 0 ? void 0 : options.configFile) === null || _a === void 0 ? void 0 : _a.extendedSourceFiles) || ts.emptyArray, toPath);
92716         extendedConfigFilesMap.forEach(function (watcher, extendedConfigFilePath) {
92717             if (!extendedConfigs.has(extendedConfigFilePath)) {
92718                 watcher.projects.delete(projectPath);
92719                 watcher.close();
92720             }
92721         });
92722         extendedConfigs.forEach(function (extendedConfigFileName, extendedConfigFilePath) {
92723             var existing = extendedConfigFilesMap.get(extendedConfigFilePath);
92724             if (existing) {
92725                 existing.projects.add(projectPath);
92726             }
92727             else {
92728                 extendedConfigFilesMap.set(extendedConfigFilePath, {
92729                     projects: new ts.Set([projectPath]),
92730                     watcher: createExtendedConfigFileWatch(extendedConfigFileName, extendedConfigFilePath),
92731                     close: function () {
92732                         var existing = extendedConfigFilesMap.get(extendedConfigFilePath);
92733                         if (!existing || existing.projects.size !== 0)
92734                             return;
92735                         existing.watcher.close();
92736                         extendedConfigFilesMap.delete(extendedConfigFilePath);
92737                     },
92738                 });
92739             }
92740         });
92741     }
92742     ts.updateSharedExtendedConfigFileWatcher = updateSharedExtendedConfigFileWatcher;
92743     function clearSharedExtendedConfigFileWatcher(projectPath, extendedConfigFilesMap) {
92744         extendedConfigFilesMap.forEach(function (watcher) {
92745             if (watcher.projects.delete(projectPath))
92746                 watcher.close();
92747         });
92748     }
92749     ts.clearSharedExtendedConfigFileWatcher = clearSharedExtendedConfigFileWatcher;
92750     function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath) {
92751         if (!extendedConfigCache.delete(extendedConfigFilePath))
92752             return;
92753         extendedConfigCache.forEach(function (_a, key) {
92754             var _b;
92755             var extendedResult = _a.extendedResult;
92756             if ((_b = extendedResult.extendedSourceFiles) === null || _b === void 0 ? void 0 : _b.some(function (extendedFile) { return toPath(extendedFile) === extendedConfigFilePath; })) {
92757                 cleanExtendedConfigCache(extendedConfigCache, key, toPath);
92758             }
92759         });
92760     }
92761     ts.cleanExtendedConfigCache = cleanExtendedConfigCache;
92762     function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWatch) {
92763         var newMap = new ts.Map(lookups);
92764         ts.mutateMap(packageJsonWatches, newMap, {
92765             createNewValue: createPackageJsonWatch,
92766             onDeleteValue: ts.closeFileWatcher
92767         });
92768     }
92769     ts.updatePackageJsonWatch = updatePackageJsonWatch;
92770     function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
92771         var missingFilePaths = program.getMissingFilePaths();
92772         var newMissingFilePathMap = ts.arrayToMap(missingFilePaths, ts.identity, ts.returnTrue);
92773         ts.mutateMap(missingFileWatches, newMissingFilePathMap, {
92774             createNewValue: createMissingFileWatch,
92775             onDeleteValue: ts.closeFileWatcher
92776         });
92777     }
92778     ts.updateMissingFilePathsWatch = updateMissingFilePathsWatch;
92779     function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) {
92780         ts.mutateMap(existingWatchedForWildcards, wildcardDirectories, {
92781             createNewValue: createWildcardDirectoryWatcher,
92782             onDeleteValue: closeFileWatcherOf,
92783             onExistingValue: updateWildcardDirectoryWatcher
92784         });
92785         function createWildcardDirectoryWatcher(directory, flags) {
92786             return {
92787                 watcher: watchDirectory(directory, flags),
92788                 flags: flags
92789             };
92790         }
92791         function updateWildcardDirectoryWatcher(existingWatcher, flags, directory) {
92792             if (existingWatcher.flags === flags) {
92793                 return;
92794             }
92795             existingWatcher.watcher.close();
92796             existingWatchedForWildcards.set(directory, createWildcardDirectoryWatcher(directory, flags));
92797         }
92798     }
92799     ts.updateWatchingWildcardDirectories = updateWatchingWildcardDirectories;
92800     function isIgnoredFileFromWildCardWatching(_a) {
92801         var watchedDirPath = _a.watchedDirPath, fileOrDirectory = _a.fileOrDirectory, fileOrDirectoryPath = _a.fileOrDirectoryPath, configFileName = _a.configFileName, options = _a.options, program = _a.program, extraFileExtensions = _a.extraFileExtensions, currentDirectory = _a.currentDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, writeLog = _a.writeLog, toPath = _a.toPath;
92802         var newPath = ts.removeIgnoredPath(fileOrDirectoryPath);
92803         if (!newPath) {
92804             writeLog("Project: ".concat(configFileName, " Detected ignored path: ").concat(fileOrDirectory));
92805             return true;
92806         }
92807         fileOrDirectoryPath = newPath;
92808         if (fileOrDirectoryPath === watchedDirPath)
92809             return false;
92810         if (ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, options, extraFileExtensions)) {
92811             writeLog("Project: ".concat(configFileName, " Detected file add/remove of non supported extension: ").concat(fileOrDirectory));
92812             return true;
92813         }
92814         if (ts.isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) {
92815             writeLog("Project: ".concat(configFileName, " Detected excluded file: ").concat(fileOrDirectory));
92816             return true;
92817         }
92818         if (!program)
92819             return false;
92820         if (ts.outFile(options) || options.outDir)
92821             return false;
92822         if (ts.fileExtensionIs(fileOrDirectoryPath, ".d.ts")) {
92823             if (options.declarationDir)
92824                 return false;
92825         }
92826         else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensionsFlat)) {
92827             return false;
92828         }
92829         var filePathWithoutExtension = ts.removeFileExtension(fileOrDirectoryPath);
92830         var realProgram = ts.isArray(program) ? undefined : isBuilderProgram(program) ? program.getProgramOrUndefined() : program;
92831         var builderProgram = !realProgram && !ts.isArray(program) ? program : undefined;
92832         if (hasSourceFile((filePathWithoutExtension + ".ts")) ||
92833             hasSourceFile((filePathWithoutExtension + ".tsx"))) {
92834             writeLog("Project: ".concat(configFileName, " Detected output file: ").concat(fileOrDirectory));
92835             return true;
92836         }
92837         return false;
92838         function hasSourceFile(file) {
92839             return realProgram ?
92840                 !!realProgram.getSourceFileByPath(file) :
92841                 builderProgram ?
92842                     builderProgram.getState().fileInfos.has(file) :
92843                     !!ts.find(program, function (rootFile) { return toPath(rootFile) === file; });
92844         }
92845     }
92846     ts.isIgnoredFileFromWildCardWatching = isIgnoredFileFromWildCardWatching;
92847     function isBuilderProgram(program) {
92848         return !!program.getState;
92849     }
92850     function isEmittedFileOfProgram(program, file) {
92851         if (!program) {
92852             return false;
92853         }
92854         return program.isEmittedFile(file);
92855     }
92856     ts.isEmittedFileOfProgram = isEmittedFileOfProgram;
92857     var WatchLogLevel;
92858     (function (WatchLogLevel) {
92859         WatchLogLevel[WatchLogLevel["None"] = 0] = "None";
92860         WatchLogLevel[WatchLogLevel["TriggerOnly"] = 1] = "TriggerOnly";
92861         WatchLogLevel[WatchLogLevel["Verbose"] = 2] = "Verbose";
92862     })(WatchLogLevel = ts.WatchLogLevel || (ts.WatchLogLevel = {}));
92863     function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo) {
92864         ts.setSysLog(watchLogLevel === WatchLogLevel.Verbose ? log : ts.noop);
92865         var plainInvokeFactory = {
92866             watchFile: function (file, callback, pollingInterval, options) { return host.watchFile(file, callback, pollingInterval, options); },
92867             watchDirectory: function (directory, callback, flags, options) { return host.watchDirectory(directory, callback, (flags & 1) !== 0, options); },
92868         };
92869         var triggerInvokingFactory = watchLogLevel !== WatchLogLevel.None ?
92870             {
92871                 watchFile: createTriggerLoggingAddWatch("watchFile"),
92872                 watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
92873             } :
92874             undefined;
92875         var factory = watchLogLevel === WatchLogLevel.Verbose ?
92876             {
92877                 watchFile: createFileWatcherWithLogging,
92878                 watchDirectory: createDirectoryWatcherWithLogging
92879             } :
92880             triggerInvokingFactory || plainInvokeFactory;
92881         var excludeWatcherFactory = watchLogLevel === WatchLogLevel.Verbose ?
92882             createExcludeWatcherWithLogging :
92883             ts.returnNoopFileWatcher;
92884         return {
92885             watchFile: createExcludeHandlingAddWatch("watchFile"),
92886             watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
92887         };
92888         function createExcludeHandlingAddWatch(key) {
92889             return function (file, cb, flags, options, detailInfo1, detailInfo2) {
92890                 var _a;
92891                 return !ts.matchesExclude(file, key === "watchFile" ? options === null || options === void 0 ? void 0 : options.excludeFiles : options === null || options === void 0 ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) === null || _a === void 0 ? void 0 : _a.call(host)) || "") ?
92892                     factory[key].call(undefined, file, cb, flags, options, detailInfo1, detailInfo2) :
92893                     excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
92894             };
92895         }
92896         function useCaseSensitiveFileNames() {
92897             return typeof host.useCaseSensitiveFileNames === "boolean" ?
92898                 host.useCaseSensitiveFileNames :
92899                 host.useCaseSensitiveFileNames();
92900         }
92901         function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
92902             log("ExcludeWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)));
92903             return {
92904                 close: function () { return log("ExcludeWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); }
92905             };
92906         }
92907         function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
92908             log("FileWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)));
92909             var watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
92910             return {
92911                 close: function () {
92912                     log("FileWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)));
92913                     watcher.close();
92914                 }
92915             };
92916         }
92917         function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
92918             var watchInfo = "DirectoryWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo));
92919             log(watchInfo);
92920             var start = ts.timestamp();
92921             var watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
92922             var elapsed = ts.timestamp() - start;
92923             log("Elapsed:: ".concat(elapsed, "ms ").concat(watchInfo));
92924             return {
92925                 close: function () {
92926                     var watchInfo = "DirectoryWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo));
92927                     log(watchInfo);
92928                     var start = ts.timestamp();
92929                     watcher.close();
92930                     var elapsed = ts.timestamp() - start;
92931                     log("Elapsed:: ".concat(elapsed, "ms ").concat(watchInfo));
92932                 }
92933             };
92934         }
92935         function createTriggerLoggingAddWatch(key) {
92936             return function (file, cb, flags, options, detailInfo1, detailInfo2) { return plainInvokeFactory[key].call(undefined, file, function () {
92937                 var args = [];
92938                 for (var _i = 0; _i < arguments.length; _i++) {
92939                     args[_i] = arguments[_i];
92940                 }
92941                 var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== undefined ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo));
92942                 log(triggerredInfo);
92943                 var start = ts.timestamp();
92944                 cb.call.apply(cb, __spreadArray([undefined], args, false));
92945                 var elapsed = ts.timestamp() - start;
92946                 log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo));
92947             }, flags, options, detailInfo1, detailInfo2); };
92948         }
92949         function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo) {
92950             return "WatchInfo: ".concat(file, " ").concat(flags, " ").concat(JSON.stringify(options), " ").concat(getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : detailInfo2 === undefined ? detailInfo1 : "".concat(detailInfo1, " ").concat(detailInfo2));
92951         }
92952     }
92953     ts.getWatchFactory = getWatchFactory;
92954     function getFallbackOptions(options) {
92955         var fallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling;
92956         return {
92957             watchFile: fallbackPolling !== undefined ?
92958                 fallbackPolling :
92959                 ts.WatchFileKind.PriorityPollingInterval
92960         };
92961     }
92962     ts.getFallbackOptions = getFallbackOptions;
92963     function closeFileWatcherOf(objWithWatcher) {
92964         objWithWatcher.watcher.close();
92965     }
92966     ts.closeFileWatcherOf = closeFileWatcherOf;
92967 })(ts || (ts = {}));
92968 var ts;
92969 (function (ts) {
92970     function findConfigFile(searchPath, fileExists, configName) {
92971         if (configName === void 0) { configName = "tsconfig.json"; }
92972         return ts.forEachAncestorDirectory(searchPath, function (ancestor) {
92973             var fileName = ts.combinePaths(ancestor, configName);
92974             return fileExists(fileName) ? fileName : undefined;
92975         });
92976     }
92977     ts.findConfigFile = findConfigFile;
92978     function resolveTripleslashReference(moduleName, containingFile) {
92979         var basePath = ts.getDirectoryPath(containingFile);
92980         var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName);
92981         return ts.normalizePath(referencedFileName);
92982     }
92983     ts.resolveTripleslashReference = resolveTripleslashReference;
92984     function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {
92985         var commonPathComponents;
92986         var failed = ts.forEach(fileNames, function (sourceFile) {
92987             var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory);
92988             sourcePathComponents.pop();
92989             if (!commonPathComponents) {
92990                 commonPathComponents = sourcePathComponents;
92991                 return;
92992             }
92993             var n = Math.min(commonPathComponents.length, sourcePathComponents.length);
92994             for (var i = 0; i < n; i++) {
92995                 if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {
92996                     if (i === 0) {
92997                         return true;
92998                     }
92999                     commonPathComponents.length = i;
93000                     break;
93001                 }
93002             }
93003             if (sourcePathComponents.length < commonPathComponents.length) {
93004                 commonPathComponents.length = sourcePathComponents.length;
93005             }
93006         });
93007         if (failed) {
93008             return "";
93009         }
93010         if (!commonPathComponents) {
93011             return currentDirectory;
93012         }
93013         return ts.getPathFromPathComponents(commonPathComponents);
93014     }
93015     ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames;
93016     function createCompilerHost(options, setParentNodes) {
93017         return createCompilerHostWorker(options, setParentNodes);
93018     }
93019     ts.createCompilerHost = createCompilerHost;
93020     function createCompilerHostWorker(options, setParentNodes, system) {
93021         if (system === void 0) { system = ts.sys; }
93022         var existingDirectories = new ts.Map();
93023         var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
93024         var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
93025         function getSourceFile(fileName, languageVersion, onError) {
93026             var text;
93027             try {
93028                 ts.performance.mark("beforeIORead");
93029                 text = compilerHost.readFile(fileName);
93030                 ts.performance.mark("afterIORead");
93031                 ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
93032             }
93033             catch (e) {
93034                 if (onError) {
93035                     onError(e.message);
93036                 }
93037                 text = "";
93038             }
93039             return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
93040         }
93041         function directoryExists(directoryPath) {
93042             if (existingDirectories.has(directoryPath)) {
93043                 return true;
93044             }
93045             if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
93046                 existingDirectories.set(directoryPath, true);
93047                 return true;
93048             }
93049             return false;
93050         }
93051         function writeFile(fileName, data, writeByteOrderMark, onError) {
93052             try {
93053                 ts.performance.mark("beforeIOWrite");
93054                 ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return writeFileWorker(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
93055                 ts.performance.mark("afterIOWrite");
93056                 ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
93057             }
93058             catch (e) {
93059                 if (onError) {
93060                     onError(e.message);
93061                 }
93062             }
93063         }
93064         var outputFingerprints;
93065         function writeFileWorker(fileName, data, writeByteOrderMark) {
93066             if (!ts.isWatchSet(options) || !system.getModifiedTime) {
93067                 system.writeFile(fileName, data, writeByteOrderMark);
93068                 return;
93069             }
93070             if (!outputFingerprints) {
93071                 outputFingerprints = new ts.Map();
93072             }
93073             var hash = computeHash(data);
93074             var mtimeBefore = system.getModifiedTime(fileName);
93075             if (mtimeBefore) {
93076                 var fingerprint = outputFingerprints.get(fileName);
93077                 if (fingerprint &&
93078                     fingerprint.byteOrderMark === writeByteOrderMark &&
93079                     fingerprint.hash === hash &&
93080                     fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
93081                     return;
93082                 }
93083             }
93084             system.writeFile(fileName, data, writeByteOrderMark);
93085             var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
93086             outputFingerprints.set(fileName, {
93087                 hash: hash,
93088                 byteOrderMark: writeByteOrderMark,
93089                 mtime: mtimeAfter
93090             });
93091         }
93092         function getDefaultLibLocation() {
93093             return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
93094         }
93095         var newLine = ts.getNewLineCharacter(options, function () { return system.newLine; });
93096         var realpath = system.realpath && (function (path) { return system.realpath(path); });
93097         var compilerHost = {
93098             getSourceFile: getSourceFile,
93099             getDefaultLibLocation: getDefaultLibLocation,
93100             getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },
93101             writeFile: writeFile,
93102             getCurrentDirectory: ts.memoize(function () { return system.getCurrentDirectory(); }),
93103             useCaseSensitiveFileNames: function () { return system.useCaseSensitiveFileNames; },
93104             getCanonicalFileName: getCanonicalFileName,
93105             getNewLine: function () { return newLine; },
93106             fileExists: function (fileName) { return system.fileExists(fileName); },
93107             readFile: function (fileName) { return system.readFile(fileName); },
93108             trace: function (s) { return system.write(s + newLine); },
93109             directoryExists: function (directoryName) { return system.directoryExists(directoryName); },
93110             getEnvironmentVariable: function (name) { return system.getEnvironmentVariable ? system.getEnvironmentVariable(name) : ""; },
93111             getDirectories: function (path) { return system.getDirectories(path); },
93112             realpath: realpath,
93113             readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
93114             createDirectory: function (d) { return system.createDirectory(d); },
93115             createHash: ts.maybeBind(system, system.createHash)
93116         };
93117         return compilerHost;
93118     }
93119     ts.createCompilerHostWorker = createCompilerHostWorker;
93120     function changeCompilerHostLikeToUseCache(host, toPath, getSourceFile) {
93121         var originalReadFile = host.readFile;
93122         var originalFileExists = host.fileExists;
93123         var originalDirectoryExists = host.directoryExists;
93124         var originalCreateDirectory = host.createDirectory;
93125         var originalWriteFile = host.writeFile;
93126         var readFileCache = new ts.Map();
93127         var fileExistsCache = new ts.Map();
93128         var directoryExistsCache = new ts.Map();
93129         var sourceFileCache = new ts.Map();
93130         var readFileWithCache = function (fileName) {
93131             var key = toPath(fileName);
93132             var value = readFileCache.get(key);
93133             if (value !== undefined)
93134                 return value !== false ? value : undefined;
93135             return setReadFileCache(key, fileName);
93136         };
93137         var setReadFileCache = function (key, fileName) {
93138             var newValue = originalReadFile.call(host, fileName);
93139             readFileCache.set(key, newValue !== undefined ? newValue : false);
93140             return newValue;
93141         };
93142         host.readFile = function (fileName) {
93143             var key = toPath(fileName);
93144             var value = readFileCache.get(key);
93145             if (value !== undefined)
93146                 return value !== false ? value : undefined;
93147             if (!ts.fileExtensionIs(fileName, ".json") && !ts.isBuildInfoFile(fileName)) {
93148                 return originalReadFile.call(host, fileName);
93149             }
93150             return setReadFileCache(key, fileName);
93151         };
93152         var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) {
93153             var key = toPath(fileName);
93154             var value = sourceFileCache.get(key);
93155             if (value)
93156                 return value;
93157             var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
93158             if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json"))) {
93159                 sourceFileCache.set(key, sourceFile);
93160             }
93161             return sourceFile;
93162         } : undefined;
93163         host.fileExists = function (fileName) {
93164             var key = toPath(fileName);
93165             var value = fileExistsCache.get(key);
93166             if (value !== undefined)
93167                 return value;
93168             var newValue = originalFileExists.call(host, fileName);
93169             fileExistsCache.set(key, !!newValue);
93170             return newValue;
93171         };
93172         if (originalWriteFile) {
93173             host.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
93174                 var key = toPath(fileName);
93175                 fileExistsCache.delete(key);
93176                 var value = readFileCache.get(key);
93177                 if (value !== undefined && value !== data) {
93178                     readFileCache.delete(key);
93179                     sourceFileCache.delete(key);
93180                 }
93181                 else if (getSourceFileWithCache) {
93182                     var sourceFile = sourceFileCache.get(key);
93183                     if (sourceFile && sourceFile.text !== data) {
93184                         sourceFileCache.delete(key);
93185                     }
93186                 }
93187                 originalWriteFile.call(host, fileName, data, writeByteOrderMark, onError, sourceFiles);
93188             };
93189         }
93190         if (originalDirectoryExists && originalCreateDirectory) {
93191             host.directoryExists = function (directory) {
93192                 var key = toPath(directory);
93193                 var value = directoryExistsCache.get(key);
93194                 if (value !== undefined)
93195                     return value;
93196                 var newValue = originalDirectoryExists.call(host, directory);
93197                 directoryExistsCache.set(key, !!newValue);
93198                 return newValue;
93199             };
93200             host.createDirectory = function (directory) {
93201                 var key = toPath(directory);
93202                 directoryExistsCache.delete(key);
93203                 originalCreateDirectory.call(host, directory);
93204             };
93205         }
93206         return {
93207             originalReadFile: originalReadFile,
93208             originalFileExists: originalFileExists,
93209             originalDirectoryExists: originalDirectoryExists,
93210             originalCreateDirectory: originalCreateDirectory,
93211             originalWriteFile: originalWriteFile,
93212             getSourceFileWithCache: getSourceFileWithCache,
93213             readFileWithCache: readFileWithCache
93214         };
93215     }
93216     ts.changeCompilerHostLikeToUseCache = changeCompilerHostLikeToUseCache;
93217     function getPreEmitDiagnostics(program, sourceFile, cancellationToken) {
93218         var diagnostics;
93219         diagnostics = ts.addRange(diagnostics, program.getConfigFileParsingDiagnostics());
93220         diagnostics = ts.addRange(diagnostics, program.getOptionsDiagnostics(cancellationToken));
93221         diagnostics = ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile, cancellationToken));
93222         diagnostics = ts.addRange(diagnostics, program.getGlobalDiagnostics(cancellationToken));
93223         diagnostics = ts.addRange(diagnostics, program.getSemanticDiagnostics(sourceFile, cancellationToken));
93224         if (ts.getEmitDeclarations(program.getCompilerOptions())) {
93225             diagnostics = ts.addRange(diagnostics, program.getDeclarationDiagnostics(sourceFile, cancellationToken));
93226         }
93227         return ts.sortAndDeduplicateDiagnostics(diagnostics || ts.emptyArray);
93228     }
93229     ts.getPreEmitDiagnostics = getPreEmitDiagnostics;
93230     function formatDiagnostics(diagnostics, host) {
93231         var output = "";
93232         for (var _i = 0, diagnostics_3 = diagnostics; _i < diagnostics_3.length; _i++) {
93233             var diagnostic = diagnostics_3[_i];
93234             output += formatDiagnostic(diagnostic, host);
93235         }
93236         return output;
93237     }
93238     ts.formatDiagnostics = formatDiagnostics;
93239     function formatDiagnostic(diagnostic, host) {
93240         var errorMessage = "".concat(ts.diagnosticCategoryName(diagnostic), " TS").concat(diagnostic.code, ": ").concat(flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())).concat(host.getNewLine());
93241         if (diagnostic.file) {
93242             var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character;
93243             var fileName = diagnostic.file.fileName;
93244             var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); });
93245             return "".concat(relativeFileName, "(").concat(line + 1, ",").concat(character + 1, "): ") + errorMessage;
93246         }
93247         return errorMessage;
93248     }
93249     ts.formatDiagnostic = formatDiagnostic;
93250     var ForegroundColorEscapeSequences;
93251     (function (ForegroundColorEscapeSequences) {
93252         ForegroundColorEscapeSequences["Grey"] = "\u001B[90m";
93253         ForegroundColorEscapeSequences["Red"] = "\u001B[91m";
93254         ForegroundColorEscapeSequences["Yellow"] = "\u001B[93m";
93255         ForegroundColorEscapeSequences["Blue"] = "\u001B[94m";
93256         ForegroundColorEscapeSequences["Cyan"] = "\u001B[96m";
93257     })(ForegroundColorEscapeSequences = ts.ForegroundColorEscapeSequences || (ts.ForegroundColorEscapeSequences = {}));
93258     var gutterStyleSequence = "\u001b[7m";
93259     var gutterSeparator = " ";
93260     var resetEscapeSequence = "\u001b[0m";
93261     var ellipsis = "...";
93262     var halfIndent = "  ";
93263     var indent = "    ";
93264     function getCategoryFormat(category) {
93265         switch (category) {
93266             case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
93267             case ts.DiagnosticCategory.Warning: return ForegroundColorEscapeSequences.Yellow;
93268             case ts.DiagnosticCategory.Suggestion: return ts.Debug.fail("Should never get an Info diagnostic on the command line.");
93269             case ts.DiagnosticCategory.Message: return ForegroundColorEscapeSequences.Blue;
93270         }
93271     }
93272     function formatColorAndReset(text, formatStyle) {
93273         return formatStyle + text + resetEscapeSequence;
93274     }
93275     ts.formatColorAndReset = formatColorAndReset;
93276     function formatCodeSpan(file, start, length, indent, squiggleColor, host) {
93277         var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
93278         var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
93279         var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
93280         var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
93281         var gutterWidth = (lastLine + 1 + "").length;
93282         if (hasMoreThanFiveLines) {
93283             gutterWidth = Math.max(ellipsis.length, gutterWidth);
93284         }
93285         var context = "";
93286         for (var i = firstLine; i <= lastLine; i++) {
93287             context += host.getNewLine();
93288             if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
93289                 context += indent + formatColorAndReset(ts.padLeft(ellipsis, gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
93290                 i = lastLine - 1;
93291             }
93292             var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
93293             var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
93294             var lineContent = file.text.slice(lineStart, lineEnd);
93295             lineContent = ts.trimStringEnd(lineContent);
93296             lineContent = lineContent.replace(/\t/g, " ");
93297             context += indent + formatColorAndReset(ts.padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
93298             context += lineContent + host.getNewLine();
93299             context += indent + formatColorAndReset(ts.padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
93300             context += squiggleColor;
93301             if (i === firstLine) {
93302                 var lastCharForLine = i === lastLine ? lastLineChar : undefined;
93303                 context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
93304                 context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
93305             }
93306             else if (i === lastLine) {
93307                 context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
93308             }
93309             else {
93310                 context += lineContent.replace(/./g, "~");
93311             }
93312             context += resetEscapeSequence;
93313         }
93314         return context;
93315     }
93316     function formatLocation(file, start, host, color) {
93317         if (color === void 0) { color = formatColorAndReset; }
93318         var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
93319         var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName;
93320         var output = "";
93321         output += color(relativeFileName, ForegroundColorEscapeSequences.Cyan);
93322         output += ":";
93323         output += color("".concat(firstLine + 1), ForegroundColorEscapeSequences.Yellow);
93324         output += ":";
93325         output += color("".concat(firstLineChar + 1), ForegroundColorEscapeSequences.Yellow);
93326         return output;
93327     }
93328     ts.formatLocation = formatLocation;
93329     function formatDiagnosticsWithColorAndContext(diagnostics, host) {
93330         var output = "";
93331         for (var _i = 0, diagnostics_4 = diagnostics; _i < diagnostics_4.length; _i++) {
93332             var diagnostic = diagnostics_4[_i];
93333             if (diagnostic.file) {
93334                 var file = diagnostic.file, start = diagnostic.start;
93335                 output += formatLocation(file, start, host);
93336                 output += " - ";
93337             }
93338             output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
93339             output += formatColorAndReset(" TS".concat(diagnostic.code, ": "), ForegroundColorEscapeSequences.Grey);
93340             output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
93341             if (diagnostic.file) {
93342                 output += host.getNewLine();
93343                 output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host);
93344             }
93345             if (diagnostic.relatedInformation) {
93346                 output += host.getNewLine();
93347                 for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) {
93348                     var _c = _b[_a], file = _c.file, start = _c.start, length_9 = _c.length, messageText = _c.messageText;
93349                     if (file) {
93350                         output += host.getNewLine();
93351                         output += halfIndent + formatLocation(file, start, host);
93352                         output += formatCodeSpan(file, start, length_9, indent, ForegroundColorEscapeSequences.Cyan, host);
93353                     }
93354                     output += host.getNewLine();
93355                     output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
93356                 }
93357             }
93358             output += host.getNewLine();
93359         }
93360         return output;
93361     }
93362     ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext;
93363     function flattenDiagnosticMessageText(diag, newLine, indent) {
93364         if (indent === void 0) { indent = 0; }
93365         if (ts.isString(diag)) {
93366             return diag;
93367         }
93368         else if (diag === undefined) {
93369             return "";
93370         }
93371         var result = "";
93372         if (indent) {
93373             result += newLine;
93374             for (var i = 0; i < indent; i++) {
93375                 result += "  ";
93376             }
93377         }
93378         result += diag.messageText;
93379         indent++;
93380         if (diag.next) {
93381             for (var _i = 0, _a = diag.next; _i < _a.length; _i++) {
93382                 var kid = _a[_i];
93383                 result += flattenDiagnosticMessageText(kid, newLine, indent);
93384             }
93385         }
93386         return result;
93387     }
93388     ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
93389     function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
93390         if (names.length === 0) {
93391             return [];
93392         }
93393         var resolutions = [];
93394         var cache = new ts.Map();
93395         for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
93396             var name = names_2[_i];
93397             var result = void 0;
93398             if (cache.has(name)) {
93399                 result = cache.get(name);
93400             }
93401             else {
93402                 cache.set(name, result = loader(name, containingFile, redirectedReference));
93403             }
93404             resolutions.push(result);
93405         }
93406         return resolutions;
93407     }
93408     ts.loadWithLocalCache = loadWithLocalCache;
93409     ;
93410     function getModeForResolutionAtIndex(file, index) {
93411         if (file.impliedNodeFormat === undefined)
93412             return undefined;
93413         return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
93414     }
93415     ts.getModeForResolutionAtIndex = getModeForResolutionAtIndex;
93416     function getModeForUsageLocation(file, usage) {
93417         var _a;
93418         if (file.impliedNodeFormat === undefined)
93419             return undefined;
93420         if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
93421             return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
93422         }
93423         var exprParentParent = (_a = ts.walkUpParenthesizedExpressions(usage.parent)) === null || _a === void 0 ? void 0 : _a.parent;
93424         return exprParentParent && ts.isImportEqualsDeclaration(exprParentParent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
93425     }
93426     ts.getModeForUsageLocation = getModeForUsageLocation;
93427     function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
93428         if (names.length === 0) {
93429             return [];
93430         }
93431         var resolutions = [];
93432         var cache = new ts.Map();
93433         var i = 0;
93434         for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
93435             var name = names_3[_i];
93436             var result = void 0;
93437             var mode = getModeForResolutionAtIndex(containingFile, i);
93438             i++;
93439             var cacheKey = mode !== undefined ? "".concat(mode, "|").concat(name) : name;
93440             if (cache.has(cacheKey)) {
93441                 result = cache.get(cacheKey);
93442             }
93443             else {
93444                 cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference));
93445             }
93446             resolutions.push(result);
93447         }
93448         return resolutions;
93449     }
93450     ts.loadWithModeAwareCache = loadWithModeAwareCache;
93451     function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
93452         return forEachProjectReference(undefined, resolvedProjectReferences, function (resolvedRef, parent) { return resolvedRef && cb(resolvedRef, parent); });
93453     }
93454     ts.forEachResolvedProjectReference = forEachResolvedProjectReference;
93455     function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
93456         var seenResolvedRefs;
93457         return worker(projectReferences, resolvedProjectReferences, undefined);
93458         function worker(projectReferences, resolvedProjectReferences, parent) {
93459             if (cbRef) {
93460                 var result = cbRef(projectReferences, parent);
93461                 if (result)
93462                     return result;
93463             }
93464             return ts.forEach(resolvedProjectReferences, function (resolvedRef, index) {
93465                 if (resolvedRef && (seenResolvedRefs === null || seenResolvedRefs === void 0 ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
93466                     return undefined;
93467                 }
93468                 var result = cbResolvedRef(resolvedRef, parent, index);
93469                 if (result || !resolvedRef)
93470                     return result;
93471                 (seenResolvedRefs || (seenResolvedRefs = new ts.Set())).add(resolvedRef.sourceFile.path);
93472                 return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef);
93473             });
93474         }
93475     }
93476     ts.inferredTypesContainingFile = "__inferred type names__.ts";
93477     function isReferencedFile(reason) {
93478         switch (reason === null || reason === void 0 ? void 0 : reason.kind) {
93479             case ts.FileIncludeKind.Import:
93480             case ts.FileIncludeKind.ReferenceFile:
93481             case ts.FileIncludeKind.TypeReferenceDirective:
93482             case ts.FileIncludeKind.LibReferenceDirective:
93483                 return true;
93484             default:
93485                 return false;
93486         }
93487     }
93488     ts.isReferencedFile = isReferencedFile;
93489     function isReferenceFileLocation(location) {
93490         return location.pos !== undefined;
93491     }
93492     ts.isReferenceFileLocation = isReferenceFileLocation;
93493     function getReferencedFileLocation(getSourceFileByPath, ref) {
93494         var _a, _b, _c;
93495         var _d, _e, _f, _g;
93496         var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
93497         var kind = ref.kind, index = ref.index;
93498         var pos, end, packageId;
93499         switch (kind) {
93500             case ts.FileIncludeKind.Import:
93501                 var importLiteral = getModuleNameStringLiteralAt(file, index);
93502                 packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
93503                 if (importLiteral.pos === -1)
93504                     return { file: file, packageId: packageId, text: importLiteral.text };
93505                 pos = ts.skipTrivia(file.text, importLiteral.pos);
93506                 end = importLiteral.end;
93507                 break;
93508             case ts.FileIncludeKind.ReferenceFile:
93509                 (_a = file.referencedFiles[index], pos = _a.pos, end = _a.end);
93510                 break;
93511             case ts.FileIncludeKind.TypeReferenceDirective:
93512                 (_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
93513                 packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId;
93514                 break;
93515             case ts.FileIncludeKind.LibReferenceDirective:
93516                 (_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
93517                 break;
93518             default:
93519                 return ts.Debug.assertNever(kind);
93520         }
93521         return { file: file, pos: pos, end: end, packageId: packageId };
93522     }
93523     ts.getReferencedFileLocation = getReferencedFileLocation;
93524     function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
93525         if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
93526             return false;
93527         if (!ts.arrayIsEqualTo(program.getRootFileNames(), rootFileNames))
93528             return false;
93529         var seenResolvedRefs;
93530         if (!ts.arrayIsEqualTo(program.getProjectReferences(), projectReferences, projectReferenceUptoDate))
93531             return false;
93532         if (program.getSourceFiles().some(sourceFileNotUptoDate))
93533             return false;
93534         if (program.getMissingFilePaths().some(fileExists))
93535             return false;
93536         var currentOptions = program.getCompilerOptions();
93537         if (!ts.compareDataObjects(currentOptions, newOptions))
93538             return false;
93539         if (currentOptions.configFile && newOptions.configFile)
93540             return currentOptions.configFile.text === newOptions.configFile.text;
93541         return true;
93542         function sourceFileNotUptoDate(sourceFile) {
93543             return !sourceFileVersionUptoDate(sourceFile) ||
93544                 hasInvalidatedResolution(sourceFile.path);
93545         }
93546         function sourceFileVersionUptoDate(sourceFile) {
93547             return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName);
93548         }
93549         function projectReferenceUptoDate(oldRef, newRef, index) {
93550             return ts.projectReferenceIsEqualTo(oldRef, newRef) &&
93551                 resolvedProjectReferenceUptoDate(program.getResolvedProjectReferences()[index], oldRef);
93552         }
93553         function resolvedProjectReferenceUptoDate(oldResolvedRef, oldRef) {
93554             if (oldResolvedRef) {
93555                 if (ts.contains(seenResolvedRefs, oldResolvedRef))
93556                     return true;
93557                 var refPath_1 = resolveProjectReferencePath(oldRef);
93558                 var newParsedCommandLine = getParsedCommandLine(refPath_1);
93559                 if (!newParsedCommandLine)
93560                     return false;
93561                 if (oldResolvedRef.commandLine.options.configFile !== newParsedCommandLine.options.configFile)
93562                     return false;
93563                 if (!ts.arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newParsedCommandLine.fileNames))
93564                     return false;
93565                 (seenResolvedRefs || (seenResolvedRefs = [])).push(oldResolvedRef);
93566                 return !ts.forEach(oldResolvedRef.references, function (childResolvedRef, index) {
93567                     return !resolvedProjectReferenceUptoDate(childResolvedRef, oldResolvedRef.commandLine.projectReferences[index]);
93568                 });
93569             }
93570             var refPath = resolveProjectReferencePath(oldRef);
93571             return !getParsedCommandLine(refPath);
93572         }
93573     }
93574     ts.isProgramUptoDate = isProgramUptoDate;
93575     function getConfigFileParsingDiagnostics(configFileParseResult) {
93576         return configFileParseResult.options.configFile ? __spreadArray(__spreadArray([], configFileParseResult.options.configFile.parseDiagnostics, true), configFileParseResult.errors, true) :
93577             configFileParseResult.errors;
93578     }
93579     ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
93580     function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
93581         switch (ts.getEmitModuleResolutionKind(options)) {
93582             case ts.ModuleResolutionKind.Node12:
93583             case ts.ModuleResolutionKind.NodeNext:
93584                 return ts.fileExtensionIsOneOf(fileName, [".d.mts", ".mts", ".mjs"]) ? ts.ModuleKind.ESNext :
93585                     ts.fileExtensionIsOneOf(fileName, [".d.cts", ".cts", ".cjs"]) ? ts.ModuleKind.CommonJS :
93586                         ts.fileExtensionIsOneOf(fileName, [".d.ts", ".ts", ".tsx", ".js", ".jsx"]) ? lookupFromPackageJson() :
93587                             undefined;
93588             default:
93589                 return undefined;
93590         }
93591         function lookupFromPackageJson() {
93592             var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
93593             return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
93594         }
93595     }
93596     ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
93597     function shouldProgramCreateNewSourceFiles(program, newOptions) {
93598         if (!program)
93599             return false;
93600         return ts.optionsHaveChanges(program.getCompilerOptions(), newOptions, ts.sourceFileAffectingCompilerOptions);
93601     }
93602     function createCreateProgramOptions(rootNames, options, host, oldProgram, configFileParsingDiagnostics) {
93603         return {
93604             rootNames: rootNames,
93605             options: options,
93606             host: host,
93607             oldProgram: oldProgram,
93608             configFileParsingDiagnostics: configFileParsingDiagnostics
93609         };
93610     }
93611     function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
93612         var _a, _b, _c, _d;
93613         var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
93614         var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
93615         var oldProgram = createProgramOptions.oldProgram;
93616         var processingDefaultLibFiles;
93617         var processingOtherFiles;
93618         var files;
93619         var symlinks;
93620         var commonSourceDirectory;
93621         var diagnosticsProducingTypeChecker;
93622         var noDiagnosticsTypeChecker;
93623         var classifiableNames;
93624         var ambientModuleNameToUnmodifiedFileName = new ts.Map();
93625         var fileReasons = ts.createMultiMap();
93626         var cachedBindAndCheckDiagnosticsForFile = {};
93627         var cachedDeclarationDiagnosticsForFile = {};
93628         var resolvedTypeReferenceDirectives = new ts.Map();
93629         var fileProcessingDiagnostics;
93630         var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
93631         var currentNodeModulesDepth = 0;
93632         var modulesWithElidedImports = new ts.Map();
93633         var sourceFilesFoundSearchingNodeModules = new ts.Map();
93634         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, true);
93635         ts.performance.mark("beforeProgram");
93636         var host = createProgramOptions.host || createCompilerHost(options);
93637         var configParsingHost = parseConfigHostFromCompilerHostLike(host);
93638         var skipDefaultLib = options.noLib;
93639         var getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options); });
93640         var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName());
93641         var programDiagnostics = ts.createDiagnosticCollection();
93642         var currentDirectory = host.getCurrentDirectory();
93643         var supportedExtensions = ts.getSupportedExtensions(options);
93644         var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
93645         var hasEmitBlockingDiagnostics = new ts.Map();
93646         var _compilerOptionsObjectLiteralSyntax;
93647         var moduleResolutionCache;
93648         var typeReferenceDirectiveResolutionCache;
93649         var actualResolveModuleNamesWorker;
93650         var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
93651         if (host.resolveModuleNames) {
93652             actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
93653                 if (!resolved || resolved.extension !== undefined) {
93654                     return resolved;
93655                 }
93656                 var withExtension = ts.clone(resolved);
93657                 withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
93658                 return withExtension;
93659             }); };
93660             moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
93661         }
93662         else {
93663             moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
93664             var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
93665             actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
93666         }
93667         var actualResolveTypeReferenceDirectiveNamesWorker;
93668         if (host.resolveTypeReferenceDirectives) {
93669             actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
93670         }
93671         else {
93672             typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
93673             var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
93674             actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference) { return loadWithLocalCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, loader_2); };
93675         }
93676         var packageIdToSourceFile = new ts.Map();
93677         var sourceFileToPackageName = new ts.Map();
93678         var redirectTargetsMap = ts.createMultiMap();
93679         var usesUriStyleNodeCoreModules = false;
93680         var filesByName = new ts.Map();
93681         var missingFilePaths;
93682         var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? new ts.Map() : undefined;
93683         var resolvedProjectReferences;
93684         var projectReferenceRedirects;
93685         var mapFromFileToProjectReferenceRedirects;
93686         var mapFromToProjectReferenceRedirectSource;
93687         var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
93688             !options.disableSourceOfProjectReferenceRedirect;
93689         var _e = updateHostForUseSourceOfProjectReferenceRedirect({
93690             compilerHost: host,
93691             getSymlinkCache: getSymlinkCache,
93692             useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
93693             toPath: toPath,
93694             getResolvedProjectReferences: getResolvedProjectReferences,
93695             getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
93696             forEachResolvedProjectReference: forEachResolvedProjectReference
93697         }), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
93698         var readFile = host.readFile.bind(host);
93699         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
93700         var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
93701         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93702         var structureIsReused;
93703         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "tryReuseStructureFromOldProgram", {});
93704         structureIsReused = tryReuseStructureFromOldProgram();
93705         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93706         if (structureIsReused !== 2) {
93707             processingDefaultLibFiles = [];
93708             processingOtherFiles = [];
93709             if (projectReferences) {
93710                 if (!resolvedProjectReferences) {
93711                     resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile);
93712                 }
93713                 if (rootNames.length) {
93714                     resolvedProjectReferences === null || resolvedProjectReferences === void 0 ? void 0 : resolvedProjectReferences.forEach(function (parsedRef, index) {
93715                         if (!parsedRef)
93716                             return;
93717                         var out = ts.outFile(parsedRef.commandLine.options);
93718                         if (useSourceOfProjectReferenceRedirect) {
93719                             if (out || ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
93720                                 for (var _i = 0, _a = parsedRef.commandLine.fileNames; _i < _a.length; _i++) {
93721                                     var fileName = _a[_i];
93722                                     processProjectReferenceFile(fileName, { kind: ts.FileIncludeKind.SourceFromProjectReference, index: index });
93723                                 }
93724                             }
93725                         }
93726                         else {
93727                             if (out) {
93728                                 processProjectReferenceFile(ts.changeExtension(out, ".d.ts"), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
93729                             }
93730                             else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
93731                                 var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
93732                                 for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
93733                                     var fileName = _c[_b];
93734                                     if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
93735                                         processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
93736                                     }
93737                                 }
93738                             }
93739                         }
93740                     });
93741                 }
93742             }
93743             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processRootFiles", { count: rootNames.length });
93744             ts.forEach(rootNames, function (name, index) { return processRootFile(name, false, false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
93745             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93746             var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
93747             if (typeReferences.length) {
93748                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferences", { count: typeReferences.length });
93749                 var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
93750                 var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
93751                 var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
93752                 for (var i = 0; i < typeReferences.length; i++) {
93753                     processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
93754                 }
93755                 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93756             }
93757             if (rootNames.length && !skipDefaultLib) {
93758                 var defaultLibraryFileName = getDefaultLibraryFileName();
93759                 if (!options.lib && defaultLibraryFileName) {
93760                     processRootFile(defaultLibraryFileName, true, false, { kind: ts.FileIncludeKind.LibFile });
93761                 }
93762                 else {
93763                     ts.forEach(options.lib, function (libFileName, index) {
93764                         processRootFile(pathForLibFile(libFileName), true, false, { kind: ts.FileIncludeKind.LibFile, index: index });
93765                     });
93766                 }
93767             }
93768             missingFilePaths = ts.arrayFrom(ts.mapDefinedIterator(filesByName.entries(), function (_a) {
93769                 var path = _a[0], file = _a[1];
93770                 return file === undefined ? path : undefined;
93771             }));
93772             files = ts.stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
93773             processingDefaultLibFiles = undefined;
93774             processingOtherFiles = undefined;
93775         }
93776         ts.Debug.assert(!!missingFilePaths);
93777         if (oldProgram && host.onReleaseOldSourceFile) {
93778             var oldSourceFiles = oldProgram.getSourceFiles();
93779             for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
93780                 var oldSourceFile = oldSourceFiles_1[_i];
93781                 var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
93782                 if (shouldCreateNewSourceFile || !newFile ||
93783                     (oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
93784                     host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
93785                 }
93786             }
93787             if (!host.getParsedCommandLine) {
93788                 oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
93789                     if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
93790                         host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions(), false);
93791                     }
93792                 });
93793             }
93794         }
93795         if (oldProgram && host.onReleaseParsedCommandLine) {
93796             forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
93797                 var oldReference = (parent === null || parent === void 0 ? void 0 : parent.commandLine.projectReferences[index]) || oldProgram.getProjectReferences()[index];
93798                 var oldRefPath = resolveProjectReferencePath(oldReference);
93799                 if (!(projectReferenceRedirects === null || projectReferenceRedirects === void 0 ? void 0 : projectReferenceRedirects.has(toPath(oldRefPath)))) {
93800                     host.onReleaseParsedCommandLine(oldRefPath, oldResolvedRef, oldProgram.getCompilerOptions());
93801                 }
93802             });
93803         }
93804         typeReferenceDirectiveResolutionCache = undefined;
93805         oldProgram = undefined;
93806         var program = {
93807             getRootFileNames: function () { return rootNames; },
93808             getSourceFile: getSourceFile,
93809             getSourceFileByPath: getSourceFileByPath,
93810             getSourceFiles: function () { return files; },
93811             getMissingFilePaths: function () { return missingFilePaths; },
93812             getModuleResolutionCache: function () { return moduleResolutionCache; },
93813             getFilesByNameMap: function () { return filesByName; },
93814             getCompilerOptions: function () { return options; },
93815             getSyntacticDiagnostics: getSyntacticDiagnostics,
93816             getOptionsDiagnostics: getOptionsDiagnostics,
93817             getGlobalDiagnostics: getGlobalDiagnostics,
93818             getSemanticDiagnostics: getSemanticDiagnostics,
93819             getCachedSemanticDiagnostics: getCachedSemanticDiagnostics,
93820             getSuggestionDiagnostics: getSuggestionDiagnostics,
93821             getDeclarationDiagnostics: getDeclarationDiagnostics,
93822             getBindAndCheckDiagnostics: getBindAndCheckDiagnostics,
93823             getProgramDiagnostics: getProgramDiagnostics,
93824             getTypeChecker: getTypeChecker,
93825             getClassifiableNames: getClassifiableNames,
93826             getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
93827             getCommonSourceDirectory: getCommonSourceDirectory,
93828             emit: emit,
93829             getCurrentDirectory: function () { return currentDirectory; },
93830             getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
93831             getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
93832             getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
93833             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
93834             getInstantiationCount: function () { return getDiagnosticsProducingTypeChecker().getInstantiationCount(); },
93835             getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
93836             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
93837             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
93838             isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
93839             isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
93840             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker,
93841             getSourceFileFromReference: getSourceFileFromReference,
93842             getLibFileFromReference: getLibFileFromReference,
93843             sourceFileToPackageName: sourceFileToPackageName,
93844             redirectTargetsMap: redirectTargetsMap,
93845             usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
93846             isEmittedFile: isEmittedFile,
93847             getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
93848             getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
93849             getProjectReferences: getProjectReferences,
93850             getResolvedProjectReferences: getResolvedProjectReferences,
93851             getProjectReferenceRedirect: getProjectReferenceRedirect,
93852             getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
93853             getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
93854             forEachResolvedProjectReference: forEachResolvedProjectReference,
93855             isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
93856             emitBuildInfo: emitBuildInfo,
93857             fileExists: fileExists,
93858             readFile: readFile,
93859             directoryExists: directoryExists,
93860             getSymlinkCache: getSymlinkCache,
93861             realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
93862             useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
93863             getFileIncludeReasons: function () { return fileReasons; },
93864             structureIsReused: structureIsReused,
93865         };
93866         onProgramCreateComplete();
93867         fileProcessingDiagnostics === null || fileProcessingDiagnostics === void 0 ? void 0 : fileProcessingDiagnostics.forEach(function (diagnostic) {
93868             switch (diagnostic.kind) {
93869                 case 1:
93870                     return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || ts.emptyArray));
93871                 case 0:
93872                     var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
93873                     return programDiagnostics.add(ts.createFileDiagnostic.apply(void 0, __spreadArray([file, ts.Debug.checkDefined(pos), ts.Debug.checkDefined(end) - pos, diagnostic.diagnostic], diagnostic.args || ts.emptyArray, false)));
93874                 default:
93875                     ts.Debug.assertNever(diagnostic);
93876             }
93877         });
93878         verifyCompilerOptions();
93879         ts.performance.mark("afterProgram");
93880         ts.performance.measure("Program", "beforeProgram", "afterProgram");
93881         ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93882         return program;
93883         function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
93884             if (!moduleNames.length)
93885                 return ts.emptyArray;
93886             var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
93887             var redirectedReference = getRedirectReferenceForResolution(containingFile);
93888             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveModuleNamesWorker", { containingFileName: containingFileName });
93889             ts.performance.mark("beforeResolveModule");
93890             var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
93891             ts.performance.mark("afterResolveModule");
93892             ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
93893             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93894             return result;
93895         }
93896         function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
93897             if (!typeDirectiveNames.length)
93898                 return [];
93899             var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
93900             var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
93901             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
93902             ts.performance.mark("beforeResolveTypeReference");
93903             var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference);
93904             ts.performance.mark("afterResolveTypeReference");
93905             ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
93906             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
93907             return result;
93908         }
93909         function getRedirectReferenceForResolution(file) {
93910             var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
93911             if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts", ".d.cts", ".d.mts"]))
93912                 return redirect;
93913             var resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
93914             if (resultFromDts)
93915                 return resultFromDts;
93916             if (!host.realpath || !options.preserveSymlinks || !ts.stringContains(file.originalFileName, ts.nodeModulesPathPart))
93917                 return undefined;
93918             var realDeclarationPath = toPath(host.realpath(file.originalFileName));
93919             return realDeclarationPath === file.path ? undefined : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
93920         }
93921         function getRedirectReferenceForResolutionFromSourceOfProject(filePath) {
93922             var source = getSourceOfProjectReferenceRedirect(filePath);
93923             if (ts.isString(source))
93924                 return getResolvedProjectReferenceToRedirect(source);
93925             if (!source)
93926                 return undefined;
93927             return forEachResolvedProjectReference(function (resolvedRef) {
93928                 var out = ts.outFile(resolvedRef.commandLine.options);
93929                 if (!out)
93930                     return undefined;
93931                 return toPath(out) === filePath ? resolvedRef : undefined;
93932             });
93933         }
93934         function compareDefaultLibFiles(a, b) {
93935             return ts.compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b));
93936         }
93937         function getDefaultLibFilePriority(a) {
93938             if (ts.containsPath(defaultLibraryPath, a.fileName, false)) {
93939                 var basename = ts.getBaseFileName(a.fileName);
93940                 if (basename === "lib.d.ts" || basename === "lib.es6.d.ts")
93941                     return 0;
93942                 var name = ts.removeSuffix(ts.removePrefix(basename, "lib."), ".d.ts");
93943                 var index = ts.libs.indexOf(name);
93944                 if (index !== -1)
93945                     return index + 1;
93946             }
93947             return ts.libs.length + 2;
93948         }
93949         function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
93950             return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
93951         }
93952         function toPath(fileName) {
93953             return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
93954         }
93955         function getCommonSourceDirectory() {
93956             if (commonSourceDirectory === undefined) {
93957                 var emittedFiles_1 = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, program); });
93958                 commonSourceDirectory = ts.getCommonSourceDirectory(options, function () { return ts.mapDefined(emittedFiles_1, function (file) { return file.isDeclarationFile ? undefined : file.fileName; }); }, currentDirectory, getCanonicalFileName, function (commonSourceDirectory) { return checkSourceFilesBelongToPath(emittedFiles_1, commonSourceDirectory); });
93959             }
93960             return commonSourceDirectory;
93961         }
93962         function getClassifiableNames() {
93963             var _a;
93964             if (!classifiableNames) {
93965                 getTypeChecker();
93966                 classifiableNames = new ts.Set();
93967                 for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
93968                     var sourceFile = files_3[_i];
93969                     (_a = sourceFile.classifiableNames) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return classifiableNames.add(value); });
93970                 }
93971             }
93972             return classifiableNames;
93973         }
93974         function resolveModuleNamesReusingOldState(moduleNames, file) {
93975             if (structureIsReused === 0 && !file.ambientModuleNames.length) {
93976                 return resolveModuleNamesWorker(moduleNames, file, undefined);
93977             }
93978             var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
93979             if (oldSourceFile !== file && file.resolvedModules) {
93980                 var result_13 = [];
93981                 var i = 0;
93982                 for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
93983                     var moduleName = moduleNames_1[_i];
93984                     var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
93985                     i++;
93986                     result_13.push(resolvedModule);
93987                 }
93988                 return result_13;
93989             }
93990             var unknownModuleNames;
93991             var result;
93992             var reusedNames;
93993             var predictedToResolveToAmbientModuleMarker = {};
93994             for (var i = 0; i < moduleNames.length; i++) {
93995                 var moduleName = moduleNames[i];
93996                 if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
93997                     var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
93998                     if (oldResolvedModule) {
93999                         if (ts.isTraceEnabled(options, host)) {
94000                             ts.trace(host, oldResolvedModule.packageId ?
94001                                 ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
94002                                 ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2, moduleName, ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory), oldResolvedModule.resolvedFileName, oldResolvedModule.packageId && ts.packageIdToString(oldResolvedModule.packageId));
94003                         }
94004                         (result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule;
94005                         (reusedNames || (reusedNames = [])).push(moduleName);
94006                         continue;
94007                     }
94008                 }
94009                 var resolvesToAmbientModuleInNonModifiedFile = false;
94010                 if (ts.contains(file.ambientModuleNames, moduleName)) {
94011                     resolvesToAmbientModuleInNonModifiedFile = true;
94012                     if (ts.isTraceEnabled(options, host)) {
94013                         ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
94014                     }
94015                 }
94016                 else {
94017                     resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
94018                 }
94019                 if (resolvesToAmbientModuleInNonModifiedFile) {
94020                     (result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
94021                 }
94022                 else {
94023                     (unknownModuleNames || (unknownModuleNames = [])).push(moduleName);
94024                 }
94025             }
94026             var resolutions = unknownModuleNames && unknownModuleNames.length
94027                 ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
94028                 : ts.emptyArray;
94029             if (!result) {
94030                 ts.Debug.assert(resolutions.length === moduleNames.length);
94031                 return resolutions;
94032             }
94033             var j = 0;
94034             for (var i = 0; i < result.length; i++) {
94035                 if (result[i]) {
94036                     if (result[i] === predictedToResolveToAmbientModuleMarker) {
94037                         result[i] = undefined;
94038                     }
94039                 }
94040                 else {
94041                     result[i] = resolutions[j];
94042                     j++;
94043                 }
94044             }
94045             ts.Debug.assert(j === resolutions.length);
94046             return result;
94047             function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, index) {
94048                 if (index >= ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.imports) + ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.moduleAugmentations))
94049                     return false;
94050                 var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName, oldSourceFile && getModeForResolutionAtIndex(oldSourceFile, index));
94051                 var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
94052                 if (resolutionToFile && resolvedFile) {
94053                     return false;
94054                 }
94055                 var unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName);
94056                 if (!unmodifiedFile) {
94057                     return false;
94058                 }
94059                 if (ts.isTraceEnabled(options, host)) {
94060                     ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, unmodifiedFile);
94061                 }
94062                 return true;
94063             }
94064         }
94065         function canReuseProjectReferences() {
94066             return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
94067                 var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
94068                 var newResolvedRef = parseProjectReferenceConfigFile(newRef);
94069                 if (oldResolvedRef) {
94070                     return !newResolvedRef ||
94071                         newResolvedRef.sourceFile !== oldResolvedRef.sourceFile ||
94072                         !ts.arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newResolvedRef.commandLine.fileNames);
94073                 }
94074                 else {
94075                     return newResolvedRef !== undefined;
94076                 }
94077             }, function (oldProjectReferences, parent) {
94078                 var newReferences = parent ? getResolvedProjectReferenceByPath(parent.sourceFile.path).commandLine.projectReferences : projectReferences;
94079                 return !ts.arrayIsEqualTo(oldProjectReferences, newReferences, ts.projectReferenceIsEqualTo);
94080             });
94081         }
94082         function tryReuseStructureFromOldProgram() {
94083             var _a;
94084             if (!oldProgram) {
94085                 return 0;
94086             }
94087             var oldOptions = oldProgram.getCompilerOptions();
94088             if (ts.changesAffectModuleResolution(oldOptions, options)) {
94089                 return 0;
94090             }
94091             var oldRootNames = oldProgram.getRootFileNames();
94092             if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) {
94093                 return 0;
94094             }
94095             if (!canReuseProjectReferences()) {
94096                 return 0;
94097             }
94098             if (projectReferences) {
94099                 resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile);
94100             }
94101             var newSourceFiles = [];
94102             var modifiedSourceFiles = [];
94103             structureIsReused = 2;
94104             if (oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath); })) {
94105                 return 0;
94106             }
94107             var oldSourceFiles = oldProgram.getSourceFiles();
94108             var seenPackageNames = new ts.Map();
94109             for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
94110                 var oldSourceFile = oldSourceFiles_2[_i];
94111                 var newSourceFile = host.getSourceFileByPath
94112                     ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile)
94113                     : host.getSourceFile(oldSourceFile.fileName, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile);
94114                 if (!newSourceFile) {
94115                     return 0;
94116                 }
94117                 ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
94118                 var fileChanged = void 0;
94119                 if (oldSourceFile.redirectInfo) {
94120                     if (newSourceFile !== oldSourceFile.redirectInfo.unredirected) {
94121                         return 0;
94122                     }
94123                     fileChanged = false;
94124                     newSourceFile = oldSourceFile;
94125                 }
94126                 else if (oldProgram.redirectTargetsMap.has(oldSourceFile.path)) {
94127                     if (newSourceFile !== oldSourceFile) {
94128                         return 0;
94129                     }
94130                     fileChanged = false;
94131                 }
94132                 else {
94133                     fileChanged = newSourceFile !== oldSourceFile;
94134                 }
94135                 newSourceFile.path = oldSourceFile.path;
94136                 newSourceFile.originalFileName = oldSourceFile.originalFileName;
94137                 newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
94138                 newSourceFile.fileName = oldSourceFile.fileName;
94139                 var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
94140                 if (packageName !== undefined) {
94141                     var prevKind = seenPackageNames.get(packageName);
94142                     var newKind = fileChanged ? 1 : 0;
94143                     if ((prevKind !== undefined && newKind === 1) || prevKind === 1) {
94144                         return 0;
94145                     }
94146                     seenPackageNames.set(packageName, newKind);
94147                 }
94148                 if (fileChanged) {
94149                     if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
94150                         structureIsReused = 1;
94151                     }
94152                     if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
94153                         structureIsReused = 1;
94154                     }
94155                     if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
94156                         structureIsReused = 1;
94157                     }
94158                     collectExternalModuleReferences(newSourceFile);
94159                     if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
94160                         structureIsReused = 1;
94161                     }
94162                     if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
94163                         structureIsReused = 1;
94164                     }
94165                     if ((oldSourceFile.flags & 3145728) !== (newSourceFile.flags & 3145728)) {
94166                         structureIsReused = 1;
94167                     }
94168                     if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
94169                         structureIsReused = 1;
94170                     }
94171                     modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
94172                 }
94173                 else if (hasInvalidatedResolution(oldSourceFile.path)) {
94174                     structureIsReused = 1;
94175                     modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
94176                 }
94177                 newSourceFiles.push(newSourceFile);
94178             }
94179             if (structureIsReused !== 2) {
94180                 return structureIsReused;
94181             }
94182             var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
94183             for (var _b = 0, oldSourceFiles_3 = oldSourceFiles; _b < oldSourceFiles_3.length; _b++) {
94184                 var oldFile = oldSourceFiles_3[_b];
94185                 if (!ts.contains(modifiedFiles, oldFile)) {
94186                     for (var _c = 0, _d = oldFile.ambientModuleNames; _c < _d.length; _c++) {
94187                         var moduleName = _d[_c];
94188                         ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
94189                     }
94190                 }
94191             }
94192             for (var _e = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _e < modifiedSourceFiles_1.length; _e++) {
94193                 var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
94194                 var moduleNames = getModuleNames(newSourceFile);
94195                 var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
94196                 var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
94197                 if (resolutionsChanged) {
94198                     structureIsReused = 1;
94199                     newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
94200                 }
94201                 else {
94202                     newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
94203                 }
94204                 var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
94205                 var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
94206                 var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
94207                 if (typeReferenceResolutionsChanged) {
94208                     structureIsReused = 1;
94209                     newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
94210                 }
94211                 else {
94212                     newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
94213                 }
94214             }
94215             if (structureIsReused !== 2) {
94216                 return structureIsReused;
94217             }
94218             if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) {
94219                 return 1;
94220             }
94221             missingFilePaths = oldProgram.getMissingFilePaths();
94222             ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
94223             for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
94224                 var newSourceFile = newSourceFiles_1[_g];
94225                 filesByName.set(newSourceFile.path, newSourceFile);
94226             }
94227             var oldFilesByNameMap = oldProgram.getFilesByNameMap();
94228             oldFilesByNameMap.forEach(function (oldFile, path) {
94229                 if (!oldFile) {
94230                     filesByName.set(path, oldFile);
94231                     return;
94232                 }
94233                 if (oldFile.path === path) {
94234                     if (oldProgram.isSourceFileFromExternalLibrary(oldFile)) {
94235                         sourceFilesFoundSearchingNodeModules.set(oldFile.path, true);
94236                     }
94237                     return;
94238                 }
94239                 filesByName.set(path, filesByName.get(oldFile.path));
94240             });
94241             files = newSourceFiles;
94242             fileReasons = oldProgram.getFileIncludeReasons();
94243             fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
94244             resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
94245             sourceFileToPackageName = oldProgram.sourceFileToPackageName;
94246             redirectTargetsMap = oldProgram.redirectTargetsMap;
94247             usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
94248             return 2;
94249         }
94250         function getEmitHost(writeFileCallback) {
94251             return {
94252                 getPrependNodes: getPrependNodes,
94253                 getCanonicalFileName: getCanonicalFileName,
94254                 getCommonSourceDirectory: program.getCommonSourceDirectory,
94255                 getCompilerOptions: program.getCompilerOptions,
94256                 getCurrentDirectory: function () { return currentDirectory; },
94257                 getNewLine: function () { return host.getNewLine(); },
94258                 getSourceFile: program.getSourceFile,
94259                 getSourceFileByPath: program.getSourceFileByPath,
94260                 getSourceFiles: program.getSourceFiles,
94261                 getLibFileFromReference: program.getLibFileFromReference,
94262                 isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
94263                 getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
94264                 getProjectReferenceRedirect: getProjectReferenceRedirect,
94265                 isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
94266                 getSymlinkCache: getSymlinkCache,
94267                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
94268                 isEmitBlocked: isEmitBlocked,
94269                 readFile: function (f) { return host.readFile(f); },
94270                 fileExists: function (f) {
94271                     var path = toPath(f);
94272                     if (getSourceFileByPath(path))
94273                         return true;
94274                     if (ts.contains(missingFilePaths, path))
94275                         return false;
94276                     return host.fileExists(f);
94277                 },
94278                 useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
94279                 getProgramBuildInfo: function () { return program.getProgramBuildInfo && program.getProgramBuildInfo(); },
94280                 getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
94281                 redirectTargetsMap: redirectTargetsMap,
94282                 getFileIncludeReasons: program.getFileIncludeReasons,
94283             };
94284         }
94285         function emitBuildInfo(writeFileCallback) {
94286             ts.Debug.assert(!ts.outFile(options));
94287             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitBuildInfo", {}, true);
94288             ts.performance.mark("beforeEmit");
94289             var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback), undefined, ts.noTransformers, false, true);
94290             ts.performance.mark("afterEmit");
94291             ts.performance.measure("Emit", "beforeEmit", "afterEmit");
94292             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
94293             return emitResult;
94294         }
94295         function getResolvedProjectReferences() {
94296             return resolvedProjectReferences;
94297         }
94298         function getProjectReferences() {
94299             return projectReferences;
94300         }
94301         function getPrependNodes() {
94302             return createPrependNodes(projectReferences, function (_ref, index) { var _a; return (_a = resolvedProjectReferences[index]) === null || _a === void 0 ? void 0 : _a.commandLine; }, function (fileName) {
94303                 var path = toPath(fileName);
94304                 var sourceFile = getSourceFileByPath(path);
94305                 return sourceFile ? sourceFile.text : filesByName.has(path) ? undefined : host.readFile(path);
94306             });
94307         }
94308         function isSourceFileFromExternalLibrary(file) {
94309             return !!sourceFilesFoundSearchingNodeModules.get(file.path);
94310         }
94311         function isSourceFileDefaultLibrary(file) {
94312             if (file.hasNoDefaultLib) {
94313                 return true;
94314             }
94315             if (!options.noLib) {
94316                 return false;
94317             }
94318             var equalityComparer = host.useCaseSensitiveFileNames() ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive;
94319             if (!options.lib) {
94320                 return equalityComparer(file.fileName, getDefaultLibraryFileName());
94321             }
94322             else {
94323                 return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
94324             }
94325         }
94326         function getDiagnosticsProducingTypeChecker() {
94327             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));
94328         }
94329         function dropDiagnosticsProducingTypeChecker() {
94330             diagnosticsProducingTypeChecker = undefined;
94331         }
94332         function getTypeChecker() {
94333             return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
94334         }
94335         function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit) {
94336             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emit", { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, true);
94337             var result = runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit); });
94338             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
94339             return result;
94340         }
94341         function isEmitBlocked(emitFileName) {
94342             return hasEmitBlockingDiagnostics.has(toPath(emitFileName));
94343         }
94344         function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit) {
94345             if (!forceDtsEmit) {
94346                 var result = handleNoEmitOptions(program, sourceFile, writeFileCallback, cancellationToken);
94347                 if (result)
94348                     return result;
94349             }
94350             var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken);
94351             ts.performance.mark("beforeEmit");
94352             var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, false, forceDtsEmit);
94353             ts.performance.mark("afterEmit");
94354             ts.performance.measure("Emit", "beforeEmit", "afterEmit");
94355             return emitResult;
94356         }
94357         function getSourceFile(fileName) {
94358             return getSourceFileByPath(toPath(fileName));
94359         }
94360         function getSourceFileByPath(path) {
94361             return filesByName.get(path) || undefined;
94362         }
94363         function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) {
94364             if (sourceFile) {
94365                 return getDiagnostics(sourceFile, cancellationToken);
94366             }
94367             return ts.sortAndDeduplicateDiagnostics(ts.flatMap(program.getSourceFiles(), function (sourceFile) {
94368                 if (cancellationToken) {
94369                     cancellationToken.throwIfCancellationRequested();
94370                 }
94371                 return getDiagnostics(sourceFile, cancellationToken);
94372             }));
94373         }
94374         function getSyntacticDiagnostics(sourceFile, cancellationToken) {
94375             return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
94376         }
94377         function getSemanticDiagnostics(sourceFile, cancellationToken) {
94378             return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
94379         }
94380         function getCachedSemanticDiagnostics(sourceFile) {
94381             var _a;
94382             return sourceFile
94383                 ? (_a = cachedBindAndCheckDiagnosticsForFile.perFile) === null || _a === void 0 ? void 0 : _a.get(sourceFile.path)
94384                 : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
94385         }
94386         function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
94387             return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
94388         }
94389         function getProgramDiagnostics(sourceFile) {
94390             var _a;
94391             if (ts.skipTypeChecking(sourceFile, options, program)) {
94392                 return ts.emptyArray;
94393             }
94394             var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
94395             if (!((_a = sourceFile.commentDirectives) === null || _a === void 0 ? void 0 : _a.length)) {
94396                 return programDiagnosticsInFile;
94397             }
94398             return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics;
94399         }
94400         function getDeclarationDiagnostics(sourceFile, cancellationToken) {
94401             var options = program.getCompilerOptions();
94402             if (!sourceFile || ts.outFile(options)) {
94403                 return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
94404             }
94405             else {
94406                 return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
94407             }
94408         }
94409         function getSyntacticDiagnosticsForFile(sourceFile) {
94410             if (ts.isSourceFileJS(sourceFile)) {
94411                 if (!sourceFile.additionalSyntacticDiagnostics) {
94412                     sourceFile.additionalSyntacticDiagnostics = getJSSyntacticDiagnosticsForFile(sourceFile);
94413                 }
94414                 return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics);
94415             }
94416             return sourceFile.parseDiagnostics;
94417         }
94418         function runWithCancellationToken(func) {
94419             try {
94420                 return func();
94421             }
94422             catch (e) {
94423                 if (e instanceof ts.OperationCanceledException) {
94424                     noDiagnosticsTypeChecker = undefined;
94425                     diagnosticsProducingTypeChecker = undefined;
94426                 }
94427                 throw e;
94428             }
94429         }
94430         function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
94431             return ts.concatenate(filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options), getProgramDiagnostics(sourceFile));
94432         }
94433         function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
94434             return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
94435         }
94436         function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
94437             return runWithCancellationToken(function () {
94438                 if (ts.skipTypeChecking(sourceFile, options, program)) {
94439                     return ts.emptyArray;
94440                 }
94441                 var typeChecker = getDiagnosticsProducingTypeChecker();
94442                 ts.Debug.assert(!!sourceFile.bindDiagnostics);
94443                 var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
94444                 var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
94445                 var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
94446                     || sourceFile.scriptKind === 5 || isCheckJs || sourceFile.scriptKind === 7);
94447                 var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
94448                 var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94449                 return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94450             });
94451         }
94452         function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
94453             var _a;
94454             var allDiagnostics = [];
94455             for (var _i = 2; _i < arguments.length; _i++) {
94456                 allDiagnostics[_i - 2] = arguments[_i];
94457             }
94458             var flatDiagnostics = ts.flatten(allDiagnostics);
94459             if (!includeBindAndCheckDiagnostics || !((_a = sourceFile.commentDirectives) === null || _a === void 0 ? void 0 : _a.length)) {
94460                 return flatDiagnostics;
94461             }
94462             var _b = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics), diagnostics = _b.diagnostics, directives = _b.directives;
94463             for (var _c = 0, _d = directives.getUnusedExpectations(); _c < _d.length; _c++) {
94464                 var errorExpectation = _d[_c];
94465                 diagnostics.push(ts.createDiagnosticForRange(sourceFile, errorExpectation.range, ts.Diagnostics.Unused_ts_expect_error_directive));
94466             }
94467             return diagnostics;
94468         }
94469         function getDiagnosticsWithPrecedingDirectives(sourceFile, commentDirectives, flatDiagnostics) {
94470             var directives = ts.createCommentDirectivesMap(sourceFile, commentDirectives);
94471             var diagnostics = flatDiagnostics.filter(function (diagnostic) { return markPrecedingCommentDirectiveLine(diagnostic, directives) === -1; });
94472             return { diagnostics: diagnostics, directives: directives };
94473         }
94474         function getSuggestionDiagnostics(sourceFile, cancellationToken) {
94475             return runWithCancellationToken(function () {
94476                 return getDiagnosticsProducingTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken);
94477             });
94478         }
94479         function markPrecedingCommentDirectiveLine(diagnostic, directives) {
94480             var file = diagnostic.file, start = diagnostic.start;
94481             if (!file) {
94482                 return -1;
94483             }
94484             var lineStarts = ts.getLineStarts(file);
94485             var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line - 1;
94486             while (line >= 0) {
94487                 if (directives.markUsed(line)) {
94488                     return line;
94489                 }
94490                 var lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
94491                 if (lineText !== "" && !/^(\s*)\/\/(.*)$/.test(lineText)) {
94492                     return -1;
94493                 }
94494                 line--;
94495             }
94496             return -1;
94497         }
94498         function getJSSyntacticDiagnosticsForFile(sourceFile) {
94499             return runWithCancellationToken(function () {
94500                 var diagnostics = [];
94501                 walk(sourceFile, sourceFile);
94502                 ts.forEachChildRecursively(sourceFile, walk, walkArray);
94503                 return diagnostics;
94504                 function walk(node, parent) {
94505                     switch (parent.kind) {
94506                         case 163:
94507                         case 166:
94508                         case 168:
94509                             if (parent.questionToken === node) {
94510                                 diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?"));
94511                                 return "skip";
94512                             }
94513                         case 167:
94514                         case 170:
94515                         case 171:
94516                         case 172:
94517                         case 212:
94518                         case 255:
94519                         case 213:
94520                         case 253:
94521                             if (parent.type === node) {
94522                                 diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files));
94523                                 return "skip";
94524                             }
94525                     }
94526                     switch (node.kind) {
94527                         case 266:
94528                             if (node.isTypeOnly) {
94529                                 diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type"));
94530                                 return "skip";
94531                             }
94532                             break;
94533                         case 271:
94534                             if (node.isTypeOnly) {
94535                                 diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type"));
94536                                 return "skip";
94537                             }
94538                             break;
94539                         case 264:
94540                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files));
94541                             return "skip";
94542                         case 270:
94543                             if (node.isExportEquals) {
94544                                 diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files));
94545                                 return "skip";
94546                             }
94547                             break;
94548                         case 290:
94549                             var heritageClause = node;
94550                             if (heritageClause.token === 117) {
94551                                 diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files));
94552                                 return "skip";
94553                             }
94554                             break;
94555                         case 257:
94556                             var interfaceKeyword = ts.tokenToString(118);
94557                             ts.Debug.assertIsDefined(interfaceKeyword);
94558                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword));
94559                             return "skip";
94560                         case 260:
94561                             var moduleKeyword = node.flags & 16 ? ts.tokenToString(142) : ts.tokenToString(141);
94562                             ts.Debug.assertIsDefined(moduleKeyword);
94563                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword));
94564                             return "skip";
94565                         case 258:
94566                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
94567                             return "skip";
94568                         case 259:
94569                             var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92));
94570                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
94571                             return "skip";
94572                         case 229:
94573                             diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files));
94574                             return "skip";
94575                         case 228:
94576                             diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files));
94577                             return "skip";
94578                         case 210:
94579                             ts.Debug.fail();
94580                     }
94581                 }
94582                 function walkArray(nodes, parent) {
94583                     if (parent.decorators === nodes && !options.experimentalDecorators) {
94584                         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_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
94585                     }
94586                     switch (parent.kind) {
94587                         case 256:
94588                         case 225:
94589                         case 168:
94590                         case 170:
94591                         case 171:
94592                         case 172:
94593                         case 212:
94594                         case 255:
94595                         case 213:
94596                             if (nodes === parent.typeParameters) {
94597                                 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files));
94598                                 return "skip";
94599                             }
94600                         case 236:
94601                             if (nodes === parent.modifiers) {
94602                                 checkModifiers(parent.modifiers, parent.kind === 236);
94603                                 return "skip";
94604                             }
94605                             break;
94606                         case 166:
94607                             if (nodes === parent.modifiers) {
94608                                 for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
94609                                     var modifier = _a[_i];
94610                                     if (modifier.kind !== 124) {
94611                                         diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind)));
94612                                     }
94613                                 }
94614                                 return "skip";
94615                             }
94616                             break;
94617                         case 163:
94618                             if (nodes === parent.modifiers) {
94619                                 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));
94620                                 return "skip";
94621                             }
94622                             break;
94623                         case 207:
94624                         case 208:
94625                         case 227:
94626                         case 278:
94627                         case 279:
94628                         case 209:
94629                             if (nodes === parent.typeArguments) {
94630                                 diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files));
94631                                 return "skip";
94632                             }
94633                             break;
94634                     }
94635                 }
94636                 function checkModifiers(modifiers, isConstValid) {
94637                     for (var _i = 0, modifiers_2 = modifiers; _i < modifiers_2.length; _i++) {
94638                         var modifier = modifiers_2[_i];
94639                         switch (modifier.kind) {
94640                             case 85:
94641                                 if (isConstValid) {
94642                                     continue;
94643                                 }
94644                             case 123:
94645                             case 121:
94646                             case 122:
94647                             case 144:
94648                             case 135:
94649                             case 126:
94650                             case 158:
94651                                 diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind)));
94652                                 break;
94653                             case 124:
94654                             case 93:
94655                             case 88:
94656                         }
94657                     }
94658                 }
94659                 function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) {
94660                     var start = nodes.pos;
94661                     return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2);
94662                 }
94663                 function createDiagnosticForNode(node, message, arg0, arg1, arg2) {
94664                     return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2);
94665                 }
94666             });
94667         }
94668         function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {
94669             return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache);
94670         }
94671         function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
94672             return runWithCancellationToken(function () {
94673                 var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);
94674                 return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) || ts.emptyArray;
94675             });
94676         }
94677         function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
94678             var _a;
94679             var cachedResult = sourceFile
94680                 ? (_a = cache.perFile) === null || _a === void 0 ? void 0 : _a.get(sourceFile.path)
94681                 : cache.allDiagnostics;
94682             if (cachedResult) {
94683                 return cachedResult;
94684             }
94685             var result = getDiagnostics(sourceFile, cancellationToken);
94686             if (sourceFile) {
94687                 (cache.perFile || (cache.perFile = new ts.Map())).set(sourceFile.path, result);
94688             }
94689             else {
94690                 cache.allDiagnostics = result;
94691             }
94692             return result;
94693         }
94694         function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
94695             return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
94696         }
94697         function getOptionsDiagnostics() {
94698             return ts.sortAndDeduplicateDiagnostics(ts.concatenate(programDiagnostics.getGlobalDiagnostics(), getOptionsDiagnosticsOfConfigFile()));
94699         }
94700         function getOptionsDiagnosticsOfConfigFile() {
94701             if (!options.configFile)
94702                 return ts.emptyArray;
94703             var diagnostics = programDiagnostics.getDiagnostics(options.configFile.fileName);
94704             forEachResolvedProjectReference(function (resolvedRef) {
94705                 diagnostics = ts.concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName));
94706             });
94707             return diagnostics;
94708         }
94709         function getGlobalDiagnostics() {
94710             return rootNames.length ? ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()) : ts.emptyArray;
94711         }
94712         function getConfigFileParsingDiagnostics() {
94713             return configFileParsingDiagnostics || ts.emptyArray;
94714         }
94715         function processRootFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason) {
94716             processSourceFile(ts.normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, undefined, reason);
94717         }
94718         function fileReferenceIsEqualTo(a, b) {
94719             return a.fileName === b.fileName;
94720         }
94721         function moduleNameIsEqualTo(a, b) {
94722             return a.kind === 79
94723                 ? b.kind === 79 && a.escapedText === b.escapedText
94724                 : b.kind === 10 && a.text === b.text;
94725         }
94726         function createSyntheticImport(text, file) {
94727             var externalHelpersModuleReference = ts.factory.createStringLiteral(text);
94728             var importDecl = ts.factory.createImportDeclaration(undefined, undefined, undefined, externalHelpersModuleReference, undefined);
94729             ts.addEmitFlags(importDecl, 67108864);
94730             ts.setParent(externalHelpersModuleReference, importDecl);
94731             ts.setParent(importDecl, file);
94732             externalHelpersModuleReference.flags &= ~8;
94733             importDecl.flags &= ~8;
94734             return externalHelpersModuleReference;
94735         }
94736         function collectExternalModuleReferences(file) {
94737             if (file.imports) {
94738                 return;
94739             }
94740             var isJavaScriptFile = ts.isSourceFileJS(file);
94741             var isExternalModuleFile = ts.isExternalModule(file);
94742             var imports;
94743             var moduleAugmentations;
94744             var ambientModules;
94745             if ((options.isolatedModules || isExternalModuleFile)
94746                 && !file.isDeclarationFile) {
94747                 if (options.importHelpers) {
94748                     imports = [createSyntheticImport(ts.externalHelpersModuleNameText, file)];
94749                 }
94750                 var jsxImport = ts.getJSXRuntimeImport(ts.getJSXImplicitImportBase(options, file), options);
94751                 if (jsxImport) {
94752                     (imports || (imports = [])).push(createSyntheticImport(jsxImport, file));
94753                 }
94754             }
94755             for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
94756                 var node = _a[_i];
94757                 collectModuleReferences(node, false);
94758             }
94759             if ((file.flags & 1048576) || isJavaScriptFile) {
94760                 collectDynamicImportOrRequireCalls(file);
94761             }
94762             file.imports = imports || ts.emptyArray;
94763             file.moduleAugmentations = moduleAugmentations || ts.emptyArray;
94764             file.ambientModuleNames = ambientModules || ts.emptyArray;
94765             return;
94766             function collectModuleReferences(node, inAmbientModule) {
94767                 if (ts.isAnyImportOrReExport(node)) {
94768                     var moduleNameExpr = ts.getExternalModuleName(node);
94769                     if (moduleNameExpr && ts.isStringLiteral(moduleNameExpr) && moduleNameExpr.text && (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text))) {
94770                         ts.setParentRecursive(node, false);
94771                         imports = ts.append(imports, moduleNameExpr);
94772                         if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) {
94773                             usesUriStyleNodeCoreModules = ts.startsWith(moduleNameExpr.text, "node:");
94774                         }
94775                     }
94776                 }
94777                 else if (ts.isModuleDeclaration(node)) {
94778                     if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasSyntacticModifier(node, 2) || file.isDeclarationFile)) {
94779                         node.name.parent = node;
94780                         var nameText = ts.getTextOfIdentifierOrLiteral(node.name);
94781                         if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(nameText))) {
94782                             (moduleAugmentations || (moduleAugmentations = [])).push(node.name);
94783                         }
94784                         else if (!inAmbientModule) {
94785                             if (file.isDeclarationFile) {
94786                                 (ambientModules || (ambientModules = [])).push(nameText);
94787                             }
94788                             var body = node.body;
94789                             if (body) {
94790                                 for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
94791                                     var statement = _a[_i];
94792                                     collectModuleReferences(statement, true);
94793                                 }
94794                             }
94795                         }
94796                     }
94797                 }
94798             }
94799             function collectDynamicImportOrRequireCalls(file) {
94800                 var r = /import|require/g;
94801                 while (r.exec(file.text) !== null) {
94802                     var node = getNodeAtPosition(file, r.lastIndex);
94803                     if (isJavaScriptFile && ts.isRequireCall(node, true)) {
94804                         ts.setParentRecursive(node, false);
94805                         imports = ts.append(imports, node.arguments[0]);
94806                     }
94807                     else if (ts.isImportCall(node) && node.arguments.length >= 1 && ts.isStringLiteralLike(node.arguments[0])) {
94808                         ts.setParentRecursive(node, false);
94809                         imports = ts.append(imports, node.arguments[0]);
94810                     }
94811                     else if (ts.isLiteralImportTypeNode(node)) {
94812                         ts.setParentRecursive(node, false);
94813                         imports = ts.append(imports, node.argument.literal);
94814                     }
94815                 }
94816             }
94817             function getNodeAtPosition(sourceFile, position) {
94818                 var current = sourceFile;
94819                 var getContainingChild = function (child) {
94820                     if (child.pos <= position && (position < child.end || (position === child.end && (child.kind === 1)))) {
94821                         return child;
94822                     }
94823                 };
94824                 while (true) {
94825                     var child = isJavaScriptFile && ts.hasJSDocNodes(current) && ts.forEach(current.jsDoc, getContainingChild) || ts.forEachChild(current, getContainingChild);
94826                     if (!child) {
94827                         return current;
94828                     }
94829                     current = child;
94830                 }
94831             }
94832         }
94833         function getLibFileFromReference(ref) {
94834             var libName = ts.toFileNameLowerCase(ref.fileName);
94835             var libFileName = ts.libMap.get(libName);
94836             if (libFileName) {
94837                 return getSourceFile(pathForLibFile(libFileName));
94838             }
94839         }
94840         function getSourceFileFromReference(referencingFile, ref) {
94841             return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile);
94842         }
94843         function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, reason) {
94844             if (ts.hasExtension(fileName)) {
94845                 var canonicalFileName_1 = host.getCanonicalFileName(fileName);
94846                 if (!options.allowNonTsExtensions && !ts.forEach(ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
94847                     if (fail) {
94848                         if (ts.hasJSFileExtension(canonicalFileName_1)) {
94849                             fail(ts.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
94850                         }
94851                         else {
94852                             fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
94853                         }
94854                     }
94855                     return undefined;
94856                 }
94857                 var sourceFile = getSourceFile(fileName);
94858                 if (fail) {
94859                     if (!sourceFile) {
94860                         var redirect = getProjectReferenceRedirect(fileName);
94861                         if (redirect) {
94862                             fail(ts.Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName);
94863                         }
94864                         else {
94865                             fail(ts.Diagnostics.File_0_not_found, fileName);
94866                         }
94867                     }
94868                     else if (isReferencedFile(reason) && canonicalFileName_1 === host.getCanonicalFileName(getSourceFileByPath(reason.file).fileName)) {
94869                         fail(ts.Diagnostics.A_file_cannot_have_a_reference_to_itself);
94870                     }
94871                 }
94872                 return sourceFile;
94873             }
94874             else {
94875                 var sourceFileNoExtension = options.allowNonTsExtensions && getSourceFile(fileName);
94876                 if (sourceFileNoExtension)
94877                     return sourceFileNoExtension;
94878                 if (fail && options.allowNonTsExtensions) {
94879                     fail(ts.Diagnostics.File_0_not_found, fileName);
94880                     return undefined;
94881                 }
94882                 var sourceFileWithAddedExtension = ts.forEach(supportedExtensions[0], function (extension) { return getSourceFile(fileName + extension); });
94883                 if (fail && !sourceFileWithAddedExtension)
94884                     fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
94885                 return sourceFileWithAddedExtension;
94886             }
94887         }
94888         function processSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, packageId, reason) {
94889             getSourceFileFromReferenceWorker(fileName, function (fileName) { return findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId); }, function (diagnostic) {
94890                 var args = [];
94891                 for (var _i = 1; _i < arguments.length; _i++) {
94892                     args[_i - 1] = arguments[_i];
94893                 }
94894                 return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, diagnostic, args);
94895             }, reason);
94896         }
94897         function processProjectReferenceFile(fileName, reason) {
94898             return processSourceFile(fileName, false, false, undefined, reason);
94899         }
94900         function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
94901             var hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && ts.some(fileReasons.get(existingFile.path), isReferencedFile);
94902             if (hasExistingReasonToReportErrorOn) {
94903                 addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
94904             }
94905             else {
94906                 addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]);
94907             }
94908         }
94909         function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName) {
94910             var redirect = Object.create(redirectTarget);
94911             redirect.fileName = fileName;
94912             redirect.path = path;
94913             redirect.resolvedPath = resolvedPath;
94914             redirect.originalFileName = originalFileName;
94915             redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
94916             sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
94917             Object.defineProperties(redirect, {
94918                 id: {
94919                     get: function () { return this.redirectInfo.redirectTarget.id; },
94920                     set: function (value) { this.redirectInfo.redirectTarget.id = value; },
94921                 },
94922                 symbol: {
94923                     get: function () { return this.redirectInfo.redirectTarget.symbol; },
94924                     set: function (value) { this.redirectInfo.redirectTarget.symbol = value; },
94925                 },
94926             });
94927             return redirect;
94928         }
94929         function findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
94930             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "findSourceFile", {
94931                 fileName: fileName,
94932                 isDefaultLib: isDefaultLib || undefined,
94933                 fileIncludeKind: ts.FileIncludeKind[reason.kind],
94934             });
94935             var result = findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
94936             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
94937             return result;
94938         }
94939         function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
94940             var path = toPath(fileName);
94941             if (useSourceOfProjectReferenceRedirect) {
94942                 var source = getSourceOfProjectReferenceRedirect(path);
94943                 if (!source &&
94944                     host.realpath &&
94945                     options.preserveSymlinks &&
94946                     ts.isDeclarationFileName(fileName) &&
94947                     ts.stringContains(fileName, ts.nodeModulesPathPart)) {
94948                     var realPath = toPath(host.realpath(fileName));
94949                     if (realPath !== path)
94950                         source = getSourceOfProjectReferenceRedirect(realPath);
94951                 }
94952                 if (source) {
94953                     var file_1 = ts.isString(source) ?
94954                         findSourceFile(source, isDefaultLib, ignoreNoDefaultLib, reason, packageId) :
94955                         undefined;
94956                     if (file_1)
94957                         addFileToFilesByName(file_1, path, undefined);
94958                     return file_1;
94959                 }
94960             }
94961             var originalFileName = fileName;
94962             if (filesByName.has(path)) {
94963                 var file_2 = filesByName.get(path);
94964                 addFileIncludeReason(file_2 || undefined, reason);
94965                 if (file_2 && options.forceConsistentCasingInFileNames) {
94966                     var checkedName = file_2.fileName;
94967                     var isRedirect = toPath(checkedName) !== toPath(fileName);
94968                     if (isRedirect) {
94969                         fileName = getProjectReferenceRedirect(fileName) || fileName;
94970                     }
94971                     var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
94972                     var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory);
94973                     if (checkedAbsolutePath !== inputAbsolutePath) {
94974                         reportFileNamesDifferOnlyInCasingError(fileName, file_2, reason);
94975                     }
94976                 }
94977                 if (file_2 && sourceFilesFoundSearchingNodeModules.get(file_2.path) && currentNodeModulesDepth === 0) {
94978                     sourceFilesFoundSearchingNodeModules.set(file_2.path, false);
94979                     if (!options.noResolve) {
94980                         processReferencedFiles(file_2, isDefaultLib);
94981                         processTypeReferenceDirectives(file_2);
94982                     }
94983                     if (!options.noLib) {
94984                         processLibReferenceDirectives(file_2);
94985                     }
94986                     modulesWithElidedImports.set(file_2.path, false);
94987                     processImportedModules(file_2);
94988                 }
94989                 else if (file_2 && modulesWithElidedImports.get(file_2.path)) {
94990                     if (currentNodeModulesDepth < maxNodeModuleJsDepth) {
94991                         modulesWithElidedImports.set(file_2.path, false);
94992                         processImportedModules(file_2);
94993                     }
94994                 }
94995                 return file_2 || undefined;
94996             }
94997             var redirectedPath;
94998             if (isReferencedFile(reason) && !useSourceOfProjectReferenceRedirect) {
94999                 var redirectProject = getProjectReferenceRedirectProject(fileName);
95000                 if (redirectProject) {
95001                     if (ts.outFile(redirectProject.commandLine.options)) {
95002                         return undefined;
95003                     }
95004                     var redirect = getProjectReferenceOutputName(redirectProject, fileName);
95005                     fileName = redirect;
95006                     redirectedPath = toPath(redirect);
95007                 }
95008             }
95009             var file = host.getSourceFile(fileName, ts.getEmitScriptTarget(options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
95010             if (packageId) {
95011                 var packageIdKey = ts.packageIdToString(packageId);
95012                 var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
95013                 if (fileFromPackageId) {
95014                     var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName);
95015                     redirectTargetsMap.add(fileFromPackageId.path, fileName);
95016                     addFileToFilesByName(dupFile, path, redirectedPath);
95017                     addFileIncludeReason(dupFile, reason);
95018                     sourceFileToPackageName.set(path, packageId.name);
95019                     processingOtherFiles.push(dupFile);
95020                     return dupFile;
95021                 }
95022                 else if (file) {
95023                     packageIdToSourceFile.set(packageIdKey, file);
95024                     sourceFileToPackageName.set(path, packageId.name);
95025                 }
95026             }
95027             addFileToFilesByName(file, path, redirectedPath);
95028             if (file) {
95029                 sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
95030                 file.fileName = fileName;
95031                 file.path = path;
95032                 file.resolvedPath = toPath(fileName);
95033                 file.originalFileName = originalFileName;
95034                 file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
95035                 addFileIncludeReason(file, reason);
95036                 if (host.useCaseSensitiveFileNames()) {
95037                     var pathLowerCase = ts.toFileNameLowerCase(path);
95038                     var existingFile = filesByNameIgnoreCase.get(pathLowerCase);
95039                     if (existingFile) {
95040                         reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason);
95041                     }
95042                     else {
95043                         filesByNameIgnoreCase.set(pathLowerCase, file);
95044                     }
95045                 }
95046                 skipDefaultLib = skipDefaultLib || (file.hasNoDefaultLib && !ignoreNoDefaultLib);
95047                 if (!options.noResolve) {
95048                     processReferencedFiles(file, isDefaultLib);
95049                     processTypeReferenceDirectives(file);
95050                 }
95051                 if (!options.noLib) {
95052                     processLibReferenceDirectives(file);
95053                 }
95054                 processImportedModules(file);
95055                 if (isDefaultLib) {
95056                     processingDefaultLibFiles.push(file);
95057                 }
95058                 else {
95059                     processingOtherFiles.push(file);
95060                 }
95061             }
95062             return file;
95063         }
95064         function addFileIncludeReason(file, reason) {
95065             if (file)
95066                 fileReasons.add(file.path, reason);
95067         }
95068         function addFileToFilesByName(file, path, redirectedPath) {
95069             if (redirectedPath) {
95070                 filesByName.set(redirectedPath, file);
95071                 filesByName.set(path, file || false);
95072             }
95073             else {
95074                 filesByName.set(path, file);
95075             }
95076         }
95077         function getProjectReferenceRedirect(fileName) {
95078             var referencedProject = getProjectReferenceRedirectProject(fileName);
95079             return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
95080         }
95081         function getProjectReferenceRedirectProject(fileName) {
95082             if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts") || ts.fileExtensionIs(fileName, ".json")) {
95083                 return undefined;
95084             }
95085             return getResolvedProjectReferenceToRedirect(fileName);
95086         }
95087         function getProjectReferenceOutputName(referencedProject, fileName) {
95088             var out = ts.outFile(referencedProject.commandLine.options);
95089             return out ?
95090                 ts.changeExtension(out, ".d.ts") :
95091                 ts.getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
95092         }
95093         function getResolvedProjectReferenceToRedirect(fileName) {
95094             if (mapFromFileToProjectReferenceRedirects === undefined) {
95095                 mapFromFileToProjectReferenceRedirects = new ts.Map();
95096                 forEachResolvedProjectReference(function (referencedProject) {
95097                     if (toPath(options.configFilePath) !== referencedProject.sourceFile.path) {
95098                         referencedProject.commandLine.fileNames.forEach(function (f) {
95099                             return mapFromFileToProjectReferenceRedirects.set(toPath(f), referencedProject.sourceFile.path);
95100                         });
95101                     }
95102                 });
95103             }
95104             var referencedProjectPath = mapFromFileToProjectReferenceRedirects.get(toPath(fileName));
95105             return referencedProjectPath && getResolvedProjectReferenceByPath(referencedProjectPath);
95106         }
95107         function forEachResolvedProjectReference(cb) {
95108             return ts.forEachResolvedProjectReference(resolvedProjectReferences, cb);
95109         }
95110         function getSourceOfProjectReferenceRedirect(path) {
95111             if (!ts.isDeclarationFileName(path))
95112                 return undefined;
95113             if (mapFromToProjectReferenceRedirectSource === undefined) {
95114                 mapFromToProjectReferenceRedirectSource = new ts.Map();
95115                 forEachResolvedProjectReference(function (resolvedRef) {
95116                     var out = ts.outFile(resolvedRef.commandLine.options);
95117                     if (out) {
95118                         var outputDts = ts.changeExtension(out, ".d.ts");
95119                         mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), true);
95120                     }
95121                     else {
95122                         var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
95123                         ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
95124                             if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
95125                                 var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
95126                                 mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
95127                             }
95128                         });
95129                     }
95130                 });
95131             }
95132             return mapFromToProjectReferenceRedirectSource.get(path);
95133         }
95134         function isSourceOfProjectReferenceRedirect(fileName) {
95135             return useSourceOfProjectReferenceRedirect && !!getResolvedProjectReferenceToRedirect(fileName);
95136         }
95137         function getResolvedProjectReferenceByPath(projectReferencePath) {
95138             if (!projectReferenceRedirects) {
95139                 return undefined;
95140             }
95141             return projectReferenceRedirects.get(projectReferencePath) || undefined;
95142         }
95143         function processReferencedFiles(file, isDefaultLib) {
95144             ts.forEach(file.referencedFiles, function (ref, index) {
95145                 processSourceFile(resolveTripleslashReference(ref.fileName, file.fileName), isDefaultLib, false, undefined, { kind: ts.FileIncludeKind.ReferenceFile, file: file.path, index: index, });
95146             });
95147         }
95148         function processTypeReferenceDirectives(file) {
95149             var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
95150             if (!typeDirectives) {
95151                 return;
95152             }
95153             var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file);
95154             for (var index = 0; index < typeDirectives.length; index++) {
95155                 var ref = file.typeReferenceDirectives[index];
95156                 var resolvedTypeReferenceDirective = resolutions[index];
95157                 var fileName = ts.toFileNameLowerCase(ref.fileName);
95158                 ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
95159                 processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
95160             }
95161         }
95162         function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
95163             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
95164             processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason);
95165             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
95166         }
95167         function processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
95168             var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective);
95169             if (previousResolution && previousResolution.primary) {
95170                 return;
95171             }
95172             var saveResolution = true;
95173             if (resolvedTypeReferenceDirective) {
95174                 if (resolvedTypeReferenceDirective.isExternalLibraryImport)
95175                     currentNodeModulesDepth++;
95176                 if (resolvedTypeReferenceDirective.primary) {
95177                     processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, false, resolvedTypeReferenceDirective.packageId, reason);
95178                 }
95179                 else {
95180                     if (previousResolution) {
95181                         if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) {
95182                             var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName);
95183                             var existingFile = getSourceFile(previousResolution.resolvedFileName);
95184                             if (otherFileText !== existingFile.text) {
95185                                 addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, 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]);
95186                             }
95187                         }
95188                         saveResolution = false;
95189                     }
95190                     else {
95191                         processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, false, resolvedTypeReferenceDirective.packageId, reason);
95192                     }
95193                 }
95194                 if (resolvedTypeReferenceDirective.isExternalLibraryImport)
95195                     currentNodeModulesDepth--;
95196             }
95197             else {
95198                 addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
95199             }
95200             if (saveResolution) {
95201                 resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
95202             }
95203         }
95204         function pathForLibFile(libFileName) {
95205             var components = libFileName.split(".");
95206             var path = components[1];
95207             var i = 2;
95208             while (components[i] && components[i] !== "d") {
95209                 path += (i === 2 ? "/" : "-") + components[i];
95210                 i++;
95211             }
95212             var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_".concat(libFileName, "__.ts"));
95213             var localOverrideModuleResult = ts.resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
95214             if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
95215                 return localOverrideModuleResult.resolvedModule.resolvedFileName;
95216             }
95217             return ts.combinePaths(defaultLibraryPath, libFileName);
95218         }
95219         function processLibReferenceDirectives(file) {
95220             ts.forEach(file.libReferenceDirectives, function (libReference, index) {
95221                 var libName = ts.toFileNameLowerCase(libReference.fileName);
95222                 var libFileName = ts.libMap.get(libName);
95223                 if (libFileName) {
95224                     processRootFile(pathForLibFile(libFileName), true, true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
95225                 }
95226                 else {
95227                     var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
95228                     var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
95229                     var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
95230                     (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
95231                         kind: 0,
95232                         reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
95233                         diagnostic: diagnostic,
95234                         args: [libName, suggestion]
95235                     });
95236                 }
95237             });
95238         }
95239         function getCanonicalFileName(fileName) {
95240             return host.getCanonicalFileName(fileName);
95241         }
95242         function processImportedModules(file) {
95243             var _a;
95244             collectExternalModuleReferences(file);
95245             if (file.imports.length || file.moduleAugmentations.length) {
95246                 var moduleNames = getModuleNames(file);
95247                 var resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
95248                 ts.Debug.assert(resolutions.length === moduleNames.length);
95249                 var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a = getRedirectReferenceForResolution(file)) === null || _a === void 0 ? void 0 : _a.commandLine.options : undefined) || options;
95250                 for (var index = 0; index < moduleNames.length; index++) {
95251                     var resolution = resolutions[index];
95252                     ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
95253                     if (!resolution) {
95254                         continue;
95255                     }
95256                     var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
95257                     var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
95258                     var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
95259                     var resolvedFileName = resolution.resolvedFileName;
95260                     if (isFromNodeModulesSearch) {
95261                         currentNodeModulesDepth++;
95262                     }
95263                     var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
95264                     var shouldAddFile = resolvedFileName
95265                         && !getResolutionDiagnostic(optionsForFile, resolution)
95266                         && !optionsForFile.noResolve
95267                         && index < file.imports.length
95268                         && !elideImport
95269                         && !(isJsFile && !ts.getAllowJSCompilerOption(optionsForFile))
95270                         && (ts.isInJSFile(file.imports[index]) || !(file.imports[index].flags & 4194304));
95271                     if (elideImport) {
95272                         modulesWithElidedImports.set(file.path, true);
95273                     }
95274                     else if (shouldAddFile) {
95275                         findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
95276                     }
95277                     if (isFromNodeModulesSearch) {
95278                         currentNodeModulesDepth--;
95279                     }
95280                 }
95281             }
95282             else {
95283                 file.resolvedModules = undefined;
95284             }
95285         }
95286         function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
95287             var allFilesBelongToPath = true;
95288             var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory));
95289             for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
95290                 var sourceFile = sourceFiles_2[_i];
95291                 if (!sourceFile.isDeclarationFile) {
95292                     var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
95293                     if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
95294                         addProgramDiagnosticExplainingFile(sourceFile, ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, [sourceFile.fileName, rootDirectory]);
95295                         allFilesBelongToPath = false;
95296                     }
95297                 }
95298             }
95299             return allFilesBelongToPath;
95300         }
95301         function parseProjectReferenceConfigFile(ref) {
95302             if (!projectReferenceRedirects) {
95303                 projectReferenceRedirects = new ts.Map();
95304             }
95305             var refPath = resolveProjectReferencePath(ref);
95306             var sourceFilePath = toPath(refPath);
95307             var fromCache = projectReferenceRedirects.get(sourceFilePath);
95308             if (fromCache !== undefined) {
95309                 return fromCache || undefined;
95310             }
95311             var commandLine;
95312             var sourceFile;
95313             if (host.getParsedCommandLine) {
95314                 commandLine = host.getParsedCommandLine(refPath);
95315                 if (!commandLine) {
95316                     addFileToFilesByName(undefined, sourceFilePath, undefined);
95317                     projectReferenceRedirects.set(sourceFilePath, false);
95318                     return undefined;
95319                 }
95320                 sourceFile = ts.Debug.checkDefined(commandLine.options.configFile);
95321                 ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
95322                 addFileToFilesByName(sourceFile, sourceFilePath, undefined);
95323             }
95324             else {
95325                 var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
95326                 sourceFile = host.getSourceFile(refPath, 100);
95327                 addFileToFilesByName(sourceFile, sourceFilePath, undefined);
95328                 if (sourceFile === undefined) {
95329                     projectReferenceRedirects.set(sourceFilePath, false);
95330                     return undefined;
95331                 }
95332                 commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, undefined, refPath);
95333             }
95334             sourceFile.fileName = refPath;
95335             sourceFile.path = sourceFilePath;
95336             sourceFile.resolvedPath = sourceFilePath;
95337             sourceFile.originalFileName = refPath;
95338             var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
95339             projectReferenceRedirects.set(sourceFilePath, resolvedRef);
95340             if (commandLine.projectReferences) {
95341                 resolvedRef.references = commandLine.projectReferences.map(parseProjectReferenceConfigFile);
95342             }
95343             return resolvedRef;
95344         }
95345         function verifyCompilerOptions() {
95346             var isNightly = ts.stringContains(ts.version, "-dev");
95347             if (!isNightly) {
95348                 if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
95349                     createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
95350                 }
95351                 else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
95352                     createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
95353                 }
95354                 else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
95355                     createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
95356                 }
95357                 else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
95358                     createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
95359                 }
95360             }
95361             if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
95362                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
95363             }
95364             if (options.exactOptionalPropertyTypes && !ts.getStrictOptionValue(options, "strictNullChecks")) {
95365                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
95366             }
95367             if (options.isolatedModules) {
95368                 if (options.out) {
95369                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
95370                 }
95371                 if (options.outFile) {
95372                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
95373                 }
95374             }
95375             if (options.inlineSourceMap) {
95376                 if (options.sourceMap) {
95377                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
95378                 }
95379                 if (options.mapRoot) {
95380                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap");
95381                 }
95382             }
95383             if (options.composite) {
95384                 if (options.declaration === false) {
95385                     createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_declaration_emit, "declaration");
95386                 }
95387                 if (options.incremental === false) {
95388                     createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
95389                 }
95390             }
95391             var outputFile = ts.outFile(options);
95392             if (options.tsBuildInfoFile) {
95393                 if (!ts.isIncrementalCompilation(options)) {
95394                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
95395                 }
95396             }
95397             else if (options.incremental && !outputFile && !options.configFilePath) {
95398                 programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
95399             }
95400             verifyProjectReferences();
95401             if (options.composite) {
95402                 var rootPaths = new ts.Set(rootNames.map(toPath));
95403                 for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
95404                     var file = files_4[_i];
95405                     if (ts.sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
95406                         addProgramDiagnosticExplainingFile(file, ts.Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, [file.fileName, options.configFilePath || ""]);
95407                     }
95408                 }
95409             }
95410             if (options.paths) {
95411                 for (var key in options.paths) {
95412                     if (!ts.hasProperty(options.paths, key)) {
95413                         continue;
95414                     }
95415                     if (!ts.hasZeroOrOneAsteriskCharacter(key)) {
95416                         createDiagnosticForOptionPaths(true, key, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key);
95417                     }
95418                     if (ts.isArray(options.paths[key])) {
95419                         var len = options.paths[key].length;
95420                         if (len === 0) {
95421                             createDiagnosticForOptionPaths(false, key, ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key);
95422                         }
95423                         for (var i = 0; i < len; i++) {
95424                             var subst = options.paths[key][i];
95425                             var typeOfSubst = typeof subst;
95426                             if (typeOfSubst === "string") {
95427                                 if (!ts.hasZeroOrOneAsteriskCharacter(subst)) {
95428                                     createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_in_pattern_1_can_have_at_most_one_Asterisk_character, subst, key);
95429                                 }
95430                                 if (!options.baseUrl && !ts.pathIsRelative(subst) && !ts.pathIsAbsolute(subst)) {
95431                                     createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Non_relative_paths_are_not_allowed_when_baseUrl_is_not_set_Did_you_forget_a_leading_Slash);
95432                                 }
95433                             }
95434                             else {
95435                                 createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst);
95436                             }
95437                         }
95438                     }
95439                     else {
95440                         createDiagnosticForOptionPaths(false, key, ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key);
95441                     }
95442                 }
95443             }
95444             if (!options.sourceMap && !options.inlineSourceMap) {
95445                 if (options.inlineSources) {
95446                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources");
95447                 }
95448                 if (options.sourceRoot) {
95449                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot");
95450                 }
95451             }
95452             if (options.out && options.outFile) {
95453                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile");
95454             }
95455             if (options.mapRoot && !(options.sourceMap || options.declarationMap)) {
95456                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap");
95457             }
95458             if (options.declarationDir) {
95459                 if (!ts.getEmitDeclarations(options)) {
95460                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "declarationDir", "declaration", "composite");
95461                 }
95462                 if (outputFile) {
95463                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile");
95464                 }
95465             }
95466             if (options.declarationMap && !ts.getEmitDeclarations(options)) {
95467                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "declarationMap", "declaration", "composite");
95468             }
95469             if (options.lib && options.noLib) {
95470                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib");
95471             }
95472             if (options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict")) {
95473                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
95474             }
95475             var languageVersion = ts.getEmitScriptTarget(options);
95476             var firstNonAmbientExternalModuleSourceFile = ts.find(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile; });
95477             if (options.isolatedModules) {
95478                 if (options.module === ts.ModuleKind.None && languageVersion < 2) {
95479                     createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
95480                 }
95481                 if (options.preserveConstEnums === false) {
95482                     createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules");
95483                 }
95484                 var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6; });
95485                 if (firstNonExternalModuleSourceFile) {
95486                     var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
95487                     programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName)));
95488                 }
95489             }
95490             else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {
95491                 var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
95492                 programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
95493             }
95494             if (outputFile && !options.emitDeclarationOnly) {
95495                 if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) {
95496                     createDiagnosticForOptionName(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module");
95497                 }
95498                 else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {
95499                     var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
95500                     programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
95501                 }
95502             }
95503             if (options.resolveJsonModule) {
95504                 if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
95505                     ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
95506                     ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
95507                     createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
95508                 }
95509                 else if (!ts.hasJsonModuleEmitEnabled(options)) {
95510                     createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module");
95511                 }
95512             }
95513             if (options.outDir ||
95514                 options.rootDir ||
95515                 options.sourceRoot ||
95516                 options.mapRoot) {
95517                 var dir = getCommonSourceDirectory();
95518                 if (options.outDir && dir === "" && files.some(function (file) { return ts.getRootLength(file.fileName) > 1; })) {
95519                     createDiagnosticForOptionName(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
95520                 }
95521             }
95522             if (options.useDefineForClassFields && languageVersion === 0) {
95523                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_when_option_target_is_ES3, "useDefineForClassFields");
95524             }
95525             if (options.checkJs && !ts.getAllowJSCompilerOption(options)) {
95526                 programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
95527             }
95528             if (options.emitDeclarationOnly) {
95529                 if (!ts.getEmitDeclarations(options)) {
95530                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
95531                 }
95532                 if (options.noEmit) {
95533                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
95534                 }
95535             }
95536             if (options.emitDecoratorMetadata &&
95537                 !options.experimentalDecorators) {
95538                 createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
95539             }
95540             if (options.jsxFactory) {
95541                 if (options.reactNamespace) {
95542                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory");
95543                 }
95544                 if (options.jsx === 4 || options.jsx === 5) {
95545                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFactory", ts.inverseJsxOptionMap.get("" + options.jsx));
95546                 }
95547                 if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) {
95548                     createOptionValueDiagnostic("jsxFactory", ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory);
95549                 }
95550             }
95551             else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) {
95552                 createOptionValueDiagnostic("reactNamespace", ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace);
95553             }
95554             if (options.jsxFragmentFactory) {
95555                 if (!options.jsxFactory) {
95556                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "jsxFragmentFactory", "jsxFactory");
95557                 }
95558                 if (options.jsx === 4 || options.jsx === 5) {
95559                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFragmentFactory", ts.inverseJsxOptionMap.get("" + options.jsx));
95560                 }
95561                 if (!ts.parseIsolatedEntityName(options.jsxFragmentFactory, languageVersion)) {
95562                     createOptionValueDiagnostic("jsxFragmentFactory", ts.Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFragmentFactory);
95563                 }
95564             }
95565             if (options.reactNamespace) {
95566                 if (options.jsx === 4 || options.jsx === 5) {
95567                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "reactNamespace", ts.inverseJsxOptionMap.get("" + options.jsx));
95568                 }
95569             }
95570             if (options.jsxImportSource) {
95571                 if (options.jsx === 2) {
95572                     createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxImportSource", ts.inverseJsxOptionMap.get("" + options.jsx));
95573                 }
95574             }
95575             if (options.preserveValueImports && ts.getEmitModuleKind(options) < ts.ModuleKind.ES2015) {
95576                 createOptionValueDiagnostic("importsNotUsedAsValues", ts.Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
95577             }
95578             if (!options.noEmit && !options.suppressOutputPathCheck) {
95579                 var emitHost = getEmitHost();
95580                 var emitFilesSeen_1 = new ts.Set();
95581                 ts.forEachEmittedFile(emitHost, function (emitFileNames) {
95582                     if (!options.emitDeclarationOnly) {
95583                         verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1);
95584                     }
95585                     verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1);
95586                 });
95587             }
95588             function verifyEmitFilePath(emitFileName, emitFilesSeen) {
95589                 if (emitFileName) {
95590                     var emitFilePath = toPath(emitFileName);
95591                     if (filesByName.has(emitFilePath)) {
95592                         var chain = void 0;
95593                         if (!options.configFilePath) {
95594                             chain = 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);
95595                         }
95596                         chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
95597                         blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
95598                     }
95599                     var emitFileKey = !host.useCaseSensitiveFileNames() ? ts.toFileNameLowerCase(emitFilePath) : emitFilePath;
95600                     if (emitFilesSeen.has(emitFileKey)) {
95601                         blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName));
95602                     }
95603                     else {
95604                         emitFilesSeen.add(emitFileKey);
95605                     }
95606                 }
95607             }
95608         }
95609         function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
95610             var _a;
95611             var fileIncludeReasons;
95612             var relatedInfo;
95613             var locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : undefined;
95614             if (file)
95615                 (_a = fileReasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(processReason);
95616             if (fileProcessingReason)
95617                 processReason(fileProcessingReason);
95618             if (locationReason && (fileIncludeReasons === null || fileIncludeReasons === void 0 ? void 0 : fileIncludeReasons.length) === 1)
95619                 fileIncludeReasons = undefined;
95620             var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
95621             var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
95622             var redirectInfo = file && ts.explainIfFileIsRedirect(file);
95623             var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
95624             return location && isReferenceFileLocation(location) ?
95625                 ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
95626                 ts.createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
95627             function processReason(reason) {
95628                 (fileIncludeReasons || (fileIncludeReasons = [])).push(ts.fileIncludeReasonToDiagnostics(program, reason));
95629                 if (!locationReason && isReferencedFile(reason)) {
95630                     locationReason = reason;
95631                 }
95632                 else if (locationReason !== reason) {
95633                     relatedInfo = ts.append(relatedInfo, fileIncludeReasonToRelatedInformation(reason));
95634                 }
95635                 if (reason === fileProcessingReason)
95636                     fileProcessingReason = undefined;
95637             }
95638         }
95639         function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
95640             (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
95641                 kind: 1,
95642                 file: file && file.path,
95643                 fileProcessingReason: fileProcessingReason,
95644                 diagnostic: diagnostic,
95645                 args: args
95646             });
95647         }
95648         function addProgramDiagnosticExplainingFile(file, diagnostic, args) {
95649             programDiagnostics.add(createDiagnosticExplainingFile(file, undefined, diagnostic, args));
95650         }
95651         function fileIncludeReasonToRelatedInformation(reason) {
95652             if (isReferencedFile(reason)) {
95653                 var referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
95654                 var message_2;
95655                 switch (reason.kind) {
95656                     case ts.FileIncludeKind.Import:
95657                         message_2 = ts.Diagnostics.File_is_included_via_import_here;
95658                         break;
95659                     case ts.FileIncludeKind.ReferenceFile:
95660                         message_2 = ts.Diagnostics.File_is_included_via_reference_here;
95661                         break;
95662                     case ts.FileIncludeKind.TypeReferenceDirective:
95663                         message_2 = ts.Diagnostics.File_is_included_via_type_library_reference_here;
95664                         break;
95665                     case ts.FileIncludeKind.LibReferenceDirective:
95666                         message_2 = ts.Diagnostics.File_is_included_via_library_reference_here;
95667                         break;
95668                     default:
95669                         ts.Debug.assertNever(reason);
95670                 }
95671                 return isReferenceFileLocation(referenceLocation) ? ts.createFileDiagnostic(referenceLocation.file, referenceLocation.pos, referenceLocation.end - referenceLocation.pos, message_2) : undefined;
95672             }
95673             if (!options.configFile)
95674                 return undefined;
95675             var configFileNode;
95676             var message;
95677             switch (reason.kind) {
95678                 case ts.FileIncludeKind.RootFile:
95679                     if (!options.configFile.configFileSpecs)
95680                         return undefined;
95681                     var fileName = ts.getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
95682                     var matchedByFiles = ts.getMatchedFileSpec(program, fileName);
95683                     if (matchedByFiles) {
95684                         configFileNode = ts.getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
95685                         message = ts.Diagnostics.File_is_matched_by_files_list_specified_here;
95686                         break;
95687                     }
95688                     var matchedByInclude = ts.getMatchedIncludeSpec(program, fileName);
95689                     if (!matchedByInclude)
95690                         return undefined;
95691                     configFileNode = ts.getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
95692                     message = ts.Diagnostics.File_is_matched_by_include_pattern_specified_here;
95693                     break;
95694                 case ts.FileIncludeKind.SourceFromProjectReference:
95695                 case ts.FileIncludeKind.OutputFromProjectReference:
95696                     var referencedResolvedRef_1 = ts.Debug.checkDefined(resolvedProjectReferences === null || resolvedProjectReferences === void 0 ? void 0 : resolvedProjectReferences[reason.index]);
95697                     var referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, function (resolvedRef, parent, index) {
95698                         return resolvedRef === referencedResolvedRef_1 ? { sourceFile: (parent === null || parent === void 0 ? void 0 : parent.sourceFile) || options.configFile, index: index } : undefined;
95699                     });
95700                     if (!referenceInfo)
95701                         return undefined;
95702                     var sourceFile = referenceInfo.sourceFile, index = referenceInfo.index;
95703                     var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
95704                     return referencesSyntax && referencesSyntax.elements.length > index ?
95705                         ts.createDiagnosticForNodeInSourceFile(sourceFile, referencesSyntax.elements[index], reason.kind === ts.FileIncludeKind.OutputFromProjectReference ?
95706                             ts.Diagnostics.File_is_output_from_referenced_project_specified_here :
95707                             ts.Diagnostics.File_is_source_from_referenced_project_specified_here) :
95708                         undefined;
95709                 case ts.FileIncludeKind.AutomaticTypeDirectiveFile:
95710                     if (!options.types)
95711                         return undefined;
95712                     configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference);
95713                     message = ts.Diagnostics.File_is_entry_point_of_type_library_specified_here;
95714                     break;
95715                 case ts.FileIncludeKind.LibFile:
95716                     if (reason.index !== undefined) {
95717                         configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]);
95718                         message = ts.Diagnostics.File_is_library_specified_here;
95719                         break;
95720                     }
95721                     var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
95722                     configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined;
95723                     message = ts.Diagnostics.File_is_default_library_for_target_specified_here;
95724                     break;
95725                 default:
95726                     ts.Debug.assertNever(reason);
95727             }
95728             return configFileNode && ts.createDiagnosticForNodeInSourceFile(options.configFile, configFileNode, message);
95729         }
95730         function verifyProjectReferences() {
95731             var buildInfoPath = !options.suppressOutputPathCheck ? ts.getTsBuildInfoEmitOutputFilePath(options) : undefined;
95732             forEachProjectReference(projectReferences, resolvedProjectReferences, function (resolvedRef, parent, index) {
95733                 var ref = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
95734                 var parentFile = parent && parent.sourceFile;
95735                 if (!resolvedRef) {
95736                     createDiagnosticForReference(parentFile, index, ts.Diagnostics.File_0_not_found, ref.path);
95737                     return;
95738                 }
95739                 var options = resolvedRef.commandLine.options;
95740                 if (!options.composite || options.noEmit) {
95741                     var inputs = parent ? parent.commandLine.fileNames : rootNames;
95742                     if (inputs.length) {
95743                         if (!options.composite)
95744                             createDiagnosticForReference(parentFile, index, ts.Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
95745                         if (options.noEmit)
95746                             createDiagnosticForReference(parentFile, index, ts.Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
95747                     }
95748                 }
95749                 if (ref.prepend) {
95750                     var out = ts.outFile(options);
95751                     if (out) {
95752                         if (!host.fileExists(out)) {
95753                             createDiagnosticForReference(parentFile, index, ts.Diagnostics.Output_file_0_from_project_1_does_not_exist, out, ref.path);
95754                         }
95755                     }
95756                     else {
95757                         createDiagnosticForReference(parentFile, index, ts.Diagnostics.Cannot_prepend_project_0_because_it_does_not_have_outFile_set, ref.path);
95758                     }
95759                 }
95760                 if (!parent && buildInfoPath && buildInfoPath === ts.getTsBuildInfoEmitOutputFilePath(options)) {
95761                     createDiagnosticForReference(parentFile, index, ts.Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
95762                     hasEmitBlockingDiagnostics.set(toPath(buildInfoPath), true);
95763                 }
95764             });
95765         }
95766         function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) {
95767             var needCompilerDiagnostic = true;
95768             var pathsSyntax = getOptionPathsSyntax();
95769             for (var _i = 0, pathsSyntax_1 = pathsSyntax; _i < pathsSyntax_1.length; _i++) {
95770                 var pathProp = pathsSyntax_1[_i];
95771                 if (ts.isObjectLiteralExpression(pathProp.initializer)) {
95772                     for (var _a = 0, _b = ts.getPropertyAssignment(pathProp.initializer, key); _a < _b.length; _a++) {
95773                         var keyProps = _b[_a];
95774                         var initializer = keyProps.initializer;
95775                         if (ts.isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
95776                             programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2));
95777                             needCompilerDiagnostic = false;
95778                         }
95779                     }
95780                 }
95781             }
95782             if (needCompilerDiagnostic) {
95783                 programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1, arg2));
95784             }
95785         }
95786         function createDiagnosticForOptionPaths(onKey, key, message, arg0) {
95787             var needCompilerDiagnostic = true;
95788             var pathsSyntax = getOptionPathsSyntax();
95789             for (var _i = 0, pathsSyntax_2 = pathsSyntax; _i < pathsSyntax_2.length; _i++) {
95790                 var pathProp = pathsSyntax_2[_i];
95791                 if (ts.isObjectLiteralExpression(pathProp.initializer) &&
95792                     createOptionDiagnosticInObjectLiteralSyntax(pathProp.initializer, onKey, key, undefined, message, arg0)) {
95793                     needCompilerDiagnostic = false;
95794                 }
95795             }
95796             if (needCompilerDiagnostic) {
95797                 programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0));
95798             }
95799         }
95800         function getOptionsSyntaxByName(name) {
95801             var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
95802             return compilerOptionsObjectLiteralSyntax && ts.getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name);
95803         }
95804         function getOptionPathsSyntax() {
95805             return getOptionsSyntaxByName("paths") || ts.emptyArray;
95806         }
95807         function getOptionsSyntaxByValue(name, value) {
95808             var syntaxByName = getOptionsSyntaxByName(name);
95809             return syntaxByName && ts.firstDefined(syntaxByName, function (property) { return ts.isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : undefined; });
95810         }
95811         function getOptionsSyntaxByArrayElementValue(name, value) {
95812             var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
95813             return compilerOptionsObjectLiteralSyntax && ts.getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value);
95814         }
95815         function createDiagnosticForOptionName(message, option1, option2, option3) {
95816             createDiagnosticForOption(true, option1, option2, message, option1, option2, option3);
95817         }
95818         function createOptionValueDiagnostic(option1, message, arg0, arg1) {
95819             createDiagnosticForOption(false, option1, undefined, message, arg0, arg1);
95820         }
95821         function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
95822             var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
95823             if (referencesSyntax && referencesSyntax.elements.length > index) {
95824                 programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1));
95825             }
95826             else {
95827                 programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1));
95828             }
95829         }
95830         function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) {
95831             var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
95832             var needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax ||
95833                 !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2);
95834             if (needCompilerDiagnostic) {
95835                 programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1, arg2));
95836             }
95837         }
95838         function getCompilerOptionsObjectLiteralSyntax() {
95839             if (_compilerOptionsObjectLiteralSyntax === undefined) {
95840                 _compilerOptionsObjectLiteralSyntax = false;
95841                 var jsonObjectLiteral = ts.getTsConfigObjectLiteralExpression(options.configFile);
95842                 if (jsonObjectLiteral) {
95843                     for (var _i = 0, _a = ts.getPropertyAssignment(jsonObjectLiteral, "compilerOptions"); _i < _a.length; _i++) {
95844                         var prop = _a[_i];
95845                         if (ts.isObjectLiteralExpression(prop.initializer)) {
95846                             _compilerOptionsObjectLiteralSyntax = prop.initializer;
95847                             break;
95848                         }
95849                     }
95850                 }
95851             }
95852             return _compilerOptionsObjectLiteralSyntax || undefined;
95853         }
95854         function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) {
95855             var props = ts.getPropertyAssignment(objectLiteral, key1, key2);
95856             for (var _i = 0, props_3 = props; _i < props_3.length; _i++) {
95857                 var prop = props_3[_i];
95858                 programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2));
95859             }
95860             return !!props.length;
95861         }
95862         function blockEmittingOfFile(emitFileName, diag) {
95863             hasEmitBlockingDiagnostics.set(toPath(emitFileName), true);
95864             programDiagnostics.add(diag);
95865         }
95866         function isEmittedFile(file) {
95867             if (options.noEmit) {
95868                 return false;
95869             }
95870             var filePath = toPath(file);
95871             if (getSourceFileByPath(filePath)) {
95872                 return false;
95873             }
95874             var out = ts.outFile(options);
95875             if (out) {
95876                 return isSameFile(filePath, out) || isSameFile(filePath, ts.removeFileExtension(out) + ".d.ts");
95877             }
95878             if (options.declarationDir && ts.containsPath(options.declarationDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames())) {
95879                 return true;
95880             }
95881             if (options.outDir) {
95882                 return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
95883             }
95884             if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts")) {
95885                 var filePathWithoutExtension = ts.removeFileExtension(filePath);
95886                 return !!getSourceFileByPath((filePathWithoutExtension + ".ts")) ||
95887                     !!getSourceFileByPath((filePathWithoutExtension + ".tsx"));
95888             }
95889             return false;
95890         }
95891         function isSameFile(file1, file2) {
95892             return ts.comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === 0;
95893         }
95894         function getSymlinkCache() {
95895             if (host.getSymlinkCache) {
95896                 return host.getSymlinkCache();
95897             }
95898             if (!symlinks) {
95899                 symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
95900             }
95901             if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
95902                 symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
95903             }
95904             return symlinks;
95905         }
95906     }
95907     ts.createProgram = createProgram;
95908     function updateHostForUseSourceOfProjectReferenceRedirect(host) {
95909         var setOfDeclarationDirectories;
95910         var originalFileExists = host.compilerHost.fileExists;
95911         var originalDirectoryExists = host.compilerHost.directoryExists;
95912         var originalGetDirectories = host.compilerHost.getDirectories;
95913         var originalRealpath = host.compilerHost.realpath;
95914         if (!host.useSourceOfProjectReferenceRedirect)
95915             return { onProgramCreateComplete: ts.noop, fileExists: fileExists };
95916         host.compilerHost.fileExists = fileExists;
95917         var directoryExists;
95918         if (originalDirectoryExists) {
95919             directoryExists = host.compilerHost.directoryExists = function (path) {
95920                 if (originalDirectoryExists.call(host.compilerHost, path)) {
95921                     handleDirectoryCouldBeSymlink(path);
95922                     return true;
95923                 }
95924                 if (!host.getResolvedProjectReferences())
95925                     return false;
95926                 if (!setOfDeclarationDirectories) {
95927                     setOfDeclarationDirectories = new ts.Set();
95928                     host.forEachResolvedProjectReference(function (ref) {
95929                         var out = ts.outFile(ref.commandLine.options);
95930                         if (out) {
95931                             setOfDeclarationDirectories.add(ts.getDirectoryPath(host.toPath(out)));
95932                         }
95933                         else {
95934                             var declarationDir = ref.commandLine.options.declarationDir || ref.commandLine.options.outDir;
95935                             if (declarationDir) {
95936                                 setOfDeclarationDirectories.add(host.toPath(declarationDir));
95937                             }
95938                         }
95939                     });
95940                 }
95941                 return fileOrDirectoryExistsUsingSource(path, false);
95942             };
95943         }
95944         if (originalGetDirectories) {
95945             host.compilerHost.getDirectories = function (path) {
95946                 return !host.getResolvedProjectReferences() || (originalDirectoryExists && originalDirectoryExists.call(host.compilerHost, path)) ?
95947                     originalGetDirectories.call(host.compilerHost, path) :
95948                     [];
95949             };
95950         }
95951         if (originalRealpath) {
95952             host.compilerHost.realpath = function (s) {
95953                 var _a;
95954                 return ((_a = host.getSymlinkCache().getSymlinkedFiles()) === null || _a === void 0 ? void 0 : _a.get(host.toPath(s))) ||
95955                     originalRealpath.call(host.compilerHost, s);
95956             };
95957         }
95958         return { onProgramCreateComplete: onProgramCreateComplete, fileExists: fileExists, directoryExists: directoryExists };
95959         function onProgramCreateComplete() {
95960             host.compilerHost.fileExists = originalFileExists;
95961             host.compilerHost.directoryExists = originalDirectoryExists;
95962             host.compilerHost.getDirectories = originalGetDirectories;
95963         }
95964         function fileExists(file) {
95965             if (originalFileExists.call(host.compilerHost, file))
95966                 return true;
95967             if (!host.getResolvedProjectReferences())
95968                 return false;
95969             if (!ts.isDeclarationFileName(file))
95970                 return false;
95971             return fileOrDirectoryExistsUsingSource(file, true);
95972         }
95973         function fileExistsIfProjectReferenceDts(file) {
95974             var source = host.getSourceOfProjectReferenceRedirect(host.toPath(file));
95975             return source !== undefined ?
95976                 ts.isString(source) ? originalFileExists.call(host.compilerHost, source) : true :
95977                 undefined;
95978         }
95979         function directoryExistsIfProjectReferenceDeclDir(dir) {
95980             var dirPath = host.toPath(dir);
95981             var dirPathWithTrailingDirectorySeparator = "".concat(dirPath).concat(ts.directorySeparator);
95982             return ts.forEachKey(setOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath ||
95983                 ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) ||
95984                 ts.startsWith(dirPath, "".concat(declDirPath, "/")); });
95985         }
95986         function handleDirectoryCouldBeSymlink(directory) {
95987             var _a;
95988             if (!host.getResolvedProjectReferences() || ts.containsIgnoredPath(directory))
95989                 return;
95990             if (!originalRealpath || !ts.stringContains(directory, ts.nodeModulesPathPart))
95991                 return;
95992             var symlinkCache = host.getSymlinkCache();
95993             var directoryPath = ts.ensureTrailingDirectorySeparator(host.toPath(directory));
95994             if ((_a = symlinkCache.getSymlinkedDirectories()) === null || _a === void 0 ? void 0 : _a.has(directoryPath))
95995                 return;
95996             var real = ts.normalizePath(originalRealpath.call(host.compilerHost, directory));
95997             var realPath;
95998             if (real === directory ||
95999                 (realPath = ts.ensureTrailingDirectorySeparator(host.toPath(real))) === directoryPath) {
96000                 symlinkCache.setSymlinkedDirectory(directoryPath, false);
96001                 return;
96002             }
96003             symlinkCache.setSymlinkedDirectory(directory, {
96004                 real: ts.ensureTrailingDirectorySeparator(real),
96005                 realPath: realPath
96006             });
96007         }
96008         function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) {
96009             var _a;
96010             var fileOrDirectoryExistsUsingSource = isFile ?
96011                 function (file) { return fileExistsIfProjectReferenceDts(file); } :
96012                 function (dir) { return directoryExistsIfProjectReferenceDeclDir(dir); };
96013             var result = fileOrDirectoryExistsUsingSource(fileOrDirectory);
96014             if (result !== undefined)
96015                 return result;
96016             var symlinkCache = host.getSymlinkCache();
96017             var symlinkedDirectories = symlinkCache.getSymlinkedDirectories();
96018             if (!symlinkedDirectories)
96019                 return false;
96020             var fileOrDirectoryPath = host.toPath(fileOrDirectory);
96021             if (!ts.stringContains(fileOrDirectoryPath, ts.nodeModulesPathPart))
96022                 return false;
96023             if (isFile && ((_a = symlinkCache.getSymlinkedFiles()) === null || _a === void 0 ? void 0 : _a.has(fileOrDirectoryPath)))
96024                 return true;
96025             return ts.firstDefinedIterator(symlinkedDirectories.entries(), function (_a) {
96026                 var directoryPath = _a[0], symlinkedDirectory = _a[1];
96027                 if (!symlinkedDirectory || !ts.startsWith(fileOrDirectoryPath, directoryPath))
96028                     return undefined;
96029                 var result = fileOrDirectoryExistsUsingSource(fileOrDirectoryPath.replace(directoryPath, symlinkedDirectory.realPath));
96030                 if (isFile && result) {
96031                     var absolutePath = ts.getNormalizedAbsolutePath(fileOrDirectory, host.compilerHost.getCurrentDirectory());
96032                     symlinkCache.setSymlinkedFile(fileOrDirectoryPath, "".concat(symlinkedDirectory.real).concat(absolutePath.replace(new RegExp(directoryPath, "i"), "")));
96033                 }
96034                 return result;
96035             }) || false;
96036         }
96037     }
96038     ts.emitSkippedWithNoDiagnostics = { diagnostics: ts.emptyArray, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true };
96039     function handleNoEmitOptions(program, sourceFile, writeFile, cancellationToken) {
96040         var options = program.getCompilerOptions();
96041         if (options.noEmit) {
96042             program.getSemanticDiagnostics(sourceFile, cancellationToken);
96043             return sourceFile || ts.outFile(options) ?
96044                 ts.emitSkippedWithNoDiagnostics :
96045                 program.emitBuildInfo(writeFile, cancellationToken);
96046         }
96047         if (!options.noEmitOnError)
96048             return undefined;
96049         var diagnostics = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], program.getOptionsDiagnostics(cancellationToken), true), program.getSyntacticDiagnostics(sourceFile, cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true), program.getSemanticDiagnostics(sourceFile, cancellationToken), true);
96050         if (diagnostics.length === 0 && ts.getEmitDeclarations(program.getCompilerOptions())) {
96051             diagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken);
96052         }
96053         if (!diagnostics.length)
96054             return undefined;
96055         var emittedFiles;
96056         if (!sourceFile && !ts.outFile(options)) {
96057             var emitResult = program.emitBuildInfo(writeFile, cancellationToken);
96058             if (emitResult.diagnostics)
96059                 diagnostics = __spreadArray(__spreadArray([], diagnostics, true), emitResult.diagnostics, true);
96060             emittedFiles = emitResult.emittedFiles;
96061         }
96062         return { diagnostics: diagnostics, sourceMaps: undefined, emittedFiles: emittedFiles, emitSkipped: true };
96063     }
96064     ts.handleNoEmitOptions = handleNoEmitOptions;
96065     function filterSemanticDiagnostics(diagnostic, option) {
96066         return ts.filter(diagnostic, function (d) { return !d.skippedOn || !option[d.skippedOn]; });
96067     }
96068     ts.filterSemanticDiagnostics = filterSemanticDiagnostics;
96069     function parseConfigHostFromCompilerHostLike(host, directoryStructureHost) {
96070         if (directoryStructureHost === void 0) { directoryStructureHost = host; }
96071         return {
96072             fileExists: function (f) { return directoryStructureHost.fileExists(f); },
96073             readDirectory: function (root, extensions, excludes, includes, depth) {
96074                 ts.Debug.assertIsDefined(directoryStructureHost.readDirectory, "'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'");
96075                 return directoryStructureHost.readDirectory(root, extensions, excludes, includes, depth);
96076             },
96077             readFile: function (f) { return directoryStructureHost.readFile(f); },
96078             useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(),
96079             getCurrentDirectory: function () { return host.getCurrentDirectory(); },
96080             onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic || ts.returnUndefined,
96081             trace: host.trace ? function (s) { return host.trace(s); } : undefined
96082         };
96083     }
96084     ts.parseConfigHostFromCompilerHostLike = parseConfigHostFromCompilerHostLike;
96085     function createPrependNodes(projectReferences, getCommandLine, readFile) {
96086         if (!projectReferences)
96087             return ts.emptyArray;
96088         var nodes;
96089         for (var i = 0; i < projectReferences.length; i++) {
96090             var ref = projectReferences[i];
96091             var resolvedRefOpts = getCommandLine(ref, i);
96092             if (ref.prepend && resolvedRefOpts && resolvedRefOpts.options) {
96093                 var out = ts.outFile(resolvedRefOpts.options);
96094                 if (!out)
96095                     continue;
96096                 var _a = ts.getOutputPathsForBundle(resolvedRefOpts.options, true), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
96097                 var node = ts.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath);
96098                 (nodes || (nodes = [])).push(node);
96099             }
96100         }
96101         return nodes || ts.emptyArray;
96102     }
96103     ts.createPrependNodes = createPrependNodes;
96104     function resolveProjectReferencePath(hostOrRef, ref) {
96105         var passedInRef = ref ? ref : hostOrRef;
96106         return ts.resolveConfigFileProjectName(passedInRef.path);
96107     }
96108     ts.resolveProjectReferencePath = resolveProjectReferencePath;
96109     function getResolutionDiagnostic(options, _a) {
96110         var extension = _a.extension;
96111         switch (extension) {
96112             case ".ts":
96113             case ".d.ts":
96114                 return undefined;
96115             case ".tsx":
96116                 return needJsx();
96117             case ".jsx":
96118                 return needJsx() || needAllowJs();
96119             case ".js":
96120                 return needAllowJs();
96121             case ".json":
96122                 return needResolveJsonModule();
96123         }
96124         function needJsx() {
96125             return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
96126         }
96127         function needAllowJs() {
96128             return ts.getAllowJSCompilerOption(options) || !ts.getStrictOptionValue(options, "noImplicitAny") ? undefined : ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type;
96129         }
96130         function needResolveJsonModule() {
96131             return options.resolveJsonModule ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
96132         }
96133     }
96134     ts.getResolutionDiagnostic = getResolutionDiagnostic;
96135     function getModuleNames(_a) {
96136         var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations;
96137         var res = imports.map(function (i) { return i.text; });
96138         for (var _i = 0, moduleAugmentations_1 = moduleAugmentations; _i < moduleAugmentations_1.length; _i++) {
96139             var aug = moduleAugmentations_1[_i];
96140             if (aug.kind === 10) {
96141                 res.push(aug.text);
96142             }
96143         }
96144         return res;
96145     }
96146     function getModuleNameStringLiteralAt(_a, index) {
96147         var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations;
96148         if (index < imports.length)
96149             return imports[index];
96150         var augIndex = imports.length;
96151         for (var _i = 0, moduleAugmentations_2 = moduleAugmentations; _i < moduleAugmentations_2.length; _i++) {
96152             var aug = moduleAugmentations_2[_i];
96153             if (aug.kind === 10) {
96154                 if (index === augIndex)
96155                     return aug;
96156                 augIndex++;
96157             }
96158         }
96159         ts.Debug.fail("should never ask for module name at index higher than possible module name");
96160     }
96161     ts.getModuleNameStringLiteralAt = getModuleNameStringLiteralAt;
96162 })(ts || (ts = {}));
96163 var ts;
96164 (function (ts) {
96165     function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
96166         var outputFiles = [];
96167         var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
96168         return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
96169         function writeFile(fileName, text, writeByteOrderMark) {
96170             outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
96171         }
96172     }
96173     ts.getFileEmitOutput = getFileEmitOutput;
96174     var BuilderState;
96175     (function (BuilderState) {
96176         var manyToManyPathMapCount = 0;
96177         function createManyToManyPathMap() {
96178             function create(forward, reverse, deleted) {
96179                 var version = 0;
96180                 var map = {
96181                     id: manyToManyPathMapCount++,
96182                     version: function () { return version; },
96183                     clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
96184                     forEach: function (fn) { return forward.forEach(fn); },
96185                     getKeys: function (v) { return reverse.get(v); },
96186                     getValues: function (k) { return forward.get(k); },
96187                     hasKey: function (k) { return forward.has(k); },
96188                     keys: function () { return forward.keys(); },
96189                     deletedKeys: function () { return deleted; },
96190                     deleteKey: function (k) {
96191                         (deleted || (deleted = new ts.Set())).add(k);
96192                         var set = forward.get(k);
96193                         if (!set) {
96194                             return false;
96195                         }
96196                         set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
96197                         forward.delete(k);
96198                         version++;
96199                         return true;
96200                     },
96201                     set: function (k, vSet) {
96202                         var changed = !!(deleted === null || deleted === void 0 ? void 0 : deleted.delete(k));
96203                         var existingVSet = forward.get(k);
96204                         forward.set(k, vSet);
96205                         existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
96206                             if (!vSet.has(v)) {
96207                                 changed = true;
96208                                 deleteFromMultimap(reverse, v, k);
96209                             }
96210                         });
96211                         vSet.forEach(function (v) {
96212                             if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
96213                                 changed = true;
96214                                 addToMultimap(reverse, v, k);
96215                             }
96216                         });
96217                         if (changed) {
96218                             version++;
96219                         }
96220                         return map;
96221                     },
96222                 };
96223                 return map;
96224             }
96225             return create(new ts.Map(), new ts.Map(), undefined);
96226         }
96227         BuilderState.createManyToManyPathMap = createManyToManyPathMap;
96228         function addToMultimap(map, k, v) {
96229             var set = map.get(k);
96230             if (!set) {
96231                 set = new ts.Set();
96232                 map.set(k, set);
96233             }
96234             set.add(v);
96235         }
96236         function deleteFromMultimap(map, k, v, removeEmpty) {
96237             if (removeEmpty === void 0) { removeEmpty = true; }
96238             var set = map.get(k);
96239             if (set === null || set === void 0 ? void 0 : set.delete(v)) {
96240                 if (removeEmpty && !set.size) {
96241                     map.delete(k);
96242                 }
96243                 return true;
96244             }
96245             return false;
96246         }
96247         function getReferencedFilesFromImportedModuleSymbol(symbol) {
96248             return ts.mapDefined(symbol.declarations, function (declaration) { var _a; return (_a = ts.getSourceFileOfNode(declaration)) === null || _a === void 0 ? void 0 : _a.resolvedPath; });
96249         }
96250         function getReferencedFilesFromImportLiteral(checker, importName) {
96251             var symbol = checker.getSymbolAtLocation(importName);
96252             return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
96253         }
96254         function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
96255             return ts.toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
96256         }
96257         function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
96258             var referencedFiles;
96259             if (sourceFile.imports && sourceFile.imports.length > 0) {
96260                 var checker = program.getTypeChecker();
96261                 for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) {
96262                     var importName = _a[_i];
96263                     var declarationSourceFilePaths = getReferencedFilesFromImportLiteral(checker, importName);
96264                     declarationSourceFilePaths === null || declarationSourceFilePaths === void 0 ? void 0 : declarationSourceFilePaths.forEach(addReferencedFile);
96265                 }
96266             }
96267             var sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
96268             if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) {
96269                 for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) {
96270                     var referencedFile = _c[_b];
96271                     var referencedPath = getReferencedFileFromFileName(program, referencedFile.fileName, sourceFileDirectory, getCanonicalFileName);
96272                     addReferencedFile(referencedPath);
96273                 }
96274             }
96275             if (sourceFile.resolvedTypeReferenceDirectiveNames) {
96276                 sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) {
96277                     if (!resolvedTypeReferenceDirective) {
96278                         return;
96279                     }
96280                     var fileName = resolvedTypeReferenceDirective.resolvedFileName;
96281                     var typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
96282                     addReferencedFile(typeFilePath);
96283                 });
96284             }
96285             if (sourceFile.moduleAugmentations.length) {
96286                 var checker = program.getTypeChecker();
96287                 for (var _d = 0, _e = sourceFile.moduleAugmentations; _d < _e.length; _d++) {
96288                     var moduleName = _e[_d];
96289                     if (!ts.isStringLiteral(moduleName))
96290                         continue;
96291                     var symbol = checker.getSymbolAtLocation(moduleName);
96292                     if (!symbol)
96293                         continue;
96294                     addReferenceFromAmbientModule(symbol);
96295                 }
96296             }
96297             for (var _f = 0, _g = program.getTypeChecker().getAmbientModules(); _f < _g.length; _f++) {
96298                 var ambientModule = _g[_f];
96299                 if (ambientModule.declarations && ambientModule.declarations.length > 1) {
96300                     addReferenceFromAmbientModule(ambientModule);
96301                 }
96302             }
96303             return referencedFiles;
96304             function addReferenceFromAmbientModule(symbol) {
96305                 if (!symbol.declarations) {
96306                     return;
96307                 }
96308                 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
96309                     var declaration = _a[_i];
96310                     var declarationSourceFile = ts.getSourceFileOfNode(declaration);
96311                     if (declarationSourceFile &&
96312                         declarationSourceFile !== sourceFile) {
96313                         addReferencedFile(declarationSourceFile.resolvedPath);
96314                     }
96315                 }
96316             }
96317             function addReferencedFile(referencedPath) {
96318                 (referencedFiles || (referencedFiles = new ts.Set())).add(referencedPath);
96319             }
96320         }
96321         function canReuseOldState(newReferencedMap, oldState) {
96322             return oldState && !oldState.referencedMap === !newReferencedMap;
96323         }
96324         BuilderState.canReuseOldState = canReuseOldState;
96325         function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
96326             var fileInfos = new ts.Map();
96327             var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
96328             var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
96329             var hasCalledUpdateShapeSignature = new ts.Set();
96330             var useOldState = canReuseOldState(referencedMap, oldState);
96331             newProgram.getTypeChecker();
96332             for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
96333                 var sourceFile = _a[_i];
96334                 var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
96335                 var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
96336                 if (referencedMap) {
96337                     var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
96338                     if (newReferences) {
96339                         referencedMap.set(sourceFile.resolvedPath, newReferences);
96340                     }
96341                     if (useOldState) {
96342                         var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
96343                         if (exportedModules) {
96344                             exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
96345                         }
96346                     }
96347                 }
96348                 fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
96349             }
96350             return {
96351                 fileInfos: fileInfos,
96352                 referencedMap: referencedMap,
96353                 exportedModulesMap: exportedModulesMap,
96354                 hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
96355                 useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
96356             };
96357         }
96358         BuilderState.create = create;
96359         function releaseCache(state) {
96360             state.allFilesExcludingDefaultLibraryFile = undefined;
96361             state.allFileNames = undefined;
96362         }
96363         BuilderState.releaseCache = releaseCache;
96364         function clone(state) {
96365             var _a, _b;
96366             return {
96367                 fileInfos: new ts.Map(state.fileInfos),
96368                 referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
96369                 exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
96370                 hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
96371                 useFileVersionAsSignature: state.useFileVersionAsSignature,
96372             };
96373         }
96374         BuilderState.clone = clone;
96375         function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
96376             var signatureCache = cacheToUpdateSignature || new ts.Map();
96377             var sourceFile = programOfThisState.getSourceFileByPath(path);
96378             if (!sourceFile) {
96379                 return ts.emptyArray;
96380             }
96381             if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
96382                 return [sourceFile];
96383             }
96384             var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
96385             if (!cacheToUpdateSignature) {
96386                 updateSignaturesFromCache(state, signatureCache);
96387             }
96388             return result;
96389         }
96390         BuilderState.getFilesAffectedBy = getFilesAffectedBy;
96391         function updateSignaturesFromCache(state, signatureCache) {
96392             signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
96393         }
96394         BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
96395         function updateSignatureOfFile(state, signature, path) {
96396             state.fileInfos.get(path).signature = signature;
96397             state.hasCalledUpdateShapeSignature.add(path);
96398         }
96399         BuilderState.updateSignatureOfFile = updateSignatureOfFile;
96400         function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
96401             if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
96402             ts.Debug.assert(!!sourceFile);
96403             ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
96404             if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
96405                 return false;
96406             }
96407             var info = state.fileInfos.get(sourceFile.resolvedPath);
96408             if (!info)
96409                 return ts.Debug.fail();
96410             var prevSignature = info.signature;
96411             var latestSignature;
96412             if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
96413                 var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
96414                 var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
96415                 if (firstDts_1) {
96416                     ts.Debug.assert(ts.fileExtensionIsOneOf(firstDts_1.name, [".d.ts", ".d.mts", ".d.cts"]), "File extension for signature expected to be dts", function () { return "Found: ".concat(ts.getAnyExtensionFromPath(firstDts_1.name), " for ").concat(firstDts_1.name, ":: All output files: ").concat(JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; }))); });
96417                     latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
96418                     if (exportedModulesMapCache && latestSignature !== prevSignature) {
96419                         updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
96420                     }
96421                 }
96422             }
96423             if (latestSignature === undefined) {
96424                 latestSignature = sourceFile.version;
96425                 if (exportedModulesMapCache && latestSignature !== prevSignature) {
96426                     var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
96427                     if (references) {
96428                         exportedModulesMapCache.set(sourceFile.resolvedPath, references);
96429                     }
96430                     else {
96431                         exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
96432                     }
96433                 }
96434             }
96435             cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
96436             return latestSignature !== prevSignature;
96437         }
96438         BuilderState.updateShapeSignature = updateShapeSignature;
96439         function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
96440             if (!exportedModulesFromDeclarationEmit) {
96441                 exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
96442                 return;
96443             }
96444             var exportedModules;
96445             exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
96446             if (exportedModules) {
96447                 exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
96448             }
96449             else {
96450                 exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
96451             }
96452             function addExportedModule(exportedModulePaths) {
96453                 if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
96454                     if (!exportedModules) {
96455                         exportedModules = new ts.Set();
96456                     }
96457                     exportedModulePaths.forEach(function (path) { return exportedModules.add(path); });
96458                 }
96459             }
96460         }
96461         function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
96462             var _a;
96463             if (exportedModulesMapCache) {
96464                 ts.Debug.assert(!!state.exportedModulesMap);
96465                 var cacheId = exportedModulesMapCache.id;
96466                 var cacheVersion = exportedModulesMapCache.version();
96467                 if (state.previousCache) {
96468                     if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
96469                         return;
96470                     }
96471                     state.previousCache.id = cacheId;
96472                     state.previousCache.version = cacheVersion;
96473                 }
96474                 else {
96475                     state.previousCache = { id: cacheId, version: cacheVersion };
96476                 }
96477                 (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
96478                 exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
96479             }
96480         }
96481         BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
96482         function getAllDependencies(state, programOfThisState, sourceFile) {
96483             var compilerOptions = programOfThisState.getCompilerOptions();
96484             if (ts.outFile(compilerOptions)) {
96485                 return getAllFileNames(state, programOfThisState);
96486             }
96487             if (!state.referencedMap || isFileAffectingGlobalScope(sourceFile)) {
96488                 return getAllFileNames(state, programOfThisState);
96489             }
96490             var seenMap = new ts.Set();
96491             var queue = [sourceFile.resolvedPath];
96492             while (queue.length) {
96493                 var path = queue.pop();
96494                 if (!seenMap.has(path)) {
96495                     seenMap.add(path);
96496                     var references = state.referencedMap.getValues(path);
96497                     if (references) {
96498                         var iterator = references.keys();
96499                         for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
96500                             queue.push(iterResult.value);
96501                         }
96502                     }
96503                 }
96504             }
96505             return ts.arrayFrom(ts.mapDefinedIterator(seenMap.keys(), function (path) { var _a, _b; return (_b = (_a = programOfThisState.getSourceFileByPath(path)) === null || _a === void 0 ? void 0 : _a.fileName) !== null && _b !== void 0 ? _b : path; }));
96506         }
96507         BuilderState.getAllDependencies = getAllDependencies;
96508         function getAllFileNames(state, programOfThisState) {
96509             if (!state.allFileNames) {
96510                 var sourceFiles = programOfThisState.getSourceFiles();
96511                 state.allFileNames = sourceFiles === ts.emptyArray ? ts.emptyArray : sourceFiles.map(function (file) { return file.fileName; });
96512             }
96513             return state.allFileNames;
96514         }
96515         function getReferencedByPaths(state, referencedFilePath) {
96516             var keys = state.referencedMap.getKeys(referencedFilePath);
96517             return keys ? ts.arrayFrom(keys.keys()) : [];
96518         }
96519         BuilderState.getReferencedByPaths = getReferencedByPaths;
96520         function containsOnlyAmbientModules(sourceFile) {
96521             for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
96522                 var statement = _a[_i];
96523                 if (!ts.isModuleWithStringLiteralName(statement)) {
96524                     return false;
96525                 }
96526             }
96527             return true;
96528         }
96529         function containsGlobalScopeAugmentation(sourceFile) {
96530             return ts.some(sourceFile.moduleAugmentations, function (augmentation) { return ts.isGlobalScopeAugmentation(augmentation.parent); });
96531         }
96532         function isFileAffectingGlobalScope(sourceFile) {
96533             return containsGlobalScopeAugmentation(sourceFile) ||
96534                 !ts.isExternalOrCommonJsModule(sourceFile) && !ts.isJsonSourceFile(sourceFile) && !containsOnlyAmbientModules(sourceFile);
96535         }
96536         function getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, firstSourceFile) {
96537             if (state.allFilesExcludingDefaultLibraryFile) {
96538                 return state.allFilesExcludingDefaultLibraryFile;
96539             }
96540             var result;
96541             if (firstSourceFile)
96542                 addSourceFile(firstSourceFile);
96543             for (var _i = 0, _a = programOfThisState.getSourceFiles(); _i < _a.length; _i++) {
96544                 var sourceFile = _a[_i];
96545                 if (sourceFile !== firstSourceFile) {
96546                     addSourceFile(sourceFile);
96547                 }
96548             }
96549             state.allFilesExcludingDefaultLibraryFile = result || ts.emptyArray;
96550             return state.allFilesExcludingDefaultLibraryFile;
96551             function addSourceFile(sourceFile) {
96552                 if (!programOfThisState.isSourceFileDefaultLibrary(sourceFile)) {
96553                     (result || (result = [])).push(sourceFile);
96554                 }
96555             }
96556         }
96557         BuilderState.getAllFilesExcludingDefaultLibraryFile = getAllFilesExcludingDefaultLibraryFile;
96558         function getFilesAffectedByUpdatedShapeWhenNonModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape) {
96559             var compilerOptions = programOfThisState.getCompilerOptions();
96560             if (compilerOptions && ts.outFile(compilerOptions)) {
96561                 return [sourceFileWithUpdatedShape];
96562             }
96563             return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
96564         }
96565         function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
96566             if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
96567                 return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
96568             }
96569             var compilerOptions = programOfThisState.getCompilerOptions();
96570             if (compilerOptions && (compilerOptions.isolatedModules || ts.outFile(compilerOptions))) {
96571                 return [sourceFileWithUpdatedShape];
96572             }
96573             var seenFileNamesMap = new ts.Map();
96574             seenFileNamesMap.set(sourceFileWithUpdatedShape.resolvedPath, sourceFileWithUpdatedShape);
96575             var queue = getReferencedByPaths(state, sourceFileWithUpdatedShape.resolvedPath);
96576             while (queue.length > 0) {
96577                 var currentPath = queue.pop();
96578                 if (!seenFileNamesMap.has(currentPath)) {
96579                     var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
96580                     seenFileNamesMap.set(currentPath, currentSourceFile);
96581                     if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
96582                         queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
96583                     }
96584                 }
96585             }
96586             return ts.arrayFrom(ts.mapDefinedIterator(seenFileNamesMap.values(), function (value) { return value; }));
96587         }
96588     })(BuilderState = ts.BuilderState || (ts.BuilderState = {}));
96589 })(ts || (ts = {}));
96590 var ts;
96591 (function (ts) {
96592     function hasSameKeys(map1, map2) {
96593         return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
96594     }
96595     function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
96596         var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
96597         state.program = newProgram;
96598         var compilerOptions = newProgram.getCompilerOptions();
96599         state.compilerOptions = compilerOptions;
96600         if (!ts.outFile(compilerOptions)) {
96601             state.semanticDiagnosticsPerFile = new ts.Map();
96602         }
96603         state.changedFilesSet = new ts.Set();
96604         var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
96605         var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
96606         var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
96607             !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
96608         if (useOldState) {
96609             if (!oldState.currentChangedFilePath) {
96610                 var affectedSignatures = oldState.currentAffectedFilesSignatures;
96611                 ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
96612             }
96613             var changedFilesSet = oldState.changedFilesSet;
96614             if (canCopySemanticDiagnostics) {
96615                 ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
96616             }
96617             changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
96618             if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
96619                 state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
96620                 state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
96621                 state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
96622                 state.seenAffectedFiles = new ts.Set();
96623             }
96624         }
96625         var referencedMap = state.referencedMap;
96626         var oldReferencedMap = useOldState ? oldState.referencedMap : undefined;
96627         var copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
96628         var copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
96629         state.fileInfos.forEach(function (info, sourceFilePath) {
96630             var oldInfo;
96631             var newReferences;
96632             if (!useOldState ||
96633                 !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
96634                 oldInfo.version !== info.version ||
96635                 !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
96636                 newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
96637                 state.changedFilesSet.add(sourceFilePath);
96638             }
96639             else if (canCopySemanticDiagnostics) {
96640                 var sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
96641                 if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
96642                     return;
96643                 if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
96644                     return;
96645                 var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
96646                 if (diagnostics) {
96647                     state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics);
96648                     if (!state.semanticDiagnosticsFromOldState) {
96649                         state.semanticDiagnosticsFromOldState = new ts.Set();
96650                     }
96651                     state.semanticDiagnosticsFromOldState.add(sourceFilePath);
96652                 }
96653             }
96654         });
96655         if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
96656             ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
96657                 .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
96658         }
96659         else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
96660             newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
96661             ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
96662             state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
96663         }
96664         if (useOldState) {
96665             ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
96666                 if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
96667                     state.changedFilesSet.add(sourceFilePath);
96668                 }
96669             });
96670         }
96671         state.buildInfoEmitPending = !!state.changedFilesSet.size;
96672         return state;
96673     }
96674     function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
96675         if (!diagnostics.length)
96676             return ts.emptyArray;
96677         var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
96678         return diagnostics.map(function (diagnostic) {
96679             var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
96680             result.reportsUnnecessary = diagnostic.reportsUnnecessary;
96681             result.reportsDeprecated = diagnostic.reportDeprecated;
96682             result.source = diagnostic.source;
96683             result.skippedOn = diagnostic.skippedOn;
96684             var relatedInformation = diagnostic.relatedInformation;
96685             result.relatedInformation = relatedInformation ?
96686                 relatedInformation.length ?
96687                     relatedInformation.map(function (r) { return convertToDiagnosticRelatedInformation(r, newProgram, toPath); }) :
96688                     [] :
96689                 undefined;
96690             return result;
96691         });
96692         function toPath(path) {
96693             return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
96694         }
96695     }
96696     function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
96697         var file = diagnostic.file;
96698         return __assign(__assign({}, diagnostic), { file: file ? newProgram.getSourceFileByPath(toPath(file)) : undefined });
96699     }
96700     function releaseCache(state) {
96701         ts.BuilderState.releaseCache(state);
96702         state.program = undefined;
96703     }
96704     function cloneBuilderProgramState(state) {
96705         var _a;
96706         var newState = ts.BuilderState.clone(state);
96707         newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
96708         newState.changedFilesSet = new ts.Set(state.changedFilesSet);
96709         newState.affectedFiles = state.affectedFiles;
96710         newState.affectedFilesIndex = state.affectedFilesIndex;
96711         newState.currentChangedFilePath = state.currentChangedFilePath;
96712         newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
96713         newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
96714         newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
96715         newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
96716         newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
96717         newState.program = state.program;
96718         newState.compilerOptions = state.compilerOptions;
96719         newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
96720         newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
96721         newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
96722         newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
96723         newState.programEmitComplete = state.programEmitComplete;
96724         return newState;
96725     }
96726     function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
96727         ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
96728     }
96729     function getNextAffectedFile(state, cancellationToken, computeHash) {
96730         while (true) {
96731             var affectedFiles = state.affectedFiles;
96732             if (affectedFiles) {
96733                 var seenAffectedFiles = state.seenAffectedFiles;
96734                 var affectedFilesIndex = state.affectedFilesIndex;
96735                 while (affectedFilesIndex < affectedFiles.length) {
96736                     var affectedFile = affectedFiles[affectedFilesIndex];
96737                     if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
96738                         state.affectedFilesIndex = affectedFilesIndex;
96739                         handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
96740                         return affectedFile;
96741                     }
96742                     affectedFilesIndex++;
96743                 }
96744                 state.changedFilesSet.delete(state.currentChangedFilePath);
96745                 state.currentChangedFilePath = undefined;
96746                 ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
96747                 state.currentAffectedFilesSignatures.clear();
96748                 ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
96749                 state.affectedFiles = undefined;
96750             }
96751             var nextKey = state.changedFilesSet.keys().next();
96752             if (nextKey.done) {
96753                 return undefined;
96754             }
96755             var program = ts.Debug.checkDefined(state.program);
96756             var compilerOptions = program.getCompilerOptions();
96757             if (ts.outFile(compilerOptions)) {
96758                 ts.Debug.assert(!state.semanticDiagnosticsPerFile);
96759                 return program;
96760             }
96761             if (!state.currentAffectedFilesSignatures)
96762                 state.currentAffectedFilesSignatures = new ts.Map();
96763             if (state.exportedModulesMap) {
96764                 state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
96765             }
96766             state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
96767             state.currentChangedFilePath = nextKey.value;
96768             state.affectedFilesIndex = 0;
96769             if (!state.seenAffectedFiles)
96770                 state.seenAffectedFiles = new ts.Set();
96771         }
96772     }
96773     function getNextAffectedFilePendingEmit(state) {
96774         var affectedFilesPendingEmit = state.affectedFilesPendingEmit;
96775         if (affectedFilesPendingEmit) {
96776             var seenEmittedFiles = (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map()));
96777             for (var i = state.affectedFilesPendingEmitIndex; i < affectedFilesPendingEmit.length; i++) {
96778                 var affectedFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]);
96779                 if (affectedFile) {
96780                     var seenKind = seenEmittedFiles.get(affectedFile.resolvedPath);
96781                     var emitKind = ts.Debug.checkDefined(ts.Debug.checkDefined(state.affectedFilesPendingEmitKind).get(affectedFile.resolvedPath));
96782                     if (seenKind === undefined || seenKind < emitKind) {
96783                         state.affectedFilesPendingEmitIndex = i;
96784                         return { affectedFile: affectedFile, emitKind: emitKind };
96785                     }
96786                 }
96787             }
96788             state.affectedFilesPendingEmit = undefined;
96789             state.affectedFilesPendingEmitKind = undefined;
96790             state.affectedFilesPendingEmitIndex = undefined;
96791         }
96792         return undefined;
96793     }
96794     function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
96795         var _a;
96796         removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
96797         if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
96798             if (!state.cleanedDiagnosticsOfLibFiles) {
96799                 state.cleanedDiagnosticsOfLibFiles = true;
96800                 var program_1 = ts.Debug.checkDefined(state.program);
96801                 var options_2 = program_1.getCompilerOptions();
96802                 ts.forEach(program_1.getSourceFiles(), function (f) {
96803                     return program_1.isSourceFileDefaultLibrary(f) &&
96804                         !ts.skipTypeChecking(f, options_2, program_1) &&
96805                         removeSemanticDiagnosticsOf(state, f.resolvedPath);
96806                 });
96807             }
96808             ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
96809             return;
96810         }
96811         else {
96812             ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: ".concat(affectedFile.fileName));
96813         }
96814         if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
96815             forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
96816         }
96817     }
96818     function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
96819         removeSemanticDiagnosticsOf(state, path);
96820         if (!state.changedFilesSet.has(path)) {
96821             var program = ts.Debug.checkDefined(state.program);
96822             var sourceFile = program.getSourceFileByPath(path);
96823             if (sourceFile) {
96824                 ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, true);
96825                 if (ts.getEmitDeclarations(state.compilerOptions)) {
96826                     addToAffectedFilesPendingEmit(state, path, 0);
96827                 }
96828             }
96829         }
96830     }
96831     function removeSemanticDiagnosticsOf(state, path) {
96832         if (!state.semanticDiagnosticsFromOldState) {
96833             return true;
96834         }
96835         state.semanticDiagnosticsFromOldState.delete(path);
96836         state.semanticDiagnosticsPerFile.delete(path);
96837         return !state.semanticDiagnosticsFromOldState.size;
96838     }
96839     function isChangedSignature(state, path) {
96840         var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
96841         var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
96842         return newSignature !== oldSignature;
96843     }
96844     function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
96845         var _a, _b;
96846         if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) {
96847             return;
96848         }
96849         if (!isChangedSignature(state, affectedFile.resolvedPath))
96850             return;
96851         if (state.compilerOptions.isolatedModules) {
96852             var seenFileNamesMap = new ts.Map();
96853             seenFileNamesMap.set(affectedFile.resolvedPath, true);
96854             var queue = ts.BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
96855             while (queue.length > 0) {
96856                 var currentPath = queue.pop();
96857                 if (!seenFileNamesMap.has(currentPath)) {
96858                     seenFileNamesMap.set(currentPath, true);
96859                     fn(state, currentPath);
96860                     if (isChangedSignature(state, currentPath)) {
96861                         var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
96862                         queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
96863                     }
96864                 }
96865             }
96866         }
96867         ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
96868         var seenFileAndExportsOfFile = new ts.Set();
96869         (_a = state.currentAffectedFilesExportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
96870             return forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
96871         });
96872         (_b = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
96873             var _a;
96874             return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
96875                 !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
96876                 forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
96877         });
96878     }
96879     function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
96880         var _a;
96881         (_a = state.referencedMap.getKeys(referencedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (filePath) {
96882             return forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
96883         });
96884     }
96885     function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
96886         var _a, _b, _c;
96887         if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
96888             return;
96889         }
96890         fn(state, filePath);
96891         ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
96892         (_a = state.currentAffectedFilesExportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
96893             return forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
96894         });
96895         (_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
96896             var _a;
96897             return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
96898                 !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
96899                 forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
96900         });
96901         (_c = state.referencedMap.getKeys(filePath)) === null || _c === void 0 ? void 0 : _c.forEach(function (referencingFilePath) {
96902             return !seenFileAndExportsOfFile.has(referencingFilePath) &&
96903                 fn(state, referencingFilePath);
96904         });
96905     }
96906     function doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit) {
96907         if (isBuildInfoEmit) {
96908             state.buildInfoEmitPending = false;
96909         }
96910         else if (affected === state.program) {
96911             state.changedFilesSet.clear();
96912             state.programEmitComplete = true;
96913         }
96914         else {
96915             state.seenAffectedFiles.add(affected.resolvedPath);
96916             if (emitKind !== undefined) {
96917                 (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
96918             }
96919             if (isPendingEmit) {
96920                 state.affectedFilesPendingEmitIndex++;
96921                 state.buildInfoEmitPending = true;
96922             }
96923             else {
96924                 state.affectedFilesIndex++;
96925             }
96926         }
96927     }
96928     function toAffectedFileResult(state, result, affected) {
96929         doneWithAffectedFile(state, affected);
96930         return { result: result, affected: affected };
96931     }
96932     function toAffectedFileEmitResult(state, result, affected, emitKind, isPendingEmit, isBuildInfoEmit) {
96933         doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit);
96934         return { result: result, affected: affected };
96935     }
96936     function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
96937         return ts.concatenate(getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken), ts.Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile));
96938     }
96939     function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
96940         var path = sourceFile.resolvedPath;
96941         if (state.semanticDiagnosticsPerFile) {
96942             var cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
96943             if (cachedDiagnostics) {
96944                 return ts.filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
96945             }
96946         }
96947         var diagnostics = ts.Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
96948         if (state.semanticDiagnosticsPerFile) {
96949             state.semanticDiagnosticsPerFile.set(path, diagnostics);
96950         }
96951         return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
96952     }
96953     function getProgramBuildInfo(state, getCanonicalFileName) {
96954         if (ts.outFile(state.compilerOptions))
96955             return undefined;
96956         var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
96957         var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
96958         var fileNames = [];
96959         var fileNameToFileId = new ts.Map();
96960         var fileIdsList;
96961         var fileNamesToFileIdListId;
96962         var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
96963             var key = _a[0], value = _a[1];
96964             var fileId = toFileId(key);
96965             ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
96966             var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
96967             var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
96968             return value.version === actualSignature ?
96969                 value.affectsGlobalScope ?
96970                     { version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
96971                     value.version :
96972                 actualSignature !== undefined ?
96973                     signature === undefined ?
96974                         value :
96975                         { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
96976                     { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
96977         });
96978         var referencedMap;
96979         if (state.referencedMap) {
96980             referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { return [
96981                 toFileId(key),
96982                 toFileIdListId(state.referencedMap.getValues(key))
96983             ]; });
96984         }
96985         var exportedModulesMap;
96986         if (state.exportedModulesMap) {
96987             exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
96988                 var _a;
96989                 if (state.currentAffectedFilesExportedModulesMap) {
96990                     if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
96991                         return undefined;
96992                     }
96993                     var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
96994                     if (newValue) {
96995                         return [toFileId(key), toFileIdListId(newValue)];
96996                     }
96997                 }
96998                 return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
96999             });
97000         }
97001         var semanticDiagnosticsPerFile;
97002         if (state.semanticDiagnosticsPerFile) {
97003             for (var _i = 0, _a = ts.arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
97004                 var key = _a[_i];
97005                 var value = state.semanticDiagnosticsPerFile.get(key);
97006                 (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
97007                     [
97008                         toFileId(key),
97009                         state.hasReusableDiagnostic ?
97010                             value :
97011                             convertToReusableDiagnostics(value, relativeToBuildInfo)
97012                     ] :
97013                     toFileId(key));
97014             }
97015         }
97016         var affectedFilesPendingEmit;
97017         if (state.affectedFilesPendingEmit) {
97018             var seenFiles = new ts.Set();
97019             for (var _b = 0, _c = state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(ts.compareStringsCaseSensitive); _b < _c.length; _b++) {
97020                 var path = _c[_b];
97021                 if (ts.tryAddToSet(seenFiles, path)) {
97022                     (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push([toFileId(path), state.affectedFilesPendingEmitKind.get(path)]);
97023                 }
97024             }
97025         }
97026         return {
97027             fileNames: fileNames,
97028             fileInfos: fileInfos,
97029             options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
97030             fileIdsList: fileIdsList,
97031             referencedMap: referencedMap,
97032             exportedModulesMap: exportedModulesMap,
97033             semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
97034             affectedFilesPendingEmit: affectedFilesPendingEmit,
97035         };
97036         function relativeToBuildInfoEnsuringAbsolutePath(path) {
97037             return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
97038         }
97039         function relativeToBuildInfo(path) {
97040             return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
97041         }
97042         function toFileId(path) {
97043             var fileId = fileNameToFileId.get(path);
97044             if (fileId === undefined) {
97045                 fileNames.push(relativeToBuildInfo(path));
97046                 fileNameToFileId.set(path, fileId = fileNames.length);
97047             }
97048             return fileId;
97049         }
97050         function toFileIdListId(set) {
97051             var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
97052             var key = fileIds.join();
97053             var fileIdListId = fileNamesToFileIdListId === null || fileNamesToFileIdListId === void 0 ? void 0 : fileNamesToFileIdListId.get(key);
97054             if (fileIdListId === undefined) {
97055                 (fileIdsList || (fileIdsList = [])).push(fileIds);
97056                 (fileNamesToFileIdListId || (fileNamesToFileIdListId = new ts.Map())).set(key, fileIdListId = fileIdsList.length);
97057             }
97058             return fileIdListId;
97059         }
97060     }
97061     function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
97062         var result;
97063         var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
97064         for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
97065             var name = _a[_i];
97066             var optionKey = name.toLowerCase();
97067             var optionInfo = optionsNameMap.get(optionKey);
97068             if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
97069                 optionKey === "strict" ||
97070                 optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
97071                 (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
97072             }
97073         }
97074         return result;
97075     }
97076     function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
97077         if (option) {
97078             if (option.type === "list") {
97079                 var values = value;
97080                 if (option.element.isFilePath && values.length) {
97081                     return values.map(relativeToBuildInfo);
97082                 }
97083             }
97084             else if (option.isFilePath) {
97085                 return relativeToBuildInfo(value);
97086             }
97087         }
97088         return value;
97089     }
97090     function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
97091         ts.Debug.assert(!!diagnostics.length);
97092         return diagnostics.map(function (diagnostic) {
97093             var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
97094             result.reportsUnnecessary = diagnostic.reportsUnnecessary;
97095             result.reportDeprecated = diagnostic.reportsDeprecated;
97096             result.source = diagnostic.source;
97097             result.skippedOn = diagnostic.skippedOn;
97098             var relatedInformation = diagnostic.relatedInformation;
97099             result.relatedInformation = relatedInformation ?
97100                 relatedInformation.length ?
97101                     relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
97102                     [] :
97103                 undefined;
97104             return result;
97105         });
97106     }
97107     function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
97108         var file = diagnostic.file;
97109         return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
97110     }
97111     var BuilderProgramKind;
97112     (function (BuilderProgramKind) {
97113         BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
97114         BuilderProgramKind[BuilderProgramKind["EmitAndSemanticDiagnosticsBuilderProgram"] = 1] = "EmitAndSemanticDiagnosticsBuilderProgram";
97115     })(BuilderProgramKind = ts.BuilderProgramKind || (ts.BuilderProgramKind = {}));
97116     function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
97117         var host;
97118         var newProgram;
97119         var oldProgram;
97120         if (newProgramOrRootNames === undefined) {
97121             ts.Debug.assert(hostOrOptions === undefined);
97122             host = oldProgramOrHost;
97123             oldProgram = configFileParsingDiagnosticsOrOldProgram;
97124             ts.Debug.assert(!!oldProgram);
97125             newProgram = oldProgram.getProgram();
97126         }
97127         else if (ts.isArray(newProgramOrRootNames)) {
97128             oldProgram = configFileParsingDiagnosticsOrOldProgram;
97129             newProgram = ts.createProgram({
97130                 rootNames: newProgramOrRootNames,
97131                 options: hostOrOptions,
97132                 host: oldProgramOrHost,
97133                 oldProgram: oldProgram && oldProgram.getProgramOrUndefined(),
97134                 configFileParsingDiagnostics: configFileParsingDiagnostics,
97135                 projectReferences: projectReferences
97136             });
97137             host = oldProgramOrHost;
97138         }
97139         else {
97140             newProgram = newProgramOrRootNames;
97141             host = hostOrOptions;
97142             oldProgram = oldProgramOrHost;
97143             configFileParsingDiagnostics = configFileParsingDiagnosticsOrOldProgram;
97144         }
97145         return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
97146     }
97147     ts.getBuilderCreationParameters = getBuilderCreationParameters;
97148     function createBuilderProgram(kind, _a) {
97149         var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
97150         var oldState = oldProgram && oldProgram.getState();
97151         if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) {
97152             newProgram = undefined;
97153             oldState = undefined;
97154             return oldProgram;
97155         }
97156         var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
97157         var computeHash = ts.maybeBind(host, host.createHash);
97158         var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
97159         var backupState;
97160         newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
97161         newProgram = undefined;
97162         oldProgram = undefined;
97163         oldState = undefined;
97164         var getState = function () { return state; };
97165         var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
97166         builderProgram.getState = getState;
97167         builderProgram.backupState = function () {
97168             ts.Debug.assert(backupState === undefined);
97169             backupState = cloneBuilderProgramState(state);
97170         };
97171         builderProgram.restoreState = function () {
97172             state = ts.Debug.checkDefined(backupState);
97173             backupState = undefined;
97174         };
97175         builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
97176         builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
97177         builderProgram.emit = emit;
97178         builderProgram.releaseProgram = function () {
97179             releaseCache(state);
97180             backupState = undefined;
97181         };
97182         if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
97183             builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
97184         }
97185         else if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
97186             builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
97187             builderProgram.emitNextAffectedFile = emitNextAffectedFile;
97188             builderProgram.emitBuildInfo = emitBuildInfo;
97189         }
97190         else {
97191             ts.notImplemented();
97192         }
97193         return builderProgram;
97194         function emitBuildInfo(writeFile, cancellationToken) {
97195             if (state.buildInfoEmitPending) {
97196                 var result = ts.Debug.checkDefined(state.program).emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken);
97197                 state.buildInfoEmitPending = false;
97198                 return result;
97199             }
97200             return ts.emitSkippedWithNoDiagnostics;
97201         }
97202         function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
97203             var affected = getNextAffectedFile(state, cancellationToken, computeHash);
97204             var emitKind = 1;
97205             var isPendingEmitFile = false;
97206             if (!affected) {
97207                 if (!ts.outFile(state.compilerOptions)) {
97208                     var pendingAffectedFile = getNextAffectedFilePendingEmit(state);
97209                     if (!pendingAffectedFile) {
97210                         if (!state.buildInfoEmitPending) {
97211                             return undefined;
97212                         }
97213                         var affected_1 = ts.Debug.checkDefined(state.program);
97214                         return toAffectedFileEmitResult(state, affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, 1, false, true);
97215                     }
97216                     (affected = pendingAffectedFile.affectedFile, emitKind = pendingAffectedFile.emitKind);
97217                     isPendingEmitFile = true;
97218                 }
97219                 else {
97220                     var program = ts.Debug.checkDefined(state.program);
97221                     if (state.programEmitComplete)
97222                         return undefined;
97223                     affected = program;
97224                 }
97225             }
97226             return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
97227         }
97228         function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
97229             var restorePendingEmitOnHandlingNoEmitSuccess = false;
97230             var savedAffectedFilesPendingEmit;
97231             var savedAffectedFilesPendingEmitKind;
97232             var savedAffectedFilesPendingEmitIndex;
97233             if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
97234                 !targetSourceFile &&
97235                 !ts.outFile(state.compilerOptions) &&
97236                 !state.compilerOptions.noEmit &&
97237                 state.compilerOptions.noEmitOnError) {
97238                 restorePendingEmitOnHandlingNoEmitSuccess = true;
97239                 savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
97240                 savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
97241                 savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
97242             }
97243             if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
97244                 assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
97245             }
97246             var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
97247             if (result)
97248                 return result;
97249             if (restorePendingEmitOnHandlingNoEmitSuccess) {
97250                 state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
97251                 state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
97252                 state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
97253             }
97254             if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
97255                 var sourceMaps = [];
97256                 var emitSkipped = false;
97257                 var diagnostics = void 0;
97258                 var emittedFiles = [];
97259                 var affectedEmitResult = void 0;
97260                 while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
97261                     emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
97262                     diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
97263                     emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
97264                     sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
97265                 }
97266                 return {
97267                     emitSkipped: emitSkipped,
97268                     diagnostics: diagnostics || ts.emptyArray,
97269                     emittedFiles: emittedFiles,
97270                     sourceMaps: sourceMaps
97271                 };
97272             }
97273             return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
97274         }
97275         function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
97276             while (true) {
97277                 var affected = getNextAffectedFile(state, cancellationToken, computeHash);
97278                 if (!affected) {
97279                     return undefined;
97280                 }
97281                 else if (affected === state.program) {
97282                     return toAffectedFileResult(state, state.program.getSemanticDiagnostics(undefined, cancellationToken), affected);
97283                 }
97284                 if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram || state.compilerOptions.noEmit || state.compilerOptions.noEmitOnError) {
97285                     addToAffectedFilesPendingEmit(state, affected.resolvedPath, 1);
97286                 }
97287                 if (ignoreSourceFile && ignoreSourceFile(affected)) {
97288                     doneWithAffectedFile(state, affected);
97289                     continue;
97290                 }
97291                 return toAffectedFileResult(state, getSemanticDiagnosticsOfFile(state, affected, cancellationToken), affected);
97292             }
97293         }
97294         function getSemanticDiagnostics(sourceFile, cancellationToken) {
97295             assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
97296             var compilerOptions = ts.Debug.checkDefined(state.program).getCompilerOptions();
97297             if (ts.outFile(compilerOptions)) {
97298                 ts.Debug.assert(!state.semanticDiagnosticsPerFile);
97299                 return ts.Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
97300             }
97301             if (sourceFile) {
97302                 return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
97303             }
97304             while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
97305             }
97306             var diagnostics;
97307             for (var _i = 0, _a = ts.Debug.checkDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
97308                 var sourceFile_1 = _a[_i];
97309                 diagnostics = ts.addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile_1, cancellationToken));
97310             }
97311             return diagnostics || ts.emptyArray;
97312         }
97313     }
97314     ts.createBuilderProgram = createBuilderProgram;
97315     function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
97316         if (!state.affectedFilesPendingEmit)
97317             state.affectedFilesPendingEmit = [];
97318         if (!state.affectedFilesPendingEmitKind)
97319             state.affectedFilesPendingEmitKind = new ts.Map();
97320         var existingKind = state.affectedFilesPendingEmitKind.get(affectedFilePendingEmit);
97321         state.affectedFilesPendingEmit.push(affectedFilePendingEmit);
97322         state.affectedFilesPendingEmitKind.set(affectedFilePendingEmit, existingKind || kind);
97323         if (state.affectedFilesPendingEmitIndex === undefined) {
97324             state.affectedFilesPendingEmitIndex = 0;
97325         }
97326     }
97327     function toBuilderStateFileInfo(fileInfo) {
97328         return ts.isString(fileInfo) ?
97329             { version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined, impliedFormat: undefined } :
97330             ts.isString(fileInfo.signature) ?
97331                 fileInfo :
97332                 { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
97333     }
97334     ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
97335     function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
97336         var _a;
97337         var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
97338         var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
97339         var filePaths = program.fileNames.map(toPath);
97340         var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
97341         var fileInfos = new ts.Map();
97342         program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
97343         var state = {
97344             fileInfos: fileInfos,
97345             compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
97346             referencedMap: toManyToManyPathMap(program.referencedMap),
97347             exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
97348             semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
97349             hasReusableDiagnostic: true,
97350             affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
97351             affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
97352             affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
97353         };
97354         return {
97355             getState: function () { return state; },
97356             backupState: ts.noop,
97357             restoreState: ts.noop,
97358             getProgram: ts.notImplemented,
97359             getProgramOrUndefined: ts.returnUndefined,
97360             releaseProgram: ts.noop,
97361             getCompilerOptions: function () { return state.compilerOptions; },
97362             getSourceFile: ts.notImplemented,
97363             getSourceFiles: ts.notImplemented,
97364             getOptionsDiagnostics: ts.notImplemented,
97365             getGlobalDiagnostics: ts.notImplemented,
97366             getConfigFileParsingDiagnostics: ts.notImplemented,
97367             getSyntacticDiagnostics: ts.notImplemented,
97368             getDeclarationDiagnostics: ts.notImplemented,
97369             getSemanticDiagnostics: ts.notImplemented,
97370             emit: ts.notImplemented,
97371             getAllDependencies: ts.notImplemented,
97372             getCurrentDirectory: ts.notImplemented,
97373             emitNextAffectedFile: ts.notImplemented,
97374             getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
97375             emitBuildInfo: ts.notImplemented,
97376             close: ts.noop,
97377         };
97378         function toPath(path) {
97379             return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
97380         }
97381         function toAbsolutePath(path) {
97382             return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
97383         }
97384         function toFilePath(fileId) {
97385             return filePaths[fileId - 1];
97386         }
97387         function toFilePathsSet(fileIdsListId) {
97388             return filePathsSetList[fileIdsListId - 1];
97389         }
97390         function toManyToManyPathMap(referenceMap) {
97391             if (!referenceMap) {
97392                 return undefined;
97393             }
97394             var map = ts.BuilderState.createManyToManyPathMap();
97395             referenceMap.forEach(function (_a) {
97396                 var fileId = _a[0], fileIdListId = _a[1];
97397                 return map.set(toFilePath(fileId), toFilePathsSet(fileIdListId));
97398             });
97399             return map;
97400         }
97401     }
97402     ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
97403     function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
97404         return {
97405             getState: ts.notImplemented,
97406             backupState: ts.noop,
97407             restoreState: ts.noop,
97408             getProgram: getProgram,
97409             getProgramOrUndefined: function () { return getState().program; },
97410             releaseProgram: function () { return getState().program = undefined; },
97411             getCompilerOptions: function () { return getState().compilerOptions; },
97412             getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
97413             getSourceFiles: function () { return getProgram().getSourceFiles(); },
97414             getOptionsDiagnostics: function (cancellationToken) { return getProgram().getOptionsDiagnostics(cancellationToken); },
97415             getGlobalDiagnostics: function (cancellationToken) { return getProgram().getGlobalDiagnostics(cancellationToken); },
97416             getConfigFileParsingDiagnostics: function () { return configFileParsingDiagnostics; },
97417             getSyntacticDiagnostics: function (sourceFile, cancellationToken) { return getProgram().getSyntacticDiagnostics(sourceFile, cancellationToken); },
97418             getDeclarationDiagnostics: function (sourceFile, cancellationToken) { return getProgram().getDeclarationDiagnostics(sourceFile, cancellationToken); },
97419             getSemanticDiagnostics: function (sourceFile, cancellationToken) { return getProgram().getSemanticDiagnostics(sourceFile, cancellationToken); },
97420             emit: function (sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers) { return getProgram().emit(sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers); },
97421             emitBuildInfo: function (writeFile, cancellationToken) { return getProgram().emitBuildInfo(writeFile, cancellationToken); },
97422             getAllDependencies: ts.notImplemented,
97423             getCurrentDirectory: function () { return getProgram().getCurrentDirectory(); },
97424             close: ts.noop,
97425         };
97426         function getProgram() {
97427             return ts.Debug.checkDefined(getState().program);
97428         }
97429     }
97430     ts.createRedirectedBuilderProgram = createRedirectedBuilderProgram;
97431 })(ts || (ts = {}));
97432 var ts;
97433 (function (ts) {
97434     function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
97435         return ts.createBuilderProgram(ts.BuilderProgramKind.SemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
97436     }
97437     ts.createSemanticDiagnosticsBuilderProgram = createSemanticDiagnosticsBuilderProgram;
97438     function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
97439         return ts.createBuilderProgram(ts.BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
97440     }
97441     ts.createEmitAndSemanticDiagnosticsBuilderProgram = createEmitAndSemanticDiagnosticsBuilderProgram;
97442     function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
97443         var _a = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences), newProgram = _a.newProgram, newConfigFileParsingDiagnostics = _a.configFileParsingDiagnostics;
97444         return ts.createRedirectedBuilderProgram(function () { return ({ program: newProgram, compilerOptions: newProgram.getCompilerOptions() }); }, newConfigFileParsingDiagnostics);
97445     }
97446     ts.createAbstractBuilder = createAbstractBuilder;
97447 })(ts || (ts = {}));
97448 var ts;
97449 (function (ts) {
97450     function removeIgnoredPath(path) {
97451         if (ts.endsWith(path, "/node_modules/.staging")) {
97452             return ts.removeSuffix(path, "/.staging");
97453         }
97454         return ts.some(ts.ignoredPaths, function (searchPath) { return ts.stringContains(path, searchPath); }) ?
97455             undefined :
97456             path;
97457     }
97458     ts.removeIgnoredPath = removeIgnoredPath;
97459     function canWatchDirectory(dirPath) {
97460         var rootLength = ts.getRootLength(dirPath);
97461         if (dirPath.length === rootLength) {
97462             return false;
97463         }
97464         var nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, rootLength);
97465         if (nextDirectorySeparator === -1) {
97466             return false;
97467         }
97468         var pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
97469         var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47;
97470         if (isNonDirectorySeparatorRoot &&
97471             dirPath.search(/[a-zA-Z]:/) !== 0 &&
97472             pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) {
97473             nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
97474             if (nextDirectorySeparator === -1) {
97475                 return false;
97476             }
97477             pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
97478         }
97479         if (isNonDirectorySeparatorRoot &&
97480             pathPartForUserCheck.search(/users\//i) !== 0) {
97481             return true;
97482         }
97483         for (var searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
97484             searchIndex = dirPath.indexOf(ts.directorySeparator, searchIndex) + 1;
97485             if (searchIndex === 0) {
97486                 return false;
97487             }
97488         }
97489         return true;
97490     }
97491     ts.canWatchDirectory = canWatchDirectory;
97492     function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
97493         var filesWithChangedSetOfUnresolvedImports;
97494         var filesWithInvalidatedResolutions;
97495         var filesWithInvalidatedNonRelativeUnresolvedImports;
97496         var nonRelativeExternalModuleResolutions = ts.createMultiMap();
97497         var resolutionsWithFailedLookups = [];
97498         var resolvedFileToResolution = ts.createMultiMap();
97499         var hasChangedAutomaticTypeDirectiveNames = false;
97500         var failedLookupChecks;
97501         var startsWithPathChecks;
97502         var isInDirectoryChecks;
97503         var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); });
97504         var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
97505         var resolvedModuleNames = new ts.Map();
97506         var perDirectoryResolvedModuleNames = ts.createCacheWithRedirects();
97507         var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
97508         var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
97509         var resolvedTypeReferenceDirectives = new ts.Map();
97510         var perDirectoryResolvedTypeReferenceDirectives = ts.createCacheWithRedirects();
97511         var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
97512         var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
97513         var customFailedLookupPaths = new ts.Map();
97514         var directoryWatchesOfFailedLookups = new ts.Map();
97515         var rootDir = rootDirForResolution && ts.removeTrailingDirectorySeparator(ts.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
97516         var rootPath = (rootDir && resolutionHost.toPath(rootDir));
97517         var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
97518         var typeRootsWatches = new ts.Map();
97519         return {
97520             getModuleResolutionCache: function () { return moduleResolutionCache; },
97521             startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
97522             finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
97523             startCachingPerDirectoryResolution: clearPerDirectoryResolutions,
97524             finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
97525             resolveModuleNames: resolveModuleNames,
97526             getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
97527             resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
97528             removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
97529             removeResolutionsOfFile: removeResolutionsOfFile,
97530             hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
97531             invalidateResolutionOfFile: invalidateResolutionOfFile,
97532             invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
97533             setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
97534             createHasInvalidatedResolution: createHasInvalidatedResolution,
97535             isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
97536             updateTypeRootsWatch: updateTypeRootsWatch,
97537             closeTypeRootsWatch: closeTypeRootsWatch,
97538             clear: clear
97539         };
97540         function getResolvedModule(resolution) {
97541             return resolution.resolvedModule;
97542         }
97543         function getResolvedTypeReferenceDirective(resolution) {
97544             return resolution.resolvedTypeReferenceDirective;
97545         }
97546         function isInDirectoryPath(dir, file) {
97547             if (dir === undefined || file.length <= dir.length) {
97548                 return false;
97549             }
97550             return ts.startsWith(file, dir) && file[dir.length] === ts.directorySeparator;
97551         }
97552         function clear() {
97553             ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
97554             customFailedLookupPaths.clear();
97555             nonRelativeExternalModuleResolutions.clear();
97556             closeTypeRootsWatch();
97557             resolvedModuleNames.clear();
97558             resolvedTypeReferenceDirectives.clear();
97559             resolvedFileToResolution.clear();
97560             resolutionsWithFailedLookups.length = 0;
97561             failedLookupChecks = undefined;
97562             startsWithPathChecks = undefined;
97563             isInDirectoryChecks = undefined;
97564             clearPerDirectoryResolutions();
97565             hasChangedAutomaticTypeDirectiveNames = false;
97566         }
97567         function startRecordingFilesWithChangedResolutions() {
97568             filesWithChangedSetOfUnresolvedImports = [];
97569         }
97570         function finishRecordingFilesWithChangedResolutions() {
97571             var collected = filesWithChangedSetOfUnresolvedImports;
97572             filesWithChangedSetOfUnresolvedImports = undefined;
97573             return collected;
97574         }
97575         function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
97576             if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
97577                 return false;
97578             }
97579             var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
97580             return !!value && !!value.length;
97581         }
97582         function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
97583             invalidateResolutionsOfFailedLookupLocations();
97584             if (forceAllFilesAsInvalidated) {
97585                 filesWithInvalidatedResolutions = undefined;
97586                 return ts.returnTrue;
97587             }
97588             var collected = filesWithInvalidatedResolutions;
97589             filesWithInvalidatedResolutions = undefined;
97590             return function (path) { return (!!collected && collected.has(path)) ||
97591                 isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
97592         }
97593         function clearPerDirectoryResolutions() {
97594             moduleResolutionCache.clear();
97595             typeReferenceDirectiveResolutionCache.clear();
97596             nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
97597             nonRelativeExternalModuleResolutions.clear();
97598         }
97599         function finishCachingPerDirectoryResolution() {
97600             filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
97601             clearPerDirectoryResolutions();
97602             directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
97603                 if (watcher.refCount === 0) {
97604                     directoryWatchesOfFailedLookups.delete(path);
97605                     watcher.watcher.close();
97606                 }
97607             });
97608             hasChangedAutomaticTypeDirectiveNames = false;
97609         }
97610         function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference) {
97611             var _a;
97612             var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference);
97613             if (!resolutionHost.getGlobalCache) {
97614                 return primaryResult;
97615             }
97616             var globalCache = resolutionHost.getGlobalCache();
97617             if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
97618                 var _b = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _b.resolvedModule, failedLookupLocations = _b.failedLookupLocations;
97619                 if (resolvedModule) {
97620                     primaryResult.resolvedModule = resolvedModule;
97621                     (_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
97622                     return primaryResult;
97623                 }
97624             }
97625             return primaryResult;
97626         }
97627         function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference) {
97628             return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache);
97629         }
97630         function resolveNamesWithLocalCache(_a) {
97631             var _b, _c, _d;
97632             var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile;
97633             var path = resolutionHost.toPath(containingFile);
97634             var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
97635             var dirPath = ts.getDirectoryPath(path);
97636             var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
97637             var perDirectoryResolution = perDirectoryCache.get(dirPath);
97638             if (!perDirectoryResolution) {
97639                 perDirectoryResolution = ts.createModeAwareCache();
97640                 perDirectoryCache.set(dirPath, perDirectoryResolution);
97641             }
97642             var resolvedModules = [];
97643             var compilerOptions = resolutionHost.getCompilationSettings();
97644             var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
97645             var program = resolutionHost.getCurrentProgram();
97646             var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
97647             var unmatchedRedirects = oldRedirect ?
97648                 !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
97649                 !!redirectedReference;
97650             var seenNamesInFile = ts.createModeAwareCache();
97651             var i = 0;
97652             for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
97653                 var name = names_4[_i];
97654                 var mode = containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
97655                 i++;
97656                 var resolution = resolutionsInFile.get(name, mode);
97657                 if (!seenNamesInFile.has(name, mode) &&
97658                     unmatchedRedirects || !resolution || resolution.isInvalidated ||
97659                     (hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
97660                     var existingResolution = resolution;
97661                     var resolutionInDirectory = perDirectoryResolution.get(name, mode);
97662                     if (resolutionInDirectory) {
97663                         resolution = resolutionInDirectory;
97664                         var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
97665                         if (ts.isTraceEnabled(compilerOptions, host)) {
97666                             var resolved = getResolutionWithResolvedFileName(resolution);
97667                             ts.trace(host, loader === resolveModuleName ?
97668                                 (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
97669                                     resolved.packagetId ?
97670                                         ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
97671                                         ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
97672                                     ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
97673                                 (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
97674                                     resolved.packagetId ?
97675                                         ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
97676                                         ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
97677                                     ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved, name, containingFile, ts.getDirectoryPath(containingFile), resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts.packageIdToString(resolved.packagetId));
97678                         }
97679                     }
97680                     else {
97681                         resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
97682                         perDirectoryResolution.set(name, mode, resolution);
97683                         if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
97684                             resolutionHost.onDiscoveredSymlink();
97685                         }
97686                     }
97687                     resolutionsInFile.set(name, mode, resolution);
97688                     watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
97689                     if (existingResolution) {
97690                         stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
97691                     }
97692                     if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
97693                         filesWithChangedSetOfUnresolvedImports.push(path);
97694                         logChanges = false;
97695                     }
97696                 }
97697                 else {
97698                     var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost;
97699                     if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) {
97700                         var resolved = getResolutionWithResolvedFileName(resolution);
97701                         ts.trace(host, loader === resolveModuleName ?
97702                             (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
97703                                 resolved.packagetId ?
97704                                     ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
97705                                     ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
97706                                 ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
97707                             (resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
97708                                 resolved.packagetId ?
97709                                     ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
97710                                     ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
97711                                 ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts.packageIdToString(resolved.packagetId));
97712                     }
97713                 }
97714                 ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
97715                 seenNamesInFile.set(name, mode, true);
97716                 resolvedModules.push(getResolutionWithResolvedFileName(resolution));
97717             }
97718             resolutionsInFile.forEach(function (resolution, name, mode) {
97719                 if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
97720                     stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
97721                     resolutionsInFile.delete(name, mode);
97722                 }
97723             });
97724             return resolvedModules;
97725             function resolutionIsEqualTo(oldResolution, newResolution) {
97726                 if (oldResolution === newResolution) {
97727                     return true;
97728                 }
97729                 if (!oldResolution || !newResolution) {
97730                     return false;
97731                 }
97732                 var oldResult = getResolutionWithResolvedFileName(oldResolution);
97733                 var newResult = getResolutionWithResolvedFileName(newResolution);
97734                 if (oldResult === newResult) {
97735                     return true;
97736                 }
97737                 if (!oldResult || !newResult) {
97738                     return false;
97739                 }
97740                 return oldResult.resolvedFileName === newResult.resolvedFileName;
97741             }
97742         }
97743         function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference) {
97744             return resolveNamesWithLocalCache({
97745                 names: typeDirectiveNames,
97746                 containingFile: containingFile,
97747                 redirectedReference: redirectedReference,
97748                 cache: resolvedTypeReferenceDirectives,
97749                 perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
97750                 loader: resolveTypeReferenceDirective,
97751                 getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
97752                 shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
97753             });
97754         }
97755         function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
97756             return resolveNamesWithLocalCache({
97757                 names: moduleNames,
97758                 containingFile: containingFile,
97759                 redirectedReference: redirectedReference,
97760                 cache: resolvedModuleNames,
97761                 perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
97762                 loader: resolveModuleName,
97763                 getResolutionWithResolvedFileName: getResolvedModule,
97764                 shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
97765                 reusedNames: reusedNames,
97766                 logChanges: logChangesWhenResolvingModule,
97767                 containingSourceFile: containingSourceFile,
97768             });
97769         }
97770         function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
97771             var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
97772             if (!cache)
97773                 return undefined;
97774             return cache.get(moduleName, resolutionMode);
97775         }
97776         function isNodeModulesAtTypesDirectory(dirPath) {
97777             return ts.endsWith(dirPath, "/node_modules/@types");
97778         }
97779         function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) {
97780             if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
97781                 failedLookupLocation = ts.isRootedDiskPath(failedLookupLocation) ? ts.normalizePath(failedLookupLocation) : ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
97782                 var failedLookupPathSplit = failedLookupLocationPath.split(ts.directorySeparator);
97783                 var failedLookupSplit = failedLookupLocation.split(ts.directorySeparator);
97784                 ts.Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, "FailedLookup: ".concat(failedLookupLocation, " failedLookupLocationPath: ").concat(failedLookupLocationPath));
97785                 if (failedLookupPathSplit.length > rootSplitLength + 1) {
97786                     return {
97787                         dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(ts.directorySeparator),
97788                         dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(ts.directorySeparator)
97789                     };
97790                 }
97791                 else {
97792                     return {
97793                         dir: rootDir,
97794                         dirPath: rootPath,
97795                         nonRecursive: false
97796                     };
97797                 }
97798             }
97799             return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
97800         }
97801         function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
97802             while (ts.pathContainsNodeModules(dirPath)) {
97803                 dir = ts.getDirectoryPath(dir);
97804                 dirPath = ts.getDirectoryPath(dirPath);
97805             }
97806             if (ts.isNodeModulesDirectory(dirPath)) {
97807                 return canWatchDirectory(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
97808             }
97809             var nonRecursive = true;
97810             var subDirectoryPath, subDirectory;
97811             if (rootPath !== undefined) {
97812                 while (!isInDirectoryPath(dirPath, rootPath)) {
97813                     var parentPath = ts.getDirectoryPath(dirPath);
97814                     if (parentPath === dirPath) {
97815                         break;
97816                     }
97817                     nonRecursive = false;
97818                     subDirectoryPath = dirPath;
97819                     subDirectory = dir;
97820                     dirPath = parentPath;
97821                     dir = ts.getDirectoryPath(dir);
97822                 }
97823             }
97824             return canWatchDirectory(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
97825         }
97826         function isPathWithDefaultFailedLookupExtension(path) {
97827             return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
97828         }
97829         function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
97830             if (resolution.refCount) {
97831                 resolution.refCount++;
97832                 ts.Debug.assertDefined(resolution.files);
97833             }
97834             else {
97835                 resolution.refCount = 1;
97836                 ts.Debug.assert(ts.length(resolution.files) === 0);
97837                 if (ts.isExternalModuleNameRelative(name)) {
97838                     watchFailedLookupLocationOfResolution(resolution);
97839                 }
97840                 else {
97841                     nonRelativeExternalModuleResolutions.add(name, resolution);
97842                 }
97843                 var resolved = getResolutionWithResolvedFileName(resolution);
97844                 if (resolved && resolved.resolvedFileName) {
97845                     resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
97846                 }
97847             }
97848             (resolution.files || (resolution.files = [])).push(filePath);
97849         }
97850         function watchFailedLookupLocationOfResolution(resolution) {
97851             ts.Debug.assert(!!resolution.refCount);
97852             var failedLookupLocations = resolution.failedLookupLocations;
97853             if (!failedLookupLocations.length)
97854                 return;
97855             resolutionsWithFailedLookups.push(resolution);
97856             var setAtRoot = false;
97857             for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
97858                 var failedLookupLocation = failedLookupLocations_1[_i];
97859                 var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
97860                 var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
97861                 if (toWatch) {
97862                     var dir = toWatch.dir, dirPath = toWatch.dirPath, nonRecursive = toWatch.nonRecursive;
97863                     if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
97864                         var refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
97865                         customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
97866                     }
97867                     if (dirPath === rootPath) {
97868                         ts.Debug.assert(!nonRecursive);
97869                         setAtRoot = true;
97870                     }
97871                     else {
97872                         setDirectoryWatcher(dir, dirPath, nonRecursive);
97873                     }
97874                 }
97875             }
97876             if (setAtRoot) {
97877                 setDirectoryWatcher(rootDir, rootPath, true);
97878             }
97879         }
97880         function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
97881             var program = resolutionHost.getCurrentProgram();
97882             if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
97883                 resolutions.forEach(watchFailedLookupLocationOfResolution);
97884             }
97885         }
97886         function setDirectoryWatcher(dir, dirPath, nonRecursive) {
97887             var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
97888             if (dirWatcher) {
97889                 ts.Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
97890                 dirWatcher.refCount++;
97891             }
97892             else {
97893                 directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
97894             }
97895         }
97896         function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
97897             ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
97898             resolution.refCount--;
97899             if (resolution.refCount) {
97900                 return;
97901             }
97902             var resolved = getResolutionWithResolvedFileName(resolution);
97903             if (resolved && resolved.resolvedFileName) {
97904                 resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
97905             }
97906             if (!ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
97907                 return;
97908             }
97909             var failedLookupLocations = resolution.failedLookupLocations;
97910             var removeAtRoot = false;
97911             for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
97912                 var failedLookupLocation = failedLookupLocations_2[_i];
97913                 var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
97914                 var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
97915                 if (toWatch) {
97916                     var dirPath = toWatch.dirPath;
97917                     var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
97918                     if (refCount) {
97919                         if (refCount === 1) {
97920                             customFailedLookupPaths.delete(failedLookupLocationPath);
97921                         }
97922                         else {
97923                             ts.Debug.assert(refCount > 1);
97924                             customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
97925                         }
97926                     }
97927                     if (dirPath === rootPath) {
97928                         removeAtRoot = true;
97929                     }
97930                     else {
97931                         removeDirectoryWatcher(dirPath);
97932                     }
97933                 }
97934             }
97935             if (removeAtRoot) {
97936                 removeDirectoryWatcher(rootPath);
97937             }
97938         }
97939         function removeDirectoryWatcher(dirPath) {
97940             var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
97941             dirWatcher.refCount--;
97942         }
97943         function createDirectoryWatcher(directory, dirPath, nonRecursive) {
97944             return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
97945                 var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
97946                 if (cachedDirectoryStructureHost) {
97947                     cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
97948                 }
97949                 scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
97950             }, nonRecursive ? 0 : 1);
97951         }
97952         function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
97953             var resolutions = cache.get(filePath);
97954             if (resolutions) {
97955                 resolutions.forEach(function (resolution) { return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); });
97956                 cache.delete(filePath);
97957             }
97958         }
97959         function removeResolutionsFromProjectReferenceRedirects(filePath) {
97960             if (!ts.fileExtensionIs(filePath, ".json"))
97961                 return;
97962             var program = resolutionHost.getCurrentProgram();
97963             if (!program)
97964                 return;
97965             var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
97966             if (!resolvedProjectReference)
97967                 return;
97968             resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
97969         }
97970         function removeResolutionsOfFile(filePath) {
97971             removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
97972             removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
97973         }
97974         function invalidateResolutions(resolutions, canInvalidate) {
97975             if (!resolutions)
97976                 return false;
97977             var invalidated = false;
97978             for (var _i = 0, resolutions_1 = resolutions; _i < resolutions_1.length; _i++) {
97979                 var resolution = resolutions_1[_i];
97980                 if (resolution.isInvalidated || !canInvalidate(resolution))
97981                     continue;
97982                 resolution.isInvalidated = invalidated = true;
97983                 for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
97984                     var containingFilePath = _b[_a];
97985                     (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
97986                     hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
97987                 }
97988             }
97989             return invalidated;
97990         }
97991         function invalidateResolutionOfFile(filePath) {
97992             removeResolutionsOfFile(filePath);
97993             var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
97994             if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
97995                 hasChangedAutomaticTypeDirectiveNames &&
97996                 !prevHasChangedAutomaticTypeDirectiveNames) {
97997                 resolutionHost.onChangedAutomaticTypeDirectiveNames();
97998             }
97999         }
98000         function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
98001             ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
98002             filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
98003         }
98004         function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
98005             if (isCreatingWatchedDirectory) {
98006                 (isInDirectoryChecks || (isInDirectoryChecks = [])).push(fileOrDirectoryPath);
98007             }
98008             else {
98009                 var updatedPath = removeIgnoredPath(fileOrDirectoryPath);
98010                 if (!updatedPath)
98011                     return false;
98012                 fileOrDirectoryPath = updatedPath;
98013                 if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) {
98014                     return false;
98015                 }
98016                 var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath);
98017                 if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || ts.isNodeModulesDirectory(fileOrDirectoryPath) ||
98018                     isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || ts.isNodeModulesDirectory(dirOfFileOrDirectory)) {
98019                     (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
98020                     (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(fileOrDirectoryPath);
98021                 }
98022                 else {
98023                     if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
98024                         return false;
98025                     }
98026                     if (ts.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
98027                         return false;
98028                     }
98029                     (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
98030                     var packagePath = ts.parseNodeModuleFromPath(fileOrDirectoryPath);
98031                     if (packagePath)
98032                         (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(packagePath);
98033                 }
98034             }
98035             resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
98036         }
98037         function invalidateResolutionsOfFailedLookupLocations() {
98038             if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) {
98039                 return false;
98040             }
98041             var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
98042             failedLookupChecks = undefined;
98043             startsWithPathChecks = undefined;
98044             isInDirectoryChecks = undefined;
98045             return invalidated;
98046         }
98047         function canInvalidateFailedLookupResolution(resolution) {
98048             return resolution.failedLookupLocations.some(function (location) {
98049                 var locationPath = resolutionHost.toPath(location);
98050                 return ts.contains(failedLookupChecks, locationPath) ||
98051                     ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
98052                     (isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.some(function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath); }));
98053             });
98054         }
98055         function closeTypeRootsWatch() {
98056             ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
98057         }
98058         function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
98059             if (isInDirectoryPath(rootPath, typeRootPath)) {
98060                 return rootPath;
98061             }
98062             var toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath);
98063             return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : undefined;
98064         }
98065         function createTypeRootsWatch(typeRootPath, typeRoot) {
98066             return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
98067                 var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
98068                 if (cachedDirectoryStructureHost) {
98069                     cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
98070                 }
98071                 hasChangedAutomaticTypeDirectiveNames = true;
98072                 resolutionHost.onChangedAutomaticTypeDirectiveNames();
98073                 var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
98074                 if (dirPath) {
98075                     scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
98076                 }
98077             }, 1);
98078         }
98079         function updateTypeRootsWatch() {
98080             var options = resolutionHost.getCompilationSettings();
98081             if (options.types) {
98082                 closeTypeRootsWatch();
98083                 return;
98084             }
98085             var typeRoots = ts.getEffectiveTypeRoots(options, { directoryExists: directoryExistsForTypeRootWatch, getCurrentDirectory: getCurrentDirectory });
98086             if (typeRoots) {
98087                 ts.mutateMap(typeRootsWatches, ts.arrayToMap(typeRoots, function (tr) { return resolutionHost.toPath(tr); }), {
98088                     createNewValue: createTypeRootsWatch,
98089                     onDeleteValue: ts.closeFileWatcher
98090                 });
98091             }
98092             else {
98093                 closeTypeRootsWatch();
98094             }
98095         }
98096         function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
98097             var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
98098             var dirPath = resolutionHost.toPath(dir);
98099             return dirPath === rootPath || canWatchDirectory(dirPath);
98100         }
98101     }
98102     ts.createResolutionCache = createResolutionCache;
98103     function resolutionIsSymlink(resolution) {
98104         var _a, _b;
98105         return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
98106             ((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
98107     }
98108 })(ts || (ts = {}));
98109 var ts;
98110 (function (ts) {
98111     var moduleSpecifiers;
98112     (function (moduleSpecifiers_1) {
98113         function getPreferences(host, _a, compilerOptions, importingSourceFile) {
98114             var importModuleSpecifierPreference = _a.importModuleSpecifierPreference, importModuleSpecifierEnding = _a.importModuleSpecifierEnding;
98115             return {
98116                 relativePreference: importModuleSpecifierPreference === "relative" ? 0 :
98117                     importModuleSpecifierPreference === "non-relative" ? 1 :
98118                         importModuleSpecifierPreference === "project-relative" ? 3 :
98119                             2,
98120                 ending: getEnding(),
98121             };
98122             function getEnding() {
98123                 switch (importModuleSpecifierEnding) {
98124                     case "minimal": return 0;
98125                     case "index": return 1;
98126                     case "js": return 2;
98127                     default: return usesJsExtensionOnImports(importingSourceFile) || isFormatRequiringExtensions(compilerOptions, importingSourceFile.path, host) ? 2
98128                         : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 : 0;
98129                 }
98130             }
98131         }
98132         function getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host) {
98133             return {
98134                 relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 : 1,
98135                 ending: ts.hasJSFileExtension(oldImportSpecifier) || isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) ?
98136                     2 :
98137                     ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 : 0,
98138             };
98139         }
98140         function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
98141             if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
98142                 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
98143                 return false;
98144             }
98145             return ts.getImpliedNodeFormatForFile(importingSourceFileName, undefined, getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
98146         }
98147         function getModuleResolutionHost(host) {
98148             var _a;
98149             return {
98150                 fileExists: host.fileExists,
98151                 readFile: ts.Debug.checkDefined(host.readFile),
98152                 directoryExists: host.directoryExists,
98153                 getCurrentDirectory: host.getCurrentDirectory,
98154                 realpath: host.realpath,
98155                 useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host),
98156             };
98157         }
98158         function updateModuleSpecifier(compilerOptions, importingSourceFileName, toFileName, host, oldImportSpecifier) {
98159             var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
98160             if (res === oldImportSpecifier)
98161                 return undefined;
98162             return res;
98163         }
98164         moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier;
98165         function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host) {
98166             return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
98167         }
98168         moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier;
98169         function getNodeModulesPackageName(compilerOptions, importingSourceFileName, nodeModulesFileName, host, preferences) {
98170             var info = getInfo(importingSourceFileName, host);
98171             var modulePaths = getAllModulePaths(importingSourceFileName, nodeModulesFileName, host, preferences);
98172             return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions, true); });
98173         }
98174         moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
98175         function getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, preferences, userPreferences) {
98176             var info = getInfo(importingSourceFileName, host);
98177             var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences);
98178             return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions); }) ||
98179                 getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
98180         }
98181         function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences) {
98182             return tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences)[0];
98183         }
98184         moduleSpecifiers_1.tryGetModuleSpecifiersFromCache = tryGetModuleSpecifiersFromCache;
98185         function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences) {
98186             var _a;
98187             var moduleSourceFile = ts.getSourceFileOfModule(moduleSymbol);
98188             if (!moduleSourceFile) {
98189                 return ts.emptyArray;
98190             }
98191             var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host);
98192             var cached = cache === null || cache === void 0 ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences);
98193             return [cached === null || cached === void 0 ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached === null || cached === void 0 ? void 0 : cached.modulePaths, cache];
98194         }
98195         function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences) {
98196             return getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences).moduleSpecifiers;
98197         }
98198         moduleSpecifiers_1.getModuleSpecifiers = getModuleSpecifiers;
98199         function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences) {
98200             var computedWithoutCache = false;
98201             var ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
98202             if (ambient)
98203                 return { moduleSpecifiers: [ambient], computedWithoutCache: computedWithoutCache };
98204             var _a = tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences), specifiers = _a[0], moduleSourceFile = _a[1], modulePaths = _a[2], cache = _a[3];
98205             if (specifiers)
98206                 return { moduleSpecifiers: specifiers, computedWithoutCache: computedWithoutCache };
98207             if (!moduleSourceFile)
98208                 return { moduleSpecifiers: ts.emptyArray, computedWithoutCache: computedWithoutCache };
98209             computedWithoutCache = true;
98210             modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
98211             var result = computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences);
98212             cache === null || cache === void 0 ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, modulePaths, result);
98213             return { moduleSpecifiers: result, computedWithoutCache: computedWithoutCache };
98214         }
98215         moduleSpecifiers_1.getModuleSpecifiersWithCacheInfo = getModuleSpecifiersWithCacheInfo;
98216         function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences) {
98217             var info = getInfo(importingSourceFile.path, host);
98218             var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile);
98219             var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) {
98220                 if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path)
98221                     return undefined;
98222                 var specifier = ts.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
98223                 return preferences.relativePreference !== 1 || !ts.pathIsRelative(specifier) ?
98224                     specifier :
98225                     undefined;
98226             }); });
98227             if (existingSpecifier) {
98228                 var moduleSpecifiers_2 = [existingSpecifier];
98229                 return moduleSpecifiers_2;
98230             }
98231             var importedFileIsInNodeModules = ts.some(modulePaths, function (p) { return p.isInNodeModules; });
98232             var nodeModulesSpecifiers;
98233             var pathsSpecifiers;
98234             var relativeSpecifiers;
98235             for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
98236                 var modulePath = modulePaths_1[_i];
98237                 var specifier = tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions);
98238                 nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
98239                 if (specifier && modulePath.isRedirect) {
98240                     return nodeModulesSpecifiers;
98241                 }
98242                 if (!specifier && !modulePath.isRedirect) {
98243                     var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, preferences);
98244                     if (ts.pathIsBareSpecifier(local)) {
98245                         pathsSpecifiers = ts.append(pathsSpecifiers, local);
98246                     }
98247                     else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
98248                         relativeSpecifiers = ts.append(relativeSpecifiers, local);
98249                     }
98250                 }
98251             }
98252             return (pathsSpecifiers === null || pathsSpecifiers === void 0 ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers :
98253                 (nodeModulesSpecifiers === null || nodeModulesSpecifiers === void 0 ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers :
98254                     ts.Debug.checkDefined(relativeSpecifiers);
98255         }
98256         function getInfo(importingSourceFileName, host) {
98257             var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
98258             var sourceDirectory = ts.getDirectoryPath(importingSourceFileName);
98259             return { getCanonicalFileName: getCanonicalFileName, importingSourceFileName: importingSourceFileName, sourceDirectory: sourceDirectory };
98260         }
98261         function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, _a) {
98262             var ending = _a.ending, relativePreference = _a.relativePreference;
98263             var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
98264             var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName;
98265             var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
98266                 removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
98267             if (!baseUrl && !paths || relativePreference === 0) {
98268                 return relativePath;
98269             }
98270             var baseDirectory = ts.getNormalizedAbsolutePath(ts.getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
98271             var relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseDirectory, getCanonicalFileName);
98272             if (!relativeToBaseUrl) {
98273                 return relativePath;
98274             }
98275             var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
98276             var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
98277             var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
98278             if (!nonRelative) {
98279                 return relativePath;
98280             }
98281             if (relativePreference === 1) {
98282                 return nonRelative;
98283             }
98284             if (relativePreference === 3) {
98285                 var projectDirectory = compilerOptions.configFilePath ?
98286                     ts.toPath(ts.getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) :
98287                     info.getCanonicalFileName(host.getCurrentDirectory());
98288                 var modulePath = ts.toPath(moduleFileName, projectDirectory, getCanonicalFileName);
98289                 var sourceIsInternal = ts.startsWith(sourceDirectory, projectDirectory);
98290                 var targetIsInternal = ts.startsWith(modulePath, projectDirectory);
98291                 if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
98292                     return nonRelative;
98293                 }
98294                 var nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, ts.getDirectoryPath(modulePath));
98295                 var nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
98296                 if (nearestSourcePackageJson !== nearestTargetPackageJson) {
98297                     return nonRelative;
98298                 }
98299                 return relativePath;
98300             }
98301             if (relativePreference !== 2)
98302                 ts.Debug.assertNever(relativePreference);
98303             return isPathRelativeToParent(nonRelative) || countPathComponents(relativePath) < countPathComponents(nonRelative) ? relativePath : nonRelative;
98304         }
98305         function countPathComponents(path) {
98306             var count = 0;
98307             for (var i = ts.startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
98308                 if (path.charCodeAt(i) === 47)
98309                     count++;
98310             }
98311             return count;
98312         }
98313         moduleSpecifiers_1.countPathComponents = countPathComponents;
98314         function usesJsExtensionOnImports(_a) {
98315             var imports = _a.imports;
98316             return ts.firstDefined(imports, function (_a) {
98317                 var text = _a.text;
98318                 return ts.pathIsRelative(text) ? ts.hasJSFileExtension(text) : undefined;
98319             }) || false;
98320         }
98321         function comparePathsByRedirectAndNumberOfDirectorySeparators(a, b) {
98322             return ts.compareBooleans(b.isRedirect, a.isRedirect) || ts.compareNumberOfDirectorySeparators(a.path, b.path);
98323         }
98324         function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
98325             if (host.getNearestAncestorDirectoryWithPackageJson) {
98326                 return host.getNearestAncestorDirectoryWithPackageJson(fileName);
98327             }
98328             return !!ts.forEachAncestorDirectory(fileName, function (directory) {
98329                 return host.fileExists(ts.combinePaths(directory, "package.json")) ? true : undefined;
98330             });
98331         }
98332         function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
98333             var _a;
98334             var getCanonicalFileName = ts.hostGetCanonicalFileName(host);
98335             var cwd = host.getCurrentDirectory();
98336             var referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.getProjectReferenceRedirect(importedFileName) : undefined;
98337             var importedPath = ts.toPath(importedFileName, cwd, getCanonicalFileName);
98338             var redirects = host.redirectTargetsMap.get(importedPath) || ts.emptyArray;
98339             var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], (referenceRedirect ? [referenceRedirect] : ts.emptyArray), true), [importedFileName], false), redirects, true);
98340             var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
98341             var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
98342             if (!preferSymlinks) {
98343                 var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
98344                 if (result_14)
98345                     return result_14;
98346             }
98347             var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
98348             var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
98349             var result = symlinkedDirectories && ts.forEachAncestorDirectory(ts.getDirectoryPath(fullImportedFileName), function (realPathDirectory) {
98350                 var symlinkDirectories = symlinkedDirectories.get(ts.ensureTrailingDirectorySeparator(ts.toPath(realPathDirectory, cwd, getCanonicalFileName)));
98351                 if (!symlinkDirectories)
98352                     return undefined;
98353                 if (ts.startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) {
98354                     return false;
98355                 }
98356                 return ts.forEach(targets, function (target) {
98357                     if (!ts.startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
98358                         return;
98359                     }
98360                     var relative = ts.getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
98361                     for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
98362                         var symlinkDirectory = symlinkDirectories_1[_i];
98363                         var option = ts.resolvePath(symlinkDirectory, relative);
98364                         var result_15 = cb(option, target === referenceRedirect);
98365                         shouldFilterIgnoredPaths = true;
98366                         if (result_15)
98367                             return result_15;
98368                     }
98369                 });
98370             });
98371             return result || (preferSymlinks
98372                 ? ts.forEach(targets, function (p) { return shouldFilterIgnoredPaths && ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
98373                 : undefined);
98374         }
98375         moduleSpecifiers_1.forEachFileNameOfModule = forEachFileNameOfModule;
98376         function getAllModulePaths(importingFilePath, importedFileName, host, preferences, importedFilePath) {
98377             var _a;
98378             if (importedFilePath === void 0) { importedFilePath = ts.toPath(importedFileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }
98379             var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host);
98380             if (cache) {
98381                 var cached = cache.get(importingFilePath, importedFilePath, preferences);
98382                 if (cached === null || cached === void 0 ? void 0 : cached.modulePaths)
98383                     return cached.modulePaths;
98384             }
98385             var modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
98386             if (cache) {
98387                 cache.setModulePaths(importingFilePath, importedFilePath, preferences, modulePaths);
98388             }
98389             return modulePaths;
98390         }
98391         function getAllModulePathsWorker(importingFileName, importedFileName, host) {
98392             var getCanonicalFileName = ts.hostGetCanonicalFileName(host);
98393             var allFileNames = new ts.Map();
98394             var importedFileFromNodeModules = false;
98395             forEachFileNameOfModule(importingFileName, importedFileName, host, true, function (path, isRedirect) {
98396                 var isInNodeModules = ts.pathContainsNodeModules(path);
98397                 allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect: isRedirect, isInNodeModules: isInNodeModules });
98398                 importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
98399             });
98400             var sortedPaths = [];
98401             var _loop_31 = function (directory) {
98402                 var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
98403                 var pathsInDirectory;
98404                 allFileNames.forEach(function (_a, fileName) {
98405                     var path = _a.path, isRedirect = _a.isRedirect, isInNodeModules = _a.isInNodeModules;
98406                     if (ts.startsWith(path, directoryStart)) {
98407                         (pathsInDirectory || (pathsInDirectory = [])).push({ path: fileName, isRedirect: isRedirect, isInNodeModules: isInNodeModules });
98408                         allFileNames.delete(fileName);
98409                     }
98410                 });
98411                 if (pathsInDirectory) {
98412                     if (pathsInDirectory.length > 1) {
98413                         pathsInDirectory.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
98414                     }
98415                     sortedPaths.push.apply(sortedPaths, pathsInDirectory);
98416                 }
98417                 var newDirectory = ts.getDirectoryPath(directory);
98418                 if (newDirectory === directory)
98419                     return out_directory_1 = directory, "break";
98420                 directory = newDirectory;
98421                 out_directory_1 = directory;
98422             };
98423             var out_directory_1;
98424             for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
98425                 var state_9 = _loop_31(directory);
98426                 directory = out_directory_1;
98427                 if (state_9 === "break")
98428                     break;
98429             }
98430             if (allFileNames.size) {
98431                 var remainingPaths = ts.arrayFrom(allFileNames.values());
98432                 if (remainingPaths.length > 1)
98433                     remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
98434                 sortedPaths.push.apply(sortedPaths, remainingPaths);
98435             }
98436             return sortedPaths;
98437         }
98438         function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
98439             var _a;
98440             var decl = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isNonGlobalAmbientModule(d) && (!ts.isExternalModuleAugmentation(d) || !ts.isExternalModuleNameRelative(ts.getTextOfIdentifierOrLiteral(d.name))); });
98441             if (decl) {
98442                 return decl.name.text;
98443             }
98444             var ambientModuleDeclareCandidates = ts.mapDefined(moduleSymbol.declarations, function (d) {
98445                 var _a, _b, _c, _d;
98446                 if (!ts.isModuleDeclaration(d))
98447                     return;
98448                 var topNamespace = getTopNamespace(d);
98449                 if (!(((_a = topNamespace === null || topNamespace === void 0 ? void 0 : topNamespace.parent) === null || _a === void 0 ? void 0 : _a.parent)
98450                     && ts.isModuleBlock(topNamespace.parent) && ts.isAmbientModule(topNamespace.parent.parent) && ts.isSourceFile(topNamespace.parent.parent.parent)))
98451                     return;
98452                 var exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) === null || _b === void 0 ? void 0 : _b.get("export=")) === null || _c === void 0 ? void 0 : _c.valueDeclaration) === null || _d === void 0 ? void 0 : _d.expression;
98453                 if (!exportAssignment)
98454                     return;
98455                 var exportSymbol = checker.getSymbolAtLocation(exportAssignment);
98456                 if (!exportSymbol)
98457                     return;
98458                 var originalExportSymbol = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.flags) & 2097152 ? checker.getAliasedSymbol(exportSymbol) : exportSymbol;
98459                 if (originalExportSymbol === d.symbol)
98460                     return topNamespace.parent.parent;
98461                 function getTopNamespace(namespaceDeclaration) {
98462                     while (namespaceDeclaration.flags & 4) {
98463                         namespaceDeclaration = namespaceDeclaration.parent;
98464                     }
98465                     return namespaceDeclaration;
98466                 }
98467             });
98468             var ambientModuleDeclare = ambientModuleDeclareCandidates[0];
98469             if (ambientModuleDeclare) {
98470                 return ambientModuleDeclare.name.text;
98471             }
98472         }
98473         function tryGetModuleNameFromPaths(relativeToBaseUrlWithIndex, relativeToBaseUrl, paths) {
98474             for (var key in paths) {
98475                 for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
98476                     var patternText_1 = _a[_i];
98477                     var pattern = ts.removeFileExtension(ts.normalizePath(patternText_1));
98478                     var indexOfStar = pattern.indexOf("*");
98479                     if (indexOfStar !== -1) {
98480                         var prefix = pattern.substr(0, indexOfStar);
98481                         var suffix = pattern.substr(indexOfStar + 1);
98482                         if (relativeToBaseUrl.length >= prefix.length + suffix.length &&
98483                             ts.startsWith(relativeToBaseUrl, prefix) &&
98484                             ts.endsWith(relativeToBaseUrl, suffix) ||
98485                             !suffix && relativeToBaseUrl === ts.removeTrailingDirectorySeparator(prefix)) {
98486                             var matchedStar = relativeToBaseUrl.substr(prefix.length, relativeToBaseUrl.length - suffix.length - prefix.length);
98487                             return key.replace("*", matchedStar);
98488                         }
98489                     }
98490                     else if (pattern === relativeToBaseUrl || pattern === relativeToBaseUrlWithIndex) {
98491                         return key;
98492                     }
98493                 }
98494             }
98495         }
98496         function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) {
98497             if (mode === void 0) { mode = 0; }
98498             if (typeof exports === "string") {
98499                 var pathOrPattern = ts.getNormalizedAbsolutePath(ts.combinePaths(packageDirectory, exports), undefined);
98500                 var extensionSwappedTarget = ts.hasTSFileExtension(targetFilePath) ? ts.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined;
98501                 switch (mode) {
98502                     case 0:
98503                         if (ts.comparePaths(targetFilePath, pathOrPattern) === 0 || (extensionSwappedTarget && ts.comparePaths(extensionSwappedTarget, pathOrPattern) === 0)) {
98504                             return { moduleFileToTry: packageName };
98505                         }
98506                         break;
98507                     case 1:
98508                         if (ts.containsPath(pathOrPattern, targetFilePath)) {
98509                             var fragment = ts.getRelativePathFromDirectory(pathOrPattern, targetFilePath, false);
98510                             return { moduleFileToTry: ts.getNormalizedAbsolutePath(ts.combinePaths(ts.combinePaths(packageName, exports), fragment), undefined) };
98511                         }
98512                         break;
98513                     case 2:
98514                         var starPos = pathOrPattern.indexOf("*");
98515                         var leadingSlice = pathOrPattern.slice(0, starPos);
98516                         var trailingSlice = pathOrPattern.slice(starPos + 1);
98517                         if (ts.startsWith(targetFilePath, leadingSlice) && ts.endsWith(targetFilePath, trailingSlice)) {
98518                             var starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
98519                             return { moduleFileToTry: packageName.replace("*", starReplacement) };
98520                         }
98521                         if (extensionSwappedTarget && ts.startsWith(extensionSwappedTarget, leadingSlice) && ts.endsWith(extensionSwappedTarget, trailingSlice)) {
98522                             var starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
98523                             return { moduleFileToTry: packageName.replace("*", starReplacement) };
98524                         }
98525                         break;
98526                 }
98527             }
98528             else if (Array.isArray(exports)) {
98529                 return ts.forEach(exports, function (e) { return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions); });
98530             }
98531             else if (typeof exports === "object" && exports !== null) {
98532                 if (ts.allKeysStartWithDot(exports)) {
98533                     return ts.forEach(ts.getOwnKeys(exports), function (k) {
98534                         var subPackageName = ts.getNormalizedAbsolutePath(ts.combinePaths(packageName, k), undefined);
98535                         var mode = ts.endsWith(k, "/") ? 1
98536                             : ts.stringContains(k, "*") ? 2
98537                                 : 0;
98538                         return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode);
98539                     });
98540                 }
98541                 else {
98542                     for (var _i = 0, _a = ts.getOwnKeys(exports); _i < _a.length; _i++) {
98543                         var key = _a[_i];
98544                         if (key === "default" || conditions.indexOf(key) >= 0 || ts.isApplicableVersionedTypesKey(conditions, key)) {
98545                             var subTarget = exports[key];
98546                             var result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
98547                             if (result) {
98548                                 return result;
98549                             }
98550                         }
98551                     }
98552                 }
98553             }
98554             return undefined;
98555         }
98556         function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
98557             var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
98558             if (normalizedTargetPath === undefined) {
98559                 return undefined;
98560             }
98561             var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
98562             var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
98563             return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
98564                 ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
98565                 : ts.removeFileExtension(relativePath);
98566         }
98567         function tryGetModuleNameAsNodeModule(_a, _b, host, options, packageNameOnly) {
98568             var path = _a.path, isRedirect = _a.isRedirect;
98569             var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
98570             if (!host.fileExists || !host.readFile) {
98571                 return undefined;
98572             }
98573             var parts = getNodeModulePathParts(path);
98574             if (!parts) {
98575                 return undefined;
98576             }
98577             var moduleSpecifier = path;
98578             var isPackageRootPath = false;
98579             if (!packageNameOnly) {
98580                 var packageRootIndex = parts.packageRootIndex;
98581                 var moduleFileNameForExtensionless = void 0;
98582                 while (true) {
98583                     var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
98584                     if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Classic) {
98585                         if (blockedByExports) {
98586                             return undefined;
98587                         }
98588                         if (verbatimFromExports) {
98589                             return moduleFileToTry;
98590                         }
98591                     }
98592                     if (packageRootPath) {
98593                         moduleSpecifier = packageRootPath;
98594                         isPackageRootPath = true;
98595                         break;
98596                     }
98597                     if (!moduleFileNameForExtensionless)
98598                         moduleFileNameForExtensionless = moduleFileToTry;
98599                     packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
98600                     if (packageRootIndex === -1) {
98601                         moduleSpecifier = getExtensionlessFileName(moduleFileNameForExtensionless);
98602                         break;
98603                     }
98604                 }
98605             }
98606             if (isRedirect && !isPackageRootPath) {
98607                 return undefined;
98608             }
98609             var globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
98610             var pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
98611             if (!(ts.startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && ts.startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
98612                 return undefined;
98613             }
98614             var nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
98615             var packageName = ts.getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
98616             return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
98617             function tryDirectoryWithPackageJson(packageRootIndex) {
98618                 var packageRootPath = path.substring(0, packageRootIndex);
98619                 var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
98620                 var moduleFileToTry = path;
98621                 if (host.fileExists(packageJsonPath)) {
98622                     var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
98623                     if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
98624                         var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
98625                         if (fromExports) {
98626                             var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
98627                             return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
98628                         }
98629                         if (packageJsonContent.exports) {
98630                             return { moduleFileToTry: path, blockedByExports: true };
98631                         }
98632                     }
98633                     var versionPaths = packageJsonContent.typesVersions
98634                         ? ts.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
98635                         : undefined;
98636                     if (versionPaths) {
98637                         var subModuleName = path.slice(packageRootPath.length + 1);
98638                         var fromPaths = tryGetModuleNameFromPaths(ts.removeFileExtension(subModuleName), removeExtensionAndIndexPostFix(subModuleName, 0, options), versionPaths.paths);
98639                         if (fromPaths !== undefined) {
98640                             moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
98641                         }
98642                     }
98643                     var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
98644                     if (ts.isString(mainFileRelative)) {
98645                         var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
98646                         if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
98647                             return { packageRootPath: packageRootPath, moduleFileToTry: moduleFileToTry };
98648                         }
98649                     }
98650                 }
98651                 return { moduleFileToTry: moduleFileToTry };
98652             }
98653             function getExtensionlessFileName(path) {
98654                 var fullModulePathWithoutExtension = ts.removeFileExtension(path);
98655                 if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
98656                     return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
98657                 }
98658                 return fullModulePathWithoutExtension;
98659             }
98660         }
98661         function tryGetAnyFileFromPath(host, path) {
98662             if (!host.fileExists)
98663                 return;
98664             var extensions = ts.flatten(ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 }]));
98665             for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) {
98666                 var e = extensions_3[_i];
98667                 var fullPath = path + e;
98668                 if (host.fileExists(fullPath)) {
98669                     return fullPath;
98670                 }
98671             }
98672         }
98673         function getNodeModulePathParts(fullPath) {
98674             var topLevelNodeModulesIndex = 0;
98675             var topLevelPackageNameIndex = 0;
98676             var packageRootIndex = 0;
98677             var fileNameIndex = 0;
98678             var partStart = 0;
98679             var partEnd = 0;
98680             var state = 0;
98681             while (partEnd >= 0) {
98682                 partStart = partEnd;
98683                 partEnd = fullPath.indexOf("/", partStart + 1);
98684                 switch (state) {
98685                     case 0:
98686                         if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
98687                             topLevelNodeModulesIndex = partStart;
98688                             topLevelPackageNameIndex = partEnd;
98689                             state = 1;
98690                         }
98691                         break;
98692                     case 1:
98693                     case 2:
98694                         if (state === 1 && fullPath.charAt(partStart + 1) === "@") {
98695                             state = 2;
98696                         }
98697                         else {
98698                             packageRootIndex = partEnd;
98699                             state = 3;
98700                         }
98701                         break;
98702                     case 3:
98703                         if (fullPath.indexOf(ts.nodeModulesPathPart, partStart) === partStart) {
98704                             state = 1;
98705                         }
98706                         else {
98707                             state = 3;
98708                         }
98709                         break;
98710                 }
98711             }
98712             fileNameIndex = partStart;
98713             return state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
98714         }
98715         function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
98716             return ts.firstDefined(rootDirs, function (rootDir) {
98717                 var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
98718                 return isPathRelativeToParent(relativePath) ? undefined : relativePath;
98719             });
98720         }
98721         function removeExtensionAndIndexPostFix(fileName, ending, options) {
98722             if (ts.fileExtensionIsOneOf(fileName, [".json", ".mjs", ".cjs"]))
98723                 return fileName;
98724             var noExtension = ts.removeFileExtension(fileName);
98725             if (ts.fileExtensionIsOneOf(fileName, [".d.mts", ".mts", ".d.cts", ".cts"]))
98726                 return noExtension + getJSExtensionForFile(fileName, options);
98727             switch (ending) {
98728                 case 0:
98729                     return ts.removeSuffix(noExtension, "/index");
98730                 case 1:
98731                     return noExtension;
98732                 case 2:
98733                     return noExtension + getJSExtensionForFile(fileName, options);
98734                 default:
98735                     return ts.Debug.assertNever(ending);
98736             }
98737         }
98738         function getJSExtensionForFile(fileName, options) {
98739             var _a;
98740             return (_a = tryGetJSExtensionForFile(fileName, options)) !== null && _a !== void 0 ? _a : ts.Debug.fail("Extension ".concat(ts.extensionFromPath(fileName), " is unsupported:: FileName:: ").concat(fileName));
98741         }
98742         function tryGetJSExtensionForFile(fileName, options) {
98743             var ext = ts.tryGetExtensionFromPath(fileName);
98744             switch (ext) {
98745                 case ".ts":
98746                 case ".d.ts":
98747                     return ".js";
98748                 case ".tsx":
98749                     return options.jsx === 1 ? ".jsx" : ".js";
98750                 case ".js":
98751                 case ".jsx":
98752                 case ".json":
98753                     return ext;
98754                 case ".d.mts":
98755                 case ".mts":
98756                 case ".mjs":
98757                     return ".mjs";
98758                 case ".d.cts":
98759                 case ".cts":
98760                 case ".cjs":
98761                     return ".cjs";
98762                 default:
98763                     return undefined;
98764             }
98765         }
98766         moduleSpecifiers_1.tryGetJSExtensionForFile = tryGetJSExtensionForFile;
98767         function getRelativePathIfInDirectory(path, directoryPath, getCanonicalFileName) {
98768             var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false);
98769             return ts.isRootedDiskPath(relativePath) ? undefined : relativePath;
98770         }
98771         function isPathRelativeToParent(path) {
98772             return ts.startsWith(path, "..");
98773         }
98774     })(moduleSpecifiers = ts.moduleSpecifiers || (ts.moduleSpecifiers = {}));
98775 })(ts || (ts = {}));
98776 var ts;
98777 (function (ts) {
98778     var sysFormatDiagnosticsHost = ts.sys ? {
98779         getCurrentDirectory: function () { return ts.sys.getCurrentDirectory(); },
98780         getNewLine: function () { return ts.sys.newLine; },
98781         getCanonicalFileName: ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)
98782     } : undefined;
98783     function createDiagnosticReporter(system, pretty) {
98784         var host = system === ts.sys && sysFormatDiagnosticsHost ? sysFormatDiagnosticsHost : {
98785             getCurrentDirectory: function () { return system.getCurrentDirectory(); },
98786             getNewLine: function () { return system.newLine; },
98787             getCanonicalFileName: ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames),
98788         };
98789         if (!pretty) {
98790             return function (diagnostic) { return system.write(ts.formatDiagnostic(diagnostic, host)); };
98791         }
98792         var diagnostics = new Array(1);
98793         return function (diagnostic) {
98794             diagnostics[0] = diagnostic;
98795             system.write(ts.formatDiagnosticsWithColorAndContext(diagnostics, host) + host.getNewLine());
98796             diagnostics[0] = undefined;
98797         };
98798     }
98799     ts.createDiagnosticReporter = createDiagnosticReporter;
98800     function clearScreenIfNotWatchingForFileChanges(system, diagnostic, options) {
98801         if (system.clearScreen &&
98802             !options.preserveWatchOutput &&
98803             !options.extendedDiagnostics &&
98804             !options.diagnostics &&
98805             ts.contains(ts.screenStartingMessageCodes, diagnostic.code)) {
98806             system.clearScreen();
98807             return true;
98808         }
98809         return false;
98810     }
98811     ts.screenStartingMessageCodes = [
98812         ts.Diagnostics.Starting_compilation_in_watch_mode.code,
98813         ts.Diagnostics.File_change_detected_Starting_incremental_compilation.code,
98814     ];
98815     function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) {
98816         return ts.contains(ts.screenStartingMessageCodes, diagnostic.code)
98817             ? newLine + newLine
98818             : newLine;
98819     }
98820     function getLocaleTimeString(system) {
98821         return !system.now ?
98822             new Date().toLocaleTimeString() :
98823             system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
98824     }
98825     ts.getLocaleTimeString = getLocaleTimeString;
98826     function createWatchStatusReporter(system, pretty) {
98827         return pretty ?
98828             function (diagnostic, newLine, options) {
98829                 clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
98830                 var output = "[".concat(ts.formatColorAndReset(getLocaleTimeString(system), ts.ForegroundColorEscapeSequences.Grey), "] ");
98831                 output += "".concat(ts.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(newLine + newLine);
98832                 system.write(output);
98833             } :
98834             function (diagnostic, newLine, options) {
98835                 var output = "";
98836                 if (!clearScreenIfNotWatchingForFileChanges(system, diagnostic, options)) {
98837                     output += newLine;
98838                 }
98839                 output += "".concat(getLocaleTimeString(system), " - ");
98840                 output += "".concat(ts.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(getPlainDiagnosticFollowingNewLines(diagnostic, newLine));
98841                 system.write(output);
98842             };
98843     }
98844     ts.createWatchStatusReporter = createWatchStatusReporter;
98845     function parseConfigFileWithSystem(configFileName, optionsToExtend, extendedConfigCache, watchOptionsToExtend, system, reportDiagnostic) {
98846         var host = system;
98847         host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); };
98848         var result = ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend);
98849         host.onUnRecoverableConfigFileDiagnostic = undefined;
98850         return result;
98851     }
98852     ts.parseConfigFileWithSystem = parseConfigFileWithSystem;
98853     function getErrorCountForSummary(diagnostics) {
98854         return ts.countWhere(diagnostics, function (diagnostic) { return diagnostic.category === ts.DiagnosticCategory.Error; });
98855     }
98856     ts.getErrorCountForSummary = getErrorCountForSummary;
98857     function getWatchErrorSummaryDiagnosticMessage(errorCount) {
98858         return errorCount === 1 ?
98859             ts.Diagnostics.Found_1_error_Watching_for_file_changes :
98860             ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
98861     }
98862     ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
98863     function getErrorSummaryText(errorCount, newLine) {
98864         if (errorCount === 0)
98865             return "";
98866         var d = ts.createCompilerDiagnostic(errorCount === 1 ? ts.Diagnostics.Found_1_error : ts.Diagnostics.Found_0_errors, errorCount);
98867         return "".concat(newLine).concat(ts.flattenDiagnosticMessageText(d.messageText, newLine)).concat(newLine).concat(newLine);
98868     }
98869     ts.getErrorSummaryText = getErrorSummaryText;
98870     function isBuilderProgram(program) {
98871         return !!program.getState;
98872     }
98873     ts.isBuilderProgram = isBuilderProgram;
98874     function listFiles(program, write) {
98875         var options = program.getCompilerOptions();
98876         if (options.explainFiles) {
98877             explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
98878         }
98879         else if (options.listFiles || options.listFilesOnly) {
98880             ts.forEach(program.getSourceFiles(), function (file) {
98881                 write(file.fileName);
98882             });
98883         }
98884     }
98885     ts.listFiles = listFiles;
98886     function explainFiles(program, write) {
98887         var _a, _b;
98888         var reasons = program.getFileIncludeReasons();
98889         var getCanonicalFileName = ts.createGetCanonicalFileName(program.useCaseSensitiveFileNames());
98890         var relativeFileName = function (fileName) { return ts.convertToRelativePath(fileName, program.getCurrentDirectory(), getCanonicalFileName); };
98891         for (var _i = 0, _c = program.getSourceFiles(); _i < _c.length; _i++) {
98892             var file = _c[_i];
98893             write("".concat(toFileName(file, relativeFileName)));
98894             (_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write("  ".concat(fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText)); });
98895             (_b = explainIfFileIsRedirect(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write("  ".concat(d.messageText)); });
98896         }
98897     }
98898     ts.explainFiles = explainFiles;
98899     function explainIfFileIsRedirect(file, fileNameConvertor) {
98900         var result;
98901         if (file.path !== file.resolvedPath) {
98902             (result || (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
98903         }
98904         if (file.redirectInfo) {
98905             (result || (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
98906         }
98907         return result;
98908     }
98909     ts.explainIfFileIsRedirect = explainIfFileIsRedirect;
98910     function getMatchedFileSpec(program, fileName) {
98911         var _a;
98912         var configFile = program.getCompilerOptions().configFile;
98913         if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedFilesSpec))
98914             return undefined;
98915         var getCanonicalFileName = ts.createGetCanonicalFileName(program.useCaseSensitiveFileNames());
98916         var filePath = getCanonicalFileName(fileName);
98917         var basePath = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
98918         return ts.find(configFile.configFileSpecs.validatedFilesSpec, function (fileSpec) { return getCanonicalFileName(ts.getNormalizedAbsolutePath(fileSpec, basePath)) === filePath; });
98919     }
98920     ts.getMatchedFileSpec = getMatchedFileSpec;
98921     function getMatchedIncludeSpec(program, fileName) {
98922         var _a, _b;
98923         var configFile = program.getCompilerOptions().configFile;
98924         if (!((_a = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _a === void 0 ? void 0 : _a.validatedIncludeSpecs))
98925             return undefined;
98926         var isJsonFile = ts.fileExtensionIs(fileName, ".json");
98927         var basePath = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
98928         var useCaseSensitiveFileNames = program.useCaseSensitiveFileNames();
98929         return ts.find((_b = configFile === null || configFile === void 0 ? void 0 : configFile.configFileSpecs) === null || _b === void 0 ? void 0 : _b.validatedIncludeSpecs, function (includeSpec) {
98930             if (isJsonFile && !ts.endsWith(includeSpec, ".json"))
98931                 return false;
98932             var pattern = ts.getPatternFromSpec(includeSpec, basePath, "files");
98933             return !!pattern && ts.getRegexFromPattern("(".concat(pattern, ")$"), useCaseSensitiveFileNames).test(fileName);
98934         });
98935     }
98936     ts.getMatchedIncludeSpec = getMatchedIncludeSpec;
98937     function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
98938         var _a, _b;
98939         var options = program.getCompilerOptions();
98940         if (ts.isReferencedFile(reason)) {
98941             var referenceLocation = ts.getReferencedFileLocation(function (path) { return program.getSourceFileByPath(path); }, reason);
98942             var referenceText = ts.isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : "\"".concat(referenceLocation.text, "\"");
98943             var message = void 0;
98944             ts.Debug.assert(ts.isReferenceFileLocation(referenceLocation) || reason.kind === ts.FileIncludeKind.Import, "Only synthetic references are imports");
98945             switch (reason.kind) {
98946                 case ts.FileIncludeKind.Import:
98947                     if (ts.isReferenceFileLocation(referenceLocation)) {
98948                         message = referenceLocation.packageId ?
98949                             ts.Diagnostics.Imported_via_0_from_file_1_with_packageId_2 :
98950                             ts.Diagnostics.Imported_via_0_from_file_1;
98951                     }
98952                     else if (referenceLocation.text === ts.externalHelpersModuleNameText) {
98953                         message = referenceLocation.packageId ?
98954                             ts.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions :
98955                             ts.Diagnostics.Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions;
98956                     }
98957                     else {
98958                         message = referenceLocation.packageId ?
98959                             ts.Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions :
98960                             ts.Diagnostics.Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions;
98961                     }
98962                     break;
98963                 case ts.FileIncludeKind.ReferenceFile:
98964                     ts.Debug.assert(!referenceLocation.packageId);
98965                     message = ts.Diagnostics.Referenced_via_0_from_file_1;
98966                     break;
98967                 case ts.FileIncludeKind.TypeReferenceDirective:
98968                     message = referenceLocation.packageId ?
98969                         ts.Diagnostics.Type_library_referenced_via_0_from_file_1_with_packageId_2 :
98970                         ts.Diagnostics.Type_library_referenced_via_0_from_file_1;
98971                     break;
98972                 case ts.FileIncludeKind.LibReferenceDirective:
98973                     ts.Debug.assert(!referenceLocation.packageId);
98974                     message = ts.Diagnostics.Library_referenced_via_0_from_file_1;
98975                     break;
98976                 default:
98977                     ts.Debug.assertNever(reason);
98978             }
98979             return ts.chainDiagnosticMessages(undefined, message, referenceText, toFileName(referenceLocation.file, fileNameConvertor), referenceLocation.packageId && ts.packageIdToString(referenceLocation.packageId));
98980         }
98981         switch (reason.kind) {
98982             case ts.FileIncludeKind.RootFile:
98983                 if (!((_a = options.configFile) === null || _a === void 0 ? void 0 : _a.configFileSpecs))
98984                     return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Root_file_specified_for_compilation);
98985                 var fileName = ts.getNormalizedAbsolutePath(program.getRootFileNames()[reason.index], program.getCurrentDirectory());
98986                 var matchedByFiles = getMatchedFileSpec(program, fileName);
98987                 if (matchedByFiles)
98988                     return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Part_of_files_list_in_tsconfig_json);
98989                 var matchedByInclude = getMatchedIncludeSpec(program, fileName);
98990                 return matchedByInclude ?
98991                     ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Matched_by_include_pattern_0_in_1, matchedByInclude, toFileName(options.configFile, fileNameConvertor)) :
98992                     ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Root_file_specified_for_compilation);
98993             case ts.FileIncludeKind.SourceFromProjectReference:
98994             case ts.FileIncludeKind.OutputFromProjectReference:
98995                 var isOutput = reason.kind === ts.FileIncludeKind.OutputFromProjectReference;
98996                 var referencedResolvedRef = ts.Debug.checkDefined((_b = program.getResolvedProjectReferences()) === null || _b === void 0 ? void 0 : _b[reason.index]);
98997                 return ts.chainDiagnosticMessages(undefined, ts.outFile(options) ?
98998                     isOutput ?
98999                         ts.Diagnostics.Output_from_referenced_project_0_included_because_1_specified :
99000                         ts.Diagnostics.Source_from_referenced_project_0_included_because_1_specified :
99001                     isOutput ?
99002                         ts.Diagnostics.Output_from_referenced_project_0_included_because_module_is_specified_as_none :
99003                         ts.Diagnostics.Source_from_referenced_project_0_included_because_module_is_specified_as_none, toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor), options.outFile ? "--outFile" : "--out");
99004             case ts.FileIncludeKind.AutomaticTypeDirectiveFile:
99005                 return ts.chainDiagnosticMessages(undefined, options.types ?
99006                     reason.packageId ?
99007                         ts.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 :
99008                         ts.Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions :
99009                     reason.packageId ?
99010                         ts.Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1 :
99011                         ts.Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference, reason.packageId && ts.packageIdToString(reason.packageId));
99012             case ts.FileIncludeKind.LibFile:
99013                 if (reason.index !== undefined)
99014                     return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Library_0_specified_in_compilerOptions, options.lib[reason.index]);
99015                 var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
99016                 return ts.chainDiagnosticMessages(undefined, target ?
99017                     ts.Diagnostics.Default_library_for_target_0 :
99018                     ts.Diagnostics.Default_library, target);
99019             default:
99020                 ts.Debug.assertNever(reason);
99021         }
99022     }
99023     ts.fileIncludeReasonToDiagnostics = fileIncludeReasonToDiagnostics;
99024     function toFileName(file, fileNameConvertor) {
99025         var fileName = ts.isString(file) ? file : file.fileName;
99026         return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
99027     }
99028     function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99029         var isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
99030         var allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
99031         var configFileParsingDiagnosticsLength = allDiagnostics.length;
99032         ts.addRange(allDiagnostics, program.getSyntacticDiagnostics(undefined, cancellationToken));
99033         if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
99034             ts.addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken));
99035             if (!isListFilesOnly) {
99036                 ts.addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken));
99037                 if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
99038                     ts.addRange(allDiagnostics, program.getSemanticDiagnostics(undefined, cancellationToken));
99039                 }
99040             }
99041         }
99042         var emitResult = isListFilesOnly
99043             ? { emitSkipped: true, diagnostics: ts.emptyArray }
99044             : program.emit(undefined, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
99045         var emittedFiles = emitResult.emittedFiles, emitDiagnostics = emitResult.diagnostics;
99046         ts.addRange(allDiagnostics, emitDiagnostics);
99047         var diagnostics = ts.sortAndDeduplicateDiagnostics(allDiagnostics);
99048         diagnostics.forEach(reportDiagnostic);
99049         if (write) {
99050             var currentDir_1 = program.getCurrentDirectory();
99051             ts.forEach(emittedFiles, function (file) {
99052                 var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
99053                 write("TSFILE: ".concat(filepath));
99054             });
99055             listFiles(program, write);
99056         }
99057         if (reportSummary) {
99058             reportSummary(getErrorCountForSummary(diagnostics));
99059         }
99060         return {
99061             emitResult: emitResult,
99062             diagnostics: diagnostics,
99063         };
99064     }
99065     ts.emitFilesAndReportErrors = emitFilesAndReportErrors;
99066     function emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99067         var _a = emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), emitResult = _a.emitResult, diagnostics = _a.diagnostics;
99068         if (emitResult.emitSkipped && diagnostics.length > 0) {
99069             return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
99070         }
99071         else if (diagnostics.length > 0) {
99072             return ts.ExitStatus.DiagnosticsPresent_OutputsGenerated;
99073         }
99074         return ts.ExitStatus.Success;
99075     }
99076     ts.emitFilesAndReportErrorsAndGetExitStatus = emitFilesAndReportErrorsAndGetExitStatus;
99077     ts.noopFileWatcher = { close: ts.noop };
99078     ts.returnNoopFileWatcher = function () { return ts.noopFileWatcher; };
99079     function createWatchHost(system, reportWatchStatus) {
99080         if (system === void 0) { system = ts.sys; }
99081         var onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system);
99082         return {
99083             onWatchStatusChange: onWatchStatusChange,
99084             watchFile: ts.maybeBind(system, system.watchFile) || ts.returnNoopFileWatcher,
99085             watchDirectory: ts.maybeBind(system, system.watchDirectory) || ts.returnNoopFileWatcher,
99086             setTimeout: ts.maybeBind(system, system.setTimeout) || ts.noop,
99087             clearTimeout: ts.maybeBind(system, system.clearTimeout) || ts.noop
99088         };
99089     }
99090     ts.createWatchHost = createWatchHost;
99091     ts.WatchType = {
99092         ConfigFile: "Config file",
99093         ExtendedConfigFile: "Extended config file",
99094         SourceFile: "Source file",
99095         MissingFile: "Missing file",
99096         WildcardDirectory: "Wild card directory",
99097         FailedLookupLocations: "Failed Lookup Locations",
99098         TypeRoots: "Type roots",
99099         ConfigFileOfReferencedProject: "Config file of referened project",
99100         ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
99101         WildcardDirectoryOfReferencedProject: "Wild card directory of referenced project",
99102         PackageJson: "package.json file",
99103     };
99104     function createWatchFactory(host, options) {
99105         var watchLogLevel = host.trace ? options.extendedDiagnostics ? ts.WatchLogLevel.Verbose : options.diagnostics ? ts.WatchLogLevel.TriggerOnly : ts.WatchLogLevel.None : ts.WatchLogLevel.None;
99106         var writeLog = watchLogLevel !== ts.WatchLogLevel.None ? (function (s) { return host.trace(s); }) : ts.noop;
99107         var result = ts.getWatchFactory(host, watchLogLevel, writeLog);
99108         result.writeLog = writeLog;
99109         return result;
99110     }
99111     ts.createWatchFactory = createWatchFactory;
99112     function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost) {
99113         if (directoryStructureHost === void 0) { directoryStructureHost = host; }
99114         var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
99115         var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); });
99116         return {
99117             getSourceFile: function (fileName, languageVersion, onError) {
99118                 var text;
99119                 try {
99120                     ts.performance.mark("beforeIORead");
99121                     text = host.readFile(fileName, getCompilerOptions().charset);
99122                     ts.performance.mark("afterIORead");
99123                     ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
99124                 }
99125                 catch (e) {
99126                     if (onError) {
99127                         onError(e.message);
99128                     }
99129                     text = "";
99130                 }
99131                 return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion) : undefined;
99132             },
99133             getDefaultLibLocation: ts.maybeBind(host, host.getDefaultLibLocation),
99134             getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
99135             writeFile: writeFile,
99136             getCurrentDirectory: ts.memoize(function () { return host.getCurrentDirectory(); }),
99137             useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames; },
99138             getCanonicalFileName: ts.createGetCanonicalFileName(useCaseSensitiveFileNames),
99139             getNewLine: function () { return ts.getNewLineCharacter(getCompilerOptions(), hostGetNewLine); },
99140             fileExists: function (f) { return host.fileExists(f); },
99141             readFile: function (f) { return host.readFile(f); },
99142             trace: ts.maybeBind(host, host.trace),
99143             directoryExists: ts.maybeBind(directoryStructureHost, directoryStructureHost.directoryExists),
99144             getDirectories: ts.maybeBind(directoryStructureHost, directoryStructureHost.getDirectories),
99145             realpath: ts.maybeBind(host, host.realpath),
99146             getEnvironmentVariable: ts.maybeBind(host, host.getEnvironmentVariable) || (function () { return ""; }),
99147             createHash: ts.maybeBind(host, host.createHash),
99148             readDirectory: ts.maybeBind(host, host.readDirectory),
99149             disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
99150         };
99151         function writeFile(fileName, text, writeByteOrderMark, onError) {
99152             try {
99153                 ts.performance.mark("beforeIOWrite");
99154                 ts.writeFileEnsuringDirectories(fileName, text, writeByteOrderMark, function (path, data, writeByteOrderMark) { return host.writeFile(path, data, writeByteOrderMark); }, function (path) { return host.createDirectory(path); }, function (path) { return host.directoryExists(path); });
99155                 ts.performance.mark("afterIOWrite");
99156                 ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
99157             }
99158             catch (e) {
99159                 if (onError) {
99160                     onError(e.message);
99161                 }
99162             }
99163         }
99164     }
99165     ts.createCompilerHostFromProgramHost = createCompilerHostFromProgramHost;
99166     function setGetSourceFileAsHashVersioned(compilerHost, host) {
99167         var originalGetSourceFile = compilerHost.getSourceFile;
99168         var computeHash = ts.maybeBind(host, host.createHash) || ts.generateDjb2Hash;
99169         compilerHost.getSourceFile = function () {
99170             var args = [];
99171             for (var _i = 0; _i < arguments.length; _i++) {
99172                 args[_i] = arguments[_i];
99173             }
99174             var result = originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false));
99175             if (result) {
99176                 result.version = computeHash(result.text);
99177             }
99178             return result;
99179         };
99180     }
99181     ts.setGetSourceFileAsHashVersioned = setGetSourceFileAsHashVersioned;
99182     function createProgramHost(system, createProgram) {
99183         var getDefaultLibLocation = ts.memoize(function () { return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath())); });
99184         return {
99185             useCaseSensitiveFileNames: function () { return system.useCaseSensitiveFileNames; },
99186             getNewLine: function () { return system.newLine; },
99187             getCurrentDirectory: ts.memoize(function () { return system.getCurrentDirectory(); }),
99188             getDefaultLibLocation: getDefaultLibLocation,
99189             getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },
99190             fileExists: function (path) { return system.fileExists(path); },
99191             readFile: function (path, encoding) { return system.readFile(path, encoding); },
99192             directoryExists: function (path) { return system.directoryExists(path); },
99193             getDirectories: function (path) { return system.getDirectories(path); },
99194             readDirectory: function (path, extensions, exclude, include, depth) { return system.readDirectory(path, extensions, exclude, include, depth); },
99195             realpath: ts.maybeBind(system, system.realpath),
99196             getEnvironmentVariable: ts.maybeBind(system, system.getEnvironmentVariable),
99197             trace: function (s) { return system.write(s + system.newLine); },
99198             createDirectory: function (path) { return system.createDirectory(path); },
99199             writeFile: function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); },
99200             createHash: ts.maybeBind(system, system.createHash),
99201             createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
99202             disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
99203         };
99204     }
99205     ts.createProgramHost = createProgramHost;
99206     function createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus) {
99207         if (system === void 0) { system = ts.sys; }
99208         var write = function (s) { return system.write(s + system.newLine); };
99209         var result = createProgramHost(system, createProgram);
99210         ts.copyProperties(result, createWatchHost(system, reportWatchStatus));
99211         result.afterProgramCreate = function (builderProgram) {
99212             var compilerOptions = builderProgram.getCompilerOptions();
99213             var newLine = ts.getNewLineCharacter(compilerOptions, function () { return system.newLine; });
99214             emitFilesAndReportErrors(builderProgram, reportDiagnostic, write, function (errorCount) { return result.onWatchStatusChange(ts.createCompilerDiagnostic(getWatchErrorSummaryDiagnosticMessage(errorCount), errorCount), newLine, compilerOptions, errorCount); });
99215         };
99216         return result;
99217     }
99218     function reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic) {
99219         reportDiagnostic(diagnostic);
99220         system.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
99221     }
99222     function createWatchCompilerHostOfConfigFile(_a) {
99223         var configFileName = _a.configFileName, optionsToExtend = _a.optionsToExtend, watchOptionsToExtend = _a.watchOptionsToExtend, extraFileExtensions = _a.extraFileExtensions, system = _a.system, createProgram = _a.createProgram, reportDiagnostic = _a.reportDiagnostic, reportWatchStatus = _a.reportWatchStatus;
99224         var diagnosticReporter = reportDiagnostic || createDiagnosticReporter(system);
99225         var host = createWatchCompilerHost(system, createProgram, diagnosticReporter, reportWatchStatus);
99226         host.onUnRecoverableConfigFileDiagnostic = function (diagnostic) { return reportUnrecoverableDiagnostic(system, diagnosticReporter, diagnostic); };
99227         host.configFileName = configFileName;
99228         host.optionsToExtend = optionsToExtend;
99229         host.watchOptionsToExtend = watchOptionsToExtend;
99230         host.extraFileExtensions = extraFileExtensions;
99231         return host;
99232     }
99233     ts.createWatchCompilerHostOfConfigFile = createWatchCompilerHostOfConfigFile;
99234     function createWatchCompilerHostOfFilesAndCompilerOptions(_a) {
99235         var rootFiles = _a.rootFiles, options = _a.options, watchOptions = _a.watchOptions, projectReferences = _a.projectReferences, system = _a.system, createProgram = _a.createProgram, reportDiagnostic = _a.reportDiagnostic, reportWatchStatus = _a.reportWatchStatus;
99236         var host = createWatchCompilerHost(system, createProgram, reportDiagnostic || createDiagnosticReporter(system), reportWatchStatus);
99237         host.rootFiles = rootFiles;
99238         host.options = options;
99239         host.watchOptions = watchOptions;
99240         host.projectReferences = projectReferences;
99241         return host;
99242     }
99243     ts.createWatchCompilerHostOfFilesAndCompilerOptions = createWatchCompilerHostOfFilesAndCompilerOptions;
99244     function performIncrementalCompilation(input) {
99245         var system = input.system || ts.sys;
99246         var host = input.host || (input.host = ts.createIncrementalCompilerHost(input.options, system));
99247         var builderProgram = ts.createIncrementalProgram(input);
99248         var exitStatus = emitFilesAndReportErrorsAndGetExitStatus(builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), function (s) { return host.trace && host.trace(s); }, input.reportErrorSummary || input.options.pretty ? function (errorCount) { return system.write(getErrorSummaryText(errorCount, system.newLine)); } : undefined);
99249         if (input.afterProgramEmitAndDiagnostics)
99250             input.afterProgramEmitAndDiagnostics(builderProgram);
99251         return exitStatus;
99252     }
99253     ts.performIncrementalCompilation = performIncrementalCompilation;
99254 })(ts || (ts = {}));
99255 var ts;
99256 (function (ts) {
99257     function readBuilderProgram(compilerOptions, host) {
99258         if (ts.outFile(compilerOptions))
99259             return undefined;
99260         var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
99261         if (!buildInfoPath)
99262             return undefined;
99263         var content = host.readFile(buildInfoPath);
99264         if (!content)
99265             return undefined;
99266         var buildInfo = ts.getBuildInfo(content);
99267         if (buildInfo.version !== ts.version)
99268             return undefined;
99269         if (!buildInfo.program)
99270             return undefined;
99271         return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
99272     }
99273     ts.readBuilderProgram = readBuilderProgram;
99274     function createIncrementalCompilerHost(options, system) {
99275         if (system === void 0) { system = ts.sys; }
99276         var host = ts.createCompilerHostWorker(options, undefined, system);
99277         host.createHash = ts.maybeBind(system, system.createHash);
99278         host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
99279         ts.setGetSourceFileAsHashVersioned(host, system);
99280         ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
99281         return host;
99282     }
99283     ts.createIncrementalCompilerHost = createIncrementalCompilerHost;
99284     function createIncrementalProgram(_a) {
99285         var rootNames = _a.rootNames, options = _a.options, configFileParsingDiagnostics = _a.configFileParsingDiagnostics, projectReferences = _a.projectReferences, host = _a.host, createProgram = _a.createProgram;
99286         host = host || createIncrementalCompilerHost(options);
99287         createProgram = createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram;
99288         var oldProgram = readBuilderProgram(options, host);
99289         return createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
99290     }
99291     ts.createIncrementalProgram = createIncrementalProgram;
99292     function createWatchCompilerHost(rootFilesOrConfigFileName, options, system, createProgram, reportDiagnostic, reportWatchStatus, projectReferencesOrWatchOptionsToExtend, watchOptionsOrExtraFileExtensions) {
99293         if (ts.isArray(rootFilesOrConfigFileName)) {
99294             return ts.createWatchCompilerHostOfFilesAndCompilerOptions({
99295                 rootFiles: rootFilesOrConfigFileName,
99296                 options: options,
99297                 watchOptions: watchOptionsOrExtraFileExtensions,
99298                 projectReferences: projectReferencesOrWatchOptionsToExtend,
99299                 system: system,
99300                 createProgram: createProgram,
99301                 reportDiagnostic: reportDiagnostic,
99302                 reportWatchStatus: reportWatchStatus,
99303             });
99304         }
99305         else {
99306             return ts.createWatchCompilerHostOfConfigFile({
99307                 configFileName: rootFilesOrConfigFileName,
99308                 optionsToExtend: options,
99309                 watchOptionsToExtend: projectReferencesOrWatchOptionsToExtend,
99310                 extraFileExtensions: watchOptionsOrExtraFileExtensions,
99311                 system: system,
99312                 createProgram: createProgram,
99313                 reportDiagnostic: reportDiagnostic,
99314                 reportWatchStatus: reportWatchStatus,
99315             });
99316         }
99317     }
99318     ts.createWatchCompilerHost = createWatchCompilerHost;
99319     function createWatchProgram(host) {
99320         var builderProgram;
99321         var reloadLevel;
99322         var missingFilesMap;
99323         var packageJsonMap;
99324         var watchedWildcardDirectories;
99325         var timerToUpdateProgram;
99326         var timerToInvalidateFailedLookupResolutions;
99327         var parsedConfigs;
99328         var sharedExtendedConfigFileWatchers;
99329         var extendedConfigCache = host.extendedConfigCache;
99330         var changesAffectResolution = false;
99331         var sourceFilesCache = new ts.Map();
99332         var missingFilePathsRequestedForRelease;
99333         var hasChangedCompilerOptions = false;
99334         var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
99335         var currentDirectory = host.getCurrentDirectory();
99336         var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, watchOptionsToExtend = host.watchOptionsToExtend, extraFileExtensions = host.extraFileExtensions, createProgram = host.createProgram;
99337         var rootFileNames = host.rootFiles, compilerOptions = host.options, watchOptions = host.watchOptions, projectReferences = host.projectReferences;
99338         var wildcardDirectories;
99339         var configFileParsingDiagnostics;
99340         var canConfigFileJsonReportNoInputFiles = false;
99341         var hasChangedConfigFileParsingErrors = false;
99342         var cachedDirectoryStructureHost = configFileName === undefined ? undefined : ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames);
99343         var directoryStructureHost = cachedDirectoryStructureHost || host;
99344         var parseConfigFileHost = ts.parseConfigHostFromCompilerHostLike(host, directoryStructureHost);
99345         var newLine = updateNewLine();
99346         if (configFileName && host.configFileParsingResult) {
99347             setConfigFileParsingResult(host.configFileParsingResult);
99348             newLine = updateNewLine();
99349         }
99350         reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode);
99351         if (configFileName && !host.configFileParsingResult) {
99352             newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine(); });
99353             ts.Debug.assert(!rootFileNames);
99354             parseConfigFile();
99355             newLine = updateNewLine();
99356         }
99357         var _b = ts.createWatchFactory(host, compilerOptions), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory, writeLog = _b.writeLog;
99358         var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
99359         writeLog("Current directory: ".concat(currentDirectory, " CaseSensitiveFileNames: ").concat(useCaseSensitiveFileNames));
99360         var configFileWatcher;
99361         if (configFileName) {
99362             configFileWatcher = watchFile(configFileName, scheduleProgramReload, ts.PollingInterval.High, watchOptions, ts.WatchType.ConfigFile);
99363         }
99364         var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return compilerOptions; }, directoryStructureHost);
99365         ts.setGetSourceFileAsHashVersioned(compilerHost, host);
99366         var getNewSourceFile = compilerHost.getSourceFile;
99367         compilerHost.getSourceFile = function (fileName) {
99368             var args = [];
99369             for (var _i = 1; _i < arguments.length; _i++) {
99370                 args[_i - 1] = arguments[_i];
99371             }
99372             return getVersionedSourceFileByPath.apply(void 0, __spreadArray([fileName, toPath(fileName)], args, false));
99373         };
99374         compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
99375         compilerHost.getNewLine = function () { return newLine; };
99376         compilerHost.fileExists = fileExists;
99377         compilerHost.onReleaseOldSourceFile = onReleaseOldSourceFile;
99378         compilerHost.onReleaseParsedCommandLine = onReleaseParsedCommandLine;
99379         compilerHost.toPath = toPath;
99380         compilerHost.getCompilationSettings = function () { return compilerOptions; };
99381         compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
99382         compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
99383         compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
99384         compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
99385         compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
99386         compilerHost.onInvalidatedResolution = scheduleProgramUpdate;
99387         compilerHost.onChangedAutomaticTypeDirectiveNames = scheduleProgramUpdate;
99388         compilerHost.fileIsOpen = ts.returnFalse;
99389         compilerHost.getCurrentProgram = getCurrentProgram;
99390         compilerHost.writeLog = writeLog;
99391         compilerHost.getParsedCommandLine = getParsedCommandLine;
99392         var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
99393             ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
99394             currentDirectory, false);
99395         compilerHost.resolveModuleNames = host.resolveModuleNames ?
99396             (function () {
99397                 var args = [];
99398                 for (var _i = 0; _i < arguments.length; _i++) {
99399                     args[_i] = arguments[_i];
99400                 }
99401                 return host.resolveModuleNames.apply(host, args);
99402             }) :
99403             (function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
99404         compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
99405             (function () {
99406                 var args = [];
99407                 for (var _i = 0; _i < arguments.length; _i++) {
99408                     args[_i] = arguments[_i];
99409                 }
99410                 return host.resolveTypeReferenceDirectives.apply(host, args);
99411             }) :
99412             (function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
99413         var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
99414         builderProgram = readBuilderProgram(compilerOptions, compilerHost);
99415         synchronizeProgram();
99416         watchConfigFileWildCardDirectories();
99417         if (configFileName)
99418             updateExtendedConfigFilesWatches(toPath(configFileName), compilerOptions, watchOptions, ts.WatchType.ExtendedConfigFile);
99419         return configFileName ?
99420             { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close: close } :
99421             { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames: updateRootFileNames, close: close };
99422         function close() {
99423             clearInvalidateResolutionsOfFailedLookupLocations();
99424             resolutionCache.clear();
99425             ts.clearMap(sourceFilesCache, function (value) {
99426                 if (value && value.fileWatcher) {
99427                     value.fileWatcher.close();
99428                     value.fileWatcher = undefined;
99429                 }
99430             });
99431             if (configFileWatcher) {
99432                 configFileWatcher.close();
99433                 configFileWatcher = undefined;
99434             }
99435             extendedConfigCache === null || extendedConfigCache === void 0 ? void 0 : extendedConfigCache.clear();
99436             extendedConfigCache = undefined;
99437             if (sharedExtendedConfigFileWatchers) {
99438                 ts.clearMap(sharedExtendedConfigFileWatchers, ts.closeFileWatcherOf);
99439                 sharedExtendedConfigFileWatchers = undefined;
99440             }
99441             if (watchedWildcardDirectories) {
99442                 ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf);
99443                 watchedWildcardDirectories = undefined;
99444             }
99445             if (missingFilesMap) {
99446                 ts.clearMap(missingFilesMap, ts.closeFileWatcher);
99447                 missingFilesMap = undefined;
99448             }
99449             if (parsedConfigs) {
99450                 ts.clearMap(parsedConfigs, function (config) {
99451                     var _a;
99452                     (_a = config.watcher) === null || _a === void 0 ? void 0 : _a.close();
99453                     config.watcher = undefined;
99454                     if (config.watchedDirectories)
99455                         ts.clearMap(config.watchedDirectories, ts.closeFileWatcherOf);
99456                     config.watchedDirectories = undefined;
99457                 });
99458                 parsedConfigs = undefined;
99459             }
99460             if (packageJsonMap) {
99461                 ts.clearMap(packageJsonMap, ts.closeFileWatcher);
99462                 packageJsonMap = undefined;
99463             }
99464         }
99465         function getCurrentBuilderProgram() {
99466             return builderProgram;
99467         }
99468         function getCurrentProgram() {
99469             return builderProgram && builderProgram.getProgramOrUndefined();
99470         }
99471         function synchronizeProgram() {
99472             writeLog("Synchronizing program");
99473             clearInvalidateResolutionsOfFailedLookupLocations();
99474             var program = getCurrentBuilderProgram();
99475             if (hasChangedCompilerOptions) {
99476                 newLine = updateNewLine();
99477                 if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
99478                     resolutionCache.clear();
99479                 }
99480             }
99481             var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
99482             if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
99483                 if (hasChangedConfigFileParsingErrors) {
99484                     builderProgram = createProgram(undefined, undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
99485                     hasChangedConfigFileParsingErrors = false;
99486                 }
99487             }
99488             else {
99489                 createNewProgram(hasInvalidatedResolution);
99490             }
99491             changesAffectResolution = false;
99492             if (host.afterProgramCreate && program !== builderProgram) {
99493                 host.afterProgramCreate(builderProgram);
99494             }
99495             return builderProgram;
99496         }
99497         function createNewProgram(hasInvalidatedResolution) {
99498             writeLog("CreatingProgramWith::");
99499             writeLog("  roots: ".concat(JSON.stringify(rootFileNames)));
99500             writeLog("  options: ".concat(JSON.stringify(compilerOptions)));
99501             if (projectReferences)
99502                 writeLog("  projectReferences: ".concat(JSON.stringify(projectReferences)));
99503             var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
99504             hasChangedCompilerOptions = false;
99505             hasChangedConfigFileParsingErrors = false;
99506             resolutionCache.startCachingPerDirectoryResolution();
99507             compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
99508             compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
99509             builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
99510             var packageCacheEntries = ts.map(resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache().entries(), function (_a) {
99511                 var path = _a[0], data = _a[1];
99512                 return [compilerHost.realpath ? toPath(compilerHost.realpath(path)) : path, data];
99513             });
99514             resolutionCache.finishCachingPerDirectoryResolution();
99515             ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
99516             ts.updatePackageJsonWatch(packageCacheEntries, packageJsonMap || (packageJsonMap = new ts.Map()), watchPackageJsonLookupPath);
99517             if (needsUpdateInTypeRootWatch) {
99518                 resolutionCache.updateTypeRootsWatch();
99519             }
99520             if (missingFilePathsRequestedForRelease) {
99521                 for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) {
99522                     var missingFilePath = missingFilePathsRequestedForRelease_1[_i];
99523                     if (!missingFilesMap.has(missingFilePath)) {
99524                         sourceFilesCache.delete(missingFilePath);
99525                     }
99526                 }
99527                 missingFilePathsRequestedForRelease = undefined;
99528             }
99529         }
99530         function updateRootFileNames(files) {
99531             ts.Debug.assert(!configFileName, "Cannot update root file names with config file watch mode");
99532             rootFileNames = files;
99533             scheduleProgramUpdate();
99534         }
99535         function updateNewLine() {
99536             return ts.getNewLineCharacter(compilerOptions || optionsToExtendForConfigFile, function () { return host.getNewLine(); });
99537         }
99538         function toPath(fileName) {
99539             return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
99540         }
99541         function isFileMissingOnHost(hostSourceFile) {
99542             return typeof hostSourceFile === "boolean";
99543         }
99544         function isFilePresenceUnknownOnHost(hostSourceFile) {
99545             return typeof hostSourceFile.version === "boolean";
99546         }
99547         function fileExists(fileName) {
99548             var path = toPath(fileName);
99549             if (isFileMissingOnHost(sourceFilesCache.get(path))) {
99550                 return false;
99551             }
99552             return directoryStructureHost.fileExists(fileName);
99553         }
99554         function getVersionedSourceFileByPath(fileName, path, languageVersion, onError, shouldCreateNewSourceFile) {
99555             var hostSourceFile = sourceFilesCache.get(path);
99556             if (isFileMissingOnHost(hostSourceFile)) {
99557                 return undefined;
99558             }
99559             if (hostSourceFile === undefined || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) {
99560                 var sourceFile = getNewSourceFile(fileName, languageVersion, onError);
99561                 if (hostSourceFile) {
99562                     if (sourceFile) {
99563                         hostSourceFile.sourceFile = sourceFile;
99564                         hostSourceFile.version = sourceFile.version;
99565                         if (!hostSourceFile.fileWatcher) {
99566                             hostSourceFile.fileWatcher = watchFilePath(path, fileName, onSourceFileChange, ts.PollingInterval.Low, watchOptions, ts.WatchType.SourceFile);
99567                         }
99568                     }
99569                     else {
99570                         if (hostSourceFile.fileWatcher) {
99571                             hostSourceFile.fileWatcher.close();
99572                         }
99573                         sourceFilesCache.set(path, false);
99574                     }
99575                 }
99576                 else {
99577                     if (sourceFile) {
99578                         var fileWatcher = watchFilePath(path, fileName, onSourceFileChange, ts.PollingInterval.Low, watchOptions, ts.WatchType.SourceFile);
99579                         sourceFilesCache.set(path, { sourceFile: sourceFile, version: sourceFile.version, fileWatcher: fileWatcher });
99580                     }
99581                     else {
99582                         sourceFilesCache.set(path, false);
99583                     }
99584                 }
99585                 if (sourceFile) {
99586                     sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
99587                 }
99588                 return sourceFile;
99589             }
99590             return hostSourceFile.sourceFile;
99591         }
99592         function nextSourceFileVersion(path) {
99593             var hostSourceFile = sourceFilesCache.get(path);
99594             if (hostSourceFile !== undefined) {
99595                 if (isFileMissingOnHost(hostSourceFile)) {
99596                     sourceFilesCache.set(path, { version: false });
99597                 }
99598                 else {
99599                     hostSourceFile.version = false;
99600                 }
99601             }
99602         }
99603         function getSourceVersion(path) {
99604             var hostSourceFile = sourceFilesCache.get(path);
99605             return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
99606         }
99607         function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
99608             var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
99609             if (hostSourceFileInfo !== undefined) {
99610                 if (isFileMissingOnHost(hostSourceFileInfo)) {
99611                     (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path);
99612                 }
99613                 else if (hostSourceFileInfo.sourceFile === oldSourceFile) {
99614                     if (hostSourceFileInfo.fileWatcher) {
99615                         hostSourceFileInfo.fileWatcher.close();
99616                     }
99617                     sourceFilesCache.delete(oldSourceFile.resolvedPath);
99618                     if (!hasSourceFileByPath) {
99619                         resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
99620                     }
99621                 }
99622             }
99623         }
99624         function reportWatchDiagnostic(message) {
99625             if (host.onWatchStatusChange) {
99626                 host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile);
99627             }
99628         }
99629         function hasChangedAutomaticTypeDirectiveNames() {
99630             return resolutionCache.hasChangedAutomaticTypeDirectiveNames();
99631         }
99632         function clearInvalidateResolutionsOfFailedLookupLocations() {
99633             if (!timerToInvalidateFailedLookupResolutions)
99634                 return false;
99635             host.clearTimeout(timerToInvalidateFailedLookupResolutions);
99636             timerToInvalidateFailedLookupResolutions = undefined;
99637             return true;
99638         }
99639         function scheduleInvalidateResolutionsOfFailedLookupLocations() {
99640             if (!host.setTimeout || !host.clearTimeout) {
99641                 return resolutionCache.invalidateResolutionsOfFailedLookupLocations();
99642             }
99643             var pending = clearInvalidateResolutionsOfFailedLookupLocations();
99644             writeLog("Scheduling invalidateFailedLookup".concat(pending ? ", Cancelled earlier one" : ""));
99645             timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
99646         }
99647         function invalidateResolutionsOfFailedLookup() {
99648             timerToInvalidateFailedLookupResolutions = undefined;
99649             if (resolutionCache.invalidateResolutionsOfFailedLookupLocations()) {
99650                 scheduleProgramUpdate();
99651             }
99652         }
99653         function scheduleProgramUpdate() {
99654             if (!host.setTimeout || !host.clearTimeout) {
99655                 return;
99656             }
99657             if (timerToUpdateProgram) {
99658                 host.clearTimeout(timerToUpdateProgram);
99659             }
99660             writeLog("Scheduling update");
99661             timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
99662         }
99663         function scheduleProgramReload() {
99664             ts.Debug.assert(!!configFileName);
99665             reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
99666             scheduleProgramUpdate();
99667         }
99668         function updateProgramWithWatchStatus() {
99669             timerToUpdateProgram = undefined;
99670             reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
99671             updateProgram();
99672         }
99673         function updateProgram() {
99674             switch (reloadLevel) {
99675                 case ts.ConfigFileProgramReloadLevel.Partial:
99676                     ts.perfLogger.logStartUpdateProgram("PartialConfigReload");
99677                     reloadFileNamesFromConfigFile();
99678                     break;
99679                 case ts.ConfigFileProgramReloadLevel.Full:
99680                     ts.perfLogger.logStartUpdateProgram("FullConfigReload");
99681                     reloadConfigFile();
99682                     break;
99683                 default:
99684                     ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
99685                     synchronizeProgram();
99686                     break;
99687             }
99688             ts.perfLogger.logStopUpdateProgram("Done");
99689             return getCurrentBuilderProgram();
99690         }
99691         function reloadFileNamesFromConfigFile() {
99692             writeLog("Reloading new file names and options");
99693             rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
99694             if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
99695                 hasChangedConfigFileParsingErrors = true;
99696             }
99697             synchronizeProgram();
99698         }
99699         function reloadConfigFile() {
99700             writeLog("Reloading config file: ".concat(configFileName));
99701             reloadLevel = ts.ConfigFileProgramReloadLevel.None;
99702             if (cachedDirectoryStructureHost) {
99703                 cachedDirectoryStructureHost.clearCache();
99704             }
99705             parseConfigFile();
99706             hasChangedCompilerOptions = true;
99707             synchronizeProgram();
99708             watchConfigFileWildCardDirectories();
99709             updateExtendedConfigFilesWatches(toPath(configFileName), compilerOptions, watchOptions, ts.WatchType.ExtendedConfigFile);
99710         }
99711         function parseConfigFile() {
99712             setConfigFileParsingResult(ts.getParsedCommandLineOfConfigFile(configFileName, optionsToExtendForConfigFile, parseConfigFileHost, extendedConfigCache || (extendedConfigCache = new ts.Map()), watchOptionsToExtend, extraFileExtensions));
99713         }
99714         function setConfigFileParsingResult(configFileParseResult) {
99715             rootFileNames = configFileParseResult.fileNames;
99716             compilerOptions = configFileParseResult.options;
99717             watchOptions = configFileParseResult.watchOptions;
99718             projectReferences = configFileParseResult.projectReferences;
99719             wildcardDirectories = configFileParseResult.wildcardDirectories;
99720             configFileParsingDiagnostics = ts.getConfigFileParsingDiagnostics(configFileParseResult).slice();
99721             canConfigFileJsonReportNoInputFiles = ts.canJsonReportNoInputFiles(configFileParseResult.raw);
99722             hasChangedConfigFileParsingErrors = true;
99723         }
99724         function getParsedCommandLine(configFileName) {
99725             var configPath = toPath(configFileName);
99726             var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
99727             if (config) {
99728                 if (!config.reloadLevel)
99729                     return config.parsedCommandLine;
99730                 if (config.parsedCommandLine && config.reloadLevel === ts.ConfigFileProgramReloadLevel.Partial && !host.getParsedCommandLine) {
99731                     writeLog("Reloading new file names and options");
99732                     var fileNames = ts.getFileNamesFromConfigSpecs(config.parsedCommandLine.options.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost);
99733                     config.parsedCommandLine = __assign(__assign({}, config.parsedCommandLine), { fileNames: fileNames });
99734                     config.reloadLevel = undefined;
99735                     return config.parsedCommandLine;
99736                 }
99737             }
99738             writeLog("Loading config file: ".concat(configFileName));
99739             var parsedCommandLine = host.getParsedCommandLine ?
99740                 host.getParsedCommandLine(configFileName) :
99741                 getParsedCommandLineFromConfigFileHost(configFileName);
99742             if (config) {
99743                 config.parsedCommandLine = parsedCommandLine;
99744                 config.reloadLevel = undefined;
99745             }
99746             else {
99747                 (parsedConfigs || (parsedConfigs = new ts.Map())).set(configPath, config = { parsedCommandLine: parsedCommandLine });
99748             }
99749             watchReferencedProject(configFileName, configPath, config);
99750             return parsedCommandLine;
99751         }
99752         function getParsedCommandLineFromConfigFileHost(configFileName) {
99753             var onUnRecoverableConfigFileDiagnostic = parseConfigFileHost.onUnRecoverableConfigFileDiagnostic;
99754             parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
99755             var parsedCommandLine = ts.getParsedCommandLineOfConfigFile(configFileName, undefined, parseConfigFileHost, extendedConfigCache || (extendedConfigCache = new ts.Map()), watchOptionsToExtend);
99756             parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = onUnRecoverableConfigFileDiagnostic;
99757             return parsedCommandLine;
99758         }
99759         function onReleaseParsedCommandLine(fileName) {
99760             var _a;
99761             var path = toPath(fileName);
99762             var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(path);
99763             if (!config)
99764                 return;
99765             parsedConfigs.delete(path);
99766             if (config.watchedDirectories)
99767                 ts.clearMap(config.watchedDirectories, ts.closeFileWatcherOf);
99768             (_a = config.watcher) === null || _a === void 0 ? void 0 : _a.close();
99769             ts.clearSharedExtendedConfigFileWatcher(path, sharedExtendedConfigFileWatchers);
99770         }
99771         function watchFilePath(path, file, callback, pollingInterval, options, watchType) {
99772             return watchFile(file, function (fileName, eventKind) { return callback(fileName, eventKind, path); }, pollingInterval, options, watchType);
99773         }
99774         function onSourceFileChange(fileName, eventKind, path) {
99775             updateCachedSystemWithFile(fileName, path, eventKind);
99776             if (eventKind === ts.FileWatcherEventKind.Deleted && sourceFilesCache.has(path)) {
99777                 resolutionCache.invalidateResolutionOfFile(path);
99778             }
99779             nextSourceFileVersion(path);
99780             scheduleProgramUpdate();
99781         }
99782         function updateCachedSystemWithFile(fileName, path, eventKind) {
99783             if (cachedDirectoryStructureHost) {
99784                 cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
99785             }
99786         }
99787         function watchMissingFilePath(missingFilePath) {
99788             return (parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.has(missingFilePath)) ?
99789                 ts.noopFileWatcher :
99790                 watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, ts.PollingInterval.Medium, watchOptions, ts.WatchType.MissingFile);
99791         }
99792         function watchPackageJsonLookupPath(packageJsonPath) {
99793             return sourceFilesCache.has(packageJsonPath) ?
99794                 ts.noopFileWatcher :
99795                 watchFilePath(packageJsonPath, packageJsonPath, onPackageJsonChange, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson);
99796         }
99797         function onPackageJsonChange(fileName, eventKind, path) {
99798             updateCachedSystemWithFile(fileName, path, eventKind);
99799             reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
99800             changesAffectResolution = true;
99801             scheduleProgramUpdate();
99802         }
99803         function onMissingFileChange(fileName, eventKind, missingFilePath) {
99804             updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
99805             if (eventKind === ts.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath)) {
99806                 missingFilesMap.get(missingFilePath).close();
99807                 missingFilesMap.delete(missingFilePath);
99808                 nextSourceFileVersion(missingFilePath);
99809                 scheduleProgramUpdate();
99810             }
99811         }
99812         function watchConfigFileWildCardDirectories() {
99813             if (wildcardDirectories) {
99814                 ts.updateWatchingWildcardDirectories(watchedWildcardDirectories || (watchedWildcardDirectories = new ts.Map()), new ts.Map(ts.getEntries(wildcardDirectories)), watchWildcardDirectory);
99815             }
99816             else if (watchedWildcardDirectories) {
99817                 ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf);
99818             }
99819         }
99820         function watchWildcardDirectory(directory, flags) {
99821             return watchDirectory(directory, function (fileOrDirectory) {
99822                 ts.Debug.assert(!!configFileName);
99823                 var fileOrDirectoryPath = toPath(fileOrDirectory);
99824                 if (cachedDirectoryStructureHost) {
99825                     cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
99826                 }
99827                 nextSourceFileVersion(fileOrDirectoryPath);
99828                 if (ts.isIgnoredFileFromWildCardWatching({
99829                     watchedDirPath: toPath(directory),
99830                     fileOrDirectory: fileOrDirectory,
99831                     fileOrDirectoryPath: fileOrDirectoryPath,
99832                     configFileName: configFileName,
99833                     extraFileExtensions: extraFileExtensions,
99834                     options: compilerOptions,
99835                     program: getCurrentBuilderProgram() || rootFileNames,
99836                     currentDirectory: currentDirectory,
99837                     useCaseSensitiveFileNames: useCaseSensitiveFileNames,
99838                     writeLog: writeLog,
99839                     toPath: toPath,
99840                 }))
99841                     return;
99842                 if (reloadLevel !== ts.ConfigFileProgramReloadLevel.Full) {
99843                     reloadLevel = ts.ConfigFileProgramReloadLevel.Partial;
99844                     scheduleProgramUpdate();
99845                 }
99846             }, flags, watchOptions, ts.WatchType.WildcardDirectory);
99847         }
99848         function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions, watchType) {
99849             ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(extendedConfigFileName, function (_fileName, eventKind) {
99850                 var _a;
99851                 updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind);
99852                 if (extendedConfigCache)
99853                     ts.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath);
99854                 var projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects;
99855                 if (!(projects === null || projects === void 0 ? void 0 : projects.size))
99856                     return;
99857                 projects.forEach(function (projectPath) {
99858                     if (toPath(configFileName) === projectPath) {
99859                         reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
99860                     }
99861                     else {
99862                         var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
99863                         if (config)
99864                             config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
99865                         resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
99866                     }
99867                     scheduleProgramUpdate();
99868                 });
99869             }, ts.PollingInterval.High, watchOptions, watchType); }, toPath);
99870         }
99871         function watchReferencedProject(configFileName, configPath, commandLine) {
99872             var _a, _b, _c, _d, _e;
99873             commandLine.watcher || (commandLine.watcher = watchFile(configFileName, function (_fileName, eventKind) {
99874                 updateCachedSystemWithFile(configFileName, configPath, eventKind);
99875                 var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
99876                 if (config)
99877                     config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
99878                 resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
99879                 scheduleProgramUpdate();
99880             }, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
99881             if ((_b = commandLine.parsedCommandLine) === null || _b === void 0 ? void 0 : _b.wildcardDirectories) {
99882                 ts.updateWatchingWildcardDirectories(commandLine.watchedDirectories || (commandLine.watchedDirectories = new ts.Map()), new ts.Map(ts.getEntries((_c = commandLine.parsedCommandLine) === null || _c === void 0 ? void 0 : _c.wildcardDirectories)), function (directory, flags) {
99883                     var _a;
99884                     return watchDirectory(directory, function (fileOrDirectory) {
99885                         var fileOrDirectoryPath = toPath(fileOrDirectory);
99886                         if (cachedDirectoryStructureHost) {
99887                             cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
99888                         }
99889                         nextSourceFileVersion(fileOrDirectoryPath);
99890                         var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
99891                         if (!(config === null || config === void 0 ? void 0 : config.parsedCommandLine))
99892                             return;
99893                         if (ts.isIgnoredFileFromWildCardWatching({
99894                             watchedDirPath: toPath(directory),
99895                             fileOrDirectory: fileOrDirectory,
99896                             fileOrDirectoryPath: fileOrDirectoryPath,
99897                             configFileName: configFileName,
99898                             options: config.parsedCommandLine.options,
99899                             program: config.parsedCommandLine.fileNames,
99900                             currentDirectory: currentDirectory,
99901                             useCaseSensitiveFileNames: useCaseSensitiveFileNames,
99902                             writeLog: writeLog,
99903                             toPath: toPath,
99904                         }))
99905                             return;
99906                         if (config.reloadLevel !== ts.ConfigFileProgramReloadLevel.Full) {
99907                             config.reloadLevel = ts.ConfigFileProgramReloadLevel.Partial;
99908                             scheduleProgramUpdate();
99909                         }
99910                     }, flags, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.WildcardDirectoryOfReferencedProject);
99911                 });
99912             }
99913             else if (commandLine.watchedDirectories) {
99914                 ts.clearMap(commandLine.watchedDirectories, ts.closeFileWatcherOf);
99915                 commandLine.watchedDirectories = undefined;
99916             }
99917             updateExtendedConfigFilesWatches(configPath, (_d = commandLine.parsedCommandLine) === null || _d === void 0 ? void 0 : _d.options, ((_e = commandLine.parsedCommandLine) === null || _e === void 0 ? void 0 : _e.watchOptions) || watchOptions, ts.WatchType.ExtendedConfigOfReferencedProject);
99918         }
99919     }
99920     ts.createWatchProgram = createWatchProgram;
99921 })(ts || (ts = {}));
99922 var ts;
99923 (function (ts) {
99924     var UpToDateStatusType;
99925     (function (UpToDateStatusType) {
99926         UpToDateStatusType[UpToDateStatusType["Unbuildable"] = 0] = "Unbuildable";
99927         UpToDateStatusType[UpToDateStatusType["UpToDate"] = 1] = "UpToDate";
99928         UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes";
99929         UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
99930         UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
99931         UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
99932         UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
99933         UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
99934         UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
99935         UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
99936         UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
99937         UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
99938     })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
99939     function resolveConfigFileProjectName(project) {
99940         if (ts.fileExtensionIs(project, ".json")) {
99941             return project;
99942         }
99943         return ts.combinePaths(project, "tsconfig.json");
99944     }
99945     ts.resolveConfigFileProjectName = resolveConfigFileProjectName;
99946 })(ts || (ts = {}));
99947 var ts;
99948 (function (ts) {
99949     var minimumDate = new Date(-8640000000000000);
99950     var maximumDate = new Date(8640000000000000);
99951     var BuildResultFlags;
99952     (function (BuildResultFlags) {
99953         BuildResultFlags[BuildResultFlags["None"] = 0] = "None";
99954         BuildResultFlags[BuildResultFlags["Success"] = 1] = "Success";
99955         BuildResultFlags[BuildResultFlags["DeclarationOutputUnchanged"] = 2] = "DeclarationOutputUnchanged";
99956         BuildResultFlags[BuildResultFlags["ConfigFileErrors"] = 4] = "ConfigFileErrors";
99957         BuildResultFlags[BuildResultFlags["SyntaxErrors"] = 8] = "SyntaxErrors";
99958         BuildResultFlags[BuildResultFlags["TypeErrors"] = 16] = "TypeErrors";
99959         BuildResultFlags[BuildResultFlags["DeclarationEmitErrors"] = 32] = "DeclarationEmitErrors";
99960         BuildResultFlags[BuildResultFlags["EmitErrors"] = 64] = "EmitErrors";
99961         BuildResultFlags[BuildResultFlags["AnyErrors"] = 124] = "AnyErrors";
99962     })(BuildResultFlags || (BuildResultFlags = {}));
99963     function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) {
99964         var existingValue = configFileMap.get(resolved);
99965         var newValue;
99966         if (!existingValue) {
99967             newValue = createT();
99968             configFileMap.set(resolved, newValue);
99969         }
99970         return existingValue || newValue;
99971     }
99972     function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
99973         return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
99974     }
99975     function newer(date1, date2) {
99976         return date2 > date1 ? date2 : date1;
99977     }
99978     function isDeclarationFile(fileName) {
99979         return ts.fileExtensionIs(fileName, ".d.ts");
99980     }
99981     function isCircularBuildOrder(buildOrder) {
99982         return !!buildOrder && !!buildOrder.buildOrder;
99983     }
99984     ts.isCircularBuildOrder = isCircularBuildOrder;
99985     function getBuildOrderFromAnyBuildOrder(anyBuildOrder) {
99986         return isCircularBuildOrder(anyBuildOrder) ? anyBuildOrder.buildOrder : anyBuildOrder;
99987     }
99988     ts.getBuildOrderFromAnyBuildOrder = getBuildOrderFromAnyBuildOrder;
99989     function createBuilderStatusReporter(system, pretty) {
99990         return function (diagnostic) {
99991             var output = pretty ? "[".concat(ts.formatColorAndReset(ts.getLocaleTimeString(system), ts.ForegroundColorEscapeSequences.Grey), "] ") : "".concat(ts.getLocaleTimeString(system), " - ");
99992             output += "".concat(ts.flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)).concat(system.newLine + system.newLine);
99993             system.write(output);
99994         };
99995     }
99996     ts.createBuilderStatusReporter = createBuilderStatusReporter;
99997     function createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus) {
99998         var host = ts.createProgramHost(system, createProgram);
99999         host.getModifiedTime = system.getModifiedTime ? function (path) { return system.getModifiedTime(path); } : ts.returnUndefined;
100000         host.setModifiedTime = system.setModifiedTime ? function (path, date) { return system.setModifiedTime(path, date); } : ts.noop;
100001         host.deleteFile = system.deleteFile ? function (path) { return system.deleteFile(path); } : ts.noop;
100002         host.reportDiagnostic = reportDiagnostic || ts.createDiagnosticReporter(system);
100003         host.reportSolutionBuilderStatus = reportSolutionBuilderStatus || createBuilderStatusReporter(system);
100004         host.now = ts.maybeBind(system, system.now);
100005         return host;
100006     }
100007     function createSolutionBuilderHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportErrorSummary) {
100008         if (system === void 0) { system = ts.sys; }
100009         var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus);
100010         host.reportErrorSummary = reportErrorSummary;
100011         return host;
100012     }
100013     ts.createSolutionBuilderHost = createSolutionBuilderHost;
100014     function createSolutionBuilderWithWatchHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus) {
100015         if (system === void 0) { system = ts.sys; }
100016         var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus);
100017         var watchHost = ts.createWatchHost(system, reportWatchStatus);
100018         ts.copyProperties(host, watchHost);
100019         return host;
100020     }
100021     ts.createSolutionBuilderWithWatchHost = createSolutionBuilderWithWatchHost;
100022     function getCompilerOptionsOfBuildOptions(buildOptions) {
100023         var result = {};
100024         ts.commonOptionsWithBuild.forEach(function (option) {
100025             if (ts.hasProperty(buildOptions, option.name))
100026                 result[option.name] = buildOptions[option.name];
100027         });
100028         return result;
100029     }
100030     function createSolutionBuilder(host, rootNames, defaultOptions) {
100031         return createSolutionBuilderWorker(false, host, rootNames, defaultOptions);
100032     }
100033     ts.createSolutionBuilder = createSolutionBuilder;
100034     function createSolutionBuilderWithWatch(host, rootNames, defaultOptions, baseWatchOptions) {
100035         return createSolutionBuilderWorker(true, host, rootNames, defaultOptions, baseWatchOptions);
100036     }
100037     ts.createSolutionBuilderWithWatch = createSolutionBuilderWithWatch;
100038     function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) {
100039         var host = hostOrHostWithWatch;
100040         var hostWithWatch = hostOrHostWithWatch;
100041         var currentDirectory = host.getCurrentDirectory();
100042         var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100043         var baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
100044         var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return state.projectCompilerOptions; });
100045         ts.setGetSourceFileAsHashVersioned(compilerHost, host);
100046         compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
100047         compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
100048         compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
100049         var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
100050         var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
100051         if (!compilerHost.resolveModuleNames) {
100052             var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
100053             compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
100054                 return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
100055             };
100056             compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
100057         }
100058         if (!compilerHost.resolveTypeReferenceDirectives) {
100059             var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
100060             compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
100061                 return ts.loadWithLocalCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, loader_4);
100062             };
100063         }
100064         var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
100065         var state = {
100066             host: host,
100067             hostWithWatch: hostWithWatch,
100068             currentDirectory: currentDirectory,
100069             getCanonicalFileName: getCanonicalFileName,
100070             parseConfigFileHost: ts.parseConfigHostFromCompilerHostLike(host),
100071             write: ts.maybeBind(host, host.trace),
100072             options: options,
100073             baseCompilerOptions: baseCompilerOptions,
100074             rootNames: rootNames,
100075             baseWatchOptions: baseWatchOptions,
100076             resolvedConfigFilePaths: new ts.Map(),
100077             configFileCache: new ts.Map(),
100078             projectStatus: new ts.Map(),
100079             buildInfoChecked: new ts.Map(),
100080             extendedConfigCache: new ts.Map(),
100081             builderPrograms: new ts.Map(),
100082             diagnostics: new ts.Map(),
100083             projectPendingBuild: new ts.Map(),
100084             projectErrorsReported: new ts.Map(),
100085             compilerHost: compilerHost,
100086             moduleResolutionCache: moduleResolutionCache,
100087             typeReferenceDirectiveResolutionCache: typeReferenceDirectiveResolutionCache,
100088             buildOrder: undefined,
100089             readFileWithCache: function (f) { return host.readFile(f); },
100090             projectCompilerOptions: baseCompilerOptions,
100091             cache: undefined,
100092             allProjectBuildPending: true,
100093             needsSummary: true,
100094             watchAllProjectsPending: watch,
100095             currentInvalidatedProject: undefined,
100096             watch: watch,
100097             allWatchedWildcardDirectories: new ts.Map(),
100098             allWatchedInputFiles: new ts.Map(),
100099             allWatchedConfigFiles: new ts.Map(),
100100             allWatchedExtendedConfigFiles: new ts.Map(),
100101             allWatchedPackageJsonFiles: new ts.Map(),
100102             lastCachedPackageJsonLookups: new ts.Map(),
100103             timerToBuildInvalidatedProject: undefined,
100104             reportFileChangeDetected: false,
100105             watchFile: watchFile,
100106             watchDirectory: watchDirectory,
100107             writeLog: writeLog,
100108         };
100109         return state;
100110     }
100111     function toPath(state, fileName) {
100112         return ts.toPath(fileName, state.currentDirectory, state.getCanonicalFileName);
100113     }
100114     function toResolvedConfigFilePath(state, fileName) {
100115         var resolvedConfigFilePaths = state.resolvedConfigFilePaths;
100116         var path = resolvedConfigFilePaths.get(fileName);
100117         if (path !== undefined)
100118             return path;
100119         var resolvedPath = toPath(state, fileName);
100120         resolvedConfigFilePaths.set(fileName, resolvedPath);
100121         return resolvedPath;
100122     }
100123     function isParsedCommandLine(entry) {
100124         return !!entry.options;
100125     }
100126     function getCachedParsedConfigFile(state, configFilePath) {
100127         var value = state.configFileCache.get(configFilePath);
100128         return value && isParsedCommandLine(value) ? value : undefined;
100129     }
100130     function parseConfigFile(state, configFileName, configFilePath) {
100131         var configFileCache = state.configFileCache;
100132         var value = configFileCache.get(configFilePath);
100133         if (value) {
100134             return isParsedCommandLine(value) ? value : undefined;
100135         }
100136         var diagnostic;
100137         var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
100138         var parsed;
100139         if (host.getParsedCommandLine) {
100140             parsed = host.getParsedCommandLine(configFileName);
100141             if (!parsed)
100142                 diagnostic = ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, configFileName);
100143         }
100144         else {
100145             parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
100146             parsed = ts.getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache, baseWatchOptions);
100147             parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
100148         }
100149         configFileCache.set(configFilePath, parsed || diagnostic);
100150         return parsed;
100151     }
100152     function resolveProjectName(state, name) {
100153         return ts.resolveConfigFileProjectName(ts.resolvePath(state.currentDirectory, name));
100154     }
100155     function createBuildOrder(state, roots) {
100156         var temporaryMarks = new ts.Map();
100157         var permanentMarks = new ts.Map();
100158         var circularityReportStack = [];
100159         var buildOrder;
100160         var circularDiagnostics;
100161         for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {
100162             var root = roots_1[_i];
100163             visit(root);
100164         }
100165         return circularDiagnostics ?
100166             { buildOrder: buildOrder || ts.emptyArray, circularDiagnostics: circularDiagnostics } :
100167             buildOrder || ts.emptyArray;
100168         function visit(configFileName, inCircularContext) {
100169             var projPath = toResolvedConfigFilePath(state, configFileName);
100170             if (permanentMarks.has(projPath))
100171                 return;
100172             if (temporaryMarks.has(projPath)) {
100173                 if (!inCircularContext) {
100174                     (circularDiagnostics || (circularDiagnostics = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n")));
100175                 }
100176                 return;
100177             }
100178             temporaryMarks.set(projPath, true);
100179             circularityReportStack.push(configFileName);
100180             var parsed = parseConfigFile(state, configFileName, projPath);
100181             if (parsed && parsed.projectReferences) {
100182                 for (var _i = 0, _a = parsed.projectReferences; _i < _a.length; _i++) {
100183                     var ref = _a[_i];
100184                     var resolvedRefPath = resolveProjectName(state, ref.path);
100185                     visit(resolvedRefPath, inCircularContext || ref.circular);
100186                 }
100187             }
100188             circularityReportStack.pop();
100189             permanentMarks.set(projPath, true);
100190             (buildOrder || (buildOrder = [])).push(configFileName);
100191         }
100192     }
100193     function getBuildOrder(state) {
100194         return state.buildOrder || createStateBuildOrder(state);
100195     }
100196     function createStateBuildOrder(state) {
100197         var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
100198         state.resolvedConfigFilePaths.clear();
100199         var currentProjects = new ts.Map(getBuildOrderFromAnyBuildOrder(buildOrder).map(function (resolved) { return [toResolvedConfigFilePath(state, resolved), true]; }));
100200         var noopOnDelete = { onDeleteValue: ts.noop };
100201         ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
100202         ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
100203         ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
100204         ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
100205         ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
100206         ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
100207         ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
100208         if (state.watch) {
100209             ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
100210             state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
100211                 watcher.projects.forEach(function (project) {
100212                     if (!currentProjects.has(project)) {
100213                         watcher.projects.delete(project);
100214                     }
100215                 });
100216                 watcher.close();
100217             });
100218             ts.mutateMapSkippingNewValues(state.allWatchedWildcardDirectories, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcherOf); } });
100219             ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
100220             ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
100221         }
100222         return state.buildOrder = buildOrder;
100223     }
100224     function getBuildOrderFor(state, project, onlyReferences) {
100225         var resolvedProject = project && resolveProjectName(state, project);
100226         var buildOrderFromState = getBuildOrder(state);
100227         if (isCircularBuildOrder(buildOrderFromState))
100228             return buildOrderFromState;
100229         if (resolvedProject) {
100230             var projectPath_1 = toResolvedConfigFilePath(state, resolvedProject);
100231             var projectIndex = ts.findIndex(buildOrderFromState, function (configFileName) { return toResolvedConfigFilePath(state, configFileName) === projectPath_1; });
100232             if (projectIndex === -1)
100233                 return undefined;
100234         }
100235         var buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : buildOrderFromState;
100236         ts.Debug.assert(!isCircularBuildOrder(buildOrder));
100237         ts.Debug.assert(!onlyReferences || resolvedProject !== undefined);
100238         ts.Debug.assert(!onlyReferences || buildOrder[buildOrder.length - 1] === resolvedProject);
100239         return onlyReferences ? buildOrder.slice(0, buildOrder.length - 1) : buildOrder;
100240     }
100241     function enableCache(state) {
100242         if (state.cache) {
100243             disableCache(state);
100244         }
100245         var compilerHost = state.compilerHost, host = state.host;
100246         var originalReadFileWithCache = state.readFileWithCache;
100247         var originalGetSourceFile = compilerHost.getSourceFile;
100248         var _a = ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return toPath(state, fileName); }, function () {
100249             var args = [];
100250             for (var _i = 0; _i < arguments.length; _i++) {
100251                 args[_i] = arguments[_i];
100252             }
100253             return originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false));
100254         }), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, readFileWithCache = _a.readFileWithCache;
100255         state.readFileWithCache = readFileWithCache;
100256         compilerHost.getSourceFile = getSourceFileWithCache;
100257         state.cache = {
100258             originalReadFile: originalReadFile,
100259             originalFileExists: originalFileExists,
100260             originalDirectoryExists: originalDirectoryExists,
100261             originalCreateDirectory: originalCreateDirectory,
100262             originalWriteFile: originalWriteFile,
100263             originalReadFileWithCache: originalReadFileWithCache,
100264             originalGetSourceFile: originalGetSourceFile,
100265         };
100266     }
100267     function disableCache(state) {
100268         if (!state.cache)
100269             return;
100270         var cache = state.cache, host = state.host, compilerHost = state.compilerHost, extendedConfigCache = state.extendedConfigCache, moduleResolutionCache = state.moduleResolutionCache, typeReferenceDirectiveResolutionCache = state.typeReferenceDirectiveResolutionCache;
100271         host.readFile = cache.originalReadFile;
100272         host.fileExists = cache.originalFileExists;
100273         host.directoryExists = cache.originalDirectoryExists;
100274         host.createDirectory = cache.originalCreateDirectory;
100275         host.writeFile = cache.originalWriteFile;
100276         compilerHost.getSourceFile = cache.originalGetSourceFile;
100277         state.readFileWithCache = cache.originalReadFileWithCache;
100278         extendedConfigCache.clear();
100279         moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.clear();
100280         typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.clear();
100281         state.cache = undefined;
100282     }
100283     function clearProjectStatus(state, resolved) {
100284         state.projectStatus.delete(resolved);
100285         state.diagnostics.delete(resolved);
100286     }
100287     function addProjToQueue(_a, proj, reloadLevel) {
100288         var projectPendingBuild = _a.projectPendingBuild;
100289         var value = projectPendingBuild.get(proj);
100290         if (value === undefined) {
100291             projectPendingBuild.set(proj, reloadLevel);
100292         }
100293         else if (value < reloadLevel) {
100294             projectPendingBuild.set(proj, reloadLevel);
100295         }
100296     }
100297     function setupInitialBuild(state, cancellationToken) {
100298         if (!state.allProjectBuildPending)
100299             return;
100300         state.allProjectBuildPending = false;
100301         if (state.options.watch)
100302             reportWatchStatus(state, ts.Diagnostics.Starting_compilation_in_watch_mode);
100303         enableCache(state);
100304         var buildOrder = getBuildOrderFromAnyBuildOrder(getBuildOrder(state));
100305         buildOrder.forEach(function (configFileName) {
100306             return state.projectPendingBuild.set(toResolvedConfigFilePath(state, configFileName), ts.ConfigFileProgramReloadLevel.None);
100307         });
100308         if (cancellationToken) {
100309             cancellationToken.throwIfCancellationRequested();
100310         }
100311     }
100312     var InvalidatedProjectKind;
100313     (function (InvalidatedProjectKind) {
100314         InvalidatedProjectKind[InvalidatedProjectKind["Build"] = 0] = "Build";
100315         InvalidatedProjectKind[InvalidatedProjectKind["UpdateBundle"] = 1] = "UpdateBundle";
100316         InvalidatedProjectKind[InvalidatedProjectKind["UpdateOutputFileStamps"] = 2] = "UpdateOutputFileStamps";
100317     })(InvalidatedProjectKind = ts.InvalidatedProjectKind || (ts.InvalidatedProjectKind = {}));
100318     function doneInvalidatedProject(state, projectPath) {
100319         state.projectPendingBuild.delete(projectPath);
100320         state.currentInvalidatedProject = undefined;
100321         return state.diagnostics.has(projectPath) ?
100322             ts.ExitStatus.DiagnosticsPresent_OutputsSkipped :
100323             ts.ExitStatus.Success;
100324     }
100325     function createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder) {
100326         var updateOutputFileStampsPending = true;
100327         return {
100328             kind: InvalidatedProjectKind.UpdateOutputFileStamps,
100329             project: project,
100330             projectPath: projectPath,
100331             buildOrder: buildOrder,
100332             getCompilerOptions: function () { return config.options; },
100333             getCurrentDirectory: function () { return state.currentDirectory; },
100334             updateOutputFileStatmps: function () {
100335                 updateOutputTimestamps(state, config, projectPath);
100336                 updateOutputFileStampsPending = false;
100337             },
100338             done: function () {
100339                 if (updateOutputFileStampsPending) {
100340                     updateOutputTimestamps(state, config, projectPath);
100341                 }
100342                 return doneInvalidatedProject(state, projectPath);
100343             }
100344         };
100345     }
100346     var BuildStep;
100347     (function (BuildStep) {
100348         BuildStep[BuildStep["CreateProgram"] = 0] = "CreateProgram";
100349         BuildStep[BuildStep["SyntaxDiagnostics"] = 1] = "SyntaxDiagnostics";
100350         BuildStep[BuildStep["SemanticDiagnostics"] = 2] = "SemanticDiagnostics";
100351         BuildStep[BuildStep["Emit"] = 3] = "Emit";
100352         BuildStep[BuildStep["EmitBundle"] = 4] = "EmitBundle";
100353         BuildStep[BuildStep["EmitBuildInfo"] = 5] = "EmitBuildInfo";
100354         BuildStep[BuildStep["BuildInvalidatedProjectOfBundle"] = 6] = "BuildInvalidatedProjectOfBundle";
100355         BuildStep[BuildStep["QueueReferencingProjects"] = 7] = "QueueReferencingProjects";
100356         BuildStep[BuildStep["Done"] = 8] = "Done";
100357     })(BuildStep || (BuildStep = {}));
100358     function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath, projectIndex, config, buildOrder) {
100359         var step = kind === InvalidatedProjectKind.Build ? BuildStep.CreateProgram : BuildStep.EmitBundle;
100360         var program;
100361         var buildResult;
100362         var invalidatedProjectOfBundle;
100363         return kind === InvalidatedProjectKind.Build ?
100364             {
100365                 kind: kind,
100366                 project: project,
100367                 projectPath: projectPath,
100368                 buildOrder: buildOrder,
100369                 getCompilerOptions: function () { return config.options; },
100370                 getCurrentDirectory: function () { return state.currentDirectory; },
100371                 getBuilderProgram: function () { return withProgramOrUndefined(ts.identity); },
100372                 getProgram: function () {
100373                     return withProgramOrUndefined(function (program) { return program.getProgramOrUndefined(); });
100374                 },
100375                 getSourceFile: function (fileName) {
100376                     return withProgramOrUndefined(function (program) { return program.getSourceFile(fileName); });
100377                 },
100378                 getSourceFiles: function () {
100379                     return withProgramOrEmptyArray(function (program) { return program.getSourceFiles(); });
100380                 },
100381                 getOptionsDiagnostics: function (cancellationToken) {
100382                     return withProgramOrEmptyArray(function (program) { return program.getOptionsDiagnostics(cancellationToken); });
100383                 },
100384                 getGlobalDiagnostics: function (cancellationToken) {
100385                     return withProgramOrEmptyArray(function (program) { return program.getGlobalDiagnostics(cancellationToken); });
100386                 },
100387                 getConfigFileParsingDiagnostics: function () {
100388                     return withProgramOrEmptyArray(function (program) { return program.getConfigFileParsingDiagnostics(); });
100389                 },
100390                 getSyntacticDiagnostics: function (sourceFile, cancellationToken) {
100391                     return withProgramOrEmptyArray(function (program) { return program.getSyntacticDiagnostics(sourceFile, cancellationToken); });
100392                 },
100393                 getAllDependencies: function (sourceFile) {
100394                     return withProgramOrEmptyArray(function (program) { return program.getAllDependencies(sourceFile); });
100395                 },
100396                 getSemanticDiagnostics: function (sourceFile, cancellationToken) {
100397                     return withProgramOrEmptyArray(function (program) { return program.getSemanticDiagnostics(sourceFile, cancellationToken); });
100398                 },
100399                 getSemanticDiagnosticsOfNextAffectedFile: function (cancellationToken, ignoreSourceFile) {
100400                     return withProgramOrUndefined(function (program) {
100401                         return (program.getSemanticDiagnosticsOfNextAffectedFile) &&
100402                             program.getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile);
100403                     });
100404                 },
100405                 emit: function (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
100406                     if (targetSourceFile || emitOnlyDtsFiles) {
100407                         return withProgramOrUndefined(function (program) { var _a, _b; return program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project))); });
100408                     }
100409                     executeSteps(BuildStep.SemanticDiagnostics, cancellationToken);
100410                     if (step === BuildStep.EmitBuildInfo) {
100411                         return emitBuildInfo(writeFile, cancellationToken);
100412                     }
100413                     if (step !== BuildStep.Emit)
100414                         return undefined;
100415                     return emit(writeFile, cancellationToken, customTransformers);
100416                 },
100417                 done: done
100418             } :
100419             {
100420                 kind: kind,
100421                 project: project,
100422                 projectPath: projectPath,
100423                 buildOrder: buildOrder,
100424                 getCompilerOptions: function () { return config.options; },
100425                 getCurrentDirectory: function () { return state.currentDirectory; },
100426                 emit: function (writeFile, customTransformers) {
100427                     if (step !== BuildStep.EmitBundle)
100428                         return invalidatedProjectOfBundle;
100429                     return emitBundle(writeFile, customTransformers);
100430                 },
100431                 done: done,
100432             };
100433         function done(cancellationToken, writeFile, customTransformers) {
100434             executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
100435             return doneInvalidatedProject(state, projectPath);
100436         }
100437         function withProgramOrUndefined(action) {
100438             executeSteps(BuildStep.CreateProgram);
100439             return program && action(program);
100440         }
100441         function withProgramOrEmptyArray(action) {
100442             return withProgramOrUndefined(action) || ts.emptyArray;
100443         }
100444         function createProgram() {
100445             var _a, _b;
100446             ts.Debug.assert(program === undefined);
100447             if (state.options.dry) {
100448                 reportStatus(state, ts.Diagnostics.A_non_dry_build_would_build_project_0, project);
100449                 buildResult = BuildResultFlags.Success;
100450                 step = BuildStep.QueueReferencingProjects;
100451                 return;
100452             }
100453             if (state.options.verbose)
100454                 reportStatus(state, ts.Diagnostics.Building_project_0, project);
100455             if (config.fileNames.length === 0) {
100456                 reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
100457                 buildResult = BuildResultFlags.None;
100458                 step = BuildStep.QueueReferencingProjects;
100459                 return;
100460             }
100461             var host = state.host, compilerHost = state.compilerHost;
100462             state.projectCompilerOptions = config.options;
100463             (_a = state.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.update(config.options);
100464             (_b = state.typeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.update(config.options);
100465             program = host.createProgram(config.fileNames, config.options, compilerHost, getOldProgram(state, projectPath, config), ts.getConfigFileParsingDiagnostics(config), config.projectReferences);
100466             if (state.watch) {
100467                 state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
100468                     var path = _a[0], data = _a[1];
100469                     return [state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data];
100470                 }));
100471                 state.builderPrograms.set(projectPath, program);
100472             }
100473             step++;
100474         }
100475         function handleDiagnostics(diagnostics, errorFlags, errorType) {
100476             var _a;
100477             if (diagnostics.length) {
100478                 (_a = buildErrors(state, projectPath, program, config, diagnostics, errorFlags, errorType), buildResult = _a.buildResult, step = _a.step);
100479             }
100480             else {
100481                 step++;
100482             }
100483         }
100484         function getSyntaxDiagnostics(cancellationToken) {
100485             ts.Debug.assertIsDefined(program);
100486             handleDiagnostics(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], program.getConfigFileParsingDiagnostics(), true), program.getOptionsDiagnostics(cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true), program.getSyntacticDiagnostics(undefined, cancellationToken), true), BuildResultFlags.SyntaxErrors, "Syntactic");
100487         }
100488         function getSemanticDiagnostics(cancellationToken) {
100489             handleDiagnostics(ts.Debug.checkDefined(program).getSemanticDiagnostics(undefined, cancellationToken), BuildResultFlags.TypeErrors, "Semantic");
100490         }
100491         function emit(writeFileCallback, cancellationToken, customTransformers) {
100492             var _a;
100493             var _b, _c;
100494             ts.Debug.assertIsDefined(program);
100495             ts.Debug.assert(step === BuildStep.Emit);
100496             program.backupState();
100497             var declDiagnostics;
100498             var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
100499             var outputFiles = [];
100500             var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
100501             if (declDiagnostics) {
100502                 program.restoreState();
100503                 (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
100504                 return {
100505                     emitSkipped: true,
100506                     diagnostics: emitResult.diagnostics
100507                 };
100508             }
100509             var host = state.host, compilerHost = state.compilerHost;
100510             var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
100511             var newestDeclarationFileContentChangedTime = minimumDate;
100512             var anyDtsChanged = false;
100513             var emitterDiagnostics = ts.createDiagnosticCollection();
100514             var emittedOutputs = new ts.Map();
100515             outputFiles.forEach(function (_a) {
100516                 var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
100517                 var priorChangeTime;
100518                 if (!anyDtsChanged && isDeclarationFile(name)) {
100519                     if (host.fileExists(name) && state.readFileWithCache(name) === text) {
100520                         priorChangeTime = host.getModifiedTime(name);
100521                     }
100522                     else {
100523                         resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
100524                         anyDtsChanged = true;
100525                     }
100526                 }
100527                 emittedOutputs.set(toPath(state, name), name);
100528                 ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
100529                 if (priorChangeTime !== undefined) {
100530                     newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
100531                 }
100532             });
100533             finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime, anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
100534             return emitResult;
100535         }
100536         function emitBuildInfo(writeFileCallback, cancellationToken) {
100537             ts.Debug.assertIsDefined(program);
100538             ts.Debug.assert(step === BuildStep.EmitBuildInfo);
100539             var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
100540             if (emitResult.diagnostics.length) {
100541                 reportErrors(state, emitResult.diagnostics);
100542                 state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
100543                 buildResult = BuildResultFlags.EmitErrors & buildResult;
100544             }
100545             if (emitResult.emittedFiles && state.write) {
100546                 emitResult.emittedFiles.forEach(function (name) { return listEmittedFile(state, config, name); });
100547             }
100548             afterProgramDone(state, program, config);
100549             step = BuildStep.QueueReferencingProjects;
100550             return emitResult;
100551         }
100552         function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
100553             var _a;
100554             var emitDiagnostics = emitterDiagnostics.getDiagnostics();
100555             if (emitDiagnostics.length) {
100556                 (_a = buildErrors(state, projectPath, program, config, emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"), buildResult = _a.buildResult, step = _a.step);
100557                 return emitDiagnostics;
100558             }
100559             if (state.write) {
100560                 emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
100561             }
100562             var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
100563             state.diagnostics.delete(projectPath);
100564             state.projectStatus.set(projectPath, {
100565                 type: ts.UpToDateStatusType.UpToDate,
100566                 newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
100567                     maximumDate :
100568                     newestDeclarationFileContentChangedTime,
100569                 oldestOutputFileName: oldestOutputFileName
100570             });
100571             afterProgramDone(state, program, config);
100572             step = BuildStep.QueueReferencingProjects;
100573             buildResult = resultFlags;
100574             return emitDiagnostics;
100575         }
100576         function emitBundle(writeFileCallback, customTransformers) {
100577             var _a, _b;
100578             ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
100579             if (state.options.dry) {
100580                 reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
100581                 buildResult = BuildResultFlags.Success;
100582                 step = BuildStep.QueueReferencingProjects;
100583                 return undefined;
100584             }
100585             if (state.options.verbose)
100586                 reportStatus(state, ts.Diagnostics.Updating_output_of_project_0, project);
100587             var compilerHost = state.compilerHost;
100588             state.projectCompilerOptions = config.options;
100589             var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
100590                 var refName = resolveProjectName(state, ref.path);
100591                 return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
100592             }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
100593             if (ts.isString(outputFiles)) {
100594                 reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
100595                 step = BuildStep.BuildInvalidatedProjectOfBundle;
100596                 return invalidatedProjectOfBundle = createBuildOrUpdateInvalidedProject(InvalidatedProjectKind.Build, state, project, projectPath, projectIndex, config, buildOrder);
100597             }
100598             ts.Debug.assert(!!outputFiles.length);
100599             var emitterDiagnostics = ts.createDiagnosticCollection();
100600             var emittedOutputs = new ts.Map();
100601             outputFiles.forEach(function (_a) {
100602                 var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
100603                 emittedOutputs.set(toPath(state, name), name);
100604                 ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
100605             });
100606             var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
100607             return { emitSkipped: false, diagnostics: emitDiagnostics };
100608         }
100609         function executeSteps(till, cancellationToken, writeFile, customTransformers) {
100610             while (step <= till && step < BuildStep.Done) {
100611                 var currentStep = step;
100612                 switch (step) {
100613                     case BuildStep.CreateProgram:
100614                         createProgram();
100615                         break;
100616                     case BuildStep.SyntaxDiagnostics:
100617                         getSyntaxDiagnostics(cancellationToken);
100618                         break;
100619                     case BuildStep.SemanticDiagnostics:
100620                         getSemanticDiagnostics(cancellationToken);
100621                         break;
100622                     case BuildStep.Emit:
100623                         emit(writeFile, cancellationToken, customTransformers);
100624                         break;
100625                     case BuildStep.EmitBuildInfo:
100626                         emitBuildInfo(writeFile, cancellationToken);
100627                         break;
100628                     case BuildStep.EmitBundle:
100629                         emitBundle(writeFile, customTransformers);
100630                         break;
100631                     case BuildStep.BuildInvalidatedProjectOfBundle:
100632                         ts.Debug.checkDefined(invalidatedProjectOfBundle).done(cancellationToken, writeFile, customTransformers);
100633                         step = BuildStep.Done;
100634                         break;
100635                     case BuildStep.QueueReferencingProjects:
100636                         queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, ts.Debug.checkDefined(buildResult));
100637                         step++;
100638                         break;
100639                     case BuildStep.Done:
100640                     default:
100641                         ts.assertType(step);
100642                 }
100643                 ts.Debug.assert(step > currentStep);
100644             }
100645         }
100646     }
100647     function needsBuild(_a, status, config) {
100648         var options = _a.options;
100649         if (status.type !== ts.UpToDateStatusType.OutOfDateWithPrepend || options.force)
100650             return true;
100651         return config.fileNames.length === 0 ||
100652             !!ts.getConfigFileParsingDiagnostics(config).length ||
100653             !ts.isIncrementalCompilation(config.options);
100654     }
100655     function getNextInvalidatedProject(state, buildOrder, reportQueue) {
100656         if (!state.projectPendingBuild.size)
100657             return undefined;
100658         if (isCircularBuildOrder(buildOrder))
100659             return undefined;
100660         if (state.currentInvalidatedProject) {
100661             return ts.arrayIsEqualTo(state.currentInvalidatedProject.buildOrder, buildOrder) ?
100662                 state.currentInvalidatedProject :
100663                 undefined;
100664         }
100665         var options = state.options, projectPendingBuild = state.projectPendingBuild;
100666         for (var projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
100667             var project = buildOrder[projectIndex];
100668             var projectPath = toResolvedConfigFilePath(state, project);
100669             var reloadLevel = state.projectPendingBuild.get(projectPath);
100670             if (reloadLevel === undefined)
100671                 continue;
100672             if (reportQueue) {
100673                 reportQueue = false;
100674                 reportBuildQueue(state, buildOrder);
100675             }
100676             var config = parseConfigFile(state, project, projectPath);
100677             if (!config) {
100678                 reportParseConfigFileDiagnostic(state, projectPath);
100679                 projectPendingBuild.delete(projectPath);
100680                 continue;
100681             }
100682             if (reloadLevel === ts.ConfigFileProgramReloadLevel.Full) {
100683                 watchConfigFile(state, project, projectPath, config);
100684                 watchExtendedConfigFiles(state, projectPath, config);
100685                 watchWildCardDirectories(state, project, projectPath, config);
100686                 watchInputFiles(state, project, projectPath, config);
100687                 watchPackageJsonFiles(state, project, projectPath, config);
100688             }
100689             else if (reloadLevel === ts.ConfigFileProgramReloadLevel.Partial) {
100690                 config.fileNames = ts.getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, ts.getDirectoryPath(project), config.options, state.parseConfigFileHost);
100691                 ts.updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, ts.canJsonReportNoInputFiles(config.raw));
100692                 watchInputFiles(state, project, projectPath, config);
100693                 watchPackageJsonFiles(state, project, projectPath, config);
100694             }
100695             var status = getUpToDateStatus(state, config, projectPath);
100696             verboseReportProjectStatus(state, project, status);
100697             if (!options.force) {
100698                 if (status.type === ts.UpToDateStatusType.UpToDate) {
100699                     reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
100700                     projectPendingBuild.delete(projectPath);
100701                     if (options.dry) {
100702                         reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date, project);
100703                     }
100704                     continue;
100705                 }
100706                 if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
100707                     reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
100708                     return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
100709                 }
100710             }
100711             if (status.type === ts.UpToDateStatusType.UpstreamBlocked) {
100712                 reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
100713                 projectPendingBuild.delete(projectPath);
100714                 if (options.verbose) {
100715                     reportStatus(state, status.upstreamProjectBlocked ?
100716                         ts.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built :
100717                         ts.Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName);
100718                 }
100719                 continue;
100720             }
100721             if (status.type === ts.UpToDateStatusType.ContainerOnly) {
100722                 reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
100723                 projectPendingBuild.delete(projectPath);
100724                 continue;
100725             }
100726             return createBuildOrUpdateInvalidedProject(needsBuild(state, status, config) ?
100727                 InvalidatedProjectKind.Build :
100728                 InvalidatedProjectKind.UpdateBundle, state, project, projectPath, projectIndex, config, buildOrder);
100729         }
100730         return undefined;
100731     }
100732     function listEmittedFile(_a, proj, file) {
100733         var write = _a.write;
100734         if (write && proj.options.listEmittedFiles) {
100735             write("TSFILE: ".concat(file));
100736         }
100737     }
100738     function getOldProgram(_a, proj, parsed) {
100739         var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
100740         if (options.force)
100741             return undefined;
100742         var value = builderPrograms.get(proj);
100743         if (value)
100744             return value;
100745         return ts.readBuilderProgram(parsed.options, compilerHost);
100746     }
100747     function afterProgramDone(state, program, config) {
100748         if (program) {
100749             if (program && state.write)
100750                 ts.listFiles(program, state.write);
100751             if (state.host.afterProgramEmitAndDiagnostics) {
100752                 state.host.afterProgramEmitAndDiagnostics(program);
100753             }
100754             program.releaseProgram();
100755         }
100756         else if (state.host.afterEmitBundle) {
100757             state.host.afterEmitBundle(config);
100758         }
100759         state.projectCompilerOptions = state.baseCompilerOptions;
100760     }
100761     function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
100762         var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
100763         reportAndStoreErrors(state, resolvedPath, diagnostics);
100764         state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: "".concat(errorType, " errors") });
100765         if (canEmitBuildInfo)
100766             return { buildResult: buildResult, step: BuildStep.EmitBuildInfo };
100767         afterProgramDone(state, program, config);
100768         return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
100769     }
100770     function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
100771         var tsconfigTime = ts.getModifiedTime(state.host, configFile);
100772         if (oldestOutputFileTime < tsconfigTime) {
100773             return {
100774                 type: ts.UpToDateStatusType.OutOfDateWithSelf,
100775                 outOfDateOutputFileName: oldestOutputFileName,
100776                 newerInputFileName: configFile
100777             };
100778         }
100779     }
100780     function getUpToDateStatusWorker(state, project, resolvedPath) {
100781         var force = !!state.options.force;
100782         var newestInputFileName = undefined;
100783         var newestInputFileTime = minimumDate;
100784         var host = state.host;
100785         for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
100786             var inputFile = _a[_i];
100787             if (!host.fileExists(inputFile)) {
100788                 return {
100789                     type: ts.UpToDateStatusType.Unbuildable,
100790                     reason: "".concat(inputFile, " does not exist")
100791                 };
100792             }
100793             if (!force) {
100794                 var inputTime = ts.getModifiedTime(host, inputFile);
100795                 if (inputTime > newestInputFileTime) {
100796                     newestInputFileName = inputFile;
100797                     newestInputFileTime = inputTime;
100798                 }
100799             }
100800         }
100801         if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
100802             return {
100803                 type: ts.UpToDateStatusType.ContainerOnly
100804             };
100805         }
100806         var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
100807         var oldestOutputFileName = "(none)";
100808         var oldestOutputFileTime = maximumDate;
100809         var newestOutputFileName = "(none)";
100810         var newestOutputFileTime = minimumDate;
100811         var missingOutputFileName;
100812         var newestDeclarationFileContentChangedTime = minimumDate;
100813         var isOutOfDateWithInputs = false;
100814         if (!force) {
100815             for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
100816                 var output = outputs_1[_b];
100817                 if (!host.fileExists(output)) {
100818                     missingOutputFileName = output;
100819                     break;
100820                 }
100821                 var outputTime = ts.getModifiedTime(host, output);
100822                 if (outputTime < oldestOutputFileTime) {
100823                     oldestOutputFileTime = outputTime;
100824                     oldestOutputFileName = output;
100825                 }
100826                 if (outputTime < newestInputFileTime) {
100827                     isOutOfDateWithInputs = true;
100828                     break;
100829                 }
100830                 if (outputTime > newestOutputFileTime) {
100831                     newestOutputFileTime = outputTime;
100832                     newestOutputFileName = output;
100833                 }
100834                 if (isDeclarationFile(output)) {
100835                     var outputModifiedTime = ts.getModifiedTime(host, output);
100836                     newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
100837                 }
100838             }
100839         }
100840         var pseudoUpToDate = false;
100841         var usesPrepend = false;
100842         var upstreamChangedProject;
100843         if (project.projectReferences) {
100844             state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
100845             for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
100846                 var ref = _d[_c];
100847                 usesPrepend = usesPrepend || !!(ref.prepend);
100848                 var resolvedRef = ts.resolveProjectReferencePath(ref);
100849                 var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
100850                 var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
100851                 if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
100852                     refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
100853                     continue;
100854                 }
100855                 if (refStatus.type === ts.UpToDateStatusType.Unbuildable ||
100856                     refStatus.type === ts.UpToDateStatusType.UpstreamBlocked) {
100857                     return {
100858                         type: ts.UpToDateStatusType.UpstreamBlocked,
100859                         upstreamProjectName: ref.path,
100860                         upstreamProjectBlocked: refStatus.type === ts.UpToDateStatusType.UpstreamBlocked
100861                     };
100862                 }
100863                 if (refStatus.type !== ts.UpToDateStatusType.UpToDate) {
100864                     return {
100865                         type: ts.UpToDateStatusType.UpstreamOutOfDate,
100866                         upstreamProjectName: ref.path
100867                     };
100868                 }
100869                 if (!force && !missingOutputFileName) {
100870                     if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
100871                         continue;
100872                     }
100873                     if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
100874                         pseudoUpToDate = true;
100875                         upstreamChangedProject = ref.path;
100876                         continue;
100877                     }
100878                     ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
100879                     return {
100880                         type: ts.UpToDateStatusType.OutOfDateWithUpstream,
100881                         outOfDateOutputFileName: oldestOutputFileName,
100882                         newerProjectName: ref.path
100883                     };
100884                 }
100885             }
100886         }
100887         if (missingOutputFileName !== undefined) {
100888             return {
100889                 type: ts.UpToDateStatusType.OutputMissing,
100890                 missingOutputFileName: missingOutputFileName
100891             };
100892         }
100893         if (isOutOfDateWithInputs) {
100894             return {
100895                 type: ts.UpToDateStatusType.OutOfDateWithSelf,
100896                 outOfDateOutputFileName: oldestOutputFileName,
100897                 newerInputFileName: newestInputFileName
100898             };
100899         }
100900         else {
100901             var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
100902             if (configStatus)
100903                 return configStatus;
100904             var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
100905             if (extendedConfigStatus)
100906                 return extendedConfigStatus;
100907             var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
100908                 var path = _a[0];
100909                 return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
100910             });
100911             if (dependentPackageFileStatus)
100912                 return dependentPackageFileStatus;
100913         }
100914         if (!force && !state.buildInfoChecked.has(resolvedPath)) {
100915             state.buildInfoChecked.set(resolvedPath, true);
100916             var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
100917             if (buildInfoPath) {
100918                 var value = state.readFileWithCache(buildInfoPath);
100919                 var buildInfo = value && ts.getBuildInfo(value);
100920                 if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
100921                     return {
100922                         type: ts.UpToDateStatusType.TsVersionOutputOfDate,
100923                         version: buildInfo.version
100924                     };
100925                 }
100926             }
100927         }
100928         if (usesPrepend && pseudoUpToDate) {
100929             return {
100930                 type: ts.UpToDateStatusType.OutOfDateWithPrepend,
100931                 outOfDateOutputFileName: oldestOutputFileName,
100932                 newerProjectName: upstreamChangedProject
100933             };
100934         }
100935         return {
100936             type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
100937             newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
100938             newestInputFileTime: newestInputFileTime,
100939             newestOutputFileTime: newestOutputFileTime,
100940             newestInputFileName: newestInputFileName,
100941             newestOutputFileName: newestOutputFileName,
100942             oldestOutputFileName: oldestOutputFileName
100943         };
100944     }
100945     function getUpToDateStatus(state, project, resolvedPath) {
100946         if (project === undefined) {
100947             return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
100948         }
100949         var prior = state.projectStatus.get(resolvedPath);
100950         if (prior !== undefined) {
100951             return prior;
100952         }
100953         var actual = getUpToDateStatusWorker(state, project, resolvedPath);
100954         state.projectStatus.set(resolvedPath, actual);
100955         return actual;
100956     }
100957     function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
100958         if (proj.options.noEmit)
100959             return priorNewestUpdateTime;
100960         var host = state.host;
100961         var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
100962         if (!skipOutputs || outputs.length !== skipOutputs.size) {
100963             var reportVerbose = !!state.options.verbose;
100964             var now = host.now ? host.now() : new Date();
100965             for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
100966                 var file = outputs_2[_i];
100967                 if (skipOutputs && skipOutputs.has(toPath(state, file))) {
100968                     continue;
100969                 }
100970                 if (reportVerbose) {
100971                     reportVerbose = false;
100972                     reportStatus(state, verboseMessage, proj.options.configFilePath);
100973                 }
100974                 if (isDeclarationFile(file)) {
100975                     priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
100976                 }
100977                 host.setModifiedTime(file, now);
100978             }
100979         }
100980         return priorNewestUpdateTime;
100981     }
100982     function updateOutputTimestamps(state, proj, resolvedPath) {
100983         if (state.options.dry) {
100984             return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
100985         }
100986         var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
100987         state.projectStatus.set(resolvedPath, {
100988             type: ts.UpToDateStatusType.UpToDate,
100989             newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
100990             oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
100991         });
100992     }
100993     function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
100994         if (buildResult & BuildResultFlags.AnyErrors)
100995             return;
100996         if (!config.options.composite)
100997             return;
100998         for (var index = projectIndex + 1; index < buildOrder.length; index++) {
100999             var nextProject = buildOrder[index];
101000             var nextProjectPath = toResolvedConfigFilePath(state, nextProject);
101001             if (state.projectPendingBuild.has(nextProjectPath))
101002                 continue;
101003             var nextProjectConfig = parseConfigFile(state, nextProject, nextProjectPath);
101004             if (!nextProjectConfig || !nextProjectConfig.projectReferences)
101005                 continue;
101006             for (var _i = 0, _a = nextProjectConfig.projectReferences; _i < _a.length; _i++) {
101007                 var ref = _a[_i];
101008                 var resolvedRefPath = resolveProjectName(state, ref.path);
101009                 if (toResolvedConfigFilePath(state, resolvedRefPath) !== projectPath)
101010                     continue;
101011                 var status = state.projectStatus.get(nextProjectPath);
101012                 if (status) {
101013                     switch (status.type) {
101014                         case ts.UpToDateStatusType.UpToDate:
101015                             if (buildResult & BuildResultFlags.DeclarationOutputUnchanged) {
101016                                 if (ref.prepend) {
101017                                     state.projectStatus.set(nextProjectPath, {
101018                                         type: ts.UpToDateStatusType.OutOfDateWithPrepend,
101019                                         outOfDateOutputFileName: status.oldestOutputFileName,
101020                                         newerProjectName: project
101021                                     });
101022                                 }
101023                                 else {
101024                                     status.type = ts.UpToDateStatusType.UpToDateWithUpstreamTypes;
101025                                 }
101026                                 break;
101027                             }
101028                         case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
101029                         case ts.UpToDateStatusType.OutOfDateWithPrepend:
101030                             if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
101031                                 state.projectStatus.set(nextProjectPath, {
101032                                     type: ts.UpToDateStatusType.OutOfDateWithUpstream,
101033                                     outOfDateOutputFileName: status.type === ts.UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName,
101034                                     newerProjectName: project
101035                                 });
101036                             }
101037                             break;
101038                         case ts.UpToDateStatusType.UpstreamBlocked:
101039                             if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
101040                                 clearProjectStatus(state, nextProjectPath);
101041                             }
101042                             break;
101043                     }
101044                 }
101045                 addProjToQueue(state, nextProjectPath, ts.ConfigFileProgramReloadLevel.None);
101046                 break;
101047             }
101048         }
101049     }
101050     function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
101051         var buildOrder = getBuildOrderFor(state, project, onlyReferences);
101052         if (!buildOrder)
101053             return ts.ExitStatus.InvalidProject_OutputsSkipped;
101054         setupInitialBuild(state, cancellationToken);
101055         var reportQueue = true;
101056         var successfulProjects = 0;
101057         while (true) {
101058             var invalidatedProject = getNextInvalidatedProject(state, buildOrder, reportQueue);
101059             if (!invalidatedProject)
101060                 break;
101061             reportQueue = false;
101062             invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
101063             if (!state.diagnostics.has(invalidatedProject.projectPath))
101064                 successfulProjects++;
101065         }
101066         disableCache(state);
101067         reportErrorSummary(state, buildOrder);
101068         startWatching(state, buildOrder);
101069         return isCircularBuildOrder(buildOrder)
101070             ? ts.ExitStatus.ProjectReferenceCycle_OutputsSkipped
101071             : !buildOrder.some(function (p) { return state.diagnostics.has(toResolvedConfigFilePath(state, p)); })
101072                 ? ts.ExitStatus.Success
101073                 : successfulProjects
101074                     ? ts.ExitStatus.DiagnosticsPresent_OutputsGenerated
101075                     : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
101076     }
101077     function clean(state, project, onlyReferences) {
101078         var buildOrder = getBuildOrderFor(state, project, onlyReferences);
101079         if (!buildOrder)
101080             return ts.ExitStatus.InvalidProject_OutputsSkipped;
101081         if (isCircularBuildOrder(buildOrder)) {
101082             reportErrors(state, buildOrder.circularDiagnostics);
101083             return ts.ExitStatus.ProjectReferenceCycle_OutputsSkipped;
101084         }
101085         var options = state.options, host = state.host;
101086         var filesToDelete = options.dry ? [] : undefined;
101087         for (var _i = 0, buildOrder_1 = buildOrder; _i < buildOrder_1.length; _i++) {
101088             var proj = buildOrder_1[_i];
101089             var resolvedPath = toResolvedConfigFilePath(state, proj);
101090             var parsed = parseConfigFile(state, proj, resolvedPath);
101091             if (parsed === undefined) {
101092                 reportParseConfigFileDiagnostic(state, resolvedPath);
101093                 continue;
101094             }
101095             var outputs = ts.getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
101096             if (!outputs.length)
101097                 continue;
101098             var inputFileNames = new ts.Set(parsed.fileNames.map(function (f) { return toPath(state, f); }));
101099             for (var _a = 0, outputs_3 = outputs; _a < outputs_3.length; _a++) {
101100                 var output = outputs_3[_a];
101101                 if (inputFileNames.has(toPath(state, output)))
101102                     continue;
101103                 if (host.fileExists(output)) {
101104                     if (filesToDelete) {
101105                         filesToDelete.push(output);
101106                     }
101107                     else {
101108                         host.deleteFile(output);
101109                         invalidateProject(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None);
101110                     }
101111                 }
101112             }
101113         }
101114         if (filesToDelete) {
101115             reportStatus(state, ts.Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0, filesToDelete.map(function (f) { return "\r\n * ".concat(f); }).join(""));
101116         }
101117         return ts.ExitStatus.Success;
101118     }
101119     function invalidateProject(state, resolved, reloadLevel) {
101120         if (state.host.getParsedCommandLine && reloadLevel === ts.ConfigFileProgramReloadLevel.Partial) {
101121             reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
101122         }
101123         if (reloadLevel === ts.ConfigFileProgramReloadLevel.Full) {
101124             state.configFileCache.delete(resolved);
101125             state.buildOrder = undefined;
101126         }
101127         state.needsSummary = true;
101128         clearProjectStatus(state, resolved);
101129         addProjToQueue(state, resolved, reloadLevel);
101130         enableCache(state);
101131     }
101132     function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
101133         state.reportFileChangeDetected = true;
101134         invalidateProject(state, resolvedPath, reloadLevel);
101135         scheduleBuildInvalidatedProject(state);
101136     }
101137     function scheduleBuildInvalidatedProject(state) {
101138         var hostWithWatch = state.hostWithWatch;
101139         if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) {
101140             return;
101141         }
101142         if (state.timerToBuildInvalidatedProject) {
101143             hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
101144         }
101145         state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, 250, state);
101146     }
101147     function buildNextInvalidatedProject(state) {
101148         state.timerToBuildInvalidatedProject = undefined;
101149         if (state.reportFileChangeDetected) {
101150             state.reportFileChangeDetected = false;
101151             state.projectErrorsReported.clear();
101152             reportWatchStatus(state, ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
101153         }
101154         var buildOrder = getBuildOrder(state);
101155         var invalidatedProject = getNextInvalidatedProject(state, buildOrder, false);
101156         if (invalidatedProject) {
101157             invalidatedProject.done();
101158             if (state.projectPendingBuild.size) {
101159                 if (state.watch && !state.timerToBuildInvalidatedProject) {
101160                     scheduleBuildInvalidatedProject(state);
101161                 }
101162                 return;
101163             }
101164         }
101165         disableCache(state);
101166         reportErrorSummary(state, buildOrder);
101167     }
101168     function watchConfigFile(state, resolved, resolvedPath, parsed) {
101169         if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
101170             return;
101171         state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
101172             invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
101173         }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
101174     }
101175     function watchExtendedConfigFiles(state, resolvedPath, parsed) {
101176         ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
101177             var _a;
101178             return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
101179                 return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
101180             });
101181         }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ExtendedConfigFile); }, function (fileName) { return toPath(state, fileName); });
101182     }
101183     function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
101184         if (!state.watch)
101185             return;
101186         ts.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts.Map(ts.getEntries(parsed.wildcardDirectories)), function (dir, flags) { return state.watchDirectory(dir, function (fileOrDirectory) {
101187             var _a;
101188             if (ts.isIgnoredFileFromWildCardWatching({
101189                 watchedDirPath: toPath(state, dir),
101190                 fileOrDirectory: fileOrDirectory,
101191                 fileOrDirectoryPath: toPath(state, fileOrDirectory),
101192                 configFileName: resolved,
101193                 currentDirectory: state.currentDirectory,
101194                 options: parsed.options,
101195                 program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames),
101196                 useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames,
101197                 writeLog: function (s) { return state.writeLog(s); },
101198                 toPath: function (fileName) { return toPath(state, fileName); }
101199             }))
101200                 return;
101201             invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Partial);
101202         }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.WildcardDirectory, resolved); });
101203     }
101204     function watchInputFiles(state, resolved, resolvedPath, parsed) {
101205         if (!state.watch)
101206             return;
101207         ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
101208             createNewValue: function (_path, input) { return state.watchFile(input, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.SourceFile, resolved); },
101209             onDeleteValue: ts.closeFileWatcher,
101210         });
101211     }
101212     function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
101213         if (!state.watch || !state.lastCachedPackageJsonLookups)
101214             return;
101215         ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
101216             createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
101217             onDeleteValue: ts.closeFileWatcher,
101218         });
101219     }
101220     function startWatching(state, buildOrder) {
101221         if (!state.watchAllProjectsPending)
101222             return;
101223         state.watchAllProjectsPending = false;
101224         for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
101225             var resolved = _a[_i];
101226             var resolvedPath = toResolvedConfigFilePath(state, resolved);
101227             var cfg = parseConfigFile(state, resolved, resolvedPath);
101228             watchConfigFile(state, resolved, resolvedPath, cfg);
101229             watchExtendedConfigFiles(state, resolvedPath, cfg);
101230             if (cfg) {
101231                 watchWildCardDirectories(state, resolved, resolvedPath, cfg);
101232                 watchInputFiles(state, resolved, resolvedPath, cfg);
101233                 watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
101234             }
101235         }
101236     }
101237     function stopWatching(state) {
101238         ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
101239         ts.clearMap(state.allWatchedExtendedConfigFiles, ts.closeFileWatcherOf);
101240         ts.clearMap(state.allWatchedWildcardDirectories, function (watchedWildcardDirectories) { return ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcherOf); });
101241         ts.clearMap(state.allWatchedInputFiles, function (watchedWildcardDirectories) { return ts.clearMap(watchedWildcardDirectories, ts.closeFileWatcher); });
101242         ts.clearMap(state.allWatchedPackageJsonFiles, function (watchedPacageJsonFiles) { return ts.clearMap(watchedPacageJsonFiles, ts.closeFileWatcher); });
101243     }
101244     function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) {
101245         var state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions);
101246         return {
101247             build: function (project, cancellationToken, writeFile, getCustomTransformers) { return build(state, project, cancellationToken, writeFile, getCustomTransformers); },
101248             clean: function (project) { return clean(state, project); },
101249             buildReferences: function (project, cancellationToken, writeFile, getCustomTransformers) { return build(state, project, cancellationToken, writeFile, getCustomTransformers, true); },
101250             cleanReferences: function (project) { return clean(state, project, true); },
101251             getNextInvalidatedProject: function (cancellationToken) {
101252                 setupInitialBuild(state, cancellationToken);
101253                 return getNextInvalidatedProject(state, getBuildOrder(state), false);
101254             },
101255             getBuildOrder: function () { return getBuildOrder(state); },
101256             getUpToDateStatusOfProject: function (project) {
101257                 var configFileName = resolveProjectName(state, project);
101258                 var configFilePath = toResolvedConfigFilePath(state, configFileName);
101259                 return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
101260             },
101261             invalidateProject: function (configFilePath, reloadLevel) { return invalidateProject(state, configFilePath, reloadLevel || ts.ConfigFileProgramReloadLevel.None); },
101262             buildNextInvalidatedProject: function () { return buildNextInvalidatedProject(state); },
101263             getAllParsedConfigs: function () { return ts.arrayFrom(ts.mapDefinedIterator(state.configFileCache.values(), function (config) { return isParsedCommandLine(config) ? config : undefined; })); },
101264             close: function () { return stopWatching(state); },
101265         };
101266     }
101267     function relName(state, path) {
101268         return ts.convertToRelativePath(path, state.currentDirectory, function (f) { return state.getCanonicalFileName(f); });
101269     }
101270     function reportStatus(state, message) {
101271         var args = [];
101272         for (var _i = 2; _i < arguments.length; _i++) {
101273             args[_i - 2] = arguments[_i];
101274         }
101275         state.host.reportSolutionBuilderStatus(ts.createCompilerDiagnostic.apply(void 0, __spreadArray([message], args, false)));
101276     }
101277     function reportWatchStatus(state, message) {
101278         var _a, _b;
101279         var args = [];
101280         for (var _i = 2; _i < arguments.length; _i++) {
101281             args[_i - 2] = arguments[_i];
101282         }
101283         (_b = (_a = state.hostWithWatch).onWatchStatusChange) === null || _b === void 0 ? void 0 : _b.call(_a, ts.createCompilerDiagnostic.apply(void 0, __spreadArray([message], args, false)), state.host.getNewLine(), state.baseCompilerOptions);
101284     }
101285     function reportErrors(_a, errors) {
101286         var host = _a.host;
101287         errors.forEach(function (err) { return host.reportDiagnostic(err); });
101288     }
101289     function reportAndStoreErrors(state, proj, errors) {
101290         reportErrors(state, errors);
101291         state.projectErrorsReported.set(proj, true);
101292         if (errors.length) {
101293             state.diagnostics.set(proj, errors);
101294         }
101295     }
101296     function reportParseConfigFileDiagnostic(state, proj) {
101297         reportAndStoreErrors(state, proj, [state.configFileCache.get(proj)]);
101298     }
101299     function reportErrorSummary(state, buildOrder) {
101300         if (!state.needsSummary)
101301             return;
101302         state.needsSummary = false;
101303         var canReportSummary = state.watch || !!state.host.reportErrorSummary;
101304         var diagnostics = state.diagnostics;
101305         var totalErrors = 0;
101306         if (isCircularBuildOrder(buildOrder)) {
101307             reportBuildQueue(state, buildOrder.buildOrder);
101308             reportErrors(state, buildOrder.circularDiagnostics);
101309             if (canReportSummary)
101310                 totalErrors += ts.getErrorCountForSummary(buildOrder.circularDiagnostics);
101311         }
101312         else {
101313             buildOrder.forEach(function (project) {
101314                 var projectPath = toResolvedConfigFilePath(state, project);
101315                 if (!state.projectErrorsReported.has(projectPath)) {
101316                     reportErrors(state, diagnostics.get(projectPath) || ts.emptyArray);
101317                 }
101318             });
101319             if (canReportSummary)
101320                 diagnostics.forEach(function (singleProjectErrors) { return totalErrors += ts.getErrorCountForSummary(singleProjectErrors); });
101321         }
101322         if (state.watch) {
101323             reportWatchStatus(state, ts.getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
101324         }
101325         else if (state.host.reportErrorSummary) {
101326             state.host.reportErrorSummary(totalErrors);
101327         }
101328     }
101329     function reportBuildQueue(state, buildQueue) {
101330         if (state.options.verbose) {
101331             reportStatus(state, ts.Diagnostics.Projects_in_this_build_Colon_0, buildQueue.map(function (s) { return "\r\n    * " + relName(state, s); }).join(""));
101332         }
101333     }
101334     function reportUpToDateStatus(state, configFileName, status) {
101335         if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
101336             return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
101337         }
101338         switch (status.type) {
101339             case ts.UpToDateStatusType.OutOfDateWithSelf:
101340                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName));
101341             case ts.UpToDateStatusType.OutOfDateWithUpstream:
101342                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
101343             case ts.UpToDateStatusType.OutputMissing:
101344                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
101345             case ts.UpToDateStatusType.UpToDate:
101346                 if (status.newestInputFileTime !== undefined) {
101347                     return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || ""));
101348                 }
101349                 break;
101350             case ts.UpToDateStatusType.OutOfDateWithPrepend:
101351                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
101352             case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
101353                 return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
101354             case ts.UpToDateStatusType.UpstreamOutOfDate:
101355                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
101356             case ts.UpToDateStatusType.UpstreamBlocked:
101357                 return reportStatus(state, status.upstreamProjectBlocked ?
101358                     ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built :
101359                     ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(state, configFileName), relName(state, status.upstreamProjectName));
101360             case ts.UpToDateStatusType.Unbuildable:
101361                 return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
101362             case ts.UpToDateStatusType.TsVersionOutputOfDate:
101363                 return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relName(state, configFileName), status.version, ts.version);
101364             case ts.UpToDateStatusType.ContainerOnly:
101365             case ts.UpToDateStatusType.ComputingUpstream:
101366                 break;
101367             default:
101368                 ts.assertType(status);
101369         }
101370     }
101371     function verboseReportProjectStatus(state, configFileName, status) {
101372         if (state.options.verbose) {
101373             reportUpToDateStatus(state, configFileName, status);
101374         }
101375     }
101376 })(ts || (ts = {}));
101377 var ts;
101378 (function (ts) {
101379     function countLines(program) {
101380         var counts = getCountsMap();
101381         ts.forEach(program.getSourceFiles(), function (file) {
101382             var key = getCountKey(program, file);
101383             var lineCount = ts.getLineStarts(file).length;
101384             counts.set(key, counts.get(key) + lineCount);
101385         });
101386         return counts;
101387     }
101388     function countNodes(program) {
101389         var counts = getCountsMap();
101390         ts.forEach(program.getSourceFiles(), function (file) {
101391             var key = getCountKey(program, file);
101392             counts.set(key, counts.get(key) + file.nodeCount);
101393         });
101394         return counts;
101395     }
101396     function getCountsMap() {
101397         var counts = new ts.Map();
101398         counts.set("Library", 0);
101399         counts.set("Definitions", 0);
101400         counts.set("TypeScript", 0);
101401         counts.set("JavaScript", 0);
101402         counts.set("JSON", 0);
101403         counts.set("Other", 0);
101404         return counts;
101405     }
101406     function getCountKey(program, file) {
101407         if (program.isSourceFileDefaultLibrary(file)) {
101408             return "Library";
101409         }
101410         else if (file.isDeclarationFile) {
101411             return "Definitions";
101412         }
101413         var path = file.path;
101414         if (ts.fileExtensionIsOneOf(path, ts.supportedTSExtensionsFlat)) {
101415             return "TypeScript";
101416         }
101417         else if (ts.fileExtensionIsOneOf(path, ts.supportedJSExtensionsFlat)) {
101418             return "JavaScript";
101419         }
101420         else if (ts.fileExtensionIs(path, ".json")) {
101421             return "JSON";
101422         }
101423         else {
101424             return "Other";
101425         }
101426     }
101427     function updateReportDiagnostic(sys, existing, options) {
101428         return shouldBePretty(sys, options) ?
101429             ts.createDiagnosticReporter(sys, true) :
101430             existing;
101431     }
101432     function defaultIsPretty(sys) {
101433         return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY() && !sys.getEnvironmentVariable("NO_COLOR");
101434     }
101435     function shouldBePretty(sys, options) {
101436         if (!options || typeof options.pretty === "undefined") {
101437             return defaultIsPretty(sys);
101438         }
101439         return options.pretty;
101440     }
101441     function getOptionsForHelp(commandLine) {
101442         return !!commandLine.options.all ?
101443             ts.sort(ts.optionDeclarations, function (a, b) { return ts.compareStringsCaseInsensitive(a.name, b.name); }) :
101444             ts.filter(ts.optionDeclarations.slice(), function (v) { return !!v.showInSimplifiedHelpView; });
101445     }
101446     function printVersion(sys) {
101447         sys.write(ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version) + sys.newLine);
101448     }
101449     function createColors(sys) {
101450         var showColors = defaultIsPretty(sys);
101451         if (!showColors) {
101452             return {
101453                 bold: function (str) { return str; },
101454                 blue: function (str) { return str; },
101455                 blueBackground: function (str) { return str; },
101456                 brightWhite: function (str) { return str; }
101457             };
101458         }
101459         function bold(str) {
101460             return "\u001B[1m".concat(str, "\u001B[22m");
101461         }
101462         var isWindows = sys.getEnvironmentVariable("OS") && ts.stringContains(sys.getEnvironmentVariable("OS").toLowerCase(), "windows");
101463         var isWindowsTerminal = sys.getEnvironmentVariable("WT_SESSION");
101464         var isVSCode = sys.getEnvironmentVariable("TERM_PROGRAM") && sys.getEnvironmentVariable("TERM_PROGRAM") === "vscode";
101465         function blue(str) {
101466             if (isWindows && !isWindowsTerminal && !isVSCode) {
101467                 return brightWhite(str);
101468             }
101469             return "\u001B[94m".concat(str, "\u001B[39m");
101470         }
101471         var supportsRicherColors = sys.getEnvironmentVariable("COLORTERM") === "truecolor" || sys.getEnvironmentVariable("TERM") === "xterm-256color";
101472         function blueBackground(str) {
101473             if (supportsRicherColors) {
101474                 return "\u001B[48;5;68m".concat(str, "\u001B[39;49m");
101475             }
101476             else {
101477                 return "\u001B[44m".concat(str, "\u001B[39;49m");
101478             }
101479         }
101480         function brightWhite(str) {
101481             return "\u001B[97m".concat(str, "\u001B[39m");
101482         }
101483         return {
101484             bold: bold,
101485             blue: blue,
101486             brightWhite: brightWhite,
101487             blueBackground: blueBackground
101488         };
101489     }
101490     function getDisplayNameTextOfOption(option) {
101491         return "--".concat(option.name).concat(option.shortName ? ", -".concat(option.shortName) : "");
101492     }
101493     function generateOptionOutput(sys, option, rightAlignOfLeft, leftAlignOfRight) {
101494         var _a, _b;
101495         var text = [];
101496         var colors = createColors(sys);
101497         var name = getDisplayNameTextOfOption(option);
101498         var valueCandidates = getValueCandidate(option);
101499         var defaultValueDescription = typeof option.defaultValueDescription === "object" ? ts.getDiagnosticText(option.defaultValueDescription) : option.defaultValueDescription;
101500         var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0;
101501         if (terminalWidth >= 80) {
101502             var description = "";
101503             if (option.description) {
101504                 description = ts.getDiagnosticText(option.description);
101505             }
101506             text.push.apply(text, __spreadArray(__spreadArray([], getPrettyOutput(name, description, rightAlignOfLeft, leftAlignOfRight, terminalWidth, true), false), [sys.newLine], false));
101507             if (showAdditionalInfoOutput(valueCandidates, option)) {
101508                 if (valueCandidates) {
101509                     text.push.apply(text, __spreadArray(__spreadArray([], getPrettyOutput(valueCandidates.valueType, valueCandidates.possibleValues, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), false), [sys.newLine], false));
101510                 }
101511                 if (defaultValueDescription) {
101512                     text.push.apply(text, __spreadArray(__spreadArray([], getPrettyOutput(ts.getDiagnosticText(ts.Diagnostics.default_Colon), defaultValueDescription, rightAlignOfLeft, leftAlignOfRight, terminalWidth, false), false), [sys.newLine], false));
101513                 }
101514             }
101515             text.push(sys.newLine);
101516         }
101517         else {
101518             text.push(colors.blue(name), sys.newLine);
101519             if (option.description) {
101520                 var description = ts.getDiagnosticText(option.description);
101521                 text.push(description);
101522             }
101523             text.push(sys.newLine);
101524             if (showAdditionalInfoOutput(valueCandidates, option)) {
101525                 if (valueCandidates) {
101526                     text.push("".concat(valueCandidates.valueType, " ").concat(valueCandidates.possibleValues));
101527                 }
101528                 if (defaultValueDescription) {
101529                     if (valueCandidates)
101530                         text.push(sys.newLine);
101531                     var diagType = ts.getDiagnosticText(ts.Diagnostics.default_Colon);
101532                     text.push("".concat(diagType, " ").concat(defaultValueDescription));
101533                 }
101534                 text.push(sys.newLine);
101535             }
101536             text.push(sys.newLine);
101537         }
101538         return text;
101539         function showAdditionalInfoOutput(valueCandidates, option) {
101540             var ignoreValues = ["string"];
101541             var ignoredDescriptions = [undefined, "false", "n/a"];
101542             var defaultValueDescription = option.defaultValueDescription;
101543             if (option.category === ts.Diagnostics.Command_line_Options)
101544                 return false;
101545             if (ts.contains(ignoreValues, valueCandidates === null || valueCandidates === void 0 ? void 0 : valueCandidates.possibleValues) && ts.contains(ignoredDescriptions, defaultValueDescription)) {
101546                 return false;
101547             }
101548             return true;
101549         }
101550         function getPrettyOutput(left, right, rightAlignOfLeft, leftAlignOfRight, terminalWidth, colorLeft) {
101551             var res = [];
101552             var isFirstLine = true;
101553             var remainRight = right;
101554             var rightCharacterNumber = terminalWidth - leftAlignOfRight;
101555             while (remainRight.length > 0) {
101556                 var curLeft = "";
101557                 if (isFirstLine) {
101558                     curLeft = ts.padLeft(left, rightAlignOfLeft);
101559                     curLeft = ts.padRight(curLeft, leftAlignOfRight);
101560                     curLeft = colorLeft ? colors.blue(curLeft) : curLeft;
101561                 }
101562                 else {
101563                     curLeft = ts.padLeft("", leftAlignOfRight);
101564                 }
101565                 var curRight = remainRight.substr(0, rightCharacterNumber);
101566                 remainRight = remainRight.slice(rightCharacterNumber);
101567                 res.push("".concat(curLeft).concat(curRight));
101568                 isFirstLine = false;
101569             }
101570             return res;
101571         }
101572         function getValueCandidate(option) {
101573             if (option.type === "object") {
101574                 return undefined;
101575             }
101576             return {
101577                 valueType: getValueType(option),
101578                 possibleValues: getPossibleValues(option)
101579             };
101580             function getValueType(option) {
101581                 switch (option.type) {
101582                     case "string":
101583                     case "number":
101584                     case "boolean":
101585                         return ts.getDiagnosticText(ts.Diagnostics.type_Colon);
101586                     case "list":
101587                         return ts.getDiagnosticText(ts.Diagnostics.one_or_more_Colon);
101588                     default:
101589                         return ts.getDiagnosticText(ts.Diagnostics.one_of_Colon);
101590                 }
101591             }
101592             function getPossibleValues(option) {
101593                 var possibleValues;
101594                 switch (option.type) {
101595                     case "string":
101596                     case "number":
101597                     case "boolean":
101598                         possibleValues = option.type;
101599                         break;
101600                     case "list":
101601                         possibleValues = getPossibleValues(option.element);
101602                         break;
101603                     case "object":
101604                         possibleValues = "";
101605                         break;
101606                     default:
101607                         var keys = ts.arrayFrom(option.type.keys());
101608                         possibleValues = keys.join(", ");
101609                 }
101610                 return possibleValues;
101611             }
101612         }
101613     }
101614     function generateGroupOptionOutput(sys, optionsList) {
101615         var maxLength = 0;
101616         for (var _i = 0, optionsList_1 = optionsList; _i < optionsList_1.length; _i++) {
101617             var option = optionsList_1[_i];
101618             var curLength = getDisplayNameTextOfOption(option).length;
101619             maxLength = maxLength > curLength ? maxLength : curLength;
101620         }
101621         var rightAlignOfLeftPart = maxLength + 2;
101622         var leftAlignOfRightPart = rightAlignOfLeftPart + 2;
101623         var lines = [];
101624         for (var _a = 0, optionsList_2 = optionsList; _a < optionsList_2.length; _a++) {
101625             var option = optionsList_2[_a];
101626             var tmp = generateOptionOutput(sys, option, rightAlignOfLeftPart, leftAlignOfRightPart);
101627             lines = __spreadArray(__spreadArray([], lines, true), tmp, true);
101628         }
101629         if (lines[lines.length - 2] !== sys.newLine) {
101630             lines.push(sys.newLine);
101631         }
101632         return lines;
101633     }
101634     function generateSectionOptionsOutput(sys, sectionName, options, subCategory, beforeOptionsDescription, afterOptionsDescription) {
101635         var _a;
101636         var res = [];
101637         res.push(createColors(sys).bold(sectionName) + sys.newLine + sys.newLine);
101638         if (beforeOptionsDescription) {
101639             res.push(beforeOptionsDescription + sys.newLine + sys.newLine);
101640         }
101641         if (!subCategory) {
101642             res = __spreadArray(__spreadArray([], res, true), generateGroupOptionOutput(sys, options), true);
101643             if (afterOptionsDescription) {
101644                 res.push(afterOptionsDescription + sys.newLine + sys.newLine);
101645             }
101646             return res;
101647         }
101648         var categoryMap = new ts.Map();
101649         for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
101650             var option = options_1[_i];
101651             if (!option.category) {
101652                 continue;
101653             }
101654             var curCategory = ts.getDiagnosticText(option.category);
101655             var optionsOfCurCategory = (_a = categoryMap.get(curCategory)) !== null && _a !== void 0 ? _a : [];
101656             optionsOfCurCategory.push(option);
101657             categoryMap.set(curCategory, optionsOfCurCategory);
101658         }
101659         categoryMap.forEach(function (value, key) {
101660             res.push("### ".concat(key).concat(sys.newLine).concat(sys.newLine));
101661             res = __spreadArray(__spreadArray([], res, true), generateGroupOptionOutput(sys, value), true);
101662         });
101663         if (afterOptionsDescription) {
101664             res.push(afterOptionsDescription + sys.newLine + sys.newLine);
101665         }
101666         return res;
101667     }
101668     function printEasyHelp(sys, simpleOptions) {
101669         var colors = createColors(sys);
101670         var output = __spreadArray([], getHeader(sys, "".concat(ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler), " - ").concat(ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version))), true);
101671         output.push(colors.bold(ts.getDiagnosticText(ts.Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine);
101672         example("tsc", ts.Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
101673         example("tsc app.ts util.ts", ts.Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
101674         example("tsc -b", ts.Diagnostics.Build_a_composite_project_in_the_working_directory);
101675         example("tsc --init", ts.Diagnostics.Creates_a_tsconfig_json_with_the_recommended_settings_in_the_working_directory);
101676         example("tsc -p ./path/to/tsconfig.json", ts.Diagnostics.Compiles_the_TypeScript_project_located_at_the_specified_path);
101677         example("tsc --help --all", ts.Diagnostics.An_expanded_version_of_this_information_showing_all_possible_compiler_options);
101678         example(["tsc --noEmit", "tsc --target esnext"], ts.Diagnostics.Compiles_the_current_project_with_additional_settings);
101679         var cliCommands = simpleOptions.filter(function (opt) { return opt.isCommandLineOnly || opt.category === ts.Diagnostics.Command_line_Options; });
101680         var configOpts = simpleOptions.filter(function (opt) { return !ts.contains(cliCommands, opt); });
101681         output = __spreadArray(__spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.COMMAND_LINE_FLAGS), cliCommands, false, undefined, undefined), true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.COMMON_COMPILER_OPTIONS), configOpts, false, undefined, ts.formatMessage(undefined, ts.Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference")), true);
101682         for (var _i = 0, output_1 = output; _i < output_1.length; _i++) {
101683             var line = output_1[_i];
101684             sys.write(line);
101685         }
101686         function example(ex, desc) {
101687             var examples = typeof ex === "string" ? [ex] : ex;
101688             for (var _i = 0, examples_1 = examples; _i < examples_1.length; _i++) {
101689                 var example_1 = examples_1[_i];
101690                 output.push("  " + colors.blue(example_1) + sys.newLine);
101691             }
101692             output.push("  " + ts.getDiagnosticText(desc) + sys.newLine + sys.newLine);
101693         }
101694     }
101695     function printAllHelp(sys, compilerOptions, buildOptions, watchOptions) {
101696         var output = __spreadArray([], getHeader(sys, "".concat(ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler), " - ").concat(ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version))), true);
101697         output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, true, undefined, ts.formatMessage(undefined, ts.Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference")), true);
101698         output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.WATCH_OPTIONS), watchOptions, false, ts.getDiagnosticText(ts.Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon)), true);
101699         output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
101700         for (var _i = 0, output_2 = output; _i < output_2.length; _i++) {
101701             var line = output_2[_i];
101702             sys.write(line);
101703         }
101704     }
101705     function printBuildHelp(sys, buildOptions) {
101706         var output = __spreadArray([], getHeader(sys, "".concat(ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler), " - ").concat(ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version))), true);
101707         output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
101708         for (var _i = 0, output_3 = output; _i < output_3.length; _i++) {
101709             var line = output_3[_i];
101710             sys.write(line);
101711         }
101712     }
101713     function getHeader(sys, message) {
101714         var _a, _b;
101715         var colors = createColors(sys);
101716         var header = [];
101717         var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0;
101718         ;
101719         var tsIconLength = 5;
101720         var tsIconFirstLine = colors.blueBackground(ts.padLeft("", tsIconLength));
101721         var tsIconSecondLine = colors.blueBackground(colors.brightWhite(ts.padLeft("TS ", tsIconLength)));
101722         if (terminalWidth >= message.length + tsIconLength) {
101723             var rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
101724             var leftAlign = rightAlign - tsIconLength;
101725             header.push(ts.padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
101726             header.push(ts.padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
101727         }
101728         else {
101729             header.push(message + sys.newLine);
101730             header.push(sys.newLine);
101731         }
101732         return header;
101733     }
101734     function printHelp(sys, commandLine) {
101735         if (!commandLine.options.all) {
101736             printEasyHelp(sys, getOptionsForHelp(commandLine));
101737         }
101738         else {
101739             printAllHelp(sys, getOptionsForHelp(commandLine), ts.optionsForBuild, ts.optionsForWatch);
101740         }
101741     }
101742     function executeCommandLineWorker(sys, cb, commandLine) {
101743         var reportDiagnostic = ts.createDiagnosticReporter(sys);
101744         if (commandLine.options.build) {
101745             reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_build_must_be_the_first_command_line_argument));
101746             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101747         }
101748         var configFileName;
101749         if (commandLine.options.locale) {
101750             ts.validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors);
101751         }
101752         if (commandLine.errors.length > 0) {
101753             commandLine.errors.forEach(reportDiagnostic);
101754             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101755         }
101756         if (commandLine.options.init) {
101757             writeConfigFile(sys, reportDiagnostic, commandLine.options, commandLine.fileNames);
101758             return sys.exit(ts.ExitStatus.Success);
101759         }
101760         if (commandLine.options.version) {
101761             printVersion(sys);
101762             return sys.exit(ts.ExitStatus.Success);
101763         }
101764         if (commandLine.options.help || commandLine.options.all) {
101765             printHelp(sys, commandLine);
101766             return sys.exit(ts.ExitStatus.Success);
101767         }
101768         if (commandLine.options.watch && commandLine.options.listFilesOnly) {
101769             reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Options_0_and_1_cannot_be_combined, "watch", "listFilesOnly"));
101770             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101771         }
101772         if (commandLine.options.project) {
101773             if (commandLine.fileNames.length !== 0) {
101774                 reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
101775                 return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101776             }
101777             var fileOrDirectory = ts.normalizePath(commandLine.options.project);
101778             if (!fileOrDirectory || sys.directoryExists(fileOrDirectory)) {
101779                 configFileName = ts.combinePaths(fileOrDirectory, "tsconfig.json");
101780                 if (!sys.fileExists(configFileName)) {
101781                     reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project));
101782                     return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101783                 }
101784             }
101785             else {
101786                 configFileName = fileOrDirectory;
101787                 if (!sys.fileExists(configFileName)) {
101788                     reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project));
101789                     return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101790                 }
101791             }
101792         }
101793         else if (commandLine.fileNames.length === 0) {
101794             var searchPath = ts.normalizePath(sys.getCurrentDirectory());
101795             configFileName = ts.findConfigFile(searchPath, function (fileName) { return sys.fileExists(fileName); });
101796         }
101797         if (commandLine.fileNames.length === 0 && !configFileName) {
101798             if (commandLine.options.showConfig) {
101799                 reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, ts.normalizePath(sys.getCurrentDirectory())));
101800             }
101801             else {
101802                 printVersion(sys);
101803                 printHelp(sys, commandLine);
101804             }
101805             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101806         }
101807         var currentDirectory = sys.getCurrentDirectory();
101808         var commandLineOptions = ts.convertToOptionsWithAbsolutePaths(commandLine.options, function (fileName) { return ts.getNormalizedAbsolutePath(fileName, currentDirectory); });
101809         if (configFileName) {
101810             var extendedConfigCache = new ts.Map();
101811             var configParseResult = ts.parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic);
101812             if (commandLineOptions.showConfig) {
101813                 if (configParseResult.errors.length !== 0) {
101814                     reportDiagnostic = updateReportDiagnostic(sys, reportDiagnostic, configParseResult.options);
101815                     configParseResult.errors.forEach(reportDiagnostic);
101816                     return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101817                 }
101818                 sys.write(JSON.stringify(ts.convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
101819                 return sys.exit(ts.ExitStatus.Success);
101820             }
101821             reportDiagnostic = updateReportDiagnostic(sys, reportDiagnostic, configParseResult.options);
101822             if (ts.isWatchSet(configParseResult.options)) {
101823                 if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
101824                     return;
101825                 return createWatchOfConfigFile(sys, cb, reportDiagnostic, configParseResult, commandLineOptions, commandLine.watchOptions, extendedConfigCache);
101826             }
101827             else if (ts.isIncrementalCompilation(configParseResult.options)) {
101828                 performIncrementalCompilation(sys, cb, reportDiagnostic, configParseResult);
101829             }
101830             else {
101831                 performCompilation(sys, cb, reportDiagnostic, configParseResult);
101832             }
101833         }
101834         else {
101835             if (commandLineOptions.showConfig) {
101836                 sys.write(JSON.stringify(ts.convertToTSConfig(commandLine, ts.combinePaths(currentDirectory, "tsconfig.json"), sys), null, 4) + sys.newLine);
101837                 return sys.exit(ts.ExitStatus.Success);
101838             }
101839             reportDiagnostic = updateReportDiagnostic(sys, reportDiagnostic, commandLineOptions);
101840             if (ts.isWatchSet(commandLineOptions)) {
101841                 if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
101842                     return;
101843                 return createWatchOfFilesAndCompilerOptions(sys, cb, reportDiagnostic, commandLine.fileNames, commandLineOptions, commandLine.watchOptions);
101844             }
101845             else if (ts.isIncrementalCompilation(commandLineOptions)) {
101846                 performIncrementalCompilation(sys, cb, reportDiagnostic, __assign(__assign({}, commandLine), { options: commandLineOptions }));
101847             }
101848             else {
101849                 performCompilation(sys, cb, reportDiagnostic, __assign(__assign({}, commandLine), { options: commandLineOptions }));
101850             }
101851         }
101852     }
101853     function isBuild(commandLineArgs) {
101854         if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === 45) {
101855             var firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === 45 ? 2 : 1).toLowerCase();
101856             return firstOption === "build" || firstOption === "b";
101857         }
101858         return false;
101859     }
101860     ts.isBuild = isBuild;
101861     function executeCommandLine(system, cb, commandLineArgs) {
101862         if (isBuild(commandLineArgs)) {
101863             var _a = ts.parseBuildCommand(commandLineArgs.slice(1)), buildOptions_1 = _a.buildOptions, watchOptions_1 = _a.watchOptions, projects_1 = _a.projects, errors_1 = _a.errors;
101864             if (buildOptions_1.generateCpuProfile && system.enableCPUProfiler) {
101865                 system.enableCPUProfiler(buildOptions_1.generateCpuProfile, function () { return performBuild(system, cb, buildOptions_1, watchOptions_1, projects_1, errors_1); });
101866             }
101867             else {
101868                 return performBuild(system, cb, buildOptions_1, watchOptions_1, projects_1, errors_1);
101869             }
101870         }
101871         var commandLine = ts.parseCommandLine(commandLineArgs, function (path) { return system.readFile(path); });
101872         if (commandLine.options.generateCpuProfile && system.enableCPUProfiler) {
101873             system.enableCPUProfiler(commandLine.options.generateCpuProfile, function () { return executeCommandLineWorker(system, cb, commandLine); });
101874         }
101875         else {
101876             return executeCommandLineWorker(system, cb, commandLine);
101877         }
101878     }
101879     ts.executeCommandLine = executeCommandLine;
101880     function reportWatchModeWithoutSysSupport(sys, reportDiagnostic) {
101881         if (!sys.watchFile || !sys.watchDirectory) {
101882             reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
101883             sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101884             return true;
101885         }
101886         return false;
101887     }
101888     function performBuild(sys, cb, buildOptions, watchOptions, projects, errors) {
101889         var reportDiagnostic = updateReportDiagnostic(sys, ts.createDiagnosticReporter(sys), buildOptions);
101890         if (buildOptions.locale) {
101891             ts.validateLocaleAndSetLanguage(buildOptions.locale, sys, errors);
101892         }
101893         if (errors.length > 0) {
101894             errors.forEach(reportDiagnostic);
101895             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101896         }
101897         if (buildOptions.help) {
101898             printVersion(sys);
101899             printBuildHelp(sys, ts.buildOpts);
101900             return sys.exit(ts.ExitStatus.Success);
101901         }
101902         if (projects.length === 0) {
101903             printVersion(sys);
101904             printBuildHelp(sys, ts.buildOpts);
101905             return sys.exit(ts.ExitStatus.Success);
101906         }
101907         if (!sys.getModifiedTime || !sys.setModifiedTime || (buildOptions.clean && !sys.deleteFile)) {
101908             reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--build"));
101909             return sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped);
101910         }
101911         if (buildOptions.watch) {
101912             if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
101913                 return;
101914             var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
101915             updateSolutionBuilderHost(sys, cb, buildHost_1);
101916             var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
101917             builder_1.build();
101918             return builder_1;
101919         }
101920         var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
101921         updateSolutionBuilderHost(sys, cb, buildHost);
101922         var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
101923         var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
101924         ts.dumpTracingLegend();
101925         return sys.exit(exitStatus);
101926     }
101927     function createReportErrorSummary(sys, options) {
101928         return shouldBePretty(sys, options) ?
101929             function (errorCount) { return sys.write(ts.getErrorSummaryText(errorCount, sys.newLine)); } :
101930             undefined;
101931     }
101932     function performCompilation(sys, cb, reportDiagnostic, config) {
101933         var fileNames = config.fileNames, options = config.options, projectReferences = config.projectReferences;
101934         var host = ts.createCompilerHostWorker(options, undefined, sys);
101935         var currentDirectory = host.getCurrentDirectory();
101936         var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
101937         ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); });
101938         enableStatisticsAndTracing(sys, options, false);
101939         var programOptions = {
101940             rootNames: fileNames,
101941             options: options,
101942             projectReferences: projectReferences,
101943             host: host,
101944             configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(config)
101945         };
101946         var program = ts.createProgram(programOptions);
101947         var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options));
101948         reportStatistics(sys, program);
101949         cb(program);
101950         return sys.exit(exitStatus);
101951     }
101952     function performIncrementalCompilation(sys, cb, reportDiagnostic, config) {
101953         var options = config.options, fileNames = config.fileNames, projectReferences = config.projectReferences;
101954         enableStatisticsAndTracing(sys, options, false);
101955         var host = ts.createIncrementalCompilerHost(options, sys);
101956         var exitStatus = ts.performIncrementalCompilation({
101957             host: host,
101958             system: sys,
101959             rootNames: fileNames,
101960             options: options,
101961             configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(config),
101962             projectReferences: projectReferences,
101963             reportDiagnostic: reportDiagnostic,
101964             reportErrorSummary: createReportErrorSummary(sys, options),
101965             afterProgramEmitAndDiagnostics: function (builderProgram) {
101966                 reportStatistics(sys, builderProgram.getProgram());
101967                 cb(builderProgram);
101968             }
101969         });
101970         return sys.exit(exitStatus);
101971     }
101972     function updateSolutionBuilderHost(sys, cb, buildHost) {
101973         updateCreateProgram(sys, buildHost);
101974         buildHost.afterProgramEmitAndDiagnostics = function (program) {
101975             reportStatistics(sys, program.getProgram());
101976             cb(program);
101977         };
101978         buildHost.afterEmitBundle = cb;
101979     }
101980     function updateCreateProgram(sys, host) {
101981         var compileUsingBuilder = host.createProgram;
101982         host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
101983             ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
101984             if (options !== undefined) {
101985                 enableStatisticsAndTracing(sys, options, true);
101986             }
101987             return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
101988         };
101989     }
101990     function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
101991         updateCreateProgram(sys, watchCompilerHost);
101992         var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
101993         watchCompilerHost.afterProgramCreate = function (builderProgram) {
101994             emitFilesUsingBuilder(builderProgram);
101995             reportStatistics(sys, builderProgram.getProgram());
101996             cb(builderProgram);
101997         };
101998     }
101999     function createWatchStatusReporter(sys, options) {
102000         return ts.createWatchStatusReporter(sys, shouldBePretty(sys, options));
102001     }
102002     function createWatchOfConfigFile(system, cb, reportDiagnostic, configParseResult, optionsToExtend, watchOptionsToExtend, extendedConfigCache) {
102003         var watchCompilerHost = ts.createWatchCompilerHostOfConfigFile({
102004             configFileName: configParseResult.options.configFilePath,
102005             optionsToExtend: optionsToExtend,
102006             watchOptionsToExtend: watchOptionsToExtend,
102007             system: system,
102008             reportDiagnostic: reportDiagnostic,
102009             reportWatchStatus: createWatchStatusReporter(system, configParseResult.options)
102010         });
102011         updateWatchCompilationHost(system, cb, watchCompilerHost);
102012         watchCompilerHost.configFileParsingResult = configParseResult;
102013         watchCompilerHost.extendedConfigCache = extendedConfigCache;
102014         return ts.createWatchProgram(watchCompilerHost);
102015     }
102016     function createWatchOfFilesAndCompilerOptions(system, cb, reportDiagnostic, rootFiles, options, watchOptions) {
102017         var watchCompilerHost = ts.createWatchCompilerHostOfFilesAndCompilerOptions({
102018             rootFiles: rootFiles,
102019             options: options,
102020             watchOptions: watchOptions,
102021             system: system,
102022             reportDiagnostic: reportDiagnostic,
102023             reportWatchStatus: createWatchStatusReporter(system, options)
102024         });
102025         updateWatchCompilationHost(system, cb, watchCompilerHost);
102026         return ts.createWatchProgram(watchCompilerHost);
102027     }
102028     function canReportDiagnostics(system, compilerOptions) {
102029         return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
102030     }
102031     function canTrace(system, compilerOptions) {
102032         return system === ts.sys && compilerOptions.generateTrace;
102033     }
102034     function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
102035         if (canReportDiagnostics(system, compilerOptions)) {
102036             ts.performance.enable(system);
102037         }
102038         if (canTrace(system, compilerOptions)) {
102039             ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
102040         }
102041     }
102042     function reportStatistics(sys, program) {
102043         var compilerOptions = program.getCompilerOptions();
102044         if (canTrace(sys, compilerOptions)) {
102045             ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
102046         }
102047         var statistics;
102048         if (canReportDiagnostics(sys, compilerOptions)) {
102049             statistics = [];
102050             var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
102051             reportCountStatistic("Files", program.getSourceFiles().length);
102052             var lineCounts = countLines(program);
102053             var nodeCounts = countNodes(program);
102054             if (compilerOptions.extendedDiagnostics) {
102055                 for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
102056                     var key = _a[_i];
102057                     reportCountStatistic("Lines of " + key, lineCounts.get(key));
102058                 }
102059                 for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
102060                     var key = _c[_b];
102061                     reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
102062                 }
102063             }
102064             else {
102065                 reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
102066                 reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
102067             }
102068             reportCountStatistic("Identifiers", program.getIdentifierCount());
102069             reportCountStatistic("Symbols", program.getSymbolCount());
102070             reportCountStatistic("Types", program.getTypeCount());
102071             reportCountStatistic("Instantiations", program.getInstantiationCount());
102072             if (memoryUsed >= 0) {
102073                 reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
102074             }
102075             var isPerformanceEnabled = ts.performance.isEnabled();
102076             var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
102077             var bindTime = isPerformanceEnabled ? ts.performance.getDuration("Bind") : 0;
102078             var checkTime = isPerformanceEnabled ? ts.performance.getDuration("Check") : 0;
102079             var emitTime = isPerformanceEnabled ? ts.performance.getDuration("Emit") : 0;
102080             if (compilerOptions.extendedDiagnostics) {
102081                 var caches = program.getRelationCacheSizes();
102082                 reportCountStatistic("Assignability cache size", caches.assignable);
102083                 reportCountStatistic("Identity cache size", caches.identity);
102084                 reportCountStatistic("Subtype cache size", caches.subtype);
102085                 reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
102086                 if (isPerformanceEnabled) {
102087                     ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic("".concat(name, " time"), duration); });
102088                 }
102089             }
102090             else if (isPerformanceEnabled) {
102091                 reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"));
102092                 reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"));
102093                 reportTimeStatistic("Parse time", programTime);
102094                 reportTimeStatistic("Bind time", bindTime);
102095                 reportTimeStatistic("Check time", checkTime);
102096                 reportTimeStatistic("Emit time", emitTime);
102097             }
102098             if (isPerformanceEnabled) {
102099                 reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
102100             }
102101             reportStatistics();
102102             if (!isPerformanceEnabled) {
102103                 sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
102104             }
102105             else {
102106                 ts.performance.disable();
102107             }
102108         }
102109         function reportStatistics() {
102110             var nameSize = 0;
102111             var valueSize = 0;
102112             for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
102113                 var _a = statistics_1[_i], name = _a.name, value = _a.value;
102114                 if (name.length > nameSize) {
102115                     nameSize = name.length;
102116                 }
102117                 if (value.length > valueSize) {
102118                     valueSize = value.length;
102119                 }
102120             }
102121             for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
102122                 var _c = statistics_2[_b], name = _c.name, value = _c.value;
102123                 sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
102124             }
102125         }
102126         function reportStatisticalValue(name, value) {
102127             statistics.push({ name: name, value: value });
102128         }
102129         function reportCountStatistic(name, count) {
102130             reportStatisticalValue(name, "" + count);
102131         }
102132         function reportTimeStatistic(name, time) {
102133             reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
102134         }
102135     }
102136     function writeConfigFile(sys, reportDiagnostic, options, fileNames) {
102137         var currentDirectory = sys.getCurrentDirectory();
102138         var file = ts.normalizePath(ts.combinePaths(currentDirectory, "tsconfig.json"));
102139         if (sys.fileExists(file)) {
102140             reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
102141         }
102142         else {
102143             sys.writeFile(file, ts.generateTSConfig(options, fileNames, sys.newLine));
102144             var output = __spreadArray([sys.newLine], getHeader(sys, "Created a new tsconfig.json with:"), true);
102145             output.push(ts.getCompilerOptionsDiffValue(options, sys.newLine) + sys.newLine + sys.newLine);
102146             output.push("You can learn more at https://aka.ms/tsconfig.json" + sys.newLine);
102147             for (var _i = 0, output_4 = output; _i < output_4.length; _i++) {
102148                 var line = output_4[_i];
102149                 sys.write(line);
102150             }
102151         }
102152         return;
102153     }
102154 })(ts || (ts = {}));
102155 // This file actually uses arguments passed on commandline and executes it
102156 ts.Debug.loggingHost = {
102157     log: function (_level, s) {
102158         ts.sys.write("".concat(s || "").concat(ts.sys.newLine));
102159     }
102160 };
102161 if (ts.Debug.isDebugging) {
102162     ts.Debug.enableDebugInfo();
102163 }
102164 if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
102165     ts.sys.tryEnableSourceMapsForHost();
102166 }
102167 if (ts.sys.setBlocking) {
102168     ts.sys.setBlocking();
102169 }
102170 ts.executeCommandLine(ts.sys, ts.noop, ts.sys.args);