awayjs-display
Version:
AwayJS displaylist classes
1,412 lines • 2.16 MB
JavaScript
/* */
"format cjs";
(function(Buffer, process) {
var __extends = (this && this.__extends) || function(d, b) {
for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ts;
(function(ts) {
var OperationCanceledException = (function() {
function OperationCanceledException() {}
return OperationCanceledException;
}());
ts.OperationCanceledException = OperationCanceledException;
(function(ExitStatus) {
ExitStatus[ExitStatus["Success"] = 0] = "Success";
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped";
ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated";
})(ts.ExitStatus || (ts.ExitStatus = {}));
var ExitStatus = ts.ExitStatus;
(function(TypeReferenceSerializationKind) {
TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithConstructSignatureAndValue"] = 1] = "TypeWithConstructSignatureAndValue";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidType"] = 2] = "VoidType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["NumberLikeType"] = 3] = "NumberLikeType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["StringLikeType"] = 4] = "StringLikeType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["BooleanType"] = 5] = "BooleanType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ArrayLikeType"] = 6] = "ArrayLikeType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ESSymbolType"] = 7] = "ESSymbolType";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 8] = "TypeWithCallSignature";
TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 9] = "ObjectType";
})(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {}));
var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind;
(function(DiagnosticCategory) {
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message";
})(ts.DiagnosticCategory || (ts.DiagnosticCategory = {}));
var DiagnosticCategory = ts.DiagnosticCategory;
})(ts || (ts = {}));
var ts;
(function(ts) {
function createFileMap(keyMapper) {
var files = {};
return {
get: get,
set: set,
contains: contains,
remove: remove,
forEachValue: forEachValueInMap,
clear: clear
};
function forEachValueInMap(f) {
for (var key in files) {
f(key, files[key]);
}
}
function get(path) {
return files[toKey(path)];
}
function set(path, value) {
files[toKey(path)] = value;
}
function contains(path) {
return hasProperty(files, toKey(path));
}
function remove(path) {
var key = toKey(path);
delete files[key];
}
function clear() {
files = {};
}
function toKey(path) {
return keyMapper ? keyMapper(path) : path;
}
}
ts.createFileMap = createFileMap;
function toPath(fileName, basePath, getCanonicalFileName) {
var nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) : getNormalizedAbsolutePath(fileName, basePath);
return getCanonicalFileName(nonCanonicalizedPath);
}
ts.toPath = toPath;
function forEach(array, callback) {
if (array) {
for (var i = 0,
len = array.length; i < len; i++) {
var result = callback(array[i], i);
if (result) {
return result;
}
}
}
return undefined;
}
ts.forEach = forEach;
function contains(array, value) {
if (array) {
for (var _i = 0,
array_1 = array; _i < array_1.length; _i++) {
var v = array_1[_i];
if (v === value) {
return true;
}
}
}
return false;
}
ts.contains = contains;
function indexOf(array, value) {
if (array) {
for (var i = 0,
len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
}
}
return -1;
}
ts.indexOf = indexOf;
function countWhere(array, predicate) {
var count = 0;
if (array) {
for (var _i = 0,
array_2 = array; _i < array_2.length; _i++) {
var v = array_2[_i];
if (predicate(v)) {
count++;
}
}
}
return count;
}
ts.countWhere = countWhere;
function filter(array, f) {
var result;
if (array) {
result = [];
for (var _i = 0,
array_3 = array; _i < array_3.length; _i++) {
var item = array_3[_i];
if (f(item)) {
result.push(item);
}
}
}
return result;
}
ts.filter = filter;
function map(array, f) {
var result;
if (array) {
result = [];
for (var _i = 0,
array_4 = array; _i < array_4.length; _i++) {
var v = array_4[_i];
result.push(f(v));
}
}
return result;
}
ts.map = map;
function concatenate(array1, array2) {
if (!array2 || !array2.length)
return array1;
if (!array1 || !array1.length)
return array2;
return array1.concat(array2);
}
ts.concatenate = concatenate;
function deduplicate(array) {
var result;
if (array) {
result = [];
for (var _i = 0,
array_5 = array; _i < array_5.length; _i++) {
var item = array_5[_i];
if (!contains(result, item)) {
result.push(item);
}
}
}
return result;
}
ts.deduplicate = deduplicate;
function sum(array, prop) {
var result = 0;
for (var _i = 0,
array_6 = array; _i < array_6.length; _i++) {
var v = array_6[_i];
result += v[prop];
}
return result;
}
ts.sum = sum;
function addRange(to, from) {
if (to && from) {
for (var _i = 0,
from_1 = from; _i < from_1.length; _i++) {
var v = from_1[_i];
to.push(v);
}
}
}
ts.addRange = addRange;
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
return false;
}
pos++;
}
return true;
}
ts.rangeEquals = rangeEquals;
function lastOrUndefined(array) {
if (array.length === 0) {
return undefined;
}
return array[array.length - 1];
}
ts.lastOrUndefined = lastOrUndefined;
function binarySearch(array, value) {
var low = 0;
var high = array.length - 1;
while (low <= high) {
var middle = low + ((high - low) >> 1);
var midValue = array[middle];
if (midValue === value) {
return middle;
} else if (midValue > value) {
high = middle - 1;
} else {
low = middle + 1;
}
}
return ~low;
}
ts.binarySearch = binarySearch;
function reduceLeft(array, f, initial) {
if (array) {
var count = array.length;
if (count > 0) {
var pos = 0;
var result = arguments.length <= 2 ? array[pos] : initial;
pos++;
while (pos < count) {
result = f(result, array[pos]);
pos++;
}
return result;
}
}
return initial;
}
ts.reduceLeft = reduceLeft;
function reduceRight(array, f, initial) {
if (array) {
var pos = array.length - 1;
if (pos >= 0) {
var result = arguments.length <= 2 ? array[pos] : initial;
pos--;
while (pos >= 0) {
result = f(result, array[pos]);
pos--;
}
return result;
}
}
return initial;
}
ts.reduceRight = reduceRight;
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasProperty(map, key) {
return hasOwnProperty.call(map, key);
}
ts.hasProperty = hasProperty;
function getKeys(map) {
var keys = [];
for (var key in map) {
keys.push(key);
}
return keys;
}
ts.getKeys = getKeys;
function getProperty(map, key) {
return hasOwnProperty.call(map, key) ? map[key] : undefined;
}
ts.getProperty = getProperty;
function isEmpty(map) {
for (var id in map) {
if (hasProperty(map, id)) {
return false;
}
}
return true;
}
ts.isEmpty = isEmpty;
function clone(object) {
var result = {};
for (var id in object) {
result[id] = object[id];
}
return result;
}
ts.clone = clone;
function extend(first, second) {
var result = {};
for (var id in first) {
result[id] = first[id];
}
for (var id in second) {
if (!hasProperty(result, id)) {
result[id] = second[id];
}
}
return result;
}
ts.extend = extend;
function forEachValue(map, callback) {
var result;
for (var id in map) {
if (result = callback(map[id]))
break;
}
return result;
}
ts.forEachValue = forEachValue;
function forEachKey(map, callback) {
var result;
for (var id in map) {
if (result = callback(id))
break;
}
return result;
}
ts.forEachKey = forEachKey;
function lookUp(map, key) {
return hasProperty(map, key) ? map[key] : undefined;
}
ts.lookUp = lookUp;
function copyMap(source, target) {
for (var p in source) {
target[p] = source[p];
}
}
ts.copyMap = copyMap;
function arrayToMap(array, makeKey) {
var result = {};
forEach(array, function(value) {
result[makeKey(value)] = value;
});
return result;
}
ts.arrayToMap = arrayToMap;
function reduceProperties(map, callback, initial) {
var result = initial;
if (map) {
for (var key in map) {
if (hasProperty(map, key)) {
result = callback(result, map[key], String(key));
}
}
}
return result;
}
ts.reduceProperties = reduceProperties;
function isArray(value) {
return Array.isArray ? Array.isArray(value) : value instanceof Array;
}
ts.isArray = isArray;
function memoize(callback) {
var value;
return function() {
if (callback) {
value = callback();
callback = undefined;
}
return value;
};
}
ts.memoize = memoize;
function formatStringFromArgs(text, args, baseIndex) {
baseIndex = baseIndex || 0;
return text.replace(/{(\d+)}/g, function(match, index) {
return args[+index + baseIndex];
});
}
ts.localizedDiagnosticMessages = undefined;
function getLocaleSpecificMessage(message) {
return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] ? ts.localizedDiagnosticMessages[message.key] : message.message;
}
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
function createFileDiagnostic(file, start, length, message) {
var end = start + length;
Debug.assert(start >= 0, "start must be non-negative, is " + start);
Debug.assert(length >= 0, "length must be non-negative, is " + length);
if (file) {
Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length);
Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length);
}
var text = getLocaleSpecificMessage(message);
if (arguments.length > 4) {
text = formatStringFromArgs(text, arguments, 4);
}
return {
file: file,
start: start,
length: length,
messageText: text,
category: message.category,
code: message.code
};
}
ts.createFileDiagnostic = createFileDiagnostic;
function createCompilerDiagnostic(message) {
var text = getLocaleSpecificMessage(message);
if (arguments.length > 1) {
text = formatStringFromArgs(text, arguments, 1);
}
return {
file: undefined,
start: undefined,
length: undefined,
messageText: text,
category: message.category,
code: message.code
};
}
ts.createCompilerDiagnostic = createCompilerDiagnostic;
function chainDiagnosticMessages(details, message) {
var text = getLocaleSpecificMessage(message);
if (arguments.length > 2) {
text = formatStringFromArgs(text, arguments, 2);
}
return {
messageText: text,
category: message.category,
code: message.code,
next: details
};
}
ts.chainDiagnosticMessages = chainDiagnosticMessages;
function concatenateDiagnosticMessageChains(headChain, tailChain) {
var lastChain = headChain;
while (lastChain.next) {
lastChain = lastChain.next;
}
lastChain.next = tailChain;
return headChain;
}
ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains;
function compareValues(a, b) {
if (a === b)
return 0;
if (a === undefined)
return -1;
if (b === undefined)
return 1;
return a < b ? -1 : 1;
}
ts.compareValues = compareValues;
function getDiagnosticFileName(diagnostic) {
return diagnostic.file ? diagnostic.file.fileName : undefined;
}
function compareDiagnostics(d1, d2) {
return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0;
}
ts.compareDiagnostics = compareDiagnostics;
function compareMessageText(text1, text2) {
while (text1 && text2) {
var string1 = typeof text1 === "string" ? text1 : text1.messageText;
var string2 = typeof text2 === "string" ? text2 : text2.messageText;
var res = compareValues(string1, string2);
if (res) {
return res;
}
text1 = typeof text1 === "string" ? undefined : text1.next;
text2 = typeof text2 === "string" ? undefined : text2.next;
}
if (!text1 && !text2) {
return 0;
}
return text1 ? 1 : -1;
}
function sortAndDeduplicateDiagnostics(diagnostics) {
return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics));
}
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
function deduplicateSortedDiagnostics(diagnostics) {
if (diagnostics.length < 2) {
return diagnostics;
}
var newDiagnostics = [diagnostics[0]];
var previousDiagnostic = diagnostics[0];
for (var i = 1; i < diagnostics.length; i++) {
var currentDiagnostic = diagnostics[i];
var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0;
if (!isDupe) {
newDiagnostics.push(currentDiagnostic);
previousDiagnostic = currentDiagnostic;
}
}
return newDiagnostics;
}
ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics;
function normalizeSlashes(path) {
return path.replace(/\\/g, "/");
}
ts.normalizeSlashes = normalizeSlashes;
function getRootLength(path) {
if (path.charCodeAt(0) === 47) {
if (path.charCodeAt(1) !== 47)
return 1;
var p1 = path.indexOf("/", 2);
if (p1 < 0)
return 2;
var p2 = path.indexOf("/", p1 + 1);
if (p2 < 0)
return p1 + 1;
return p2 + 1;
}
if (path.charCodeAt(1) === 58) {
if (path.charCodeAt(2) === 47)
return 3;
return 2;
}
if (path.lastIndexOf("file:///", 0) === 0) {
return "file:///".length;
}
var idx = path.indexOf("://");
if (idx !== -1) {
return idx + "://".length;
}
return 0;
}
ts.getRootLength = getRootLength;
ts.directorySeparator = "/";
function getNormalizedParts(normalizedSlashedPath, rootLength) {
var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator);
var normalized = [];
for (var _i = 0,
parts_1 = parts; _i < parts_1.length; _i++) {
var part = parts_1[_i];
if (part !== ".") {
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
normalized.pop();
} else {
if (part) {
normalized.push(part);
}
}
}
}
return normalized;
}
function normalizePath(path) {
path = normalizeSlashes(path);
var rootLength = getRootLength(path);
var normalized = getNormalizedParts(path, rootLength);
return path.substr(0, rootLength) + normalized.join(ts.directorySeparator);
}
ts.normalizePath = normalizePath;
function getDirectoryPath(path) {
return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator)));
}
ts.getDirectoryPath = getDirectoryPath;
function isUrl(path) {
return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1;
}
ts.isUrl = isUrl;
function isRootedDiskPath(path) {
return getRootLength(path) !== 0;
}
ts.isRootedDiskPath = isRootedDiskPath;
function normalizedPathComponents(path, rootLength) {
var normalizedParts = getNormalizedParts(path, rootLength);
return [path.substr(0, rootLength)].concat(normalizedParts);
}
function getNormalizedPathComponents(path, currentDirectory) {
path = normalizeSlashes(path);
var rootLength = getRootLength(path);
if (rootLength === 0) {
path = combinePaths(normalizeSlashes(currentDirectory), path);
rootLength = getRootLength(path);
}
return normalizedPathComponents(path, rootLength);
}
ts.getNormalizedPathComponents = getNormalizedPathComponents;
function getNormalizedAbsolutePath(fileName, currentDirectory) {
return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
}
ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;
function getNormalizedPathFromPathComponents(pathComponents) {
if (pathComponents && pathComponents.length) {
return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator);
}
}
ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents;
function getNormalizedPathComponentsOfUrl(url) {
var urlLength = url.length;
var rootLength = url.indexOf("://") + "://".length;
while (rootLength < urlLength) {
if (url.charCodeAt(rootLength) === 47) {
rootLength++;
} else {
break;
}
}
if (rootLength === urlLength) {
return [url];
}
var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength);
if (indexOfNextSlash !== -1) {
rootLength = indexOfNextSlash + 1;
return normalizedPathComponents(url, rootLength);
} else {
return [url + ts.directorySeparator];
}
}
function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) {
if (isUrl(pathOrUrl)) {
return getNormalizedPathComponentsOfUrl(pathOrUrl);
} else {
return getNormalizedPathComponents(pathOrUrl, currentDirectory);
}
}
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) {
var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
directoryComponents.length--;
}
var joinStartIndex;
for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {
break;
}
}
if (joinStartIndex) {
var relativePath = "";
var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length);
for (; joinStartIndex < directoryComponents.length; joinStartIndex++) {
if (directoryComponents[joinStartIndex] !== "") {
relativePath = relativePath + ".." + ts.directorySeparator;
}
}
return relativePath + relativePathComponents.join(ts.directorySeparator);
}
var absolutePath = getNormalizedPathFromPathComponents(pathComponents);
if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) {
absolutePath = "file:///" + absolutePath;
}
return absolutePath;
}
ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl;
function getBaseFileName(path) {
if (path === undefined) {
return undefined;
}
var i = path.lastIndexOf(ts.directorySeparator);
return i < 0 ? path : path.substring(i + 1);
}
ts.getBaseFileName = getBaseFileName;
function combinePaths(path1, path2) {
if (!(path1 && path1.length))
return path2;
if (!(path2 && path2.length))
return path1;
if (getRootLength(path2) !== 0)
return path2;
if (path1.charAt(path1.length - 1) === ts.directorySeparator)
return path1 + path2;
return path1 + ts.directorySeparator + path2;
}
ts.combinePaths = combinePaths;
function fileExtensionIs(path, extension) {
var pathLen = path.length;
var extLen = extension.length;
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
}
ts.fileExtensionIs = fileExtensionIs;
function ensureScriptKind(fileName, scriptKind) {
return (scriptKind || getScriptKindFromFileName(fileName)) || 3;
}
ts.ensureScriptKind = ensureScriptKind;
function getScriptKindFromFileName(fileName) {
var ext = fileName.substr(fileName.lastIndexOf("."));
switch (ext.toLowerCase()) {
case ".js":
return 1;
case ".jsx":
return 2;
case ".ts":
return 3;
case ".tsx":
return 4;
default:
return 0;
}
}
ts.getScriptKindFromFileName = getScriptKindFromFileName;
ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"];
ts.supportedJavascriptExtensions = [".js", ".jsx"];
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
function getSupportedExtensions(options) {
return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
}
ts.getSupportedExtensions = getSupportedExtensions;
function isSupportedSourceFileName(fileName, compilerOptions) {
if (!fileName) {
return false;
}
for (var _i = 0,
_a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {
var extension = _a[_i];
if (fileExtensionIs(fileName, extension)) {
return true;
}
}
return false;
}
ts.isSupportedSourceFileName = isSupportedSourceFileName;
var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
function removeFileExtension(path) {
for (var _i = 0,
extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
var ext = extensionsToRemove_1[_i];
if (fileExtensionIs(path, ext)) {
return path.substr(0, path.length - ext.length);
}
}
return path;
}
ts.removeFileExtension = removeFileExtension;
function Symbol(flags, name) {
this.flags = flags;
this.name = name;
this.declarations = undefined;
}
function Type(checker, flags) {
this.flags = flags;
}
function Signature(checker) {}
function Node(kind, pos, end) {
this.kind = kind;
this.pos = pos;
this.end = end;
this.flags = 0;
this.parent = undefined;
}
ts.objectAllocator = {
getNodeConstructor: function() {
return Node;
},
getSourceFileConstructor: function() {
return Node;
},
getSymbolConstructor: function() {
return Symbol;
},
getTypeConstructor: function() {
return Type;
},
getSignatureConstructor: function() {
return Signature;
}
};
var Debug;
(function(Debug) {
var currentAssertionLevel = 0;
function shouldAssert(level) {
return currentAssertionLevel >= level;
}
Debug.shouldAssert = shouldAssert;
function assert(expression, message, verboseDebugInfo) {
if (!expression) {
var verboseDebugString = "";
if (verboseDebugInfo) {
verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo();
}
debugger;
throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString);
}
}
Debug.assert = assert;
function fail(message) {
Debug.assert(false, message);
}
Debug.fail = fail;
})(Debug = ts.Debug || (ts.Debug = {}));
function copyListRemovingItem(item, list) {
var copiedList = [];
for (var _i = 0,
list_1 = list; _i < list_1.length; _i++) {
var e = list_1[_i];
if (e !== item) {
copiedList.push(e);
}
}
return copiedList;
}
ts.copyListRemovingItem = copyListRemovingItem;
function createGetCanonicalFileName(useCaseSensitivefileNames) {
return useCaseSensitivefileNames ? (function(fileName) {
return fileName;
}) : (function(fileName) {
return fileName.toLowerCase();
});
}
ts.createGetCanonicalFileName = createGetCanonicalFileName;
})(ts || (ts = {}));
var ts;
(function(ts) {
ts.sys = (function() {
function getWScriptSystem() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fileStream = new ActiveXObject("ADODB.Stream");
fileStream.Type = 2;
var binaryStream = new ActiveXObject("ADODB.Stream");
binaryStream.Type = 1;
var args = [];
for (var i = 0; i < WScript.Arguments.length; i++) {
args[i] = WScript.Arguments.Item(i);
}
function readFile(fileName, encoding) {
if (!fso.FileExists(fileName)) {
return undefined;
}
fileStream.Open();
try {
if (encoding) {
fileStream.Charset = encoding;
fileStream.LoadFromFile(fileName);
} else {
fileStream.Charset = "x-ansi";
fileStream.LoadFromFile(fileName);
var bom = fileStream.ReadText(2) || "";
fileStream.Position = 0;
fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8";
}
return fileStream.ReadText();
} catch (e) {
throw e;
} finally {
fileStream.Close();
}
}
function writeFile(fileName, data, writeByteOrderMark) {
fileStream.Open();
binaryStream.Open();
try {
fileStream.Charset = "utf-8";
fileStream.WriteText(data);
if (writeByteOrderMark) {
fileStream.Position = 0;
} else {
fileStream.Position = 3;
}
fileStream.CopyTo(binaryStream);
binaryStream.SaveToFile(fileName, 2);
} finally {
binaryStream.Close();
fileStream.Close();
}
}
function getCanonicalPath(path) {
return path.toLowerCase();
}
function getNames(collection) {
var result = [];
for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {
result.push(e.item().Name);
}
return result.sort();
}
function readDirectory(path, extension, exclude) {
var result = [];
exclude = ts.map(exclude, function(s) {
return getCanonicalPath(ts.combinePaths(path, s));
});
visitDirectory(path);
return result;
function visitDirectory(path) {
var folder = fso.GetFolder(path || ".");
var files = getNames(folder.files);
for (var _i = 0,
files_1 = files; _i < files_1.length; _i++) {
var current = files_1[_i];
var name_1 = ts.combinePaths(path, current);
if ((!extension || ts.fileExtensionIs(name_1, extension)) && !ts.contains(exclude, getCanonicalPath(name_1))) {
result.push(name_1);
}
}
var subfolders = getNames(folder.subfolders);
for (var _a = 0,
subfolders_1 = subfolders; _a < subfolders_1.length; _a++) {
var current = subfolders_1[_a];
var name_2 = ts.combinePaths(path, current);
if (!ts.contains(exclude, getCanonicalPath(name_2))) {
visitDirectory(name_2);
}
}
}
}
return {
args: args,
newLine: "\r\n",
useCaseSensitiveFileNames: false,
write: function(s) {
WScript.StdOut.Write(s);
},
readFile: readFile,
writeFile: writeFile,
resolvePath: function(path) {
return fso.GetAbsolutePathName(path);
},
fileExists: function(path) {
return fso.FileExists(path);
},
directoryExists: function(path) {
return fso.FolderExists(path);
},
createDirectory: function(directoryName) {
if (!this.directoryExists(directoryName)) {
fso.CreateFolder(directoryName);
}
},
getExecutingFilePath: function() {
return WScript.ScriptFullName;
},
getCurrentDirectory: function() {
return new ActiveXObject("WScript.Shell").CurrentDirectory;
},
readDirectory: readDirectory,
exit: function(exitCode) {
try {
WScript.Quit(exitCode);
} catch (e) {}
}
};
}
function getNodeSystem() {
var _fs = require('@empty');
var _path = require('@empty');
var _os = require('os');
function createPollingWatchedFileSet(interval, chunkSize) {
if (interval === void 0) {
interval = 2500;
}
if (chunkSize === void 0) {
chunkSize = 30;
}
var watchedFiles = [];
var nextFileToCheck = 0;
var watchTimer;
function getModifiedTime(fileName) {
return _fs.statSync(fileName).mtime;
}
function poll(checkedIndex) {
var watchedFile = watchedFiles[checkedIndex];
if (!watchedFile) {
return;
}
_fs.stat(watchedFile.filePath, function(err, stats) {
if (err) {
watchedFile.callback(watchedFile.filePath);
} else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
watchedFile.mtime = getModifiedTime(watchedFile.filePath);
watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0);
}
});
}
function startWatchTimer() {
watchTimer = setInterval(function() {
var count = 0;
var nextToCheck = nextFileToCheck;
var firstCheck = -1;
while ((count < chunkSize) && (nextToCheck !== firstCheck)) {
poll(nextToCheck);
if (firstCheck < 0) {
firstCheck = nextToCheck;
}
nextToCheck++;
if (nextToCheck === watchedFiles.length) {
nextToCheck = 0;
}
count++;
}
nextFileToCheck = nextToCheck;
}, interval);
}
function addFile(filePath, callback) {
var file = {
filePath: filePath,
callback: callback,
mtime: getModifiedTime(filePath)
};
watchedFiles.push(file);
if (watchedFiles.length === 1) {
startWatchTimer();
}
return file;
}
function removeFile(file) {
watchedFiles = ts.copyListRemovingItem(file, watchedFiles);
}
return {
getModifiedTime: getModifiedTime,
poll: poll,
startWatchTimer: startWatchTimer,
addFile: addFile,
removeFile: removeFile
};
}
function createWatchedFileSet() {
var dirWatchers = ts.createFileMap();
var fileWatcherCallbacks = ts.createFileMap();
return {
addFile: addFile,
removeFile: removeFile
};
function reduceDirWatcherRefCountForFile(filePath) {
var dirPath = ts.getDirectoryPath(filePath);
if (dirWatchers.contains(dirPath)) {
var watcher = dirWatchers.get(dirPath);
watcher.referenceCount -= 1;
if (watcher.referenceCount <= 0) {
watcher.close();
dirWatchers.remove(dirPath);
}
}
}
function addDirWatcher(dirPath) {
if (dirWatchers.contains(dirPath)) {
var watcher_1 = dirWatchers.get(dirPath);
watcher_1.referenceCount += 1;
return;
}
var watcher = _fs.watch(dirPath, {persistent: true}, function(eventName, relativeFileName) {
return fileEventHandler(eventName, relativeFileName, dirPath);
});
watcher.referenceCount = 1;
dirWatchers.set(dirPath, watcher);
return;
}
function addFileWatcherCallback(filePath, callback) {
if (fileWatcherCallbacks.contains(filePath)) {
fileWatcherCallbacks.get(filePath).push(callback);
} else {
fileWatcherCallbacks.set(filePath, [callback]);
}
}
function addFile(filePath, callback) {
addFileWatcherCallback(filePath, callback);
addDirWatcher(ts.getDirectoryPath(filePath));
return {
filePath: filePath,
callback: callback
};
}
function removeFile(watchedFile) {
removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback);
reduceDirWatcherRefCountForFile(watchedFile.filePath);
}
function removeFileWatcherCallback(filePath, callback) {
if (fileWatcherCallbacks.contains(filePath)) {
var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath));
if (newCallbacks.length === 0) {
fileWatcherCallbacks.remove(filePath);
} else {
fileWatcherCallbacks.set(filePath, newCallbacks);
}
}
}
function fileEventHandler(eventName, relativeFileName, baseDirPath) {
var filePath = typeof relativeFileName !== "string" ? undefined : ts.toPath(relativeFileName, baseDirPath, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames));
if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) {
for (var _i = 0,
_a = fileWatcherCallbacks.get(filePath); _i < _a.length; _i++) {
var fileCallback = _a[_i];
fileCallback(filePath);
}
}
}
}
var pollingWatchedFileSet = createPollingWatchedFileSet();
var watchedFileSet = createWatchedFileSet();
function isNode4OrLater() {
return parseInt(process.version.charAt(1)) >= 4;
}
var platform = _os.platform();
var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
function readFile(fileName, encoding) {
if (!_fs.existsSync(fileName)) {
return undefined;
}
var buffer = _fs.readFileSync(fileName);
var len = buffer.length;
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
len &= ~1;
for (var i = 0; i < len; i += 2) {
var temp = buffer[i];
buffer[i] = buffer[i + 1];
buffer[i + 1] = temp;
}
return buffer.toString("utf16le", 2);
}
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
return buffer.toString("utf16le", 2);
}
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
return buffer.toString("utf8", 3);
}
return buffer.toString("utf8");
}
function writeFile(fileName, data, writeByteOrderMark) {
if (writeByteOrderMark) {
data = "\uFEFF" + data;
}
var fd;
try {
fd = _fs.openSync(fileName, "w");
_fs.writeSync(fd, data, undefined, "utf8");
} finally {
if (fd !== undefined) {
_fs.closeSync(fd);
}
}
}
function getCanonicalPath(path) {
return useCaseSensitiveFileNames ? path : path.toLowerCase();
}
function readDirectory(path, extension, exclude) {
var result = [];
exclude = ts.map(exclude, function(s) {
return getCanonicalPath(ts.combinePaths(path, s));
});
visitDirectory(path);
return result;
function visitDirectory(path) {
var files = _fs.readdirSync(path || ".").sort();
var directories = [];
for (var _i = 0,
files_2 = files; _i < files_2.length; _i++) {
var current = files_2[_i];
var name_3 = ts.combinePaths(path, current);
if (!ts.contains(exclude, getCanonicalPath(name_3))) {
try {
var stat = _fs.statSync(name_3);
if (stat.isFile()) {
if (!extension || ts.fileExtensionIs(name_3, extension)) {
result.push(name_3);
}
} else if (stat.isDirectory()) {
directories.push(name_3);
}
} catch (e) {}
}
}
for (var _a = 0,
directories_1 = directories; _a < directories_1.length; _a++) {
var current = directories_1[_a];
visitDirectory(current);
}
}
}
return {
args: process.argv.slice(2),
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
write: function(s) {
process.stdout.write(s);
},
readFile: readFile,
writeFile: writeFile,
watchFile: function(filePath, callback) {
var watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet;
var watchedFile = watchSet.addFile(filePath, callback);
return {close: function() {
return watchSet.removeFile(watchedFile);
}};
},
watchDirectory: function(path, callback, recursive) {
var options;
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
options = {
persistent: true,
recursive: !!recursive
};
} else {
options = {persistent: true};
}
return _fs.watch(path, options, function(eventName, relativeFileName) {
if (eventName === "rename") {
callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName)));
}
;
});
},
resolvePath: function(path) {
return _path.resolve(path);
},
fileExists: function(path) {
return _fs.existsSync(path);
},
directoryExists: function(path) {
return _fs.existsSync(path) && _fs.statSync(path).isDirectory();
},
createDirectory: function(directoryName) {
if (!this.directoryExists(directoryName)) {
_fs.mkdirSync(directoryName);
}
},
getExecutingFilePath: function() {
return __filename;
},
getCurrentDirectory: function() {
return process.cwd();
},
readDirectory: readDirectory,
getMemoryUsage: function() {
if (global.gc) {
global.gc();
}
return process.memoryUsage().heapUsed;
},
exit: function(exitCode) {
process.exit(exitCode);
}
};
}
function getChakraSystem() {
return {
newLine: ChakraHost.newLine || "\r\n",
args: ChakraHost.args,
useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames,
write: ChakraHost.echo,
readFile: function(path, encoding) {
return ChakraHost.readFile(path);
},
writeFile: function(path, data, writeByteOrderMark) {
if (writeByteOrderMark) {
data = "\uFEFF" + data;
}
ChakraHost.writeFile(path, data);
},
resolvePath: ChakraHost.resolvePath,
fileExists: ChakraHost.fileExists,
directoryExists: ChakraHost.directoryExists,
createDirectory: ChakraHost.createDirectory,
getExecutingFilePath: function() {
return ChakraHost.executingFile;
},
getCurrentDirectory: function() {
return ChakraHost.currentDirectory;
},
readDirectory: ChakraHost.readDirectory,
exit: ChakraHost.quit
};
}
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
return getWScriptSystem();
} else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
return getNodeSystem();
} else if (typeof ChakraHost !== "undefined") {
return getChakraSystem();
} else {
return undefined;
}
})();
})(ts || (ts = {}));
var ts;
(function(ts) {
ts.Diagnostics = {
Unterminated_string_literal: {
code: 1002,
category: ts.DiagnosticCategory.Error,
key: "Unterminated_string_literal_1002",
message: "Unterminated string literal."
},
Identifier_expected: {
code: 1003,
category: ts.DiagnosticCategory.Error,
key: "Identifier_expected_1003",
message: "Identifier expected."
},
_0_expected: {
code: 1005,
category: ts.DiagnosticCategory.Error,
key: "_0_expected_1005",
message: "'{0}' expected."
},
A_file_cannot_have_a_reference_to_itself: {
code: 1006,
category: ts.DiagnosticCategory.Error,
key: "A_file_cannot_have_a_reference_to_itself_1006",
message: "A file cannot have a reference to itself."
},
Trailing_comma_not_allowed: {
code: 1009,
category: ts.DiagnosticCategory.Error,
key: "Trailing_comma_not_allowed_1009",
message: "Trailing comma not allowed."
},
Asterisk_Slash_expected: {
code: 1010,
category: ts.DiagnosticCategory.Error,
key: "Asterisk_Slash_expected_1010",
message: "'*/' expected."
},
Unexpected_token: {
code: 1012,
category: ts.DiagnosticCategory.Error,
key: "Unexpected_token_1012",
message: "Unexpected token."
},
A_rest_parameter_must_be_last_in_a_parameter_list: {
code: 1014,
category: ts.DiagnosticCategory.Error,
key: "A_rest_parameter_must_be_last_in_a_parameter_list_1014",
message: "A rest parameter must be last in a parameter list."
},
Parameter_cannot_have_question_mark_and_initializer: {
code: 1015,
category: ts.DiagnosticCategory.Error,
key: "Parameter_cannot_have_question_mark_and_initializer_1015",
message: "Parameter cannot have question mark and initializer."
},
A_required_parameter_cannot_follow_an_optional_parameter: {
code: 1016,
category: ts.DiagnosticCategory.Error,
key: "A_required_parameter_cannot_follow_an_optional_parameter_1016",
message: "A required parameter cannot follow an optional parameter."
},
An_index_signature_cannot_have_a_rest_parameter: {
code: 1017,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_cannot_have_a_rest_parameter_1017",
message: "An index signature cannot have a rest parameter."
},
An_index_signature_parameter_cannot_have_an_accessibility_modifier: {
code: 1018,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018",
message: "An index signature parameter cannot have an accessibility modifier."
},
An_index_signature_parameter_cannot_have_a_question_mark: {
code: 1019,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_parameter_cannot_have_a_question_mark_1019",
message: "An index signature parameter cannot have a question mark."
},
An_index_signature_parameter_cannot_have_an_initializer: {
code: 1020,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_parameter_cannot_have_an_initializer_1020",
message: "An index signature parameter cannot have an initializer."
},
An_index_signature_must_have_a_type_annotation: {
code: 1021,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_must_have_a_type_annotation_1021",
message: "An index signature must have a type annotation."
},
An_index_signature_parameter_must_have_a_type_annotation: {
code: 1022,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_parameter_must_have_a_type_annotation_1022",
message: "An index signature parameter must have a type annotation."
},
An_index_signature_parameter_type_must_be_string_or_number: {
code: 1023,
category: ts.DiagnosticCategory.Error,
key: "An_index_signature_parameter_type_must_be_string_or_number_1023",
message: "An index signature parameter type must be 'string' or 'number'."
},
Accessibility_modifier_already_seen: {
code: 1028,
category: ts.DiagnosticCategory.Error,
key: "Accessibility_modifier_already_seen_1028",
message: "Accessibility modifier already seen."
},
_0_modifier_must_precede_1_modifier: {
code: 1029,
category: ts.DiagnosticCategory.Error,
key: "_0_modifier_must_precede_1_modifier_1029",
message: "'{0}' modifier must precede '{1}' modifier."
},
_0_modifier_already_seen: {
code: 1030,
category: ts.DiagnosticCategory.Error,
key: "_0_modifier_already_seen_1030",
message: "'{0}' modifier already seen."
},
_0_modifier_cannot_appear_on_a_class_element: {
code: 1031,
category: ts.DiagnosticCategory.Error,
key: "_0_modifier_cannot_appear_on_a_class_element_1031",
message: "'{0}' modifier cannot appear on a class element."
},
super_must_be_followed_by_an_argument_list_or_member_access: {
code: 1034,
category: ts.DiagnosticCategory.Error,
key: "super_must_be_followed_by_an_argument_list_or_member_access_1034",
message: "'supe